china-stock-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

China Stock Analysis Skill

China Stock Analysis Skill

基于价值投资理论的中国A股分析工具,面向低频交易的普通投资者。
A Chinese A-share analysis tool based on value investment theory, designed for ordinary investors with low-frequency trading.

When to Use

When to Use

当用户请求以下操作时调用此skill:
  • 分析某只A股股票
  • 筛选符合条件的股票
  • 对比多只股票或行业内股票
  • 计算股票估值或内在价值
  • 查看股票的财务健康状况
  • 检测财务异常风险
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

Prerequisites

Python环境要求

Python Environment Requirements

bash
pip install akshare pandas numpy
bash
pip install akshare pandas numpy

依赖检查

Dependency Check

在执行任何分析前,先检查akshare是否已安装:
bash
python -c "import akshare; print(akshare.__version__)"
如果未安装,提示用户安装:
bash
pip install akshare
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

Core Modules

1. Stock Screener (股票筛选器)

1. Stock Screener (股票筛选器)

筛选符合条件的股票
Screen stocks that meet the criteria

2. Financial Analyzer (财务分析器)

2. Financial Analyzer (财务分析器)

个股深度财务分析
In-depth financial analysis of individual stocks

3. Industry Comparator (行业对比)

3. Industry Comparator (行业对比)

同行业横向对比分析
Horizontal comparative analysis within the same industry

4. Valuation Calculator (估值计算器)

4. Valuation Calculator (估值计算器)

内在价值测算与安全边际计算

Intrinsic value calculation and margin of safety calculation

Workflow 1: Stock Screening (股票筛选)

Workflow 1: Stock Screening

用户请求筛选股票时使用。
Used when the user requests stock screening.

Step 1: Collect Screening Criteria

Step 1: Collect Screening Criteria

向用户询问筛选条件。提供以下选项供用户选择或自定义:
估值指标:
  • PE (市盈率): 例如 PE < 15
  • PB (市净率): 例如 PB < 2
  • PS (市销率): 例如 PS < 3
盈利能力:
  • ROE (净资产收益率): 例如 ROE > 15%
  • ROA (总资产收益率): 例如 ROA > 8%
  • 毛利率: 例如 > 30%
  • 净利率: 例如 > 10%
成长性:
  • 营收增长率: 例如 > 10%
  • 净利润增长率: 例如 > 15%
  • 连续增长年数: 例如 >= 3年
股息:
  • 股息率: 例如 > 3%
  • 连续分红年数: 例如 >= 5年
财务安全:
  • 资产负债率: 例如 < 60%
  • 流动比率: 例如 > 1.5
  • 速动比率: 例如 > 1
筛选范围:
  • 全A股
  • 沪深300成分股
  • 中证500成分股
  • 创业板/科创板
  • 用户自定义列表
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

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
参数说明:
  • --scope
    : 筛选范围 (all/hs300/zz500/cyb/kcb/custom:600519,000858,...)
  • --pe-max/--pe-min
    : PE范围
  • --pb-max/--pb-min
    : PB范围
  • --roe-min
    : 最低ROE
  • --growth-min
    : 最低增长率
  • --debt-ratio-max
    : 最大资产负债率
  • --dividend-min
    : 最低股息率
  • --output
    : 输出文件路径
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

Step 3: Present Results

读取
screening_result.json
并以表格形式呈现给用户:
代码名称PEPBROE股息率评分
600519贵州茅台25.38.530.2%2.1%85

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 (个股分析)

Workflow 2: Stock Analysis

用户请求分析某只股票时使用。
Used when the user requests analysis of a specific stock.

Step 1: Collect Stock Information

Step 1: Collect Stock Information

询问用户:
  1. 股票代码或名称
  2. 分析深度级别:
    • 摘要级:关键指标 + 投资结论(1页)
    • 标准级:财务分析 + 估值 + 行业对比 + 风险提示
    • 深度级:完整调研报告,包含历史数据追踪
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

Step 2: Fetch Stock Data

bash
python scripts/data_fetcher.py \
    --code "600519" \
    --data-type all \
    --years 5 \
    --output stock_data.json
参数说明:
  • --code
    : 股票代码
  • --data-type
    : 数据类型 (basic/financial/valuation/holder/all)
  • --years
    : 获取多少年的历史数据
  • --output
    : 输出文件
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

Step 3: Run Financial Analysis

bash
python scripts/financial_analyzer.py \
    --input stock_data.json \
    --level standard \
    --output analysis_result.json
参数说明:
  • --input
    : 输入的股票数据文件
  • --level
    : 分析深度 (summary/standard/deep)
  • --output
    : 输出文件
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

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
参数说明:
  • --input
    : 股票数据文件
  • --methods
    : 估值方法 (dcf/ddm/relative/all)
  • --discount-rate
    : 折现率(%)
  • --growth-rate
    : 永续增长率(%)
  • --margin-of-safety
    : 安全边际(%)
  • --output
    : 输出文件
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

Step 5: Generate Report

读取分析结果,参考
templates/analysis_report.md
模板生成中文分析报告。
报告结构(标准级):
  1. 公司概况:基本信息、主营业务
  2. 财务健康:资产负债表分析
  3. 盈利能力:杜邦分析、利润率趋势
  4. 成长性分析:营收/利润增长趋势
  5. 估值分析:DCF/DDM/相对估值
  6. 风险提示:财务异常检测、股东减持
  7. 投资结论:综合评分、操作建议

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 (行业对比)

Workflow 3: Industry Comparison

Step 1: Collect Comparison Targets

Step 1: Collect Comparison Targets

询问用户:
  1. 目标股票代码(可多个)
  2. 或者:行业分类 + 对比数量
Ask the user:
  1. Target stock codes (multiple allowed)
  2. Or: Industry classification + number of comparisons

Step 2: Fetch Industry Data

Step 2: Fetch Industry Data

bash
python scripts/data_fetcher.py \
    --codes "600519,000858,002304" \
    --data-type comparison \
    --output industry_data.json
或按行业获取:
bash
python scripts/data_fetcher.py \
    --industry "白酒" \
    --top 10 \
    --output industry_data.json
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

Step 3: Generate Comparison

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

Step 4: Present Comparison Table

Step 4: Present Comparison Table

指标贵州茅台五粮液洋河股份行业均值
PE25.318.215.622.4
ROE30.2%22.5%20.1%18.5%
毛利率91.5%75.2%72.3%65.4%
评分857875-

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 (估值计算)

Workflow 4: Valuation Calculator

Step 1: Collect Valuation Parameters

Step 1: Collect Valuation Parameters

询问用户估值参数(或使用默认值):
DCF模型参数:
  • 折现率 (WACC): 默认10%
  • 预测期: 默认5年
  • 永续增长率: 默认3%
DDM模型参数:
  • 要求回报率: 默认10%
  • 股息增长率: 使用历史数据推算
相对估值参数:
  • 对比基准: 行业均值 / 历史均值
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

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
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

Step 3: Present Valuation Results

估值方法内在价值当前价格安全边际价格结论
DCF¥2,150¥1,680¥1,505低估
DDM¥1,980¥1,680¥1,386低估
相对估值¥1,850¥1,680¥1,295合理

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 (财务异常检测)

Financial Anomaly Detection

在分析过程中自动检测以下异常信号:
Automatically detect the following abnormal signals during analysis:

检测项目

Detection Items

  1. 应收账款异常
    • 应收账款增速 > 营收增速 × 1.5
    • 应收账款周转天数大幅增加
  2. 现金流背离
    • 净利润持续增长但经营现金流下降
    • 现金收入比 < 80%
  3. 存货异常
    • 存货增速 > 营收增速 × 2
    • 存货周转天数大幅增加
  4. 毛利率异常
    • 毛利率波动 > 行业均值波动 × 2
    • 毛利率与同行严重偏离
  5. 关联交易
    • 关联交易占比过高(> 30%)
  6. 股东减持
    • 大股东近期减持公告
    • 高管集中减持
  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

  • 🟢 低风险:无明显异常
  • 🟡 中风险:1-2项轻微异常
  • 🔴 高风险:多项异常或严重异常

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

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

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. 控股股东类型(国企/民企/外资)
  2. 股权集中度
  3. 近期增减持情况
  4. 质押比例

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

Output Format

Output Format

JSON输出格式

JSON Output Format

所有脚本输出JSON格式,便于后续处理:
json
{
  "code": "600519",
  "name": "贵州茅台",
  "analysis_date": "2025-01-25",
  "level": "standard",
  "summary": {
    "score": 85,
    "conclusion": "低估",
    "recommendation": "建议关注"
  },
  "financials": { ... },
  "valuation": { ... },
  "risks": [ ... ]
}
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报告

Markdown Report

生成结构化的中文Markdown报告,参考
templates/analysis_report.md

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

Error Handling

Error Handling

网络错误

Network Errors

如果akshare数据获取失败,提示用户:
  1. 检查网络连接
  2. 稍后重试(可能是接口限流)
  3. 尝试更换数据源
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

Best Practices

  1. 数据时效性:财务数据以最新季报/年报为准,价格数据为当日收盘价
  2. 投资建议:所有分析仅供参考,不构成投资建议
  3. 风险提示:始终包含风险提示,特别是财务异常检测结果
  4. 对比分析:单只股票分析时,自动包含行业均值对比
  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

Important Notes

  • 所有分析基于公开财务数据,不涉及任何内幕信息
  • 估值模型的参数假设对结果影响较大,需向用户说明
  • A股市场受政策影响较大,定量分析需结合定性判断
  • 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