Use when user requests DCF (Discounted Cash Flow) valuation analysis for an A-share stock.
VariableDescriptionHow to ObtainTUSHARE_TOKENTushare API token (mandatory)Register at https://tushare.pro, get token from user centerOPENCLAW_WORKSPACEWorkspace root path (optional)Defaults to ~/.openclaw/workspace
PackageVersionPurposetushareLatestA-share financial data APIpandas≥1.0Data processingnumpy≥1.18Numerical calculationsscipy≥1.4Beta regression (stats module)
Configure Tushare Token: bash
# Add to ~/.bashrc or ~/.bash_profile
export TUSHARE_TOKEN="your_token_here"
source ~/.bashrc
Install Python Dependencies: bash
pip install tushare pandas numpy scipy
Verify Setup: bash
python3 -c "import tushare as ts; ts.set_token('$TUSHARE_TOKEN'); pro = ts.pro_api(); print(pro.stock_basic(ts_code='600519.SH'))"
ErrorCauseSolution未设置 TUSHARE_TOKEN 环境变量Token not configuredAdd export to shell profileTushare API 获取失败Invalid token or network issueVerify token, check networkNo module named 'tushare'Package not installedpip install tushare``Beta 回归数据不足Stock newly listedUse industry default Beta
text
User input: "对 贵州茅台 600519 做 DCF 估值"
→ Run: python3 scripts/a_share_dcf.py 600519.SH
→ Report saved to: reports/dcf_贵州茅台_YYYY-MM-DD.md
Method: Two-stage FCFF (Free Cash Flow to Firm) discount model
Formulas:
Three-Scenario Assumptions:
ScenarioWACCGrowth RatePerpetual GrowthConservativeWACC + 3% (min 14%)50% of 3-year avg2%BaseCalculated WACC80% of 3-year avg3%OptimisticWACC - 3% (min 7%)100% of 3-year avg4%
Conservative Scenario: Higher WACC reflects elevated risk premium; reduced growth rate accounts for potential downside from competition, regulation, or macro headwinds. Suitable for risk-averse investors.
Base Scenario: Uses calculated WACC from company-specific beta and capital structure; growth rate anchored to historical average but tempered for maturity trajectory. Represents most likely outcome under normal conditions.
Optimistic Scenario: Lower WACC assumes favorable risk environment; full historical growth reflects best-case execution. Appropriate for growth-oriented analysis or upside case.
Tushare uses XXXXXX.SH (Shanghai) or XXXXXX.SZ (Shenzhen) format:
python
# Auto conversion
if code.startswith('6'):
ts_code = f"{code}.SH"
elif code.startswith(('0', '3')):
ts_code = f"{code}.SZ"
bash
cd $OPENCLAW_WORKSPACE && python3 skills/a-share-dcf-valuation/scripts/a_share_dcf.py <TS_CODE> [公司名]
# Example: python3 skills/a-share-dcf-valuation/scripts/a_share_dcf.py 600519.SH 贵州茅台
Note: $OPENCLAW_WORKSPACE defaults to ~/.openclaw/workspace. Use relative paths from workspace root for portability.
reports/dcf_{公司名}_{日期}.mdFirst provide summary conclusion, then report path:
text
## DCF 估值完成 — {公司名}
| 场景 | DCF每股价值 | vs 当前股价 |
|------|------------|------------|
| 保守 | ¥XX.XX | -XX.X% |
| 中性 | ¥XX.XX | -XX.X% |
| 乐观 | ¥XX.XX | -XX.X% |
当前股价: ¥XXX.XX
完整报告: reports/dcf_{公司名}_{日期}.md
The following parameters are NOT hardcoded fixed values. They are dynamically determined with explicit data sources and rationale:
ApproachSourceValue RangePrimaryChina 10-year Treasury yield1.8% - 4.5% (historical)Reference中债估值~2.1% - 2.5% (2024-2025)FallbackRecent 10Y bond average2.25% (default)
Method: Query public bond yield data; if unavailable, use recent reference value with explicit notation.
Correct Terminology: ERP (Equity Risk Premium), not MRP (Market Risk Premium).
SourceERP EstimateDamodaran (2024)6.5% for China中金/中信研报5% - 8%程晓明等学术研究6.0% - 7.5%Historical calculation (A股20年平均收益率 - RF)5.5% - 7.0%
Industry Adjustment:
Method: Base ERP 6.5% + industry-specific risk adjustment.
ApproachFormulaPrimaryLPR 1Y + Credit SpreadLPR Reference3.1% (2025 1-year LPR)Credit Spread0.5% - 1.5% based on ratingCompany ProfileEstimated RdLow debt (<10%), strong credit3.6% (LPR + 0.5%)Moderate debt (10-50%)4.0% (LPR + 0.9%)High debt (>50%)5.0% (LPR + 1.9%)
Method: Estimate based on company's debt ratio and implied credit quality.
SourceRatePrimaryActual effective tax rate from financial statementsHigh-tech enterprise15% (qualified)General corporate25%
High-tech Identification Criteria:
Method: First attempt to extract actual tax rate from income statement; if unavailable, determine based on industry and gross margin characteristics.
The "Risk Disclosure" section must be dynamically generated based on company and industry characteristics, NOT hardcoded. The script should:
Industry Risk Mapping:
IndustryKey Risk Factors科技/半导体技术迭代快、研发投入大、国际竞争、供应链风险消费/食品饮料品牌溢价风险、消费降级、渠道变革医药/医疗政策监管(集采)、研发失败、专利到期金融/银行利率周期、信用风险、监管趋严周期/制造经济周期敏感、产能过剩、环保政策新能源/光伏技术路线竞争、产能扩张过快、补贴退坡房地产/建材政策调控、去杠杆、销售疲软互联网/传媒用户增长放缓、监管趋严、变现模式受限交通运输油价波动、需求周期、基础设施投资其他行业竞争格局变化、政策不确定性
markdown
# DCF 估值报告 — {公司名} ({TS_CODE})
> 估值日期 | 当前股价 | 总市值 | PE | PB
## 一、公司基本面概览
- 公司简介
- 历史财务数据表(7年)
- 关键财务指标(最新年报)
## 二、WACC 计算
- 参数表格(Rf, Beta, MRP, Re, Rd, Tax, We, Wd, WACC)
## 三、三场景 DCF 估值
- 场景假设表(含设定依据说明)
- 估值结果表
## 四、敏感性分析
- WACC × 永续增长率 矩阵
## 五、关键假设
- 列出核心假设
## 六、风险提示(Dynamic)
- 根据公司行业特性、财务状况动态生成针对性风险提示
## 七、结论
- 估值区间
- 与当前股价对比
- 简要分析
> 免责声明
All paths should be relative to the workspace root ( $OPENCLAW_WORKSPACE or ~/.openclaw/workspace):
skills/a-share-dcf-valuation/scripts/a_share_dcf.pyreports/dcf_{公司名}_{YYYY-MM-DD}.mdImportant: Avoid absolute paths like /home/laigen/ in the script. Use environment variable $OPENCLAW_WORKSPACE or relative paths for portability.