# AI股票分析平台 **Repository Path**: zhang-jiabao/AI-MCP-STOCKS ## Basic Information - **Project Name**: AI股票分析平台 - **Description**: 基于deepseek的MCP的股票评估平台 - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 2 - **Created**: 2025-10-23 - **Last Updated**: 2025-11-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AI Stock Analysis Platform #### Introduction The AI Stock Analysis Platform is an intelligent stock evaluation system based on the DeepSeek large language model. It integrates technical indicator calculation, AI deep analysis, and data visualization functions. This platform can automatically retrieve A-share market data, calculate various technical indicators, and utilize AI to provide professional investment advice analysis, offering decision-making references for investors. #### Key Features - Support for A-share market data retrieval and analysis - Automatic calculation of rich technical indicators (MACD, RSI, KDJ, Bollinger Bands, etc.) - Professional stock analysis reports generated using DeepSeek AI model - Stock buy/sell signal recognition - Analysis result caching mechanism for improved query efficiency - Support for single stock and batch stock analysis - Clean and intuitive web interface operation #### Software Architecture This project adopts a front-end and back-end separation architecture design. The back-end provides RESTful API services based on the Flask framework, while the front-end implements the user interface using HTML/JavaScript/CSS, interacting with the back-end through APIs. The system architecture is divided into the following core layers: ##### 1. Presentation Layer - **Front-end Interface**: Located in the `templates` and `static` directories, including HTML templates and JavaScript/CSS resources - **Flask Routes**: Defined in `app.py`, handling HTTP requests and returning corresponding results ##### 2. Business Logic Layer - **Analysis Manager**: `analysis_manager.py`, coordinating the entire stock analysis process - **AI Analyzer**: `ai_analyzer.py`, calling the DeepSeek API for intelligent analysis - **Technical Indicator Calculator**: `technical_analyzer.py`, calculating various technical indicators and trading signals - **Cache Manager**: `cache_manager.py`, managing the caching and expiration mechanism for analysis results ##### 3. Data Access Layer - **Data Providers**: `stock_data_provider.py` and `stock_info_provider.py`, responsible for retrieving stock data and information - **Database Manager**: `database_manager.py`, handling database connections and data storage - **Configuration Manager**: `config_manager.py`, managing system configuration parameters ##### 4. External Dependencies - **DeepSeek API**: Providing large language model analysis capabilities - **AkShare Library**: Retrieving A-share market data - **MySQL Database**: Storing stock information and analysis results #### Installation Guide ##### 1. Environment Preparation - Python 3.7+ environment - MySQL database - DeepSeek API Key (can be applied from [DeepSeek official website](https://deepseek.com/)) ##### 2. Install Dependencies ```bash # Clone the repository git clone https://gitee.com/zhang-jiabao/AI-MCP-STOCKS.git cd AI-MCP-STOCKS # Install Python dependencies pip install -r requirements.txt ``` ##### 3. Configure Database 1. Create MySQL database: ```sql CREATE DATABASE stock_analysis DEFAULT CHARACTER SET utf8mb4; CREATE USER 'root'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON stock_analysis.* TO 'root'@'localhost'; FLUSH PRIVILEGES; ``` 2. Or modify the database connection information in `config.json`: ```json { "database": { "host": "localhost", "port": 3306, "user": "your_username", "password": "your_password", "database": "stock_analysis" } } ``` ##### 4. Configure DeepSeek API Set the DeepSeek API Key in `config.json`: ```json { "deepseek_api_key": "your_api_key", "deepseek_api_url": "https://api.deepseek.com/v1/chat/completions" } ``` ##### 5. Start the Application ```bash # Run directly python app.py # Or use batch file (Windows) start.bat ``` After the application starts, you can access the system through your browser at `http://127.0.0.1:5000`. #### Usage Instructions ##### 1. Basic Usage - Open a browser and visit the system homepage - Enter an A-share code in the stock code input box (e.g., 600519, 000858, etc.) - Click the "Analyze" button to get analysis results - The system will display technical indicators, AI analysis reports, and investment advice ##### 2. Batch Analysis - On the batch analysis page, enter multiple stock codes (one per line) - Click the "Batch Analyze" button for batch processing - The system will analyze each stock sequentially and display the results ##### 3. System Configuration - You can modify parameters such as API key and default stock list through the configuration page - Configurations will be automatically saved and take effect immediately after modification ##### 4. Data Update - The system will automatically check the cache, and today's analysis results will be read directly from the cache - After the cache expires, the latest data will be automatically retrieved and new analysis reports will be generated #### Project Structure ``` AI-MCP-STOCKS/ ├── app.py # Flask application main entry ├── config_manager.py # Configuration management ├── database_manager.py # Database management ├── analysis_manager.py # Analysis process management ├── ai_analyzer.py # AI analysis interface ├── technical_analyzer.py # Technical indicator calculation ├── cache_manager.py # Cache management ├── stock_data_provider.py # Stock data retrieval ├── stock_info_provider.py # Stock information retrieval ├── config.json # Configuration file ├── requirements.txt # Dependency list ├── start.bat # Startup script ├── static/ # Static resources │ ├── css/ # CSS styles │ ├── js/ # JavaScript scripts │ └── images/ # Image resources └── templates/ # HTML templates └── index.html # Main page ``` #### Technical Indicator List The system supports the following main technical indicators: - **Moving Averages**: MA5, MA10, MA20, MA30, MA60, MA120 - **Volatility**: Volatility_20, Volatility_60 - **Relative Strength Index**: RSI_6, RSI_14, RSI_21 - **MACD**: MACD, Signal_Line, MACD_Hist - **Bollinger Bands**: Upper_Band, Middle_Band, Lower_Band - **KDJ Indicator**: K, D, J - **Momentum Indicators**: Momentum, ROC - **Volume Indicators**: Volume_MA5, Volume_MA20, Volume_Ratio - **Other Indicators**: OBV, Williams_R, MA_Ratio #### Contribution Guidelines 1. Fork this repository 2. Create a new Feat_xxx branch 3. Commit your code 4. Create a new Pull Request #### License MIT License #### Contact If you have any questions or suggestions, please submit feedback through Gitee Issues.