Content
# Tool List
<div align="center">
<!-- Keep these links. Translations will automatically update with the README. -->
<a href="README_EN.md">English</a> | <a href="README.md">Chinese</a>
</div>
## Project Overview
AI-Kline is a Python-based A-share analysis tool that combines traditional technical analysis and AI prediction functions. It uses K-line charts, technical indicators, financial data, and news data to comprehensively analyze and predict stocks. The tool can:
1. Retrieve historical trading data of A-share stocks and calculate various technical indicators
2. Generate professional K-line charts and technical indicator visualization charts
3. Obtain financial data and news information related to stocks
4. Use OpenAI API to analyze integrated data and predict future stock trends
## Features
- **Data Retrieval**: Use AKShare to retrieve historical trading data, financial data, and news information of A-share stocks
- **Technical Analysis**: Calculate multiple technical indicators, including MA, MACD, KDJ, RSI, Bollinger Bands, etc.
- **Visualization**: Generate static and interactive K-line charts and technical indicator charts
- **AI Analysis**: Utilize multimodal AI to analyze stock data and predict future trends
- **Web Interface**: Provide a simple and beautiful web interface for users to input stock codes and view analysis results
- **MCP Server**: Provide MCP Server support, supporting interaction through LLM, and analyzing stocks at any time
## Installation Instructions
### Environment Requirements
- Python 3.8+
- Dependency packages: see `requirements.txt`
### Installation Steps
1. Clone or download this project to your local machine
2. Install dependency packages
```bash
pip install -r requirements.txt
```
3. Create a `.env` file and add API keys
```
API_KEY=your_api_key_here
BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
MODEL_NAME=qwen-vl-max
```
> Note: A multimodal model is required
## Usage
### Command Line Usage
```bash
python main.py --stock_code 000001 --period 1 year --save_path ./output
```
Parameter explanation:
- `--stock_code`: Stock code, required parameter
- `--period`: Analysis period, optional values: "1 year", "6 months", "3 months", "1 month", default is "1 year"
- `--save_path`: Result saving path, default is "./output"
### Web Interface Usage
Start the web service:
```bash
python web_app.py
```
Then access http://localhost:5000 in your browser:
1. Enter the stock code (e.g., 000001) in the form
2. Select the analysis period
3. Click the "Start Analysis" button
4. Wait for the analysis to complete and view the results
The web interface includes:
- Stock basic information
- K-line charts and technical indicator charts
- AI analysis result text
Page screenshot:

### MCP Server Usage
Start MCP:
```bash
uv run mcp_server.py
```
Then configure in the MCP client (streamable-http):
http://localhost:8000/mcp
Cherry-Studio page screenshot:


### Output Results
The program will generate the following files in the specified save path:
1. K-line charts and technical indicator charts (static PNG images and interactive HTML charts)
2. AI analysis result text files
## Project Structure
```
AI-Kline/
├── main.py # Main program entry
├── web_app.py # Web application entry
├── requirements.txt # Dependency package list
├── .env # Environment variable configuration (need to create manually)
├── modules/ # Functional modules
│ ├── __init__.py
│ ├── data_fetcher.py # Data retrieval module
│ ├── technical_analyzer.py # Technical analysis module
│ ├── visualizer.py # Visualization module
│ └── ai_analyzer.py # AI analysis module
├── templates/ # Web template directory
│ └── index.html # Homepage template
├── static/ # Static resource directory
│ ├── css/ # CSS styles
│ │ └── style.css # Custom styles
│ └── js/ # JavaScript scripts
│ └── main.js # Main script
└── output/ # Output result directory (automatically created during runtime)
├── charts/ # Chart directory
└── *_analysis_result.txt # Analysis result file
```
## Communication and Learning

## Precautions
- This tool is only for learning and research, and does not constitute any investment advice
- AI analysis results are based on historical data and current information, and cannot guarantee the accuracy of future trends
- Please ensure that you have correctly configured the Gemini API key before use
- Stock data retrieval depends on the AKShare library, which may be limited by network and data sources
- This project is an open-source project of QuantML. Please indicate the source if you reprint or use it. Commercial use requires contacting the WeChat ID QuantML
## Disclaimer
The analysis and predictions provided by this tool are for reference only and do not constitute any investment advice. Investment carries risks, and users are responsible for their own investment decisions.
Connection Info
You Might Also Like
Vibe-Trading
Vibe-Trading: Your Personal Trading Agent
ai-berkshire
Berkshire in the AI Era: A Value Investment Research Framework Based on...
valuecell
Valuecell is a Python project for efficient data management.
hexstrike-ai
HexStrike AI is an AI-powered MCP cybersecurity automation platform with 150+ tools.
tradingview-mcp
AI-assisted TradingView chart analysis — connect Claude Code to your...
tradingview-mcp
TradingView MCP Server offers real-time market analysis for crypto and stocks.