stock-analysis
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesestock-analysis · 个股深度研究系统
stock-analysis · A-share Individual Stock In-depth Research System
Agent 阅读顺序
Agent Reading Sequence
- 本文 SKILL.md — 阶段总览(你正在读)
- Phase 1.5 时 → +
output/.../data_inventory.md(自动产出)output/.../anomalies.md - Phase 2 写每段前 → references/tag-spec.md + references/analysis-framework.md 对应 Step
- Phase 2 评分 → references/rubric-spec.md
- Phase 2 异常 → references/anomaly-rules.md
- Phase 3 时 → references/html-spec.md + references/batch-checklist.md
- 写/读 data.json 时 → references/data-schema.md
- Phase 3 末 → 跑 scripts/verify_html.sh(含 verify_content.py)
- This SKILL.md — Phase Overview (you are reading this now)
- During Phase 1.5 → +
output/.../data_inventory.md(automatically generated)output/.../anomalies.md - Before writing each section in Phase 2 → Corresponding Step in references/tag-spec.md + references/analysis-framework.md
- Scoring in Phase 2 → references/rubric-spec.md
- Anomalies in Phase 2 → references/anomaly-rules.md
- During Phase 3 → references/html-spec.md + references/batch-checklist.md
- When writing/reading data.json → references/data-schema.md
- End of Phase 3 → Run scripts/verify_html.sh (includes verify_content.py)
触发示例
Trigger Examples
| 用户说 | 触发 |
|---|---|
| ✓ |
| ✓ |
| ✓ |
| ✓ |
| ✓ |
| User's Input | Triggered |
|---|---|
| ✓ |
| ✓ |
| ✓ |
| How are BYD's fundamentals? | ✓ |
| ✓ |
阶段时序(v3.1)
Phase Timeline (v3.1)
text
Phase 1 数据采集
└─ fetch_data.py 末尾自动 chain:
build_inventory.py → data_inventory.md
scan_anomalies.py → anomalies.{json,md}
Phase 1.5 数据 checkpoint
└─ agent 必读 data_inventory.md + anomalies.md
└─ ❌ 字段必须 web_fetch 补 或 显式 [GAP]
└─ CRITICAL anomaly 必须在 Step 0.5 整段讨论
Phase 2 深度分析(三段检点制 + 标签)
§1 (Step 0, 0.5, 1, 2) → part1 → verify_facts.py --partial part1
§2 (Step 3, 4, 5) → part2 → verify_facts.py --partial part2
§3 (Step 6, 7, 8) → part3 → verify_facts.py --partial part3
合并 cat part*.md > report.md
Phase 2.5 Fact-checker
└─ verify_facts.py FULL → 必须 0 FAIL
└─ Task(general-purpose subagent) → fact-check-report.md
└─ FAIL 项必须 Edit 修正后重跑(最多 3 轮)
Phase 2.6 Bear-case
└─ Task(general-purpose subagent) → bear-case.md
└─ append 到 report.md 作为新 section
Phase 3 HTML 6 批分批手写
└─ verify_html.sh(含 verify_content.py)→ 0 FAIL
└─ 删除中间产物 _h_part*.htmltext
Phase 1 Data Collection
└─ Automatic chaining at the end of fetch_data.py:
build_inventory.py → data_inventory.md
scan_anomalies.py → anomalies.{json,md}
Phase 1.5 Data Checkpoint
└─ Agent must read data_inventory.md + anomalies.md
└─ ❌ Missing fields must be supplemented via web_fetch or explicitly marked [GAP]
└─ CRITICAL anomalies must be fully discussed in Step 0.5
Phase 2 In-depth Analysis (Three-section Check System + Tags)
§1 (Step 0, 0.5, 1, 2) → part1 → verify_facts.py --partial part1
§2 (Step 3, 4, 5) → part2 → verify_facts.py --partial part2
§3 (Step 6, 7, 8) → part3 → verify_facts.py --partial part3
Merge: cat part*.md > report.md
Phase 2.5 Fact-checker
└─ verify_facts.py FULL → Must have 0 FAIL
└─ Task(general-purpose subagent) → fact-check-report.md
└─ FAIL items must be edited and re-run (max 3 rounds)
Phase 2.6 Bear-case
└─ Task(general-purpose subagent) → bear-case.md
└─ Append to report.md as a new section
Phase 3 HTML Writing in 6 Batches
└─ verify_html.sh (includes verify_content.py) → 0 FAIL
└─ Delete intermediate products _h_part*.htmlPhase 2.5 fact-checker sub-agent prompt(agent 复制粘贴用)
Phase 2.5 fact-checker sub-agent prompt (for agent copy-paste)
text
你是审稿人。检查 report.md 数字准确性 + 推断合理性。
【输入】report.md / data.json / anomalies.md(路径见此次 output 目录)
【任务】
1. 抽样 20 个 [F:] 标签,逐一核对值的精确性 + 单位 + 上下文
2. 检查所有 [I:] 推断依据是否合理("行业常识·龙头地位"这种宽泛理由不通过)
3. 检查所有 [T:] 目标价的乘法表是否自洽
4. 找出 anomalies.md 中存在但报告中未充分讨论的异常
5. 找出报告内部矛盾
【输出】fact-check-report.md
- PASS: N / FAIL: M / WARN: K
- 每条 FAIL 必含:location + 问题描述 + 修复指令text
You are a reviewer. Check the numerical accuracy and inference rationality of report.md.
【Input】report.md / data.json / anomalies.md (path in current output directory)
【Tasks】
1. Sample 20 [F:] tags, verify the accuracy, unit and context of each value one by one
2. Check if the basis for all [I:] inferences is reasonable (broad reasons like "industry common sense · leading position" are not acceptable)
3. Check if the multiplication table for all [T:] target prices is self-consistent
4. Identify anomalies in anomalies.md that are not fully discussed in the report
5. Find internal contradictions in the report
【Output】fact-check-report.md
- PASS: N / FAIL: M / WARN: K
- Each FAIL item must include: location + problem description + repair instructionPhase 2.6 bear-case sub-agent prompt
Phase 2.6 bear-case sub-agent prompt
text
你是空头分析师。基于 report.md 与 anomalies.md,写 300-500 字对立面观点。
【任务】
1. 找出 3 条主 agent 没充分讨论的负面证据
2. 给出"如果多头观点错了,错在哪里"的具体路径
3. 反驳报告中关键的 [I:] 推断
4. 提出 3 条"如果出现 X 信号,则空头观点确认"的可观测指标
【输出】bear-case.md(不需要标签)
- 必须引用 anomalies.md 中至少 2 条 IDtext
You are a bearish analyst. Based on report.md and anomalies.md, write a 300-500 word opposing view.
【Tasks】
1. Find 3 pieces of negative evidence that the main agent did not fully discuss
2. Provide specific paths for "if the bullish view is wrong, where is it wrong"
3. Refute key [I:] inferences in the report
4. Propose 3 observable indicators: "if signal X appears, the bearish view is confirmed"
【Output】bear-case.md (no tags required)
- Must cite at least 2 IDs from anomalies.mdPhase 1 · 数据采集(3-5 min)
Phase 1 · Data Collection (3-5 min)
所需数据: 近 3 年日 K 线、近 3 年财务(营收/净利/毛利/ROE)、主营业务构成、十大股东、近期新闻。
实现方式(任选):
| 方式 | 命令 |
|---|---|
| akshare 参考脚本 | |
| 财经类 MCP | agent 直接调用 |
| web_fetch | agent 自行抓取雪球/东财公开页 |
| 手工上传 | 用户提供 CSV/JSON |
输出: ,schema 见 references/data-schema.md。
output/<股票名>_<代码>/<YYYY-MM-DD>/data.jsonRequired Data: Daily K-lines of the past 3 years, financial data of the past 3 years (revenue/net profit/gross profit/ROE), main business composition, top 10 shareholders, recent news.
Implementation Methods (Optional):
| Method | Command |
|---|---|
| akshare reference script | |
| Financial MCP | Direct call by agent |
| web_fetch | Agent crawls public pages from Xueqiu/Eastmoney on its own |
| Manual upload | User provides CSV/JSON |
Output: , schema see references/data-schema.md.
output/<Stock Name>_<Code>/<YYYY-MM-DD>/data.jsonPhase 2 · AI 深度分析(30-45 min · 三段检点制)
Phase 2 · AI In-depth Analysis (30-45 min · Three-section Check System)
| 段 | 包含 Step | 落盘 |
|---|---|---|
| §1 | Step 0-2(任务/宏观/产业链) | |
| §2 | Step 3-5(公司质地/弹性/风险) | |
| §3 | Step 6-8(估值/对标/跟踪结论) | |
| 合并 | — | |
节奏:
- 同会话默认三段连续执行,不询问"是否继续"
- 每段完成输出
✅ §X 完成(XX 行 / Step A-B) - 跨会话续跑:读 下已存在的 part 文件决定起点
output/<股票名>_<代码>/latest/
最低行数(不可少): Step 0:10 / 1:50 / 2:100 / 3:50 / 4:80 / 5:40 / 6:100 / 7:60 / 8:50(合计 540 行)。
方法论详见: references/analysis-framework.md
| Section | Included Steps | Output |
|---|---|---|
| §1 | Step 0-2 (Task/Macro/Industrial Chain) | |
| §2 | Step 3-5 (Company Quality/Elasticity/Risk) | |
| §3 | Step 6-8 (Valuation/Benchmarking/Tracking Conclusion) | |
| Merge | — | |
Rhythm:
- By default, the three sections are executed continuously in the same session, no need to ask "Continue?"
- After completing each section, output
✅ §X Completed (XX lines / Step A-B) - Resume across sessions: Determine the starting point by reading existing part files under
output/<Stock Name>_<Code>/latest/
Minimum Line Count (Mandatory): Step 0:10 / 1:50 / 2:100 / 3:50 / 4:80 / 5:40 / 6:100 / 7:60 / 8:50 (total 540 lines).
Methodology Details: references/analysis-framework.md
Phase 3 · HTML 生成(30-40 min · 6 批分批手写)
Phase 3 · HTML Generation (30-40 min · Written in 6 Batches)
工具分工:
- Write 写 markup / Edit 局部改 / Bash cat 字节拼接
- 禁止: Python f-string、Bash heredoc、拼字符串
python -c
6 批方案(每批 ≤300 行,写完跑该批 grep 校验):
| 批 | 内容 | 主要 grep 校验 |
|---|---|---|
| 0 | DOCTYPE + head + style(完整复制 | |
| 1 | body + nav + compliance + hero + conclusion-top + profile | nav 13 锚点、4 hero-meta、compliance-banner 存在 |
| 2 | financial-grid + K线 + Step 0-3 | mission/macro/chain/quality 四 id 存在 |
| 3 | Step 4-6(弹性/风险/估值) | elasticity/risk/valuation 三 id 存在 |
| 4 | Step 7-8 + 总结框 + footer | // CONCLUSION 存在、footer 内 |
| 5 | script(完整复制 | |
| 合并 | | 全 PASS |
详细分批指南(含 ANCHOR 用法、每批 grep 命令、失败处理):
references/batch-checklist.md
HTML 设计规范(色板/字体/组件):
references/html-spec.md
金标范例:
examples/比亚迪_002594.html
Tool Division:
- Write for markup / Edit for local modifications / Bash cat for byte splicing
- Prohibited: Python f-string, Bash heredoc, for string splicing
python -c
6-batch Plan (Each batch ≤300 lines, run grep verification after writing):
| Batch | Content | Main Grep Verification |
|---|---|---|
| 0 | DOCTYPE + head + style (fully copy | |
| 1 | body + nav + compliance + hero + conclusion-top + profile | 13 anchors in nav, 4 hero-meta, compliance-banner exists |
| 2 | financial-grid + K-line + Step 0-3 | Four ids mission/macro/chain/quality exist |
| 3 | Step 4-6 (Elasticity/Risk/Valuation) | Three ids elasticity/risk/valuation exist |
| 4 | Step 7-8 + Summary Box + footer | // CONCLUSION exists, |
| 5 | script (fully copy | |
| Merge | | All PASS |
Detailed Batch Guide (Including ANCHOR usage, grep commands for each batch, failure handling):
references/batch-checklist.md
HTML Design Specifications (Color Palette/Fonts/Components):
references/html-spec.md
Golden Sample:
examples/比亚迪_002594.html
输出结构
Output Structure
output/
└── <股票名>_<代码>/
├── <YYYY-MM-DD>/
│ ├── data.json # Phase 1
│ ├── report.md.part1-3 # Phase 2 中间产物
│ ├── report.md # Phase 2 合并终版
│ ├── _h_part0-5.html # Phase 3 中间产物
│ └── report.html # 终交付物
└── latest -> <YYYY-MM-DD> # 软链output/
└── <Stock Name>_<Code>/
├── <YYYY-MM-DD>/
│ ├── data.json # Phase 1
│ ├── report.md.part1-3 # Intermediate products of Phase 2
│ ├── report.md # Merged final version of Phase 2
│ ├── _h_part0-5.html # Intermediate products of Phase 3
│ └── report.html # Final deliverable
└── latest -> <YYYY-MM-DD> # Symbolic link关键禁止事项
Key Prohibited Items
| # | 禁止 | 原因 |
|---|---|---|
| 1 | Python 生成 HTML markup | 转义混乱、难维护 |
| 2 | Bash heredoc 写多行 HTML | EOF 容易匹配失败 |
| 3 | 跳过/简化任何 Step | 完整框架缺一不可 |
| 4 | OHLC 用 [open, high, low, close] | 与 ECharts 默认不符 |
| 5 | MathJax 使用双反斜杠 | 分隔符匹配失败 |
| 6 | accent 色混用金色 / 多色 score-fill 渐变 | 违反 Linear Terminal+ 设计 |
| 7 | footer 使用 | 违反纯 Mono footer 规范 |
| 8 | Phase 1 输出旧路径 | 应使用 |
| 9 | 一次性写完整 HTML | 必须分 6 批,每批 ≤300 行 |
| 11 | 报告中数字不带 [F]/[C]/[I]/[T]/[GAP] 标签 | verify_facts FAIL,无法进 Phase 3 |
| 12 | 跳过 fact-checker 或 bear-case sub-agent | 多 agent 防御纵深失效 |
| 13 | hero meta 显示 A/B/C 字母评级 | v3.1 改用 |
| 14 | Step 8 再次出现 5 维综合评分 | 已取消,仅保留定性结论 |
| # | Prohibited | Reason |
|---|---|---|
| 1 | Generate HTML markup with Python | Escape chaos, difficult to maintain |
| 2 | Write multi-line HTML with Bash heredoc | EOF matching failure is easy to occur |
| 3 | Skip/simplify any Step | The complete framework is indispensable |
| 4 | Use [open, high, low, close] for OHLC | Does not match ECharts default |
| 5 | Use double backslash | Delimiter matching failure |
| 6 | Mix gold color for accent / multi-color score-fill gradient | Violates Linear Terminal+ design |
| 7 | Use | Violates pure Mono footer specification |
| 8 | Output to old path | Should use |
| 9 | Write complete HTML at once | Must split into 6 batches, each batch ≤300 lines |
| 11 | Numbers in the report without [F]/[C]/[I]/[T]/[GAP] tags | verify_facts FAIL, cannot enter Phase 3 |
| 12 | Skip fact-checker or bear-case sub-agent | Multi-agent defense depth fails |
| 13 | Display A/B/C letter ratings in hero meta | v3.1 uses |
| 14 | Reappear 5-dimensional comprehensive score in Step 8 | Cancelled, only qualitative conclusions are retained |