A China A-share analysis tool based on value investing theory, intended for ordinary investors who trade infrequently.
When to Use
Invoke 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 it:
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 comparison analysis within the same industry
4. Valuation Calculator
Intrinsic value estimation and margin of safety calculation
Workflow 1: Stock Screening
Use when the user requests stock screening.
Step 1: Collect Screening Criteria
Ask the user for screening conditions. Provide the following options for the user to select 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%
- Number of consecutive years of growth: e.g. >= 3 years
Dividends:
- Dividend yield: e.g. > 3%
- Number of 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 description:
--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:
- Stock code or name
- 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 fetch--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 and refer to the templates/analysis_report.md template to generate a Chinese analysis report.
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 Disclosure: financial anomaly detection, shareholder reductions
- Investment Conclusion: overall score, operational 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
python scripts/data_fetcher.py \
--codes "600519,000858,002304" \
--data-type comparison \
--output industry_data.json
Or fetch 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% |
| 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: 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
The following anomaly signals are automatically detected during analysis:
Detection Item
-
Accounts Receivable Anomaly
- Accounts receivable growth > Revenue growth × 1.5
- Accounts receivable turnover days increase significantly
-
Cash Flow Divergence
- Net profit continues to grow but operating cash flow declines
- Cash-to-revenue ratio < 80%
-
Inventory Anomaly
- Inventory growth > Revenue growth × 2
- Inventory turnover days increase significantly
-
Gross Margin Anomaly
- Gross margin volatility > Industry average volatility × 2
- Gross margin deviates severely from peers
-
Related-Party Transactions
- Related-party transaction ratio too high (> 30%)
-
Shareholder Reduction
- Recent reduction announcement by major shareholder
- Concentrated reduction by senior management
Risk Level
- 🟢 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 notes based on industry classification:
- Real Estate: Housing is for living, not for speculation policy
- New Energy: Subsidy policy changes
- Pharmaceuticals: Impact of centralized procurement policy
- Internet: Antitrust, data security
Shareholder Structure Analysis
- Type of controlling shareholder (state-owned/private/foreign)
- Ownership concentration
- Recent increases/decreases in holdings
- Pledge ratio
Output Format
JSON Output Format
All scripts output in JSON format for downstream 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 to:
- Check network connection
- Retry later (may be API rate limiting)
- Try switching to another 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 the analysis based on available data.
Best Practices
- Data timeliness: Financial data shall be based on the latest quarterly/annual reports, and price data shall be the closing price of the day
- Investment advice: All analyses are for reference only and do not constitute investment advice
- Risk disclosure: Always include risk disclosures, especially for financial anomaly detection results
- Comparative analysis: When analyzing a single stock, automatically include a comparison with the industry average
Important Notes
- All analyses are based on public financial data and do not involve any inside information
- The parameter assumptions of valuation models have a significant impact on the results and must be explained to the user
- The A-share market is significantly affected by policy, so quantitative analysis needs to be combined with qualitative judgment