@openfinclaw/findoo-datahub-plugin 2026.3.2 → 2026.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/DESIGN.md +492 -151
  2. package/_vendor/claude-skills-finance/SKILL.md +192 -0
  3. package/_vendor/claude-skills-finance/assets/dcf_analysis_template.md +184 -0
  4. package/_vendor/claude-skills-finance/assets/expected_output.json +161 -0
  5. package/_vendor/claude-skills-finance/assets/forecast_report_template.md +177 -0
  6. package/_vendor/claude-skills-finance/assets/sample_financial_data.json +219 -0
  7. package/_vendor/claude-skills-finance/assets/variance_report_template.md +122 -0
  8. package/_vendor/claude-skills-finance/references/financial-ratios-guide.md +396 -0
  9. package/_vendor/claude-skills-finance/references/forecasting-best-practices.md +294 -0
  10. package/_vendor/claude-skills-finance/references/valuation-methodology.md +255 -0
  11. package/_vendor/claude-skills-finance/scripts/budget_variance_analyzer.py +406 -0
  12. package/_vendor/claude-skills-finance/scripts/dcf_valuation.py +449 -0
  13. package/_vendor/claude-skills-finance/scripts/forecast_builder.py +494 -0
  14. package/_vendor/claude-skills-finance/scripts/ratio_calculator.py +432 -0
  15. package/index.ts +332 -14
  16. package/openclaw.plugin.json +2 -2
  17. package/package.json +1 -1
  18. package/references/cn-market-specifics.md +165 -0
  19. package/references/crypto-analysis.md +635 -0
  20. package/references/financial-ratios-cn.md +452 -0
  21. package/references/hk-market-specifics.md +166 -0
  22. package/references/macro-cycle-cn.md +409 -0
  23. package/references/valuation-cn.md +427 -0
  24. package/skills/README.md +294 -0
  25. package/skills/a-concept-cycle/skill.md +200 -0
  26. package/skills/a-convertible-arb/skill.md +294 -0
  27. package/skills/a-dividend-king/skill.md +187 -0
  28. package/skills/a-earnings-season/skill.md +221 -0
  29. package/skills/a-index-timer/skill.md +192 -0
  30. package/skills/a-ipo-new/skill.md +297 -0
  31. package/skills/a-northbound-decoder/skill.md +185 -0
  32. package/skills/a-quant-board/skill.md +286 -0
  33. package/skills/a-share/skill.md +347 -0
  34. package/skills/a-share-radar/skill.md +185 -0
  35. package/skills/cross-asset/skill.md +202 -0
  36. package/skills/crypto/skill.md +269 -0
  37. package/skills/crypto-altseason/skill.md +208 -0
  38. package/skills/crypto-btc-cycle/skill.md +231 -0
  39. package/skills/crypto-defi-yield/skill.md +181 -0
  40. package/skills/crypto-funding-arb/skill.md +158 -0
  41. package/skills/crypto-stablecoin-flow/skill.md +149 -0
  42. package/skills/data-query/skill.md +124 -30
  43. package/skills/derivatives/skill.md +188 -35
  44. package/skills/etf-fund/skill.md +216 -0
  45. package/skills/factor-screen/skill.md +186 -0
  46. package/skills/hk-china-internet/skill.md +190 -0
  47. package/skills/hk-dividend-harvest/skill.md +192 -0
  48. package/skills/hk-hsi-pulse/skill.md +154 -0
  49. package/skills/hk-southbound-alpha/skill.md +163 -0
  50. package/skills/hk-stock/skill.md +295 -0
  51. package/skills/macro/skill.md +244 -53
  52. package/skills/risk-monitor/skill.md +171 -0
  53. package/skills/us-dividend/skill.md +162 -0
  54. package/skills/us-earnings/skill.md +149 -0
  55. package/skills/us-equity/skill.md +235 -0
  56. package/skills/us-etf/skill.md +261 -0
  57. package/skills/us-sector-rotation/skill.md +223 -0
  58. package/src/config.ts +4 -5
  59. package/src/datahub-client.test.ts +4 -7
  60. package/src/datahub-client.ts +6 -1
  61. package/src/register-tools.ts +720 -0
  62. package/src/tool-helpers.ts +89 -0
  63. package/test/e2e/l3-gateway-bootstrap.live.test.ts +339 -0
  64. package/test/e2e/l4-skill-tool-chain.live.test.ts +465 -0
  65. package/skills/crypto-defi/skill.md +0 -69
  66. package/skills/equity/skill.md +0 -64
  67. package/skills/market-radar/skill.md +0 -47
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: fin-crypto-funding-arb
3
+ description: "Crypto funding rate arbitrage — perpetual funding rates, delta-neutral yield, cross-exchange rate spread, annualized return calculator. Use when: user asks about funding rate, delta-neutral strategy, basis trading, perpetual vs spot arb, or CeFi yield. NOT for: DeFi yields (use fin-crypto-defi-yield), spot trading (use fin-crypto), macro rates (use fin-macro)."
4
+ metadata: { "openclaw": { "emoji": "🔄", "requires": { "extensions": ["findoo-datahub-plugin"] } } }
5
+ ---
6
+
7
+ # Crypto Funding Rate Arbitrage
8
+
9
+ 永续合约资金费率套利分析 — Delta 中性策略的收益计算、风险监控与跨交易所利差发现。通过 `fin_crypto` 访问 funding rate / ticker / orderbook 数据。
10
+
11
+ > **核心逻辑:** 永续合约每 8h 结算 funding rate。当 funding > 0 时,做多付费给做空方。Delta 中性策略 = 现货买入 + 永续做空,锁定 funding 收益,无方向性风险。
12
+
13
+ ## When to Use
14
+
15
+ - "BTC 资金费率多少" / "BTC funding rate"
16
+ - "哪些币 funding rate 最高" / "top funding rate coins"
17
+ - "funding 套利能赚多少" / "funding arb yield"
18
+ - "现在做 delta 中性策略合适吗" / "delta neutral strategy"
19
+ - "Binance 和 OKX funding 差多少" / "cross-exchange funding spread"
20
+ - "funding rate 历史高不高" / "is funding rate extreme"
21
+ - "资金费率套利风险" / "funding arb risks"
22
+
23
+ ## When NOT to Use
24
+
25
+ - DeFi 收益 / yield farming / Aave / Compound → use `/fin-crypto-defi-yield`
26
+ - 现货价格 / 代币信息 / 全景分析 → use `/fin-crypto`
27
+ - 宏观利率 / 美债收益率 → use `/fin-macro`
28
+ - 合约爆仓计算 / 杠杆风险 → use `/fin-crypto` (Contract Risk Calculator)
29
+ - 期货期权 / 传统衍生品 → use `/fin-derivatives`
30
+
31
+ ## Tools & Parameters
32
+
33
+ ### fin_crypto — Funding & Market Data
34
+
35
+ | Parameter | Type | Required | Format | Default | Example |
36
+ | --------- | ------ | -------- | ------------------- | ------- | ------------------- |
37
+ | endpoint | string | Yes | see endpoints below | — | market/funding_rate |
38
+ | symbol | string | Depends | pair format | — | BTC/USDT:USDT |
39
+ | limit | number | No | 1-250 | 100 | 20 |
40
+
41
+ #### Endpoints
42
+
43
+ | endpoint | Description | Example |
44
+ | --------------------- | --------------------------- | -------------------------------------------------------------------- |
45
+ | `market/funding_rate` | Perpetual funding rate + OI | `fin_crypto(endpoint="market/funding_rate", symbol="BTC/USDT:USDT")` |
46
+ | `market/ticker` | Spot price snapshot | `fin_crypto(endpoint="market/ticker", symbol="BTC/USDT")` |
47
+ | `market/tickers` | All tickers (scan) | `fin_crypto(endpoint="market/tickers")` |
48
+ | `market/orderbook` | Order book depth | `fin_crypto(endpoint="market/orderbook", symbol="BTC/USDT")` |
49
+ | `market/trades` | Recent trades | `fin_crypto(endpoint="market/trades", symbol="BTC/USDT")` |
50
+
51
+ ### Auxiliary Tools
52
+
53
+ | Tool | Purpose | Example |
54
+ | ----------------- | ---------------------------- | ----------------------------------------------------- |
55
+ | `fin_data_ohlcv` | K-line for basis calculation | `fin_data_ohlcv(symbol="BTC/USDT", timeframe="1h")` |
56
+ | `fin_ta` | Trend indicators | `fin_ta(symbol="BTC/USDT", indicator="rsi")` |
57
+ | `fin_data_regime` | Market regime | `fin_data_regime(symbol="BTC/USDT", market="crypto")` |
58
+
59
+ ## Funding Rate Arbitrage Analysis Pattern
60
+
61
+ 1. **Funding Rate Scan** `fin_crypto(market/funding_rate, symbol="BTC/USDT:USDT")` — 获取目标币种当前 funding rate + OI
62
+ - ⚠️ 如果 funding > +0.10%/8h → 多头极度拥挤,套利收益高但清算瀑布风险也高
63
+ - ⚠️ 如果 funding < -0.05%/8h → 空头拥挤,反向套利(现货做空 + 永续做多)但执行难度大
64
+ - 💡 关注 funding 持续性:连续 3+ 期 >0.05% = 稳定套利窗口;单期跳升可能是噪音
65
+
66
+ 2. **Spot Price Baseline** `fin_crypto(market/ticker, symbol="BTC/USDT")` — 现货价格基准
67
+ - 💡 计算 basis = (永续价 - 现货价) / 现货价 × 100%。正 basis + 正 funding = 做空端有利
68
+
69
+ 3. **Annualized Return Calculation** — 核心输出
70
+
71
+ ```
72
+ 8h rate → Daily = rate × 3
73
+ Annual = rate × 3 × 365
74
+ Net annual = annual - (maker_fee × 2 × 365) - slippage_estimate
75
+ ```
76
+
77
+ - ⚠️ 如果年化 < 10% → 扣除手续费和滑点后可能不值得(DeFi 蓝筹 yield 通常 3-8%)
78
+ - 💡 对比 DeFi yield:切换 `/fin-crypto-defi-yield` 查 Aave/Compound 同期收益,做风险调整后对比
79
+
80
+ 4. **Liquidity Assessment** `fin_crypto(market/orderbook, symbol="BTC/USDT")` — 执行成本评估
81
+ - ⚠️ 如果 spread > 0.1% → 大仓位进出滑点显著,套利净收益打折
82
+ - ⚠️ 如果 orderbook depth < $500K within 0.1% → 流动性不足,不适合大额套利
83
+ - 💡 小币种 funding 高但流动性差 = 纸面收益陷阱
84
+
85
+ 5. **Risk Monitor** — 综合风险评估
86
+ - ⚠️ OI 突增 >20% + funding >0.15%/8h → "拥挤交易警报",清算级联风险极高
87
+ - ⚠️ Basis 快速收敛 → 平仓窗口,套利收益可能归零
88
+ - 💡 用 `fin_data_regime` 判断市场体制:Volatile/Crisis 时 funding 波动剧烈,套利窗口短且风险高
89
+
90
+ 6. **Market Regime Context** `fin_data_regime(symbol="BTC/USDT", market="crypto")` — 体制对策略的影响
91
+ - Bull + 高 funding = 最佳套利环境(趋势性行情 funding 持续性强)
92
+ - Sideways + 低 funding = 收益不足以覆盖成本
93
+ - Volatile/Crisis = funding 剧烈波动,短期窗口但风险极高
94
+
95
+ ## Yield Comparison Framework
96
+
97
+ | Source | Typical Yield | Risk Level | Liquidity |
98
+ | --------------------- | ------------------- | ------------------------ | ---------- |
99
+ | Funding Arb (BTC) | 15-40% annualized | Medium (basis risk) | High (CEX) |
100
+ | Funding Arb (Altcoin) | 30-100%+ annualized | High (liquidity + basis) | Low-Medium |
101
+ | Aave USDC (ETH) | 3-8% | Low (smart contract) | High |
102
+ | Compound USDC | 3-6% | Low | High |
103
+ | US Treasury | 4-5% | Risk-free | High |
104
+
105
+ ## Signal Quick-Reference
106
+
107
+ ### Funding Rate Signals
108
+
109
+ | Funding Rate (8h) | Annualized | Signal | Action |
110
+ | ----------------- | ---------- | ------------- | ------------------------------------------ |
111
+ | > +0.15% | > 55% | Extreme long | High yield but squeeze risk; size down |
112
+ | +0.05% ~ +0.15% | 18-55% | Sweet spot | Best risk-adjusted arb window |
113
+ | +0.01% ~ +0.05% | 4-18% | Marginal | Only worth it for large capital + low fees |
114
+ | -0.01% ~ +0.01% | < 4% | Neutral | Not actionable |
115
+ | < -0.05% | — | Short squeeze | Consider reverse arb (risky) |
116
+
117
+ ### Risk Alerts
118
+
119
+ | Condition | Risk | Mitigation |
120
+ | ------------------------------ | ----------------------- | -------------------- |
121
+ | OI surge >20% in 24h | Liquidation cascade | Reduce position size |
122
+ | Funding >0.15% for >3 periods | Mean reversion imminent | Take partial profit |
123
+ | Basis flips negative | Funding may flip | Close arb position |
124
+ | Exchange rate divergence >0.3% | Execution risk | Avoid cross-exchange |
125
+
126
+ ## Data Notes
127
+
128
+ - **Funding Rate**: Settlement cycle varies by exchange (Binance 8h, some exchanges 4h/1h); always note the period when calculating annualized yield
129
+ - **OI Data**: Available via `market/funding_rate` response; cross-validate with volume
130
+ - **Cross-Exchange**: DataHub may aggregate from primary exchange only; manual comparison needed for cross-exchange arb
131
+ - **Historical Funding**: Current endpoint returns latest snapshot; historical funding time series may be limited
132
+ - **Basis Calculation**: Use `fin_data_ohlcv` for perpetual vs spot price comparison; note that OHLCV symbol format differs (e.g., `BTC/USDT` for spot, `BTC/USDT:USDT` for perpetual)
133
+
134
+ ## Response Guidelines
135
+
136
+ ### Number Formatting
137
+
138
+ - Funding rate: 4 decimal places per period (+0.0800%/8h)
139
+ - Annualized yield: 1 decimal place (35.0% annualized)
140
+ - BTC price: to integer ($67,432)
141
+ - Altcoin price: 4 significant digits ($0.0034, $1.2345)
142
+ - OI / Volume: $B/$M notation ($4.2B OI)
143
+ - Basis: 2 decimal places (+0.12%)
144
+
145
+ ### Must Include
146
+
147
+ - Funding rate period (8h/4h/1h) — never show rate without period
148
+ - Net yield after fees (maker fee typically 0.02%, taker 0.05%)
149
+ - Risk tier classification (low/medium/high/extreme)
150
+ - Comparison benchmark (vs DeFi blue-chip yield or US Treasury)
151
+ - Data timestamp ("funding rate as of 2026-03-07 08:00 UTC")
152
+
153
+ ### Display Format
154
+
155
+ - Single coin funding analysis → structured narrative with yield calculator
156
+ - Multi-coin funding scan → table (columns: symbol / rate / annualized / OI / duration / risk)
157
+ - Risk assessment → bullet points with clear thresholds
158
+ - Always end with: position sizing suggestion based on risk tier
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: fin-crypto-stablecoin-flow
3
+ description: "Stablecoin capital flow analysis — USDT/USDC/DAI market cap trends, 4-week rolling inflow as leading indicator, chain distribution (ETH/Tron/BSC), stablecoin-to-total-market ratio. Use when: user asks about stablecoin supply, capital inflow/outflow, OTC demand, USDT vs USDC comparison, or whether money is entering crypto. NOT for: individual coin analysis (use fin-crypto), DeFi yield farming (use fin-crypto), macro rates (use fin-macro)."
4
+ metadata: { "openclaw": { "emoji": "💵", "requires": { "extensions": ["findoo-datahub-plugin"] } } }
5
+ ---
6
+
7
+ # Stablecoin Capital Flow Analysis
8
+
9
+ Stablecoins = crypto market's M2 money supply. Track stablecoin flows as a **2-4 week leading indicator** for BTC and altcoin price direction.
10
+
11
+ > **Core thesis:** Capital enters crypto in three steps: fiat -> stablecoin -> BTC/altcoin. Stablecoin supply changes signal capital intent before price moves.
12
+
13
+ ## When to Use
14
+
15
+ - "USDT 市值在增长吗" / "Is USDT market cap growing"
16
+ - "稳定币总量是多少" / "Total stablecoin supply"
17
+ - "场外资金在进场吗" / "Is money flowing into crypto"
18
+ - "USDT 和 USDC 有什么区别" / "USDT vs USDC comparison"
19
+ - "稳定币在哪条链上最多" / "Which chain has the most stablecoins"
20
+ - "现在是入场好时机吗" / "Is this a good time to enter crypto"
21
+
22
+ ## When NOT to Use
23
+
24
+ - Individual coin price/analysis (BTC/ETH/SOL) -> use `/fin-crypto`
25
+ - DeFi protocol TVL/yields -> use `/fin-crypto`
26
+ - CEX trading (orderbook/funding rate) -> use `/fin-crypto`
27
+ - Macro interest rates/treasury yields -> use `/fin-macro`
28
+ - A-share/US equity -> use `/fin-a-share` or `/fin-us-equity`
29
+
30
+ ## Tools & Parameters
31
+
32
+ ### fin_crypto
33
+
34
+ | Parameter | Type | Required | Format | Default | Example |
35
+ | --------- | ------ | -------- | ------------------- | ------- | ---------------- |
36
+ | endpoint | string | Yes | see endpoints below | — | defi/stablecoins |
37
+ | symbol | string | Depends | coin ID / pair | — | bitcoin |
38
+ | limit | number | No | 1-250 | 100 | 20 |
39
+
40
+ #### Key Endpoints
41
+
42
+ | endpoint | Description | Example |
43
+ | ------------------- | ------------------------------------------------ | ---------------------------------------------- |
44
+ | `defi/stablecoins` | All stablecoins: market cap + chain distribution | `fin_crypto(endpoint="defi/stablecoins")` |
45
+ | `coin/global_stats` | Total crypto market cap (for ratio calc) | `fin_crypto(endpoint="coin/global_stats")` |
46
+ | `coin/market` | Top coins by market cap (BTC price ref) | `fin_crypto(endpoint="coin/market", limit=10)` |
47
+ | `defi/chains` | Per-chain TVL (cross-validate fund flow) | `fin_crypto(endpoint="defi/chains")` |
48
+ | `defi/bridges` | Cross-chain bridge volumes (migration) | `fin_crypto(endpoint="defi/bridges")` |
49
+
50
+ ### Auxiliary Tools
51
+
52
+ | tool | use case |
53
+ | ----------------- | ------------------------------------- |
54
+ | `fin_data_ohlcv` | BTC/ETH price overlay for correlation |
55
+ | `fin_data_regime` | Current market regime context |
56
+ | `fin_ta` | BTC trend confirmation |
57
+
58
+ ## Stablecoin Flow Analysis Pattern
59
+
60
+ 1. **Stablecoin Supply Snapshot** `fin_crypto(endpoint="defi/stablecoins")` — Total supply + per-coin breakdown
61
+ - Key fields: total mcap, USDT mcap, USDC mcap, DAI mcap, chain distribution per coin
62
+ - ⚠️ If total stablecoin mcap < previous known value -> capital outflow signal, check severity
63
+ - 💡 USDT growth = primarily Asian retail/OTC inflow; USDC growth = institutional/DeFi allocation
64
+
65
+ 2. **Total Market Context** `fin_crypto(endpoint="coin/global_stats")` — Crypto total market cap + BTC dominance
66
+ - Calculate: stablecoin_ratio = total_stablecoin_mcap / total_crypto_mcap
67
+ - ⚠️ Ratio rising (e.g., 9% -> 12%) = capital retreating to sidelines (defensive)
68
+ - ⚠️ Ratio falling (e.g., 12% -> 9%) = capital deploying into risk assets (offensive)
69
+ - 💡 Cross-validate with BTC dominance: stablecoin ratio down + BTC dom down = broad risk-on (altseason fuel)
70
+
71
+ 3. **Chain Distribution Analysis** `fin_crypto(endpoint="defi/stablecoins")` — Per-chain stablecoin breakdown
72
+ - Ethereum = institutional DeFi + lending protocols
73
+ - Tron = Asian OTC + cross-border remittance + retail
74
+ - BSC = retail DeFi + gaming
75
+ - Arbitrum/Base = L2 DeFi migration
76
+ - ⚠️ If Tron USDT growing fastest -> Asian retail surge (historically bullish for BTC in 2-4 weeks)
77
+ - ⚠️ If Ethereum USDC growing -> institutional positioning (larger but slower capital)
78
+ - 💡 Bridge data (`defi/bridges`) cross-validates: net inflow to a chain confirms stablecoin migration direction
79
+
80
+ 4. **BTC Price Correlation** `fin_crypto(endpoint="coin/market", limit=5)` + `fin_data_ohlcv(symbol="BTC/USDT")`
81
+ - Compare stablecoin supply trend vs BTC 30-day price trend
82
+ - ⚠️ Stablecoin supply rising + BTC flat/declining = accumulation phase (bullish setup)
83
+ - ⚠️ Stablecoin supply declining + BTC rising = distribution/leverage-driven rally (fragile)
84
+ - 💡 Historical pattern: stablecoin 4-week increase > $2B precedes BTC 30-day average gain of +12%
85
+
86
+ 5. **USDT vs USDC Structural Analysis** — Derive from `defi/stablecoins` data
87
+ - USDT/USDC ratio trend: rising = retail dominance; falling = institutional shift
88
+ - ⚠️ USDT market share dropping below 60% = potential regulatory pressure signal
89
+ - 💡 After major regulatory events (e.g., SEC actions), watch for USDT->USDC rotation
90
+
91
+ 6. **Capital Flow Verdict** — Synthesize all signals
92
+ - Strong inflow: 4w total increase > $2B + ratio declining + Tron USDT growing
93
+ - Neutral: 4w change < $1B absolute, ratio stable
94
+ - Outflow warning: 4w decrease > $1B + ratio rising + BTC price declining
95
+
96
+ ## Leading Indicator Framework
97
+
98
+ ### 4-Week Rolling Change Thresholds
99
+
100
+ | 4-Week Change | Signal | Historical BTC 30d Avg | Action |
101
+ | ------------- | ---------------- | ---------------------- | ----------------------------- |
102
+ | > +$3B | Strong inflow | +15% | Bullish positioning warranted |
103
+ | +$1B to +$3B | Moderate inflow | +8% | Cautiously optimistic |
104
+ | -$1B to +$1B | Neutral | +2% | No directional signal |
105
+ | -$3B to -$1B | Moderate outflow | -5% | Reduce leverage, raise cash |
106
+ | < -$3B | Capital flight | -12% | Defensive mode, max caution |
107
+
108
+ ### Stablecoin/Market Cap Ratio Interpretation
109
+
110
+ | Ratio Range | State | Meaning |
111
+ | ----------- | ------------ | ------------------------------------ |
112
+ | > 15% | Max defense | Heavy sideline capital, fear extreme |
113
+ | 10-15% | Cautious | Significant dry powder available |
114
+ | 7-10% | Balanced | Capital actively deployed |
115
+ | < 7% | Full risk-on | Almost all capital in risk assets |
116
+
117
+ ## Data Notes
118
+
119
+ - **DefiLlama stablecoins**: No auth required, ~10min refresh cycle. Covers USDT/USDC/DAI/BUSD/TUSD and 20+ minor stablecoins
120
+ - **Chain distribution**: Per-coin per-chain breakdown available. Some smaller chains may have incomplete coverage
121
+ - **Missing data**: Mint/burn event stream (requires on-chain data — Tether Treasury/Circle), USDT OTC premium/discount (requires OTC desk quotes), historical time-series per chain (snapshot only, no built-in 4-week rolling — must compare against previous observation)
122
+ - **4-week rolling calculation**: Since `defi/stablecoins` returns a current snapshot, 4-week change requires comparing against a prior data point. If unavailable, state current absolute values and note the limitation
123
+ - **CoinGecko rate limit**: ~30 req/min for `coin/global_stats` and `coin/market`
124
+
125
+ ## Response Guidelines
126
+
127
+ ### Number Formats
128
+
129
+ - Stablecoin market cap: $168.2B (use $B for billions, $M for millions)
130
+ - Supply changes: +$1.8B / -$500M (always show +/- sign)
131
+ - Ratios: 9.8% (1 decimal place)
132
+ - BTC price: to nearest dollar ($67,432)
133
+ - Chain distribution: percentages with 1 decimal (Ethereum 45.2%, Tron 31.8%)
134
+
135
+ ### Must Include
136
+
137
+ - Data timestamp ("Data as of YYYY-MM-DD")
138
+ - Top 3 stablecoins by market cap with individual figures
139
+ - Stablecoin/total crypto market cap ratio
140
+ - Chain distribution for at least top 3 chains
141
+ - Explicit note when 4-week rolling data is unavailable (snapshot limitation)
142
+
143
+ ### Display Format
144
+
145
+ - Overview query -> summary paragraph + key metrics table
146
+ - USDT vs USDC comparison -> side-by-side table (market cap, growth, chain distribution, user profile)
147
+ - Capital flow analysis -> bullet-point signals with strength indicators
148
+ - Always end with a directional verdict: bullish / neutral / bearish with confidence level
149
+ - Include caveat: "Stablecoin flow is a leading indicator, not a guarantee. Always combine with price action and on-chain data for confirmation."
@@ -1,56 +1,150 @@
1
1
  ---
2
2
  name: fin-data-query
3
- description: "Generic DataHub query — directly call any of 172 financial data endpoints by path. Fallback when specialized tools don't cover the data need."
3
+ description: "Generic DataHub query fallback access any of 168+ financial data endpoints by path. Also provides OHLCV candle data with caching, market regime detection, and supported markets listing. Use when: specialized tools (fin_stock/fin_crypto/fin_macro/etc.) don't cover the data need, or querying uncommon endpoints like company news or coverage metadata. NOT for: common queries covered by fin-a-share/fin-us-equity/fin-hk-stock, fin-macro, fin-crypto, fin-derivatives, fin-a-share-radar, fin-etf-fund."
4
4
  metadata: { "openclaw": { "emoji": "🔍", "requires": { "extensions": ["findoo-datahub-plugin"] } } }
5
5
  ---
6
6
 
7
7
  # Data Query (Fallback)
8
8
 
9
- Use the **fin_query** tool as a generic fallback to access any of the 172 DataHub endpoints directly (works out of the box).
9
+ Use **fin_query** as a generic fallback to access any of the 168+ DataHub endpoints directly. Also use **fin_data_ohlcv** for K-line data, **fin_data_markets** for supported markets, and **fin_data_regime** for market regime detection.
10
10
 
11
- ## When to Use
11
+ The datahub has **8 specialized query tools** (fin_stock, fin_index, fin_macro, fin_crypto, fin_derivatives, fin_market, fin_etf, fin_currency) plus fin_ta — prefer those for common queries. Use fin_query only when no specialized tool covers the endpoint.
12
12
 
13
- - When specialized tools (fin_stock, fin_index, fin_macro, fin_derivatives, fin_crypto, fin_market) don't cover the specific data need
14
- - When querying less common endpoints
13
+ ## Skill Routing Quick-Check
15
14
 
16
- ## DataHub Categories
15
+ Before proceeding, check if a specialized skill handles this query better:
16
+
17
+ | User Intent (keywords) | Route to |
18
+ | ------------------------------ | ------------------- |
19
+ | A 股 / 茅台 / 沪深 | `fin-a-share` |
20
+ | AAPL / US earnings / S&P 500 | `fin-us-equity` |
21
+ | 00700.HK / 港股 | `fin-hk-stock` |
22
+ | BTC / DeFi / CEX | `fin-crypto` |
23
+ | GDP / CPI / 宏观 | `fin-macro` |
24
+ | 期货 / 期权 / 可转债 | `fin-derivatives` |
25
+ | 基金 / ETF / NAV | `fin-etf-fund` |
26
+ | 市场复盘 / 涨跌排行 | `fin-a-share-radar` |
27
+ | 选股 / 因子筛选 | `fin-factor-screen` |
28
+ | 资产配置 / 跨市场 | `fin-cross-asset` |
29
+ | 风险评估 / VaR | `fin-risk-monitor` |
30
+ | **None match** → proceed below | `fin-data-query` |
31
+
32
+ ## Tools & Parameters
33
+
34
+ ### fin_query — Generic Query
35
+
36
+ | Parameter | Type | Required | Format | Default | Example |
37
+ | --------- | ------ | -------- | ----------------------------- | ------- | ----------------- |
38
+ | path | string | Yes | category/endpoint (see below) | — | news/company |
39
+ | params | object | No | key-value query params | {} | {"symbol":"AAPL"} |
40
+
41
+ ### fin_data_ohlcv — K-line (OHLCV)
42
+
43
+ | Parameter | Type | Required | Format | Default | Example |
44
+ | --------- | ------ | -------- | --------------------------- | ------- | -------- |
45
+ | symbol | string | Yes | trading pair or stock code | — | BTC/USDT |
46
+ | market | string | No | crypto / equity / commodity | crypto | equity |
47
+ | timeframe | string | No | 1m / 5m / 1h / 4h / 1d | 1h | 1d |
48
+ | since | number | No | Unix timestamp in ms | — | — |
49
+ | limit | number | No | 1-1000 | 200 | 100 |
50
+
51
+ ### fin_data_regime — Market Regime Detection
52
+
53
+ | Parameter | Type | Required | Format | Default | Example |
54
+ | --------- | ------ | -------- | --------------------------- | ------- | --------- |
55
+ | symbol | string | Yes | trading pair or stock code | — | 600519.SH |
56
+ | market | string | No | crypto / equity / commodity | crypto | equity |
57
+ | timeframe | string | No | 1m / 5m / 1h / 4h / 1d | 4h | 1d |
58
+
59
+ Returns: `bull` / `bear` / `sideways` / `volatile` / `crisis`
60
+
61
+ ### fin_data_markets — Supported Markets
62
+
63
+ No parameters. Returns supported markets, data categories, and total endpoint count.
64
+
65
+ ## DataHub Categories (168+ endpoints)
17
66
 
18
67
  | Category | Endpoints | Coverage |
19
68
  | --------------- | --------- | ------------------------------------------------------------- |
20
69
  | `equity/*` | 83 | A-share, HK, US — prices, fundamentals, ownership, money flow |
21
70
  | `crypto/*` | 23 | CEX market data, CoinGecko, DeFi via DefiLlama |
22
- | `economy/*` | 21 | China macro, rates, FX, World Bank |
23
- | `derivatives/*` | 13 | Futures, options, convertible bonds |
24
- | `index/*` | 12 | Index data, thematic indices |
25
- | `etf/*` | 9 | ETF prices, NAV, fund data |
26
- | `currency/*` | 3 | FX historical, search, snapshots |
71
+ | `economy/*` | 23 | China macro, rates, FX, World Bank, Shibor quote, WZ index |
72
+ | `derivatives/*` | 13 | Futures (incl. curve), options, convertible bonds |
73
+ | `index/*` | 10 | Index data, thematic indices |
74
+ | `etf/*` | 9 | ETF prices, NAV, fund portfolio/manager/dividends/share/adj |
75
+ | `currency/*` | 4 | FX historical, search, snapshots, news |
27
76
  | `news/*` | 1 | Company news |
77
+ | `coverage/*` | 2+ | Provider list, endpoint discovery |
28
78
 
29
- ## Example Calls
79
+ ## Removed / Dead Endpoints
30
80
 
31
- ```
32
- # ETF fund manager info
33
- fin_query(path="etf/fund/manager", params={"symbol": "110011"})
81
+ 以下端点已移除,请勿使用:
82
+
83
+ | 端点 | 状态 | 替代方案 |
84
+ | ----------------- | ------------------- | ------------------------- |
85
+ | `index/members` | 已移除 (始终返回 0) | 使用 `index/constituents` |
86
+ | `index/snapshots` | 已移除 (404 错误) | 使用 `index/daily_basic` |
87
+ | `flow/ggt_top10` | 已移除 (超时) | 使用 `flow/ggt_daily` |
88
+
89
+ ## Endpoint Discovery Pattern
90
+
91
+ 1. `fin_query(path="coverage/providers")` — see all 38+ data providers
92
+ 2. `fin_query(path="coverage/commands")` — browse all 168+ endpoints with descriptions
93
+ 3. Use category prefix to narrow down (equity/, crypto/, economy/, etc.)
34
94
 
35
- # Currency historical
36
- fin_query(path="currency/price/historical", params={"symbol": "USDCNH"})
95
+ ## Common Queries (only via fin_query)
37
96
 
97
+ ```
38
98
  # Company news
39
99
  fin_query(path="news/company", params={"symbol": "AAPL"})
40
100
 
41
- # Coverage metadata — see all available endpoints
42
- fin_query(path="coverage/providers")
101
+ # Discover all available endpoints
43
102
  fin_query(path="coverage/commands")
103
+
104
+ # List all data providers
105
+ fin_query(path="coverage/providers")
44
106
  ```
45
107
 
46
- ## When to Prefer Specialized Tools
47
-
48
- | Data Need | Use Instead |
49
- | --------------------------- | ----------------- |
50
- | Stock quote / financials | `fin_stock` |
51
- | Index / ETF / Fund | `fin_index` |
52
- | GDP / CPI / interest rates | `fin_macro` |
53
- | Futures / options / CB | `fin_derivatives` |
54
- | Crypto / DeFi | `fin_crypto` |
55
- | Dragon-tiger / market radar | `fin_market` |
56
- | Simple OHLCV (CCXT/Yahoo) | `fin_data_ohlcv` |
108
+ ## Market Regime Usage
109
+
110
+ ```
111
+ # Detect if market is bullish/bearish
112
+ fin_data_regime(symbol="000300.SH", market="equity", timeframe="1d")
113
+ # Returns: "bull" / "bear" / "sideways" / "volatile" / "crisis"
114
+
115
+ # Crypto regime
116
+ fin_data_regime(symbol="BTC/USDT", market="crypto", timeframe="4h")
117
+ ```
118
+
119
+ - Uses SMA crossover + ATR analysis on 200+ bars
120
+ - Needs 200+ bars of historical data; defaults to "sideways" if insufficient
121
+ - Useful as input for strategy decisions or risk assessment
122
+
123
+ ## Data Notes
124
+
125
+ - **fin_query**: 万能后备,任何 DataHub endpoint 都可通过 path + params 调用
126
+ - **fin_data_ohlcv**: 带 SQLite 本地缓存,重复查询更快
127
+ - **fin_data_regime**: 需要 200+ 根 K 线,数据不足返回 "sideways"
128
+ - **coverage/commands**: 全量 endpoint 列表,最可靠的发现方式
129
+ - 查询失败时,建议用 coverage/commands 确认 endpoint 是否存在
130
+ - fin_query 返回原始 JSON,大数据量 (>20 行) 只展示 Top 10 + 总数
131
+
132
+ ### 端点参数特殊说明
133
+
134
+ | 端点 | 特殊参数 | 说明 |
135
+ | --------------------- | ------------------------- | --------------------------------- |
136
+ | `flow/hsgt_top10` | 需 `date` (非 trade_date) | 北向 Top10 持股,必须传 date 参数 |
137
+ | `flow/hs_const` | 需 `hs_type` (SH 或 SZ) | 互联互通成分股,hs_type 必填 |
138
+ | `market/stock_limit` | 需 `symbol` | 个股涨跌停价,不支持按日期批量 |
139
+ | `estimates/consensus` | 仅 yfinance 美股 | A 股不支持,有频率限制 |
140
+ | `fixedincome/rate/*` | 通过 fin_macro 调用 | LIBOR/HIBOR 数据截止 2020-06 |
141
+
142
+ ## Troubleshooting
143
+
144
+ | Symptom | Fix |
145
+ | --------------------- | --------------------------------------------------------- |
146
+ | "endpoint not found" | 用 `coverage/commands` 确认 path 拼写和存在性 |
147
+ | 返回空数组 | 检查 params 格式 (symbol 大小写、日期格式 YYYYMMDD) |
148
+ | Rate limit / 429 | CoinGecko ~30 req/min, tushare ~200 req/min; 降低请求频率 |
149
+ | 数据截断 | 所有 endpoint 返回 JSON 数组; 大结果集自动截断 Top 10 |
150
+ | World Bank 自定义指标 | `fin_macro` + path `worldbank/indicator` + 自定义 code |