Stock Valuation Report Generator v3.0
Generate professional valuation reports with ONE command. The pipeline auto-detects peers, runs all 8 data scripts in parallel, and produces a polished HTML report.
Quick Start (One Prompt)
CODEBLOCK0
Agent steps:
Step 1: Run Data Pipeline
CODEBLOCK1
Options:
CODEBLOCK2
Step 2: Qualitative Research (MANDATORY)
Run these searches in parallel and collect the results into /tmp/TICKER_research.json:
2a. Seeking Alpha Research
web_search "{TICKER} seekingalpha analysis 2025 2026"
web_search "seekingalpha {TICKER} strong buy OR turning bullish OR high growth"
Extract 3-5 articles: title, date, rating (Strong Buy/Buy/Hold/Sell), one-sentence thesis.
2b. X/Twitter Sentiment
# If bird CLI available:
bird search '$TICKER' -n 15 --plain
# Otherwise:
web_search "{TICKER} stock twitter sentiment price target"
Extract 3-5 notable posts: username, bull/bear stance, key argument, any specific price target.
2c. Analyst Consensus
web_search "{TICKER} analyst price target consensus 2026"
Extract: consensus rating, average/low/high price targets.
2d. Earnings & Revenue
web_search "{TICKER} latest earnings call revenue composition segments"
web_fetch "BEST_EARNINGS_URL" --maxChars 6000
Extract: revenue by segment (amount, % of total, YoY growth), geographic breakdown, funded accounts/AUM/key KPIs, management guidance.
2e. Catalysts & Risks
Synthesize from all research above. Aim for 5-7 catalysts and 5-7 risks (with mitigants).
Save as Research JSON
Save to /tmp/TICKER_research.json:
CODEBLOCK7
Step 3: Generate Report
CODEBLOCK8
Step 4: Convert to PDF & Deliver
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--headless --disable-gpu --print-to-pdf=/tmp/TICKER_report.pdf \
--no-pdf-header-footer /tmp/TICKER_report.html
Deliver the PDF (and optionally HTML) to the user.
Script Reference
| Script | Deps | Output |
|---|
| INLINECODE2 | yfinance,matplotlib,lxml | Merged JSON → file |
| INLINECODE3 |
(none) | HTML report |
|
fetch_fundamentals.py TICKER [PEERS...] | yfinance | Financials, ratios, peer data |
|
fetch_technicals.py TICKER | yfinance | SMAs, RSI, MACD, 52W range |
|
fetch_historical_valuation.py TICKER | yfinance,lxml | 5yr P/E history, percentile |
|
dcf_model.py TICKER [--wacc] [--growth-*] | yfinance | 10yr DCF bear/base/bull |
|
fetch_insiders.py TICKER | yfinance | Insider txns + institutional holders |
|
fetch_options.py TICKER | yfinance | P/C ratio, IV, unusual vol |
|
fetch_earnings_calendar.py TICKER | yfinance | Next earnings date |
|
generate_charts.py TICKER | yfinance,matplotlib | 4 PNGs → /tmp/ |
|
detect_peers.py TICKER [--count N] | yfinance | Auto-detected peers |
|
filter_tweets.py (stdin) | (none) | Filtered tweet JSON |
Report Sections
The generated report includes all of these (in order):
- 1. Header (company name, ticker, date, data sources)
- Earnings Badge (next earnings date)
- KPI Cards (price, MCap, P/E, margins — 2 rows of 4)
- Quarterly Trends (with QoQ growth arrows ↑↑/↑/→/↓)
- Revenue Composition (segment breakdown table + insight callout)
- Geographic Expansion (market-by-market table)
- Technical Analysis (6-panel: RSI, SMAs, MACD, 52W range)
- Charts (2×2 grid: price+SMA, revenue, margins, PE history)
- Historical Valuation (5Y PE avg, range, percentile + mean reversion callout)
- Peer Comparison (full table with highlight row + discount callout)
- Options Sentiment (4 KPI cards + interpretation)
- Insider Activity
- Seeking Alpha Research (bullish/cautious grouping + consensus callout)
- X/Twitter Sentiment (notable takes + consensus callout)
- Catalysts (5-7 items, most important first)
- Risks (5-7 items with mitigants)
- Valuation Framework (P/E multiples, mean reversion, DCF)
- Price Target Scenarios (bear/base/bull with math)
- Investment Thesis (specific, opinionated verdict)
- Disclaimer
- Footer
Rules
- - NEVER include personal position data, portfolio info, or user-identifiable information
- All scripts work with
uv run --with <deps> (no pip install needed) - Charts are embedded as base64 in HTML for portability
- If any data script fails, its section shows gracefully degraded (no broken HTML)
股票估值报告生成器 v3.0
通过一条命令生成专业估值报告。该流程自动检测同行业公司,并行运行全部8个数据脚本,并生成精美的HTML报告。
快速开始(一条提示)
用户:为AAPL生成估值报告
代理步骤:
步骤1:运行数据管道
bash
uv run --with yfinance,matplotlib,lxml python3 $SKILL
DIR/scripts/runpipeline.py TICKER
输出:/tmp/TICKER_data.json
选项:
bash
手动指定同行业公司
uv run --with yfinance,matplotlib,lxml python3 $SKILL
DIR/scripts/runpipeline.py AAPL --peers MSFT GOOG META
步骤2:定性研究(必须执行)
并行运行以下搜索,并将结果收集到/tmp/TICKER_research.json:
2a. Seeking Alpha研究
web_search {TICKER} seekingalpha analysis 2025 2026
web_search seekingalpha {TICKER} strong buy OR turning bullish OR high growth
提取3-5篇文章:标题、日期、评级(强力买入/买入/持有/卖出)、一句话核心观点。
2b. X/Twitter情绪
bash
如果bird CLI可用:
bird search $TICKER -n 15 --plain
否则:
web_search {TICKER} stock twitter sentiment price target
提取3-5条重要帖子:用户名、看涨/看跌立场、关键论点、具体目标价。
2c. 分析师共识
web_search {TICKER} analyst price target consensus 2026
提取:共识评级、平均/最低/最高目标价。
2d. 盈利与收入
web_search {TICKER} latest earnings call revenue composition segments
webfetch BESTEARNINGS_URL --maxChars 6000
提取:按业务板块划分的收入(金额、占总收入百分比、同比增长)、地域分布、受资助账户/AUM/关键指标、管理层指引。
2e. 催化剂与风险
综合以上所有研究。目标为5-7个催化剂和5-7个风险(含缓解措施)。
保存为研究JSON文件
保存至/tmp/TICKER_research.json:
json
{
sa_articles: [
{title: 文章标题, date: 2025年12月, rating: 强力买入, summary: 一句话核心观点}
],
twitter_sentiment: [
{user: FinanceGuy, stance: 看涨, summary: 关键论点或目标价}
],
analystconsensus: {rating: 强力买入, avgpt: 200.0, lowpt: 150.0, highpt: 250.0},
catalysts: [
Q4盈利超预期可能触发重新估值(3月19日发布),
向新市场的地域扩张降低了集中度风险
],
risks: [
关键市场的监管风险。缓解措施:在6个以上司法管辖区分散布局,
交易量的周期性波动。缓解措施:利息收入提供稳定基础
],
revenue_composition: [
{stream: 产品销售, amount: 500亿美元, pct: 52%, trend: 强劲增长, notes: 核心硬件}
],
geographic_data: [
{market: 美洲, newaccountspct: 45%, avg_deposit: 5万美元, highlights: 最大市场}
]
}
步骤3:生成报告
bash
uv run python3 $SKILL
DIR/scripts/generatereport.py /tmp/TICKER
data.json --research /tmp/TICKERresearch.json
输出:/tmp/TICKER_report.html
步骤4:转换为PDF并交付
bash
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--headless --disable-gpu --print-to-pdf=/tmp/TICKER_report.pdf \
--no-pdf-header-footer /tmp/TICKER_report.html
将PDF(以及可选的HTML)交付给用户。
脚本参考
| 脚本 | 依赖 | 输出 |
|---|
| runpipeline.py TICKER [--peers P1 P2] [--output] | yfinance,matplotlib,lxml | 合并JSON → 文件 |
| generatereport.py DATA.json [--output] [--research] |
(无) | HTML报告 |
| fetch_fundamentals.py TICKER [PEERS...] | yfinance | 财务数据、比率、同行数据 |
| fetch_technicals.py TICKER | yfinance | SMA、RSI、MACD、52周范围 |
| fetch
historicalvaluation.py TICKER | yfinance,lxml | 5年市盈率历史、百分位 |
| dcf_model.py TICKER [--wacc] [--growth-*] | yfinance | 10年DCF悲观/基准/乐观 |
| fetch_insiders.py TICKER | yfinance | 内部交易 + 机构持有者 |
| fetch_options.py TICKER | yfinance | 看跌/看涨比率、隐含波动率、异常成交量 |
| fetch
earningscalendar.py TICKER | yfinance | 下次财报日期 |
| generate_charts.py TICKER | yfinance,matplotlib | 4张PNG → /tmp/ |
| detect_peers.py TICKER [--count N] | yfinance | 自动检测同行 |
| filter_tweets.py (标准输入) | (无) | 过滤后的推文JSON |
报告章节
生成的报告包含以下所有内容(按顺序):
- 1. 页眉(公司名称、股票代码、日期、数据来源)
- 财报徽章(下次财报日期)
- KPI卡片(股价、市值、市盈率、利润率 — 2行×4列)
- 季度趋势(含环比增长箭头↑↑/↑/→/↓)
- 收入构成(板块细分表格 + 洞察标注)
- 地域扩张(分市场表格)
- 技术分析(6面板:RSI、SMA、MACD、52周范围)
- 图表(2×2网格:股价+SMA、收入、利润率、市盈率历史)
- 历史估值(5年平均市盈率、范围、百分位 + 均值回归标注)
- 同行比较(完整表格 + 高亮行 + 折价标注)
- 期权情绪(4个KPI卡片 + 解读)
- 内部交易活动
- Seeking Alpha研究(看涨/谨慎分组 + 共识标注)
- X/Twitter情绪(重要观点 + 共识标注)
- 催化剂(5-7项,最重要的在前)
- 风险(5-7项,含缓解措施)
- 估值框架(市盈率倍数、均值回归、DCF)
- 目标价情景(悲观/基准/乐观,含计算)
- 投资论点(具体、有观点的结论)
- 免责声明
- 页脚
规则
- - 绝不包含个人持仓数据、投资组合信息或用户可识别信息
- 所有脚本使用uv run --with 运行(无需pip install)
- 图表以base64格式嵌入HTML,便于移植
- 如果任何数据脚本失败,其对应章节将优雅降级(不产生损坏的HTML)