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:
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:
- : Screening scope (all/hs300/zz500/cyb/kcb/custom:600519,000858,...)
- : PE range
- : PB range
- : Minimum ROE
- : Minimum growth rate
- : Maximum asset-liability ratio
- : Minimum dividend yield
- : Output file path
Step 3: Present Results
Read
and present it to the user in table format:
| 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 specific stock.
Step 1: Collect Stock Information
Ask the user:
- Stock code or name
- 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:
- : Stock code
- : Data type (basic/financial/valuation/holder/all)
- : Number of years of historical data to retrieve
- : 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 stock data file
- : Analysis depth (summary/standard/deep)
- : 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:
- : Stock data file
- : Valuation methods (dcf/ddm/relative/all)
- : Discount rate (%)
- : Perpetual growth rate (%)
- : Margin of safety (%)
- : 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):
- Company Overview: Basic information, main business
- Financial Health: Balance sheet analysis
- Profitability: DuPont analysis, profit margin trends
- Growth Analysis: Revenue/profit growth trends
- Valuation Analysis: DCF/DDM/Relative Valuation
- Risk Warning: Financial anomaly detection, shareholder reduction
- Investment Conclusion: Comprehensive score, operation recommendations
Workflow 3: Industry Comparison
Step 1: Collect Comparison Targets
Ask the user:
- Target stock codes (multiple allowed)
- 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
| Indicator | Kweichow Moutai | Wuliangye | Yanghe Co., Ltd. | Industry Average |
|---|
| PE | 25.3 | 18.2 | 15.6 | 22.4 |
| ROE | 30.2% | 22.5% | 20.1% | 18.5% |
| Gross Profit Margin | 91.5% | 75.2% | 72.3% | 65.4% |
| Score | 85 | 78 | 75 | - |
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 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 | Reasonable |
Financial Anomaly Detection
Automatically detect the following abnormal signals during analysis:
Detection Items
-
Abnormal Accounts Receivable
- Accounts receivable growth rate > Revenue growth rate × 1.5
- Significant increase in accounts receivable turnover days
-
Cash Flow Divergence
- Net profit continues to grow but operating cash flow declines
- Cash-to-revenue ratio < 80%
-
Abnormal Inventory
- Inventory growth rate > Revenue growth rate × 2
- Significant increase in inventory turnover days
-
Abnormal Gross Profit Margin
- Gross profit margin volatility > Industry average volatility × 2
- Gross profit margin significantly deviates from peers
-
Related Party Transactions
- High proportion of related party transactions (> 30%)
-
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
- Controlling shareholder type (State-owned enterprise/Private enterprise/Foreign capital)
- Share concentration
- Recent increase/reduction situations
- 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:
- Check network connection
- Retry later (may be due to interface rate limiting)
- 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
- Data Timeliness: Financial data is based on the latest quarterly/annual report, and price data is the closing price of the day
- Investment Recommendations: All analysis is for reference only and does not constitute investment advice
- Risk Warning: Always include risk warnings, especially the results of financial anomaly detection
- 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