@openfinclaw/openfinclaw-strategy 2026.3.14 → 2026.3.26

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.
@@ -3,7 +3,7 @@
3
3
  "name": "OpenFinClaw",
4
4
  "description": "Unified financial tools: market data (price/K-line/crypto/compare/search), strategy publishing, fork, and validation. Single API key for Hub and DataHub.",
5
5
  "kind": "financial",
6
- "version": "0.1.0",
6
+ "version": "2026.3.25",
7
7
  "skills": ["./skills"],
8
8
  "configSchema": {
9
9
  "type": "object",
@@ -49,4 +49,4 @@
49
49
  "placeholder": "http://43.134.61.136:9080"
50
50
  }
51
51
  }
52
- }
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfinclaw/openfinclaw-strategy",
3
- "version": "2026.3.14",
3
+ "version": "2026.3.26",
4
4
  "description": "OpenFinClaw - Unified financial tools: market data (price/K-line/crypto/compare/search), strategy publishing, fork, and validation. Single API key for Hub and DataHub.",
5
5
  "keywords": [
6
6
  "backtest",
@@ -11,6 +11,7 @@ metadata:
11
11
  # OpenFinClaw
12
12
 
13
13
  统一金融工具平台,一个 API Key 即可使用所有功能:
14
+
14
15
  - **行情数据**: 价格查询、K线、加密市场数据、多资产对比、代码搜索
15
16
  - **策略工具**: 创建、验证、发布、Fork 策略
16
17
  - **统一认证**: 一个 API Key 访问 Hub 和 DataHub
@@ -121,13 +122,13 @@ export OPENFINCLAW_API_KEY=YOUR_API_KEY
121
122
 
122
123
  ### 行情数据工具
123
124
 
124
- | 工具名 | 用途 | 需要 API Key |
125
- | ----------------- | -------------------------------- | ------------ |
126
- | `fin_price` | 价格查询(股票/加密/指数) | **是** |
127
- | `fin_kline` | K线/OHLCV 数据 | **是** |
128
- | `fin_crypto` | 加密市场数据(21个端点) | **是** |
129
- | `fin_compare` | 多资产价格对比(2-5个资产) | **是** |
130
- | `fin_slim_search` | 代码/名称搜索 | **是** |
125
+ | 工具名 | 用途 | 需要 API Key |
126
+ | ----------------- | --------------------------- | ------------ |
127
+ | `fin_price` | 价格查询(股票/加密/指数) | **是** |
128
+ | `fin_kline` | K线/OHLCV 数据 | **是** |
129
+ | `fin_crypto` | 加密市场数据(21个端点) | **是** |
130
+ | `fin_compare` | 多资产价格对比(2-5个资产) | **是** |
131
+ | `fin_slim_search` | 代码/名称搜索 | **是** |
131
132
 
132
133
  ### 策略工具
133
134
 
@@ -145,14 +146,9 @@ export OPENFINCLAW_API_KEY=YOUR_API_KEY
145
146
 
146
147
  #### 行情数据 Skills
147
148
 
148
- | Skill | 触发场景 | 说明 |
149
- | ------------------------ | ---------------------------------- | ------------------------ |
150
- | `price-check` | 快速查价、XX多少钱 | 最简单的价格查询 |
151
- | `quick-quote` | 加密市场概览、Top coins、DeFi TVL | 市场快照 |
152
- | `crypto-stablecoin-flow` | 稳定币资金流、USDT/USDC 分析 | 2-4周领先指标 |
153
- | `crypto-funding-arb` | 资金费率套利、Delta中性策略 | 收益计算与风险评估 |
154
- | `crypto-altseason` | 山寨季、BTC dominance、轮动时机 | 轮动阶梯与顶部信号 |
155
- | `cross-asset-lite` | 多资产对比、BTC vs 黄金、跨市场 | 价格对比与相对强弱 |
149
+ | Skill | 触发场景 | 说明 |
150
+ | ------------- | ------------------ | ---------------- |
151
+ | `price-check` | 快速查价、XX多少钱 | 最简单的价格查询 |
156
152
 
157
153
  #### 策略 Skills
158
154
 
@@ -251,27 +247,22 @@ openclaw strategy show 550e8400-e29b-41d4-a716-446655440001 --remote
251
247
 
252
248
  当用户提到以下内容时,应引导阅读对应的 Skill:
253
249
 
254
- | 触发关键词 | Skill | 说明 |
255
- | ------------------------------------ | ----------------------- | ------------------------ |
256
- | XX多少钱、什么价格、查价 | `price-check` | 最简单的价格查询 |
257
- | 加密市场、Top coins、DeFi TVL | `quick-quote` | 市场快照 |
258
- | 稳定币、USDT、资金流 | `crypto-stablecoin-flow`| 资金流分析 |
259
- | 资金费率套利、Delta中性 | `crypto-funding-arb` | 套利分析 |
260
- | 山寨季、BTC dominance、轮动 | `crypto-altseason` | 轮动时机 |
261
- | 多资产对比、BTC vs 黄金 | `cross-asset-lite` | 跨市场对比 |
262
- | 创建策略、写策略、生成策略包 | `strategy-builder` | 自然语言 → FEP v2.0 |
263
- | 发布策略、上传策略、提交策略 | `skill-publish` | 验证 → 打包 → 发布 |
264
- | Fork 策略、下载策略、克隆策略 | `strategy-fork` | 从 Hub Fork 策略 |
265
- | 策略包格式、FEP 规范、打包回测 | `strategy-pack` | FEP v2.0 规范详解 |
250
+ | 触发关键词 | Skill | 说明 |
251
+ | ------------------------------ | ------------------ | ------------------- |
252
+ | XX多少钱、什么价格、查价 | `price-check` | 最简单的价格查询 |
253
+ | 创建策略、写策略、生成策略包 | `strategy-builder` | 自然语言 → FEP v2.0 |
254
+ | 发布策略、上传策略、提交策略 | `skill-publish` | 验证 → 打包 → 发布 |
255
+ | Fork 策略、下载策略、克隆策略 | `strategy-fork` | 从 Hub Fork 策略 |
256
+ | 策略包格式、FEP 规范、打包回测 | `strategy-pack` | FEP v2.0 规范详解 |
266
257
 
267
258
  ## 配置选项
268
259
 
269
- | 配置项 | 环境变量 | 说明 | 默认值 |
270
- | ------------------- | -------------------------- | ---------------- | ---------------------------- |
271
- | `apiKey` | `OPENFINCLAW_API_KEY` | 统一 API Key | 必填 |
272
- | `hubApiUrl` | `HUB_API_URL` | Hub 服务地址 | `https://hub.openfinclaw.ai` |
273
- | `datahubGatewayUrl` | `DATAHUB_GATEWAY_URL` | DataHub 网关地址 | `http://43.134.61.136:9080` |
274
- | `requestTimeoutMs` | `REQUEST_TIMEOUT_MS` | 请求超时(毫秒) | `60000` |
260
+ | 配置项 | 环境变量 | 说明 | 默认值 |
261
+ | ------------------- | --------------------- | ---------------- | ---------------------------- |
262
+ | `apiKey` | `OPENFINCLAW_API_KEY` | 统一 API Key | 必填 |
263
+ | `hubApiUrl` | `HUB_API_URL` | Hub 服务地址 | `https://hub.openfinclaw.ai` |
264
+ | `datahubGatewayUrl` | `DATAHUB_GATEWAY_URL` | DataHub 网关地址 | `http://43.134.61.136:9080` |
265
+ | `requestTimeoutMs` | `REQUEST_TIMEOUT_MS` | 请求超时(毫秒) | `60000` |
275
266
 
276
267
  ## 常见问题
277
268
 
@@ -307,4 +298,4 @@ openclaw plugins list | grep openfinclaw
307
298
  - **排行榜**: https://hub.openfinclaw.ai/leaderboard
308
299
  - **策略发现**: https://hub.openfinclaw.ai/discover
309
300
  - **获取 API Key**: https://hub.openfinclaw.ai/dashboard
310
- - **GitHub 仓库**: https://github.com/cryptoSUN2049/openFinclaw
301
+ - **GitHub 仓库**: https://github.com/cryptoSUN2049/openFinclaw
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  name: fin-price-check
3
3
  description: "Quick price lookup for any asset — stocks, crypto, indices. Use when user asks '什么价格', 'how much is', 'current price of', or any simple price query. Returns latest price, volume, and date."
4
- metadata:
5
- { "openclaw": { "emoji": "💰", "requires": { "extensions": ["openfinclaw"] } } }
4
+ metadata: { "openclaw": { "emoji": "💰", "requires": { "extensions": ["openfinclaw"] } } }
6
5
  ---
7
6
 
8
7
  # Price Check
@@ -20,6 +19,12 @@ metadata:
20
19
 
21
20
  Market 自动检测:含 `/` → crypto;`.SH/.SZ/.HK` 或纯字母 → equity。
22
21
 
22
+ **返回字段:**
23
+
24
+ - `price`: 最新价格
25
+ - `volume24h`: 24小时成交量(加密货币)
26
+ - `timestamp`: 数据时间
27
+
23
28
  ### fin_kline — 查历史 K 线
24
29
 
25
30
  | Parameter | Type | Required | Default | Example |
@@ -28,13 +33,63 @@ Market 自动检测:含 `/` → crypto;`.SH/.SZ/.HK` 或纯字母 → equity
28
33
  | market | string | No | auto | equity |
29
34
  | limit | number | No | 30 | 10 |
30
35
 
36
+ **返回字段:**
37
+
38
+ - `bars[]`: K线数组,包含 date, open, high, low, close, volume
39
+
31
40
  ### fin_compare — 多资产对比
32
41
 
33
42
  | Parameter | Type | Required | Example |
34
43
  | --------- | ------ | -------- | --------------------------- |
35
44
  | symbols | string | Yes | BTC/USDT,ETH/USDT,600519.SH |
36
45
 
37
- 返回每个资产的最新价格 + 周涨跌幅。
46
+ **返回字段:**
47
+
48
+ - `comparison[]`: 每个资产的 price, weekChange(周涨跌幅)
49
+
50
+ ### fin_slim_search — 搜索代码
51
+
52
+ 当用户只说公司/币种名称,不确定 symbol 时使用:
53
+
54
+ | Parameter | Type | Required | Example |
55
+ | --------- | ------ | -------- | ------- |
56
+ | query | string | Yes | 茅台 |
57
+ | market | string | No | equity |
58
+
59
+ **触发场景:**
60
+
61
+ - 用户说 "茅台多少钱" → 先搜索 `query="茅台"` → 找到 `600519.SH` → 再查价格
62
+ - 用户说 "特斯拉股价" → 先搜索 `query="特斯拉"` → 找到 `TSLA` → 再查价格
63
+
64
+ ### fin_crypto — 加密市场数据
65
+
66
+ | Parameter | Type | Required | Example |
67
+ | --------- | ------ | -------- | ------------------- |
68
+ | endpoint | string | Yes | market/funding_rate |
69
+ | symbol | string | No | BTC/USDT:USDT |
70
+ | limit | number | No | 20 |
71
+
72
+ **常用端点:**
73
+
74
+ | 端点 | 用途 |
75
+ | --------------------- | ------------------ |
76
+ | `market/ticker` | 单币种行情 |
77
+ | `market/tickers` | 多币种行情 |
78
+ | `market/funding_rate` | 资金费率 |
79
+ | `coin/market` | CoinGecko 币种排行 |
80
+ | `coin/trending` | 热门币种 |
81
+ | `defi/protocols` | DeFi 协议 TVL 排行 |
82
+ | `defi/yields` | DeFi 收益率 |
83
+
84
+ ## Symbol 格式速查
85
+
86
+ | 格式 | 市场 | 示例 |
87
+ | ------------- | ------ | ------------------------ |
88
+ | `XXX/YYY` | Crypto | `BTC/USDT`, `ETH/BTC` |
89
+ | `6位数.SZ/SH` | A股 | `000001.SZ`, `600519.SH` |
90
+ | `5位数.HK` | 港股 | `00700.HK`, `00941.HK` |
91
+ | `1-5大写字母` | 美股 | `AAPL`, `NVDA`, `TSLA` |
92
+ | `000xxx.SH` | 指数 | `000300.SH` (沪深300) |
38
93
 
39
94
  ## Response Guidelines
40
95
 
@@ -42,12 +97,19 @@ Market 自动检测:含 `/` → crypto;`.SH/.SZ/.HK` 或纯字母 → equity
42
97
  2. **格式清晰** — 用表格展示,包含:资产名、价格、涨跌幅
43
98
  3. **币种标注** — 加密标注 USD,A 股标注 CNY,港股标注 HKD
44
99
  4. **时间标注** — 说明数据截至时间
100
+ 5. **搜索优先** — 用户只说名称时,先用 fin_slim_search 找 symbol
45
101
 
46
102
  ## Examples
47
103
 
48
104
  **用户:** BTC 多少钱?
49
105
  **流程:** `fin_price(symbol="BTC/USDT")` → 返回 $69,552
50
106
 
107
+ **用户:** 茅台现在什么价?
108
+ **流程:**
109
+
110
+ 1. `fin_slim_search(query="茅台")` → 找到 `600519.SH`
111
+ 2. `fin_price(symbol="600519.SH")` → 返回 ¥1,856.00
112
+
51
113
  **用户:** 茅台和腾讯谁贵?
52
114
  **流程:** `fin_compare(symbols="600519.SH,00700.HK")` → 对比表格
53
115
 
@@ -55,4 +117,7 @@ Market 自动检测:含 `/` → crypto;`.SH/.SZ/.HK` 或纯字母 → equity
55
117
  **流程:** `fin_kline(symbol="ETH/USDT", market="crypto", limit=5)` → K 线数据
56
118
 
57
119
  **用户:** BTC 资金费率现在多少?
58
- **流程:** `fin_crypto(endpoint="market/funding_rate", symbol="BTC/USDT:USDT")` → 费率数据
120
+ **流程:** `fin_crypto(endpoint="market/funding_rate", symbol="BTC/USDT:USDT")` → 费率数据
121
+
122
+ **用户:** 现在 DeFi 哪个协议 TVL 最高?
123
+ **流程:** `fin_crypto(endpoint="defi/protocols", limit=5)` → TVL 排行
@@ -41,18 +41,18 @@ This skill needs **read** (read files) and **exec** (run shell commands). Ensure
41
41
 
42
42
  ### Strategy Tools (from this plugin)
43
43
 
44
- | Tool | Purpose |
45
- | ---------------------- | ------------------------------------------ |
44
+ | Tool | Purpose |
45
+ | ---------------------- | ---------------------------------------------- |
46
46
  | `skill_validate` | Validate strategy package directory (FEP v2.0) |
47
- | `skill_publish` | Publish strategy ZIP to Hub |
48
- | `skill_publish_verify` | Query publish status and backtest report |
47
+ | `skill_publish` | Publish strategy ZIP to Hub |
48
+ | `skill_publish_verify` | Query publish status and backtest report |
49
49
 
50
50
  ### Market Data Tools (for symbol validation)
51
51
 
52
- | Tool | Purpose |
53
- | ------------- | ------------------------------------------ |
54
- | `fin_price` | Check current price, validate symbol |
55
- | `fin_kline` | Get historical K-line data |
52
+ | Tool | Purpose |
53
+ | ----------- | ------------------------------------ |
54
+ | `fin_price` | Check current price, validate symbol |
55
+ | `fin_kline` | Get historical K-line data |
56
56
 
57
57
  ---
58
58
 
@@ -131,28 +131,28 @@ classification:
131
131
 
132
132
  ### Identity Fields (必填)
133
133
 
134
- | Field | Description |
135
- | ------------ | ------------------------------------ |
136
- | `id` | 策略唯一标识(英文 + 连字符) |
137
- | `name` | 策略显示名称 |
138
- | `version` | 语义化版本号(如 `"1.0.0"`) |
139
- | `style` | `trend` | `mean-reversion` | `momentum` | `dca` | `hybrid` |
140
- | `visibility` | `public` | `private` | `unlisted` |
141
- | `summary` | 一句话策略描述 |
142
- | `description`| 详细策略说明 |
143
- | `license` | `MIT` | `CC-BY-4.0` | `proprietary` |
144
- | `tags` | 标签数组,如 `[dca, btc, crypto]` |
145
- | `author` | 对象,必须包含 `name` 字段 |
146
- | `changelog` | 变更日志数组 |
134
+ | Field | Description |
135
+ | ------------- | --------------------------------- | ---------------- | ------------- | ----- | -------- |
136
+ | `id` | 策略唯一标识(英文 + 连字符) |
137
+ | `name` | 策略显示名称 |
138
+ | `version` | 语义化版本号(如 `"1.0.0"`) |
139
+ | `style` | `trend` | `mean-reversion` | `momentum` | `dca` | `hybrid` |
140
+ | `visibility` | `public` | `private` | `unlisted` |
141
+ | `summary` | 一句话策略描述 |
142
+ | `description` | 详细策略说明 |
143
+ | `license` | `MIT` | `CC-BY-4.0` | `proprietary` |
144
+ | `tags` | 标签数组,如 `[dca, btc, crypto]` |
145
+ | `author` | 对象,必须包含 `name` 字段 |
146
+ | `changelog` | 变更日志数组 |
147
147
 
148
148
  ### Backtest Fields (必填)
149
149
 
150
- | Field | Description |
151
- | ---------------------- | ------------------------ |
152
- | `symbol` | 交易品种(自动推断市场) |
153
- | `defaultPeriod.startDate` | 回测开始日期 |
154
- | `defaultPeriod.endDate` | 回测结束日期 |
155
- | `initialCapital` | 初始资金 |
150
+ | Field | Description |
151
+ | ------------------------- | ------------------------ |
152
+ | `symbol` | 交易品种(自动推断市场) |
153
+ | `defaultPeriod.startDate` | 回测开始日期 |
154
+ | `defaultPeriod.endDate` | 回测结束日期 |
155
+ | `initialCapital` | 初始资金 |
156
156
 
157
157
  ### Symbol 格式
158
158
 
@@ -180,7 +180,7 @@ def compute(data, context=None):
180
180
  """
181
181
  close = data["close"].values
182
182
  current_price = float(close[-1])
183
-
183
+
184
184
  return {
185
185
  "action": "buy",
186
186
  "amount": 100.0,
@@ -191,11 +191,11 @@ def compute(data, context=None):
191
191
 
192
192
  ### 信号返回格式
193
193
 
194
- | action | 必填字段 | 说明 |
195
- | ------ | ------------- | -------------- |
196
- | `buy` | amount, price | 按金额买入 |
197
- | `sell` | — | 无参数=全仓卖 |
198
- | `hold` | — | 不操作 |
194
+ | action | 必填字段 | 说明 |
195
+ | ------ | ------------- | ------------- |
196
+ | `buy` | amount, price | 按金额买入 |
197
+ | `sell` | — | 无参数=全仓卖 |
198
+ | `hold` | — | 不操作 |
199
199
 
200
200
  ### Allowed Imports
201
201
 
@@ -213,14 +213,14 @@ def compute(data, context=None):
213
213
 
214
214
  Extract key dimensions:
215
215
 
216
- | Dimension | Example |
217
- | -------------- | -------------------------- |
218
- | Asset | BTC, ETH, AAPL |
219
- | Frequency | daily, weekly |
220
- | Core idea | buy dips, trend follow, DCA|
221
- | Capital | $10,000 |
222
- | Risk tolerance | 25% max drawdown |
223
- | Time horizon | 2025-01-01 to 2026-01-01 |
216
+ | Dimension | Example |
217
+ | -------------- | --------------------------- |
218
+ | Asset | BTC, ETH, AAPL |
219
+ | Frequency | daily, weekly |
220
+ | Core idea | buy dips, trend follow, DCA |
221
+ | Capital | $10,000 |
222
+ | Risk tolerance | 25% max drawdown |
223
+ | Time horizon | 2025-01-01 to 2026-01-01 |
224
224
 
225
225
  ### Step 2: Technical Design
226
226
 
@@ -277,4 +277,4 @@ Present the package and next steps:
277
277
  2. Present technical design and wait for confirmation
278
278
  3. Show generated package structure
279
279
  4. Run validation and report pass/fail
280
- 5. End with clear next steps (publish, iterate)
280
+ 5. End with clear next steps (publish, iterate)
@@ -276,10 +276,10 @@ def select(universe):
276
276
 
277
277
  ## 相关 Tools
278
278
 
279
- | Tool | 用途 |
280
- | ---------------------- | ---------------------------------------------- |
281
- | `skill_validate` | 校验策略包目录格式是否符合 FEP v2.0 |
282
- | `skill_publish` | 提交已打包的 ZIP 到 Hub,自动触发回测 |
283
- | `skill_publish_verify` | 查询发布状态与回测报告 |
279
+ | Tool | 用途 |
280
+ | ---------------------- | ------------------------------------- |
281
+ | `skill_validate` | 校验策略包目录格式是否符合 FEP v2.0 |
282
+ | `skill_publish` | 提交已打包的 ZIP 到 Hub,自动触发回测 |
283
+ | `skill_publish_verify` | 查询发布状态与回测报告 |
284
284
 
285
285
  总结:**先按本 skill 生成/补全策略包 → 用 skill_validate 校验 → 通过后再打包并 skill_publish**。
package/src/cli.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * CLI commands for strategy management.
3
3
  */
4
4
  import type { Command } from "commander";
5
- import { forkStrategy, fetchStrategyInfo } from "./fork.js";
6
- import { listLocalStrategies, findLocalStrategy, removeLocalStrategy } from "./strategy-storage.js";
5
+ import { forkStrategy, fetchStrategyInfo } from "./strategy/fork.js";
6
+ import { listLocalStrategies, findLocalStrategy, removeLocalStrategy } from "./strategy/storage.js";
7
7
  import type { UnifiedPluginConfig, LeaderboardResponse, BoardType } from "./types.js";
8
8
 
9
9
  type Logger = {
package/src/config.ts CHANGED
@@ -54,4 +54,4 @@ export function resolvePluginConfig(api: OpenClawPluginApi): UnifiedPluginConfig
54
54
  datahubGatewayUrl: datahubGatewayUrl.replace(/\/+$/, ""),
55
55
  requestTimeoutMs,
56
56
  };
57
- }
57
+ }
@@ -147,4 +147,4 @@ export function guessMarket(symbol: string): MarketType {
147
147
  if (/^\d{5,6}/.test(u)) return "equity";
148
148
  if (/^[A-Z]{1,5}$/.test(u)) return "equity";
149
149
  return "crypto";
150
- }
150
+ }