stock-analysis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

stock-analysis · 个股深度研究系统

stock-analysis · A-share Individual Stock In-depth Research System

Agent 阅读顺序

Agent Reading Sequence

  1. 本文 SKILL.md — 阶段总览(你正在读)
  2. Phase 1.5 时
    output/.../data_inventory.md
    +
    output/.../anomalies.md
    (自动产出)
  3. Phase 2 写每段前references/tag-spec.md + references/analysis-framework.md 对应 Step
  4. Phase 2 评分references/rubric-spec.md
  5. Phase 2 异常references/anomaly-rules.md
  6. Phase 3 时references/html-spec.md + references/batch-checklist.md
  7. 写/读 data.json 时references/data-schema.md
  8. Phase 3 末 → 跑 scripts/verify_html.sh(含 verify_content.py)

  1. This SKILL.md — Phase Overview (you are reading this now)
  2. During Phase 1.5
    output/.../data_inventory.md
    +
    output/.../anomalies.md
    (automatically generated)
  3. Before writing each section in Phase 2 → Corresponding Step in references/tag-spec.md + references/analysis-framework.md
  4. Scoring in Phase 2references/rubric-spec.md
  5. Anomalies in Phase 2references/anomaly-rules.md
  6. During Phase 3references/html-spec.md + references/batch-checklist.md
  7. When writing/reading data.jsonreferences/data-schema.md
  8. End of Phase 3 → Run scripts/verify_html.sh (includes verify_content.py)

触发示例

Trigger Examples

用户说触发
分析 002594
看下比亚迪
002594 值得买吗
比亚迪基本面怎么样
帮我研究下比亚迪

User's InputTriggered
Analyze 002594
Check BYD
Is 002594 worth buying?
How are BYD's fundamentals?
Help me research BYD

阶段时序(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*.html
text
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*.html

Phase 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 instruction

Phase 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 条 ID

text
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.md

Phase 1 · 数据采集(3-5 min)

Phase 1 · Data Collection (3-5 min)

所需数据: 近 3 年日 K 线、近 3 年财务(营收/净利/毛利/ROE)、主营业务构成、十大股东、近期新闻。
实现方式(任选):
方式命令
akshare 参考脚本
python scripts/fetch_data.py <代码> [--date YYYY-MM-DD]
财经类 MCPagent 直接调用
web_fetchagent 自行抓取雪球/东财公开页
手工上传用户提供 CSV/JSON
输出:
output/<股票名>_<代码>/<YYYY-MM-DD>/data.json
,schema 见 references/data-schema.md

Required 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):
MethodCommand
akshare reference script
python scripts/fetch_data.py <code> [--date YYYY-MM-DD]
Financial MCPDirect call by agent
web_fetchAgent crawls public pages from Xueqiu/Eastmoney on its own
Manual uploadUser provides CSV/JSON
Output:
output/<Stock Name>_<Code>/<YYYY-MM-DD>/data.json
, schema see references/data-schema.md.

Phase 2 · AI 深度分析(30-45 min · 三段检点制)

Phase 2 · AI In-depth Analysis (30-45 min · Three-section Check System)

包含 Step落盘
§1Step 0-2(任务/宏观/产业链)
report.md.part1
§2Step 3-5(公司质地/弹性/风险)
report.md.part2
§3Step 6-8(估值/对标/跟踪结论)
report.md.part3
合并
cat part* > report.md
节奏:
  • 同会话默认三段连续执行,不询问"是否继续"
  • 每段完成输出
    ✅ §X 完成(XX 行 / Step A-B)
  • 跨会话续跑:读
    output/<股票名>_<代码>/latest/
    下已存在的 part 文件决定起点
最低行数(不可少): Step 0:10 / 1:50 / 2:100 / 3:50 / 4:80 / 5:40 / 6:100 / 7:60 / 8:50(合计 540 行)。
方法论详见: references/analysis-framework.md

SectionIncluded StepsOutput
§1Step 0-2 (Task/Macro/Industrial Chain)
report.md.part1
§2Step 3-5 (Company Quality/Elasticity/Risk)
report.md.part2
§3Step 6-8 (Valuation/Benchmarking/Tracking Conclusion)
report.md.part3
Merge
cat part* > report.md
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 校验
0DOCTYPE + head + style(完整复制
templates/template_base.css
grep -c '<style>'=1
、accent token 存在
1body + nav + compliance + hero + conclusion-top + profilenav 13 锚点、4 hero-meta、compliance-banner 存在
2financial-grid + K线 + Step 0-3mission/macro/chain/quality 四 id 存在
3Step 4-6(弹性/风险/估值)elasticity/risk/valuation 三 id 存在
4Step 7-8 + 总结框 + footer// CONCLUSION 存在、footer 内
<strong>
= 0
5script(完整复制
templates/template_base.js
,注入 rawData/pieData)
__RAW_DATA
/
__PIE_DATA
= 0
合并
cat _h_part*.html > report.html
然后
bash scripts/verify_html.sh report.html
全 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,
    python -c
    for string splicing
6-batch Plan (Each batch ≤300 lines, run grep verification after writing):
BatchContentMain Grep Verification
0DOCTYPE + head + style (fully copy
templates/template_base.css
)
grep -c '<style>'=1
, accent token exists
1body + nav + compliance + hero + conclusion-top + profile13 anchors in nav, 4 hero-meta, compliance-banner exists
2financial-grid + K-line + Step 0-3Four ids mission/macro/chain/quality exist
3Step 4-6 (Elasticity/Risk/Valuation)Three ids elasticity/risk/valuation exist
4Step 7-8 + Summary Box + footer// CONCLUSION exists,
<strong>
in footer = 0
5script (fully copy
templates/template_base.js
, inject rawData/pieData)
__RAW_DATA
/
__PIE_DATA
= 0
Merge
cat _h_part*.html > report.html
then
bash scripts/verify_html.sh report.html
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

#禁止原因
1Python 生成 HTML markup转义混乱、难维护
2Bash heredoc 写多行 HTMLEOF 容易匹配失败
3跳过/简化任何 Step完整框架缺一不可
4OHLC 用 [open, high, low, close]与 ECharts 默认不符
5MathJax 使用双反斜杠
\\(...\\)
分隔符匹配失败
6accent 色混用金色 / 多色 score-fill 渐变违反 Linear Terminal+ 设计
7footer 使用
<strong>
/ 金色
违反纯 Mono footer 规范
8Phase 1 输出旧路径
output/data_<code>.json
应使用
<股票名>_<代码>/<日期>/
9一次性写完整 HTML必须分 6 批,每批 ≤300 行
11报告中数字不带 [F]/[C]/[I]/[T]/[GAP] 标签verify_facts FAIL,无法进 Phase 3
12跳过 fact-checker 或 bear-case sub-agent多 agent 防御纵深失效
13hero meta 显示 A/B/C 字母评级v3.1 改用
Rubric: <total>/100
14Step 8 再次出现 5 维综合评分已取消,仅保留定性结论
#ProhibitedReason
1Generate HTML markup with PythonEscape chaos, difficult to maintain
2Write multi-line HTML with Bash heredocEOF matching failure is easy to occur
3Skip/simplify any StepThe complete framework is indispensable
4Use [open, high, low, close] for OHLCDoes not match ECharts default
5Use double backslash
\\(...\\)
for MathJax
Delimiter matching failure
6Mix gold color for accent / multi-color score-fill gradientViolates Linear Terminal+ design
7Use
<strong>
/ gold color in footer
Violates pure Mono footer specification
8Output to old path
output/data_<code>.json
in Phase 1
Should use
<Stock Name>_<Code>/<Date>/
9Write complete HTML at onceMust split into 6 batches, each batch ≤300 lines
11Numbers in the report without [F]/[C]/[I]/[T]/[GAP] tagsverify_facts FAIL, cannot enter Phase 3
12Skip fact-checker or bear-case sub-agentMulti-agent defense depth fails
13Display A/B/C letter ratings in hero metav3.1 uses
Rubric: <total>/100
instead
14Reappear 5-dimensional comprehensive score in Step 8Cancelled, only qualitative conclusions are retained