A

AI看线 - 股票技术分析与AI预测工具

JJX2025/AI-Kline
2 Stars 2.3k 次浏览 更新于 2026-08-23

AI看线是一个基于Python的A股分析工具,结合了传统技术分析和人工智能预测功能。它可以获取股票的历史量价数据,生成专业的K线图和技术指标图表,获取财务和新闻数据,并使用Google的Gemini AI模型分析并预测未来的股票走势。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

AI-Kline - Stock Technical Analysis and AI Prediction Tool

Project Overview

AI-Kline is a Python-based A-share analysis tool that combines traditional technical analysis with artificial intelligence prediction capabilities. It uses K-line charts, technical indicators, financial data, and news data to comprehensively analyze and predict stock performance. This tool can:

  1. Obtain historical price and volume data for A-shares and calculate various technical indicators
  2. Generate professional K-line charts and visualizations of technical indicators
  3. Retrieve financial data and news information related to stocks
  4. Use Google's Gemini AI model to analyze and integrate data to predict future stock trends

Features

  • Data Acquisition: Uses AKShare to obtain historical trading data, financial data, and news information for A-shares
  • Technical Analysis: Calculates multiple technical indicators including MA, MACD, KDJ, RSI, Bollinger Bands, etc.
  • Visualization: Generates static and interactive K-line charts and technical indicator charts
  • AI Analysis: Utilizes the Gemini AI model to analyze stock data and predict future trends
  • Web Interface: Provides a simple and elegant web interface for users to input stock codes and view analysis results
  • MCP SERVER: Offers MCP SERVER support, allowing for real-time stock analysis through LLM interaction

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 required packages.

bash
pip install -r requirements.txt

  1. Create a .env file and add the Gemini API key.

GEMINI_API_KEY=your_api_key_here

Note: To obtain the Gemini API key, you need to register and create an API key on Google AI Studio.

Usage

Command Line Usage

bash
python main.py --stock_code 000001 --period 1年 --save_path ./output

Parameter Explanation:

  • --stock_code: Stock code, a required parameter
  • --period: Analysis period, optional values: "1年", "6个月", "3个月", "1个月", default is "1年"
  • --save_path: Path to save the 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 (e.g., 000001) in the form
  2. Select the analysis period
  3. Click the "开始分析" button
  4. Wait for the analysis to complete and view the results

The web interface includes:

  • Basic stock information
  • K-line charts and technical indicator charts
  • AI analysis result text

Screenshot of the web interface:

Web Interface 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 screenshots:

MCP Interface Screenshot
MCP Interface Screenshot

Output Results

After running the program, the following will be generated 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 point
├── web_app.py # Web application entry point
├── requirements.txt # List of dependencies
├── .env # Environment variable configuration (to be created by the 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 resources 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

Join the Group

Precautions

  • This tool is for learning and research purposes only and does not constitute any investment advice.
  • The AI analysis results are based on historical data and current information, and cannot guarantee the accuracy of future trends.
  • Before use, please ensure that the Gemini API key has been correctly configured.
  • 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. For commercial use, please contact 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 caution should be exercised when entering the market. Users are responsible for their own investment decisions.

相关 MCP 服务