china-stock-analysis

Original🇨🇳 Chinese
Translated
4 scriptsChecked / no sensitive code detected

A-share Value Investment Analysis Tool that provides stock screening, in-depth individual stock analysis, industry comparison and valuation calculation functions. Based on value investment theory, it uses akshare to obtain public financial data, suitable for ordinary investors with low-frequency trading.

12.7kinstalls
Added on

NPX Install

npx skill4agent add sugarforever/01coder-agent-skills china-stock-analysis

SKILL.md Content (Chinese)

View Translation Comparison →

China Stock Analysis Skill

A Chinese A-share analysis tool based on value investment theory, designed for ordinary investors with low-frequency trading.

When to Use

Call this skill when the user requests the following operations:
  • Analyze a specific A-share stock
  • Screen stocks that meet the criteria
  • Compare multiple stocks or stocks within the same industry
  • Calculate stock valuation or intrinsic value
  • Check the financial health of a stock
  • Detect financial anomaly risks

Prerequisites

Python Environment Requirements

bash
pip install akshare pandas numpy

Dependency Check

Before performing any analysis, first check if akshare is installed:
bash
python -c "import akshare; print(akshare.__version__)"
If not installed, prompt the user to install it:
bash
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 calculation 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 Profit Margin: e.g., > 30%
  • Net Profit Margin: e.g., > 10%
Growth:
  • Revenue Growth Rate: e.g., > 10%
  • Net Profit Growth Rate: e.g., > 15%
  • Number of Consecutive Growth Years: e.g., >= 3 years
Dividends:
  • Dividend Yield: e.g., > 3%
  • Number of Consecutive Dividend Years: e.g., >= 5 years
Financial Safety:
  • Asset-Liability 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 Board/STAR Market
  • User-defined list

Step 2: Execute Screening

bash
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 Explanations:
  • --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 asset-liability 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 format:
CodeNamePEPBROEDividend YieldScore
600519Kweichow Moutai25.38.530.2%2.1%85

Workflow 2: Stock Analysis

Used when the user requests analysis of a specific stock.

Step 1: Collect Stock Information

Ask the user:
  1. Stock code or name
  2. Analysis depth level:
    • Summary Level: Key indicators + investment conclusion (1 page)
    • Standard Level: Financial analysis + valuation + industry comparison + risk warning
    • In-depth Level: Complete research report including historical data tracking

Step 2: Fetch Stock Data

bash
python scripts/data_fetcher.py \
    --code "600519" \
    --data-type all \
    --years 5 \
    --output stock_data.json
Parameter Explanations:
  • --code
    : Stock code
  • --data-type
    : Data type (basic/financial/valuation/holder/all)
  • --years
    : Number of years of historical data to retrieve
  • --output
    : Output file

Step 3: Run Financial Analysis

bash
python scripts/financial_analyzer.py \
    --input stock_data.json \
    --level standard \
    --output analysis_result.json
Parameter Explanations:
  • --input
    : Input stock data file
  • --level
    : Analysis depth (summary/standard/deep)
  • --output
    : Output file

Step 4: Calculate Valuation

bash
python scripts/valuation_calculator.py \
    --input stock_data.json \
    --methods dcf,ddm,relative \
    --discount-rate 10 \
    --growth-rate 8 \
    --output valuation_result.json
Parameter Explanations:
  • --input
    : Stock data file
  • --methods
    : Valuation methods (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 and generate a Chinese analysis report with reference to the
templates/analysis_report.md
template.
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 Warning: Financial anomaly detection, shareholder reduction
  7. Investment Conclusion: Comprehensive score, operation recommendations

Workflow 3: Industry Comparison

Step 1: Collect Comparison Targets

Ask the user:
  1. Target stock codes (multiple allowed)
  2. Or: Industry classification + number of comparisons

Step 2: Fetch Industry Data

bash
python scripts/data_fetcher.py \
    --codes "600519,000858,002304" \
    --data-type comparison \
    --output industry_data.json
Or retrieve by industry:
bash
python scripts/data_fetcher.py \
    --industry "Liquor" \
    --top 10 \
    --output industry_data.json

Step 3: Generate Comparison

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

Step 4: Present Comparison Table

IndicatorKweichow MoutaiWuliangyeYanghe Co., Ltd.Industry Average
PE25.318.215.622.4
ROE30.2%22.5%20.1%18.5%
Gross Profit Margin91.5%75.2%72.3%65.4%
Score857875-

Workflow 4: Valuation Calculator

Step 1: Collect Valuation Parameters

Ask the user for valuation parameters (or use default values):
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: Calculated using historical data
Relative Valuation Parameters:
  • Comparison Benchmark: Industry average / historical average

Step 2: Run Valuation

bash
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 MethodIntrinsic ValueCurrent PriceMargin of Safety PriceConclusion
DCF¥2,150¥1,680¥1,505Undervalued
DDM¥1,980¥1,680¥1,386Undervalued
Relative Valuation¥1,850¥1,680¥1,295Reasonable

Financial Anomaly Detection

Automatically detect the following abnormal signals during analysis:

Detection Items

  1. Abnormal Accounts Receivable
    • Accounts receivable growth rate > Revenue growth rate × 1.5
    • Significant increase in accounts receivable turnover days
  2. Cash Flow Divergence
    • Net profit continues to grow but operating cash flow declines
    • Cash-to-revenue ratio < 80%
  3. Abnormal Inventory
    • Inventory growth rate > Revenue growth rate × 2
    • Significant increase in inventory turnover days
  4. Abnormal Gross Profit Margin
    • Gross profit margin volatility > Industry average volatility × 2
    • Gross profit margin significantly deviates from peers
  5. Related Party Transactions
    • High proportion of related party transactions (> 30%)
  6. Shareholder Reduction
    • Recent reduction announcements by major shareholders
    • Concentrated reduction by executives

Risk Levels

  • 🟢 Low Risk: No obvious anomalies
  • 🟡 Medium Risk: 1-2 minor anomalies
  • 🔴 High Risk: Multiple anomalies or severe anomalies

A-Share Specific Analysis

Policy Sensitivity

Provide policy-related prompts based on industry classification:
  • Real Estate: "House is for living, not for speculation" policy
  • New Energy: Changes in subsidy policies
  • Pharmaceuticals: Impact of centralized procurement policies
  • Internet: Anti-monopoly, data security

Shareholder Structure Analysis

  1. Controlling shareholder type (State-owned enterprise/Private enterprise/Foreign capital)
  2. Share concentration
  3. Recent increase/reduction situations
  4. Pledge ratio

Output Format

JSON Output Format

All scripts output in JSON format for subsequent processing:
json
{
  "code": "600519",
  "name": "Kweichow Moutai",
  "analysis_date": "2025-01-25",
  "level": "standard",
  "summary": {
    "score": 85,
    "conclusion": "Undervalued",
    "recommendation": "Recommended to pay attention"
  },
  "financials": { ... },
  "valuation": { ... },
  "risks": [ ... ]
}

Markdown Report

Generate a structured Chinese Markdown report with reference to
templates/analysis_report.md
.

Error Handling

Network Errors

If akshare data retrieval fails, prompt the user:
  1. Check network connection
  2. Retry later (may be due to interface rate limiting)
  3. Try changing data sources

Invalid Stock Code

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

Incomplete Data

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

Best Practices

  1. Data Timeliness: Financial data is based on the latest quarterly/annual report, and price data is the closing price of the day
  2. Investment Recommendations: 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 individual stocks, automatically include industry average comparisons

Important Notes

  • All analysis is based on public financial data and does not involve any insider information
  • Parameter assumptions in valuation models have a significant impact on results, which should be explained to users
  • The A-share market is greatly affected by policies, so quantitative analysis should be combined with qualitative judgment