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 analysis tool for A-shares that combines traditional technical analysis with AI prediction capabilities. It conducts comprehensive analysis and forecasting of stocks using candlestick charts, technical indicators, financial data, and news data. This tool can:
1. Retrieve historical volume and price data of A-share stocks and calculate various technical indicators.
2. Generate professional candlestick charts and visualizations of technical indicators.
3. Obtain financial data and news information related to stocks.
4. Use the OpenAI API to analyze and integrate data to predict future stock trends.
## Features
- **Data Acquisition**: Use AKShare to obtain historical trading data, financial data, and news information for 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 graphs.
- **AI Analysis**: Utilize multimodal AI to analyze stock data and predict future trends.
- **Web Interface**: Provide a clean and aesthetically pleasing web interface for users to input stock codes and view analysis results.
- **MCP SERVER**: Provide MCP SERVER support, allowing interaction through LLM for real-time stock analysis.
## 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 the dependencies.
```bash
pip install -r requirements.txt
```
3. Create a `.env` file and add your API key.
```
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年 --save_path ./output
```
Parameter Explanation:
- `--stock_code`: Stock code, required parameter.
- `--period`: Analysis period, optional values: "1年", "6个月", "3个月", "1个月", default is "1年".
- `--save_path`: Result save path, default is "./output".
### Web Interface Usage
Start the web service:
```bash
python web_app.py
```
Then access the web interface in your browser at http://localhost:5000:
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 graphs.
- AI analysis result text.
Screenshot of the page:

### MCP SERVER Usage
Start the 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, the following will be generated in the specified save path:
1. Candlestick charts and technical indicator graphs (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 (to be created by 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 results directory (automatically created during runtime)
├── charts/ # Charts directory
└── *_analysis_result.txt # Analysis result files
```
## Communication and Learning

## Notes
- 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 relies on the AKShare library, which may be subject to network and data source limitations.
- This project is an open-source project by QuantML. Please cite the source when reproducing or using it, and contact WeChat ID QuantML for commercial use.
## Disclaimer
The analysis and predictions provided by this tool are for reference only and do not constitute any investment advice. Investment carries risks, and caution is advised when entering the market. Users are responsible for their own investment decisions.
Connection Info
You Might Also Like
valuecell
ValueCell is a community-driven, multi-agent platform for financial applications.
hexstrike-ai
HexStrike AI MCP Agents is an advanced MCP server that lets AI agents...
YC-Killer
A library of enterprise-grade AI agents designed to democratize artificial...
mcp-sdk-php
Model Context Protocol SDK for PHP
mcp-sdk-php
Model Context Protocol SDK for PHP
airtable-mcp-server
🗂️🤖 Airtable Model Context Protocol Server, for allowing AI systems to...