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**: Support MCP SERVER for interaction via LLM, allowing 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 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`: Path to save results, 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
Screenshot of the Cherry-Studio page:


### Output Results
After the program runs, it will generate the following 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 # List of dependencies
├── .env # Environment variable configuration (to be created by user)
├── modules/ # Functional modules
│ ├── __init__.py
│ ├── data_fetcher.py # Data fetching 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 at 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 retrieval 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 credit 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 involves risks; please proceed with caution. Users are responsible for their own investment decisions.
You Might Also Like
hexstrike-ai
HexStrike AI is an AI-powered MCP cybersecurity automation platform with 150+ tools.
solana-agent-kit
An open-source toolkit for AI agents to interact with Solana protocols.

Stripe
The Stripe Agent Toolkit integrates agent frameworks with Stripe APIs for...
google-search
A Node.js tool for Google searches, bypassing anti-scraping with MCP server support.
moling
MoLing is a dependency-free MCP Server for file system operations and system...
mcp2mqtt
mcp2mqtt bridges IoT devices and AI models, enabling natural language control.