SuperAPI AI Directory

china-stock-analysis

Data & analytics

View repository

Updated 10-15 19:51

About this skill

China Stock Analysis Skill

A China A-share analysis tool based on value investing theory, aimed at ordinary investors engaging in low-frequency trading.

When to Use

Call this skill when the user requests the following operations:

  • Analyze a certain A-share stock
  • Screen stocks that meet the criteria
  • Compare multiple stocks or stocks within an industry
  • Calculate stock valuation or intrinsic value
  • View a stock's financial health
  • Detect financial anomaly risks

Prerequisites

Python Environment Requirements

pip install akshare pandas numpy

Dependency Check

Before performing any analysis, first check whether akshare is installed:

python -c "import akshare; print(akshare.__version__)"

If not installed, prompt the user to install:

pip install akshare

Core Modules

1. Stock Screener

Screen stocks that meet the criteria

2. Financial Analyzer

In-depth financial analysis of individual stocks

3. Industry Comparator

Horizontal comparative analysis within the same industry

4. Valuation Calculator

Intrinsic value estimation and margin of safety calculation


Workflow 1: Stock Screening

Used when the user requests stock screening.

Step 1: Collect Screening Criteria

Ask the user for screening criteria. Provide the following options for the user to choose or customize:

Valuation metrics:

  • PE (Price-to-Earnings Ratio): e.g., PE < 15
  • PB (Price-to-Book Ratio): e.g., PB < 2
  • PS (Price-to-Sales Ratio): e.g., PS < 3

Profitability:

  • ROE (Return on Equity): e.g., ROE > 15%
  • ROA (Return on Assets): e.g., ROA > 8%
  • Gross margin: e.g., > 30%
  • Net margin: e.g., > 10%

Growth:

  • Revenue growth rate: e.g., > 10%
  • Net profit growth rate: e.g., > 15%
  • Consecutive years of growth: e.g., >= 3 years

Dividends:

  • Dividend yield: e.g., > 3%
  • Consecutive years of dividend payments: e.g., >= 5 years

Financial safety:

  • Debt-to-asset ratio: e.g., < 60%
  • Current ratio: e.g., > 1.5
  • Quick ratio: e.g., > 1

Screening scope:

  • All A-shares
  • CSI 300 constituent stocks
  • CSI 500 constituent stocks
  • ChiNext/STAR Market
  • User-defined list

Step 2: Execute Screening

python scripts/stock_screener.py \
    --scope "hs300" \
    --pe-max 15 \
    --roe-min 15 \
    --debt-ratio-max 60 \
    --dividend-min 2 \
    --output screening_result.json

Parameter descriptions:

  • --scope: Screening scope (all/hs300/zz500/cyb/kcb/custom:600519,000858,...)
  • --pe-max/--pe-min: PE range
  • --pb-max/--pb-min: PB range
  • --roe-min: Minimum ROE
  • --growth-min: Minimum growth rate
  • --debt-ratio-max: Maximum debt-to-asset ratio
  • --dividend-min: Minimum dividend yield
  • --output: Output file path

Step 3: Present Results

Read screening_result.json and present it to the user in table form:

Code Name PE PB ROE Dividend yield Score
600519 Kweichow Moutai 25.3 8.5 30.2% 2.1% 85

Workflow 2: Stock Analysis

Used when the user requests analysis of a certain stock.

Step 1: Collect Stock Information

Ask the user:

  1. Stock code or name
  2. Analysis depth level:
    • Summary level: Key metrics + investment conclusion (1 page)
    • Standard level: Financial analysis + valuation + industry comparison + risk disclosure
    • Deep level: Complete research report, including historical data tracking

Step 2: Fetch Stock Data

python scripts/data_fetcher.py \
    --code "600519" \
    --data-type all \
    --years 5 \
    --output stock_data.json

Parameter description:

  • --code: Stock code
  • --data-type: Data type (basic/financial/valuation/holder/all)
  • --years: How many years of historical data to retrieve
  • --output: Output file

Step 3: Run Financial Analysis

python scripts/financial_analyzer.py \
    --input stock_data.json \
    --level standard \
    --output analysis_result.json

Parameter description:

  • --input: Input stock data file
  • --level: Analysis depth (summary/standard/deep)
  • --output: Output file

Step 4: Calculate Valuation

python scripts/valuation_calculator.py \
    --input stock_data.json \
    --methods dcf,ddm,relative \
    --discount-rate 10 \
    --growth-rate 8 \
    --output valuation_result.json

Parameter description:

  • --input: Stock data file
  • --methods: Valuation method (dcf/ddm/relative/all)
  • --discount-rate: Discount rate (%)
  • --growth-rate: Perpetual growth rate (%)
  • --margin-of-safety: Margin of safety (%)
  • --output: Output file

Step 5: Generate Report

Read the analysis results, refer to the templates/analysis_report.md template to generate a Chinese analysis report.

Report structure (standard level):

  1. Company overview: Basic information, main business
  2. Financial health: Balance sheet analysis
  3. Profitability: DuPont analysis, profit margin trends
  4. Growth analysis: Revenue/profit growth trends
  5. Valuation analysis: DCF/DDM/relative valuation
  6. Risk disclosure: Financial anomaly detection, shareholder reduction
  7. Investment conclusion: Composite score, action recommendations

Workflow 3: Industry Comparison (Industry Comparison)

Step 1: Collect Comparison Targets

Ask the user:

  1. Target stock code(s) (can be multiple)
  2. Or: industry classification + number of comparisons

Step 2: Fetch Industry Data

python scripts/data_fetcher.py \
    --codes "600519,000858,002304" \
    --data-type comparison \
    --output industry_data.json

Or retrieve by industry:

python scripts/data_fetcher.py \
    --industry "白酒" \
    --top 10 \
    --output industry_data.json

Step 3: Generate Comparison

python scripts/financial_analyzer.py \
    --input industry_data.json \
    --mode comparison \
    --output comparison_result.json

Step 4: Present Comparison Table

Metric Kweichow Moutai Wuliangye Yanghe Stock Industry average
PE 25.3 18.2 15.6 22.4
ROE 30.2% 22.5% 20.1% 18.5%
Gross margin 91.5% 75.2% 72.3% 65.4%
Rating 85 78 75 -

Workflow 4: Valuation Calculator (Valuation Calculation)

Step 1: Collect Valuation Parameters

Ask the user for valuation parameters (or use defaults):

DCF model parameters:

  • Discount rate (WACC): default 10%
  • Forecast period: default 5 years
  • Perpetual growth rate: default 3%

DDM model parameters:

  • Required rate of return: default 10%
  • Dividend growth rate: estimated using historical data

Relative valuation parameters:

  • Comparison benchmark: industry average / historical average

Step 2: Run Valuation

python scripts/valuation_calculator.py \
    --code "600519" \
    --methods all \
    --discount-rate 10 \
    --terminal-growth 3 \
    --forecast-years 5 \
    --margin-of-safety 30 \
    --output valuation.json

Step 3: Present Valuation Results

Valuation method Intrinsic value Current price Margin of safety price Conclusion
DCF ¥2,150 ¥1,680 ¥1,505 Undervalued
DDM ¥1,980 ¥1,680 ¥1,386 Undervalued
Relative valuation ¥1,850 ¥1,680 ¥1,295 Fair

Financial Anomaly Detection (Financial Anomaly Detection)

Automatically detect the following anomaly signals during analysis:

Detection item

  1. Accounts receivable anomaly

    • Accounts receivable growth rate > revenue growth rate × 1.5
    • Accounts receivable turnover days increase significantly
  2. Cash flow divergence

    • Net profit continues to grow but operating cash flow declines
    • Cash income ratio < 80%
  3. Abnormal inventory

    • Inventory growth rate > Revenue growth rate × 2
    • Inventory turnover days increase significantly
  4. Abnormal gross margin

    • Gross margin volatility > Industry average volatility × 2
    • Gross margin severely deviates from peers
  5. Related-party transactions

    • Proportion of related-party transactions too high (> 30%)
  6. Shareholder reduction

    • Recent reduction announcement by major shareholder
    • Concentrated reduction by executives

Risk level

  • 🟢 Low risk: No obvious abnormality
  • 🟡 Medium risk: 1-2 minor abnormalities
  • 🔴 High risk: Multiple abnormalities or severe abnormalities

A-Share Specific Analysis (A股特色分析)

Policy sensitivity

Provide policy-related reminders based on industry classification:

  • Real estate: Housing is for living, not for speculation policy
  • New energy: Changes in subsidy policies
  • Pharmaceuticals: Impact of centralized procurement policies
  • Internet: Antitrust, data security

Shareholder structure analysis

  1. Type of controlling shareholder (state-owned/private/foreign)
  2. Equity concentration
  3. Recent increases or decreases in holdings
  4. Pledge ratio

Output Format

JSON output format

All scripts output in JSON format for subsequent processing:

{
  "code": "600519",
  "name": "贵州茅台",
  "analysis_date": "2025-01-25",
  "level": "standard",
  "summary": {
    "score": 85,
    "conclusion": "低估",
    "recommendation": "建议关注"
  },
  "financials": { ... },
  "valuation": { ... },
  "risks": [ ... ]
}

Markdown report

Generate a structured Chinese Markdown report, refer to templates/analysis_report.md。


Error Handling

Network error

If akshare data retrieval fails, prompt the user:

  1. Check network connection
  2. Retry later (may be interface rate limiting)
  3. Try changing the data source

Invalid stock code

Prompt the user to check whether the stock code is correct, and provide possible matching suggestions.

Incomplete data

For newly listed stocks or cases with incomplete financial data, explain the data limitations and conduct analysis based on available data.


Best Practices

  1. Data timeliness: Financial data is based on the latest quarterly/annual report, price data is the closing price of the day
  2. Investment advice: All analysis is for reference only and does not constitute investment advice
  3. Risk warning: Always include risk warnings, especially the results of financial anomaly detection
  4. Comparative analysis: When analyzing a single stock, automatically include industry average comparison

Important Notes

  • All analysis is based on public financial data and does not involve any inside information
  • The parameter assumptions of the valuation model have a significant impact on the results and must be explained to the user
  • The A-share market is greatly affected by policies, and quantitative analysis needs to be combined with qualitative judgment