同行全追踪 (Peer Financial Tracker)
Purpose
Generate a comprehensive, interactive HTML dashboard for comparing a target company against its industry peers. The dashboard covers: real-time market data, multi-period financial comparisons, full announcement tracking with PDF links, news sentiment monitoring, price deviation alerts, and customizable metric charts.
When to Use
Trigger this skill when the user asks to:
- Compare a company's financials with industry peers
- Generate a financial dashboard for a specific company
- Track peer companies in an industry
- Monitor announcements and news for a company and its competitors
- Set up a "同行全追踪" (peer tracking) view
Workflow
Step 1: Gather user requirements
Collect:
- Target company name (required) — e.g. "宁德时代", "晶品特装", "比亚迪"
- Peer companies (optional) — if user doesn't specify, infer from same industry/sector
- Industry/board (optional) — e.g. "动力电池", "无人装备"
If the user doesn't provide peer companies, identify them by:
- Query the target company's board/sector membership
- Select 4-6 closest peers by market cap or industry relevance
Step 2: Fetch data via westock-data CLI
Use the westock-data CLI (documented in references/westock-cli.md) to fetch:
- Search: Get the stock code for the target company
- Quotes: Real-time prices for target + all peers (single call, comma-separated codes)
- K-lines: 30-day daily K-line data for sparkline charts (target + peers)
- Financials: Income statement data (
--type lrb --num 4 --raw) for target + each peer - Notices: Latest 20 announcements for target + each peer
- URL format: Use
http://www.cninfo.com.cn/new/disclosure/stock?stockCode=XXXXXXfor the stock's disclosure page, or the PDF URL from the notice endpoint if available. Never use#placeholders — every announcement must have a valid, clickable link.
- URL format: Use
- News: Latest 10 news articles for target + each peer
Parse the JSON outputs and normalize into a unified data structure.
Step 3: Build the data model
Construct a JavaScript data structure matching the template format:
const COMPANIES = [
{
code: 'sz300750', name: '宁德时代', short: '宁', color: '#d61f26', own: true,
price: 245.80, chg: -2.35, mcap: '10780亿', pe: 22.5, pb: 4.2, stars: 4,
spark: { base: 252.0, drift: -0.08, vol: 1.2 },
fin: {
q1: { rev: 890.5, revYoy: 8.2, profit: 105.3, profitYoy: 12.5, gm: 22.3, nm: 11.8, roe: 4.5 },
fy: { rev: 3620.0, revYoy: 10.1, profit: 441.2, profitYoy: 9.8, gm: 21.8, nm: 12.2, roe: 18.2 },
q3: { rev: 2590.0, revYoy: 11.5, profit: 310.8, profitYoy: 8.5, gm: 22.0, nm: 12.0, roe: 13.0 }
},
// 异动监控数据
alert: {
dev3: 5.2, dev5: -1.8, dev10: -3.5, dev30: -8.2,
rules: [
{ name: '单日涨跌幅超±7%', triggered: false, value: '-2.35%', threshold: '±7%' },
{ name: '连续3日同向异动', triggered: false, value: '否', threshold: '3日' },
{ name: '成交量超20日均量200%', triggered: true, value: '215%', threshold: '200%' },
{ name: '10日累计偏离值超±20%', triggered: false, value: '-3.5%', threshold: '±20%' },
{ name: '价格触及30日新高/新低', triggered: false, value: '—', threshold: '30日' }
]
}
},
// ... peers
];
For financial data periods, use:
q1: Latest quarterly report (or H1 if mid-year)fy: Latest annual reportq3: Previous Q3 report
Step 4: Generate the HTML dashboard
Use the template in assets/dashboard-template.html as the base. The template includes:
Layout sections (top to bottom):
- Top bar: Dashboard title + industry tag + company search/添加
- Peer strip: Company chips with remove buttons
- Row 1 (2-column):
- Left: Own company compact card (price, OHLCV, deviation indicators)
- Right: News sentiment with emotion donut chart
- Row 2 (full-width): 异动监控 (Anomaly Monitoring)
- Left panel: 累计偏离值监控 (Cumulative Deviation vs Index)
- Right panel: 预警条件监控 (Alert Rules with status indicators)
- Row 3 (full-width): Financial comparison table (period switchable)
- Row 4 (full-width): Single-metric bar chart (7 metrics switchable via chips)
- Row 5 (2-column): Full announcement tracking
Key design rules:
- A-share color convention: red for up (涨), green for down (跌)
- Own company always first row, highlighted with orange background
- All charts use pure SVG (no external CDN dependencies)
- Table column highlighting syncs with selected chart metric
- Period switching (Q1/FY/Q3) updates table + chart in sync
- Announcements support PDF link jumps + keyword highlighting
- Peer removal updates all panels (table, chart, peer count)
Step 5: Present and iterate
Save the generated HTML to the workspace, present it via present_files, and ask for feedback. Common adjustments:
- Add/remove specific metrics
- Adjust layout or color scheme
- Add more peer companies
- Change default period
Important Notes
- The westock-data CLI is at:
C:/Program Files/WorkBuddy/resources/app.asar.unpacked/resources/builtin-skills/westock-data/scripts/index.js - Run with the managed Node.js:
C:\Users\14578\.workbuddy\binaries\node\versions\22.22.2\node.exe - If a peer company's financial data cannot be fetched (API limitations), use reasonable estimated values and mark them as "估算值" in footnotes
- All SVG charts are self-contained — no external libraries needed
- The template supports up to 10 peer companies; beyond that, suggest limiting
Scan to join WeChat group