Content
# AI-Kline - Stock Technical Analysis and AI Prediction Tool
<div align="center">
<!-- Keep these links. Translations will automatically update with the README. -->
<a href="README_EN.md">English</a> | <a href="README.md">中文</a>
</div>
## Project Introduction
AI-Kline is a Python-based A-share analysis tool that combines traditional technical analysis with artificial intelligence prediction capabilities. It utilizes candlestick charts, technical indicators, financial data, and news data to comprehensively analyze and predict stocks. This tool can:
1. Obtain historical volume and price data of A-share stocks and calculate various technical indicators
2. Generate professional candlestick charts and technical indicator visualization charts
3. Obtain stock-related financial data and news information
4. Use openai api to analyze and integrate data and predict future stock trends
## Features
- **Data Acquisition**: Use AKShare to obtain historical trading data, financial data, and news information of A-share stocks
- **Technical Analysis**: Calculate various technical indicators, including MA, MACD, KDJ, RSI, Bollinger Bands, etc.
- **Visualization**: Generate static and interactive candlestick 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 easily enter stock codes and view analysis results
- **MCP SERVER**: Provide MCP SERVER support, support interaction through LLM, and analyze stocks at any time
## Installation Instructions
### Environment Requirements
- Python 3.8+
- Dependencies: See `requirements.txt`
### Installation Steps
1. Clone or download this project to your local machine
2. Install dependencies
```bash
pip install -r requirements.txt
```
3. Create a `.env` file and add the API key
```
API_KEY=your_api_key_here
BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
MODEL_NAME=qwen-vl-max
```
> Note: Multimodal models are required
## Usage
### Command Line Usage
```bash
python main.py --stock_code 000001 --period 1年 --save_path ./output
```
Parameter Description:
- `--stock_code`: Stock code, required parameter
- `--period`: Analysis period, optional values: "1年", "6个月", "3个月", "1个月", default is "1年"
- `--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 to use the Web interface:
1. Enter the stock code in the form (e.g., 000001)
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 the following content:
- Basic stock information
- Candlestick 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
After the program runs, it will generate the following in the specified save path:
1. Candlestick charts and technical indicator charts (static PNG images and interactive HTML charts)
2. AI analysis result text file
## Project Structure
```
AI看线/
├── main.py # Main program entry
├── web_app.py # Web application entry
├── requirements.txt # Dependency list
├── .env # Environment variable configuration (create yourself)
├── modules/ # Functional modules
│ ├── __init__.py
│ ├── data_fetcher.py # Data acquisition module
│ ├── technical_analyzer.py # Technical analysis module
│ ├── visualizer.py # Visualization module
│ └── ai_analyzer.py # AI analysis module
├── templates/ # Web template directory
│ └── index.html # Home page 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 at runtime)
├── charts/ # Chart directory
└── *_analysis_result.txt # Analysis result file
```
## Communication and Learning

## Precautions
- This tool is for learning and research purposes only 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 the Gemini API key is correctly configured before use
- Stock data acquisition depends on the AKShare library and may be subject to network and data source limitations
- This project is an open-source project of QuantML. Please indicate the source for reprinting or use. For commercial use, please contact WeChat account QuantML
## Disclaimer
The analysis and predictions provided by this tool are for reference only and do not constitute any investment advice. Investment is risky, and caution is required when entering the market. Users are responsible for their own investment decisions.
Connection Info
You Might Also Like
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.
AP2
AP2 provides code samples and demos for the Agent Payments Protocol.
YC-Killer
YC-Killer is an AI agents library by Singularity Research, open-sourcing...
solana-agent-kit
An open-source toolkit for AI agents to interact with Solana protocols.
mcp-server
MCP Server provides access to stock market data and financial statements.