AI看线: A-Share Analysis with K-Line Charts and Gemini AI Forecasts

5月20日 Published inStock Market Tools

AI看线 is a Python-based utility designed for the analysis of Chinese A-shares. The tool integrates traditional technical analysis with modern AI forecasting by aggregating price history, financial statements, and news headlines. After calculating a suite of standard indicators, the system leverages Google’s Gemini model to provide a forward-looking perspective on the asset.

Core Features

Data Retrieval. AKShare serves as the primary data source, providing the raw inputs: historical OHLC (Open, High, Low, Close) data, financial reports, and the latest news updates.

Technical Indicators. The system supports a comprehensive set of standard metrics, including Moving Averages (MA), MACD, KDJ, RSI, and Bollinger Bands.

Visualization. The tool generates both static PNG images and interactive HTML charts. These visualizations feature K-line plots integrated with dedicated indicator panels for deeper inspection.

AI Analysis. The Gemini model evaluates the synthesized data, examining price trends, technical signals, and recent news to produce a qualitative market outlook.

Web Interface. A streamlined browser-based UI allows users to conduct analyses efficiently. Simply enter a ticker symbol, select a timeframe, and execute the process to view results directly on the dashboard.

Installation and Setup

This tool requires Python 3.8 or newer. All necessary dependencies are listed in the requirements.txt file.

Steps

  1. Clone or download the source code repository.
  2. Install the required packages:
pip install -r requirements.txt
  1. Create a .env file in the root directory and add your Gemini API key:
GEMINI_API_KEY=your_api_key_here

API keys can be obtained through Google AI Studio.

Command Line Usage

To run the analysis via the terminal, use the following command:

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

Arguments

  • --stock_code: The ticker symbol (Required).
  • --period: The analysis window. Options include 1年 (1 year), 6个月 (6 months), 3个月 (3 months), or 1个月 (1 month). The default setting is 1年.
  • --save_path: The directory where the results will be stored. Defaults to ./output.

Web Interface

To launch the browser-based application, start the server:

python web_app.py

Once running, navigate to http://localhost:5000 in your web browser.

Input the stock code (e.g., 000001), select your preferred timeframe, and click "Start Analysis." The page will refresh to display the generated insights.

Dashboard Features

  • Company Overview: Displays the name, ticker code, total market capitalization, float, and listing date.
  • Interactive Charts: Features the K-line chart alongside various indicator subplots.
  • AI Insights: Displays the written commentary and market outlook generated by Gemini.

Output Files

The tool exports the following files to your designated save path:

  • K-Line Charts: Both static PNG files and interactive HTML versions featuring technical indicators.
  • Analysis Report: A plain text file containing the detailed AI-generated commentary.