功夫财经
by @jickchen34
Mainland China A-share stock and sector analysis tool (中国A股个股与板块分析). Current repo build focuses on stable deterministic products for stock snapshots, basic f...
clawhub install kungfu-finance📖 About This Skill
name: kungfu_finance description: Mainland China A-share stock and sector analysis tool (中国A股个股与板块分析). Current repo build focuses on stable deterministic products for stock snapshots, basic finance indicators, chip/price levels, sector detail lookup, plus bucket, phase-2 strategy, researcher, bayesian monitor, and preview stock/sector deep research flows. user-invocable: true disable-model-invocation: false metadata: {"openclaw":{"skillKey":"kungfu_finance","always":false,"requires":{"bins":["node"],"optionalBins":["inkscape"],"env":["KUNGFU_OPENKEY"]},"primaryEnv":"KUNGFU_OPENKEY","install":{"node":{"packageManager":"none","bundledScripts":true}},"runtime":"bundled-node-scripts","networkSurface":["tianshan-api.kungfu-trader.com","push2.eastmoney.com","push2his.eastmoney.com","qt.gtimg.cn","ifzq.gtimg.cn","wry-manatee-359.convex.site","clawhub.ai"],"fileWrites":["~/.openclaw/workspace/finance-master/charts/","~/.openclaw/.env"],"subprocesses":["inkscape (execFileSync, fixed args, SVG→PNG conversion only)"],"homepage":"https://github.com/kungfu-trader/kungfu-skills","publisher":{"name":"kungfu-trader","contact":"https://github.com/kungfu-trader"}}}
功夫财经 | KungfuFinance
Publisher
Runtime Model
.mjs scripts (bundled executable scripts with zero npm dependencies — no npm install needed)https://tianshan-api.kungfu-trader.com — deterministic products (snapshot, finance, bucket, strategy, researcher, bayesian monitor)
- https://push2.eastmoney.com / https://push2his.eastmoney.com — stock/sector deep research market data (free public API, no key required)
- https://ifzq.gtimg.cn / https://qt.gtimg.cn — fallback market data via Tencent Finance (free public API, no key required)
- https://wry-manatee-359.convex.site / https://clawhub.ai — check-update version query (ClawHub registry, public, no key required)
KUNGFU_OPENKEY environment variable, sent as Authorization: Bearer (Tianshan API only; EastMoney/Tencent/ClawHub APIs require no authentication)KUNGFU_PLATFORM (optional, defaults to openclaw)~/.openclaw/workspace/finance-master/charts/inkscape for SVG→PNG conversion; no other subprocessesAll environment variables are read from the host process; none are accepted from user prompts.
Optional Research Search Surface
When separately configured, stock/sector deep research may call an additional search endpoint. This surface is independent from the Tianshan API and uses its own credential boundary:
| Env Var | Purpose |
|---------|---------|
| KUNGFU_ENABLE_RESEARCH_SEARCH | Set to 1 to enable |
| KUNGFU_RESEARCH_SEARCH_PROVIDER | Provider name (currently web_search) |
| KUNGFU_RESEARCH_SEARCH_ENDPOINT | Search service URL |
| KUNGFU_RESEARCH_SEARCH_API_KEY | Search service credential |
| KUNGFU_RESEARCH_SEARCH_TIMEOUT_MS | Search request timeout (default: 15000) |
When search is enabled, requests are POSTed as JSON to KUNGFU_RESEARCH_SEARCH_ENDPOINT with KUNGFU_RESEARCH_SEARCH_API_KEY as Bearer token.
KUNGFU_OPENKEY is never reused for search requests.
If search is enabled but misconfigured, the result returns misconfigured status instead of silently failing.
Non-Secret Tuning Variables
| Env Var | Purpose |
|---------|---------|
| KUNGFU_ENABLE_EXPERIMENTAL_PRODUCTS | Set to 1 to enable unreleased products |
| KUNGFU_RESEARCH_DEFAULT_TARGET_DATE | Override default research date (YYYYMMDD format, for testing) |
Rollout Status
stock-research / sector-research use public EastMoney/Tencent APIs for market data — no backend dependency for these flowsKUNGFU_ENABLE_EXPERIMENTAL_PRODUCTS=1stock-research / sector-research produce markdown_svg_preview with explicit degradation reportingData Handling & Network Surface
KUNGFU_OPENKEY is sent only to tianshan-api.kungfu-trader.com — never to EastMoney, Tencent, or any other hostScope
Public Intents
Route the user into the currently enabled intent families below. Do not expose internal product names unless needed for implementation.
1. Stock Snapshot
Use when the user wants one A-share stock's current state, recent走势, K-line window, holders,筹码分布,支撑压力位, or other narrow deterministic data.
Default behavior:
instrument_nameexchange_id must be SSE or SZE2. Finance Analysis
Use when the user wants one A-share stock's基础财务指标或基础财务上下文。
Default behavior:
finance_basic_indicators for narrow factual questionsfinance_context for lightweight finance context3. Sector Analysis
Use when the user asks about one A-share industry or sector.
Default behavior:
sector_namesector-research resolves theme words by matching against the full EastMoney concept sector listsector-research accepts sector_name or sector_id directly; when the local resolver cannot disambiguate, it returns needs_input for the user to provide a BK code3C. Sector Deep Research
Use when the user wants one A-share sector's deep research, hype-cycle view, thematic thesis, dragon-head observation, committee-style bull/bear review, or a longer structured report.
Default behavior:
sector_name or sector_id; target_date is optional and defaults to the current market date in Asia/Shanghaimarkdown_svg_preview and returns explicit degradations for remaining search / adapter gapssector-analysis skillreport_svg and quality_gateneeds_input for the user to provide a BK codeweb_search runtime is enabled and configured, macro / policy / catalyst / industry-trend / competition / money-flow evidence may be attached as external search evidence (7 search buckets)3B. Stock Deep Research
Use when the user wants one A-share stock's deep research, investment thesis, catalyst map, committee-style bull/bear review, or a longer structured report.
Default behavior:
target_date and defaults it to the current market date in Asia/Shanghaimarkdown_svg_preview and returns explicit degradations for remaining search / adapter gapsstock-analysis-v2 skillreport_svg and quality_gateweb_search runtime is enabled and configured, these evidence buckets are populated; otherwise the report surfaces explicit degradations4. Bucket Flow
Use when the user wants to:
Default behavior:
needs_input response so the host can continue the dialogueneeds_input for corrected instruments instead of calling the write API5. Strategy Flow
Use when the user wants to:
Default behavior:
lago_planmarket-select supports InstrumentSelect, TemplateInstrumentSelect, BuySell, and TemplateBuySellmarket-select is used on BuySell or TemplateBuySell, whole-market results only return buy pointsmarket-select accepts either target_date, or strategy_start_date + strategy_end_datemarket-select mixes the two date modes, or only provides half of a range, return a structured needs_input responseneeds_input response so the host can continue the dialogueblocked response instead of pretending the scan succeeded6. Researcher Flow
Use when the user wants to:
Default behavior:
Journeyman membership or abovestock-reports is a composed flow built from researcher score plus researcher report listauthor-reports prefers researcher-author-idresearcher-name, resolve it conservatively; if not unique, return needs_input7. Bayesian Monitor Flow
Use when the user wants to:
Default behavior:
list returns task summaries only and must not expose full original_reportreports supports bayesian-task-id and conservative bayesian-topic resolutionneeds_input response so the host can continue the dialogueblocked response instead of pretending the task exists8. Indicator Chart
Use when the user wants to see one A-share stock's technical indicator chart. The script automatically renders SVG, converts to PNG via inkscape, and returns file paths (no SVG text in stdout). Supported chart types:
kline — K线图 (candlestick chart with optional chip distribution overlay, price level lines, and custom annotations)lushan_shadow — 庐山照影图 (CM mountain + FC shadow dual-bar chart)lushan_4season — 庐山四季图 (GG/HY/DP lines + RS bars + bottom resonance/strong markers)shuanglun — 双轮驱动图 (K-wheel + R-wheel stacked bars with trend coloring)liumai — 六脉神剑图 (6-signal heatmap matrix with buy/sell signal row)smart_money — 聪明钱图 (smart money vs follow money dual-line chart)finance_score — 个股综合得分 (radar chart with 行业统治力/财务健康度/发展前景 three-dimensional scoring)K-line chart additional options:
--with-chip-peak true — overlay chip distribution (筹码峰) on the right side--with-price-levels true — draw support/resistance/concentration price level lines (阻力位/支撑位)--annotations '[{"date":"20260328","price":15.5,"type":"buy","label":"买入点","color":"#ef4444"}]' — mark custom points on the chart9. Finance Score
Use when the user wants one A-share stock's comprehensive scoring across three dimensions:
Available as both a data product (finance_score) and a rendered SVG chart (indicator-chart --chart-type finance_score).
10. Subscription Flow (自选)
Use when the user wants to:
Default behavior:
list groups subscriptions by instrument and shows instrument name, code, auto-update statusanomaly returns unusual movements sorted by date descending, plus signals count and analysissummary returns aggregate UM_ct (异动数量) and UM_SG_ct (异动信号) countsneeds_input responseNot Yet Enabled In Experience Build
The following capabilities are still under route-contract cleanup and should not be used in the current public rollout:
sector-researchIntent Routing
Pick one default route from the list below.
Stock Snapshot
Finance Analysis
Sector Analysis
Stock Deep Research
Bucket Flow
Strategy Flow
Indicator Chart
Finance Score
Researcher Flow
Bayesian Monitor Flow
Health Check
Config OpenKey
Subscription Flow (action: list)
Subscription Flow (action: add)
Subscription Flow (action: delete)
Subscription Flow (action: anomaly)
Subscription Flow (action: summary)
Check UpdateIf the user asks for arbitrary whole-market screening or market-news bundles, do not use this skill in the current release build.
Input Rules
Stock Identification
For single-stock requests, use exactly one:
--instrument-name--instrument-id and --exchange-idNever mix both modes.
If the stock code is unknown, prefer --instrument-name.
When using code mode, --exchange-id must be SSE or SZE.
Stock Date Mode
For stock products and flows, use:
--target-date--visual-days-lenStrategy Date Mode
For strategy actions, use:
signal and count: --target-date with optional --visual-days-lenbatch-scan: --target-datemarket-select: either --target-date, or --strategy-start-date plus --strategy-end-dateNever mix single-day mode and range mode in the same market-select request.
Sector Mode
--sector-name
- --sector-idPrefer --sector-name.
Only reuse --sector-id after the backend has already returned it.
The current release build does not expose fuzzy sector resolution as a standalone public data product, but sector-research can resolve theme words via the EastMoney concept sector list.
Hidden Parameters
Do not generate or expose these from the model side:
start_dateend_dateis_realtimelimitdaysperiodsInternal Building Blocks
The internal deterministic product contract lives here:
Use that file only when you need exact internal product names, allowed parameter shapes, or output keys. Do not dump that whole catalog into the user-facing reasoning path by default.
Bucket flow contract lives here:
Strategy flow contract lives here:
Researcher flow contract lives here:
Bayesian monitor flow contract lives here:
Research Methodologies
Documented research methods live here:
Use them as methodology references and migration inputs for deep research.
The repo build currently has preview CLI/runtime entrypoints via stock-research and sector-research.
The sector preview accepts sector_name first and uses best-effort EastMoney concept list resolution before falling back to needs_input.
Read runtime_parity.md before treating any research wrapper or asset as implementation-ready truth.
Prompt assets are flow-specific. Do not mix finance-analysis formatting requirements into movement-analysis outputs, or vice versa.
Standard Commands
Stock Snapshot
node scripts/flows/run_data_request.mjs --product price_snapshot --instrument-name 贵州茅台 --target-date 20260301
Sector Detail
node scripts/flows/run_data_request.mjs --product sector_performance --sector-name 白酒 --target-date 20260301
Bucket List
node scripts/router/run_router.mjs bucket --bucket-action list
Bucket Add
node scripts/router/run_router.mjs bucket --bucket-action add --bucket-name 观察池 --bucket-instrument 贵州茅台 --bucket-instrument 平安银行
Strategy List
node scripts/router/run_router.mjs strategy --strategy-action list
Strategy Signal
node scripts/router/run_router.mjs strategy --strategy-action signal --strategy-name 三分归元 --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 22
Strategy Batch Scan
node scripts/router/run_router.mjs strategy --strategy-action batch-scan --strategy-id 900 --strategy-instrument 600519.SSE --strategy-instrument 000001.SZE --target-date 20260331
Strategy Market Select
node scripts/router/run_router.mjs strategy --strategy-action market-select --strategy-name 庐山升龙 --target-date 20260331
Stock Deep Research
node scripts/router/run_router.mjs stock-research --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 120
Sector Deep Research
node scripts/router/run_router.mjs sector-research --sector-name 机器人 --target-date 20260331 --visual-days-len 780
Indicator Chart — K-line
node scripts/router/run_router.mjs indicator-chart --chart-type kline --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 120
Indicator Chart — K-line with Chip Peak and Price Levels
node scripts/router/run_router.mjs indicator-chart --chart-type kline --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 120 --with-chip-peak true --with-price-levels true
Indicator Chart — K-line with Annotations
node scripts/router/run_router.mjs indicator-chart --chart-type kline --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 60 --annotations '[{"date":"20260310","type":"buy","label":"买入"},{"date":"20260325","type":"sell","label":"卖出"}]'
Indicator Chart — 庐山照影图
node scripts/router/run_router.mjs indicator-chart --chart-type lushan_shadow --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 120
Indicator Chart — 庐山四季图
node scripts/router/run_router.mjs indicator-chart --chart-type lushan_4season --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 120
Indicator Chart — 双轮驱动图
node scripts/router/run_router.mjs indicator-chart --chart-type shuanglun --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 120
Indicator Chart — 六脉神剑图
node scripts/router/run_router.mjs indicator-chart --chart-type liumai --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 120
Indicator Chart — 聪明钱图
node scripts/router/run_router.mjs indicator-chart --chart-type smart_money --instrument-name 贵州茅台 --target-date 20260331 --visual-days-len 120
Finance Score (data only)
node scripts/flows/run_data_request.mjs --product finance_score --instrument-name 贵州茅台 --target-date 20260331
Finance Score (SVG radar chart)
node scripts/router/run_router.mjs indicator-chart --chart-type finance_score --instrument-name 贵州茅台 --target-date 20260331
Researcher Rank
node scripts/router/run_router.mjs researcher --researcher-action rank --researcher-rank-by 1m --researcher-limit 10
Researcher Stock Reports
node scripts/router/run_router.mjs researcher --researcher-action stock-reports --instrument-name 贵州茅台
Researcher Author Reports
node scripts/router/run_router.mjs researcher --researcher-action author-reports --researcher-author-id author-1
Health Check
node scripts/router/run_router.mjs health
Returns { healthy: true/false, checks: { openkey, api_test } }. Verifies KUNGFU_OPENKEY is set and authenticates against the backend.
Config OpenKey
node scripts/router/run_router.mjs config-openkey --openkey kf_ok_live_xxxxx
Validates the key against the backend, then writes it to ~/.openclaw/.env. Returns user_id and plan_code on success.
Subscription List (自选列表)
node scripts/router/run_router.mjs subscription --subscription-action list
Subscription Add (加自选)
node scripts/router/run_router.mjs subscription --subscription-action add --subscription-instrument 贵州茅台 --subscription-instrument 平安银行
Subscription Delete (删自选)
node scripts/router/run_router.mjs subscription --subscription-action delete --subscription-instrument 贵州茅台
Subscription Anomaly Report (异动报告)
node scripts/router/run_router.mjs subscription --subscription-action anomaly --instrument-name 贵州茅台 --target-date 20260401
Subscription Summary (异动汇总)
node scripts/router/run_router.mjs subscription --subscription-action summary
Check Update
node scripts/router/run_router.mjs check-update
Checks ClawHub registry for a newer version. Returns { update_available, local_version, remote_version, update_command }. When an update is available, the agent should run the returned update_command (clawhub update kungfu-finance) in a shell to apply it.