@openfinclaw/openfinclaw-strategy 0.0.11

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.
@@ -0,0 +1,35 @@
1
+ {
2
+ "id": "openfinclaw",
3
+ "name": "OpenFinClaw",
4
+ "description": "Skill publishing and strategy validation tools. Publish strategy ZIPs to remote server with automatic backtest.",
5
+ "kind": "financial",
6
+ "skills": ["./skills"],
7
+ "configSchema": {
8
+ "type": "object",
9
+ "properties": {
10
+ "skillApiUrl": {
11
+ "type": "string",
12
+ "description": "Skill API base URL (e.g. https://hub.openfinclaw.ai). No trailing slash.",
13
+ "default": "https://hub.openfinclaw.ai"
14
+ },
15
+ "skillApiKey": {
16
+ "type": "string",
17
+ "description": "API key for skill server (fch_ prefix, 68 chars). Required for publishing."
18
+ },
19
+ "requestTimeoutMs": {
20
+ "type": "number",
21
+ "default": 60000,
22
+ "minimum": 5000,
23
+ "maximum": 300000,
24
+ "description": "HTTP request timeout in milliseconds"
25
+ }
26
+ }
27
+ },
28
+ "uiHints": {
29
+ "skillApiKey": { "label": "Skill API Key", "sensitive": true },
30
+ "skillApiUrl": {
31
+ "label": "Skill Server URL",
32
+ "placeholder": "https://hub.openfinclaw.ai"
33
+ }
34
+ }
35
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@openfinclaw/openfinclaw-strategy",
3
+ "version": "0.0.11",
4
+ "description": "OpenFinClaw - Financial tools for OpenClaw: strategy builder, remote backtest",
5
+ "keywords": [
6
+ "backtest",
7
+ "crypto",
8
+ "financial",
9
+ "openclaw",
10
+ "openfinclaw",
11
+ "strategy",
12
+ "trading"
13
+ ],
14
+ "homepage": "https://github.com/cryptoSUN2049/openFinclaw#readme",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/cryptoSUN2049/openFinclaw.git",
19
+ "directory": "extensions/openfinclaw"
20
+ },
21
+ "files": [
22
+ "skills",
23
+ "src",
24
+ "*.ts",
25
+ "openclaw.plugin.json",
26
+ "README.md"
27
+ ],
28
+ "type": "module",
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "registry": "https://registry.npmjs.org"
32
+ },
33
+ "dependencies": {
34
+ "@sinclair/typebox": "^0.34.0",
35
+ "adm-zip": "^0.5.16"
36
+ },
37
+ "devDependencies": {
38
+ "@types/adm-zip": "^0.5.8"
39
+ },
40
+ "openclaw": {
41
+ "extensions": [
42
+ "./index.ts"
43
+ ]
44
+ }
45
+ }
@@ -0,0 +1,301 @@
1
+ ---
2
+ name: openfinclaw
3
+ description: "FinClaw Commons 入口 - 量化策略开发平台。帮助用户安装插件、了解 Hub 平台、使用策略工具链(创建、验证、发布、Fork)。当用户提到 FinClaw、Hub、策略发布、策略下载、量化策略时触发。"
4
+ metadata:
5
+ openclaw:
6
+ emoji: "🦈"
7
+ requires:
8
+ extensions: ["openfinclaw"]
9
+ ---
10
+
11
+ # FinClaw Commons
12
+
13
+ 量化策略开发平台,连接 **hub.openfinclaw.ai** 策略网络。用户可以创建、验证、发布、Fork 策略,参与社区策略进化。
14
+
15
+ ## 平台简介
16
+
17
+ **Hub 平台 (hub.openfinclaw.ai)** 是一个 7×24 小时全球策略进化网络:
18
+
19
+ - **策略分享**: 发布你的策略,供社区成员查看和 Fork
20
+ - **回测验证**: 发布时自动运行回测,验证策略有效性
21
+ - **社区进化**: 其他用户可以 Fork 你的策略进行优化改进
22
+ - **绩效排行**: 查看各市场表现最佳的策略
23
+
24
+ 核心价值:**不要追逐浪潮,创造浪潮。**
25
+
26
+ ## 快速开始
27
+
28
+ 安装完成后,你可以立即开始(无需 API Key):
29
+
30
+ ```bash
31
+ # 1. 查看排行榜(无需 API Key)
32
+ openclaw strategy leaderboard
33
+
34
+ # 2. 查看收益榜 Top 10
35
+ openclaw strategy leaderboard returns --limit 10
36
+
37
+ # 3. 查看策略详情(无需 API Key)
38
+ openclaw strategy show 550e8400-e29b-41d4-a716-446655440001 --remote
39
+ ```
40
+
41
+ 或者直接告诉 Agent 你想做什么:
42
+
43
+ - "帮我看看排行榜有什么好策略" → Agent 会使用 `skill_leaderboard`
44
+ - "这个策略收益怎么样" → Agent 会使用 `skill_get_info`
45
+ - "帮我 Fork 这个策略" → Agent 会使用 `skill_fork`(需要配置 API Key)
46
+
47
+ ## 安装指南
48
+
49
+ ### 前置检查
50
+
51
+ 在安装前,检查用户是否已安装 OpenClaw:
52
+
53
+ ```bash
54
+ openclaw --version
55
+ ```
56
+
57
+ 如果未安装,引导用户安装 OpenClaw(参考 https://docs.openclaw.ai/install)。
58
+
59
+ ### 安装 openfinclaw 插件
60
+
61
+ **OpenClaw (推荐):**
62
+
63
+ ```bash
64
+ openclaw plugins install @openfinclaw/openfinclaw-strategy
65
+
66
+ openclaw plugins enable @openfinclaw/openfinclaw-strategy
67
+ ```
68
+
69
+ 安装成功后会显示插件路径,如 `~/.openclaw/extensions/openfinclaw`。
70
+
71
+ ### 验证安装
72
+
73
+ ```bash
74
+ # 查看插件状态
75
+ openclaw plugins list
76
+
77
+ # 测试命令
78
+ openclaw strategy list
79
+ ```
80
+
81
+ ### 配置 API Key
82
+
83
+ 从 https://hub.openfinclaw.ai 获取 API Key(以 `fch_` 开头):
84
+
85
+ ```bash
86
+ openclaw config set plugins.entries.openfinclaw.config.skillApiKey YOUR_API_KEY
87
+ ```
88
+
89
+ 或使用环境变量:
90
+
91
+ ```bash
92
+ export SKILL_API_KEY=YOUR_API_KEY
93
+ ```
94
+
95
+ ### ⚠️ API Key 安全提醒
96
+
97
+ **重要:请勿泄露你的 Hub API Key!**
98
+
99
+ - API Key 以 `fch_` 开头,仅用于 hub.openfinclaw.ai 接口校验
100
+ - **不要**将 API Key 提交到 Git 仓库或公开分享
101
+ - **不要**在公开聊天、截图、代码示例中暴露真实的 API Key
102
+ - 如果怀疑 Key 已泄露,请立即在 Hub 个人设置中重新生成
103
+
104
+ 配置建议:
105
+
106
+ ```bash
107
+ # 推荐:使用环境变量(不会写入配置文件)
108
+ export SKILL_API_KEY=your_api_key_here
109
+
110
+ # 或使用 OpenClaw 配置(存储在本地配置文件,注意权限)
111
+ openclaw config set plugins.entries.openfinclaw.config.skillApiKey YOUR_API_KEY
112
+ ```
113
+
114
+ ## 功能概览
115
+
116
+ 本插件提供两类能力:
117
+
118
+ ### Tools(工具)
119
+
120
+ Agent 可直接调用的函数:
121
+
122
+ | 工具名 | 用途 | 需要 API Key |
123
+ | ---------------------- | -------------------------------------- | ------------ |
124
+ | `skill_leaderboard` | 查询排行榜(综合/收益/风控/人气/新星) | 否 |
125
+ | `skill_get_info` | 获取 Hub 策略公开详情 | 否 |
126
+ | `skill_validate` | 本地验证策略包格式(FEP v2.0) | 否 |
127
+ | `skill_list_local` | 列出本地已下载的策略 | 否 |
128
+ | `skill_fork` | 从 Hub 下载公开策略到本地 | **是** |
129
+ | `skill_publish` | 发布策略 ZIP 到 Hub,自动触发回测 | **是** |
130
+ | `skill_publish_verify` | 查询发布状态和回测报告 | **是** |
131
+
132
+ ### Skills(指导文档)
133
+
134
+ 定义 Agent 在特定场景下的行为规范,位于 `skills/` 目录:
135
+
136
+ | Skill | 触发场景 | 说明 |
137
+ | ------------------ | ------------------------ | ----------------------------- |
138
+ | `strategy-builder` | 创建新策略、生成策略代码 | 自然语言 → FEP v2.0 策略包 |
139
+ | `skill-publish` | 发布策略到服务器 | 验证 → 打包 → 发布 → 查询回测 |
140
+ | `strategy-fork` | 下载/克隆 Hub 策略 | Fork → 本地编辑 → 发布新版本 |
141
+ | `strategy-pack` | 创建回测策略包 | 生成 fep.yaml + strategy.py |
142
+
143
+ ### 典型工作流
144
+
145
+ ```
146
+ 创建策略 → 验证 → 发布 → Fork → 优化 → 再次发布
147
+ ↓ ↓ ↓ ↓
148
+ strategy-builder skill_publish skill_fork
149
+ skill_validate skill_publish_verify
150
+ ```
151
+
152
+ ## CLI 命令
153
+
154
+ ### strategy leaderboard
155
+
156
+ 查看 Hub 排行榜(无需 API Key):
157
+
158
+ ```bash
159
+ # 综合榜 Top 20(默认)
160
+ openclaw strategy leaderboard
161
+
162
+ # 收益榜 Top 10
163
+ openclaw strategy leaderboard returns --limit 10
164
+
165
+ # 人气榜第 21-40 名
166
+ openclaw strategy leaderboard popular --offset 20 --limit 20
167
+ ```
168
+
169
+ **榜单类型**:
170
+
171
+ | 榜单类型 | 说明 | 排序依据 |
172
+ | ----------- | -------------- | ---------------- |
173
+ | `composite` | 综合榜(默认) | FCS 综合分 |
174
+ | `returns` | 收益榜 | 收益率 |
175
+ | `risk` | 风控榜 | 风控分 |
176
+ | `popular` | 人气榜 | 订阅数 |
177
+ | `rising` | 新星榜 | 30天内新策略收益 |
178
+
179
+ ### strategy fork
180
+
181
+ 从 Hub 下载策略到本地:
182
+
183
+ ```bash
184
+ # 使用策略 ID
185
+ openclaw strategy fork 34a5792f-7d20-4a15-90f3-26f1c54fa4a6
186
+
187
+ # 使用 Hub URL
188
+ openclaw strategy fork https://hub.openfinclaw.ai/strategy/34a5792f-7d20-4a15-90f3-26f1c54fa4a6
189
+
190
+ # 指定日期目录
191
+ openclaw strategy fork 34a5792f-7d20-4a15-90f3-26f1c54fa4a6 --date 2026-03-01
192
+
193
+ # 自定义路径
194
+ openclaw strategy fork 34a5792f-7d20-4a15-90f3-26f1c54fa4a6 --dir ./my-strategies/
195
+ ```
196
+
197
+ ### strategy list
198
+
199
+ 列出本地策略:
200
+
201
+ ```bash
202
+ openclaw strategy list
203
+ openclaw strategy list --json
204
+ ```
205
+
206
+ 输出示例:
207
+
208
+ ```
209
+ 2026-03-16/
210
+ btc-adaptive-dca-34a5792f BTC Adaptive DCA (forked)
211
+ my-test-strategy My Test Strategy (created)
212
+ 2026-03-15/
213
+ eth-momentum-7e8a9b2c ETH Momentum (forked)
214
+ ```
215
+
216
+ ### strategy show
217
+
218
+ 查看策略详情:
219
+
220
+ ```bash
221
+ # 查看本地策略
222
+ openclaw strategy show btc-adaptive-dca-34a5792f
223
+
224
+ # 从 Hub 获取最新信息(无需 API Key)
225
+ openclaw strategy show 550e8400-e29b-41d4-a716-446655440001 --remote
226
+ ```
227
+
228
+ ### strategy remove
229
+
230
+ 删除本地策略:
231
+
232
+ ```bash
233
+ openclaw strategy remove btc-adaptive-dca-34a5792f --force
234
+ ```
235
+
236
+ ## 本地存储结构
237
+
238
+ 策略存储在 `~/.openfinclaw/workspace/strategies/` 目录:
239
+
240
+ ```
241
+ ~/.openfinclaw/workspace/strategies/
242
+ └── 2026-03-16/ # 按日期组织
243
+ ├── btc-adaptive-dca-34a5792f/ # 名称 + 短ID(Fork 来的)
244
+ │ ├── fep.yaml # 策略配置
245
+ │ ├── scripts/
246
+ │ │ └── strategy.py # 策略代码
247
+ │ └── .fork-meta.json # 元数据
248
+ └── my-new-strategy/ # 自建策略(无短ID)
249
+ └── ...
250
+ ```
251
+
252
+ ## 触发场景与相关 Skills
253
+
254
+ 当用户提到以下内容时,应引导阅读对应的 Skill:
255
+
256
+ | 触发关键词 | Skill 目录 | 说明 |
257
+ | ------------------------------ | ------------------ | --------------------------------------- |
258
+ | 创建策略、写策略、生成策略包 | `strategy-builder` | 自然语言 → FEP v2.0 策略包 |
259
+ | 发布策略、上传策略、提交策略 | `skill-publish` | 验证 → 打包 → 发布到 Hub → 查询回测报告 |
260
+ | Fork 策略、下载策略、克隆策略 | `strategy-fork` | 从 Hub Fork 策略到本地,支持二次开发 |
261
+ | 策略包格式、FEP 规范、打包回测 | `strategy-pack` | FEP v2.0 规范详解,打包和校验指南 |
262
+
263
+ ## 配置选项
264
+
265
+ | 配置项 | 环境变量 | 说明 | 默认值 |
266
+ | ------------------ | -------------------------- | ---------------- | ---------------------------- |
267
+ | `skillApiKey` | `SKILL_API_KEY` | Hub API Key | 必填 |
268
+ | `skillApiUrl` | `SKILL_API_URL` | Hub 服务地址 | `https://hub.openfinclaw.ai` |
269
+ | `requestTimeoutMs` | `SKILL_REQUEST_TIMEOUT_MS` | 请求超时(毫秒) | `60000` |
270
+
271
+ ## 常见问题
272
+
273
+ ### Q: API Key 在哪里获取?
274
+
275
+ 访问 https://hub.openfinclaw.ai 登录后在个人设置中获取。
276
+
277
+ ### Q: Fork 的策略可以修改吗?
278
+
279
+ 可以。Fork 下载到本地后,可以自由修改 `scripts/strategy.py`,然后发布为自己的新版本。
280
+
281
+ ### Q: 发布策略会公开吗?
282
+
283
+ 取决于 `fep.yaml` 中的 `identity.visibility` 设置:
284
+
285
+ - `public`: 公开,社区可见可 Fork
286
+ - `private`: 私有,仅自己可见
287
+ - `unlisted`: 不公开但可通过链接访问
288
+
289
+ ### Q: 如何检查 openfinclaw 是否已安装?
290
+
291
+ ```bash
292
+ openclaw plugins list | grep openfinclaw
293
+ ```
294
+
295
+ ## 链接
296
+
297
+ - **Hub 平台**: https://hub.openfinclaw.ai
298
+ - **排行榜**: https://hub.openfinclaw.ai/leaderboard
299
+ - **策略发现**: https://hub.openfinclaw.ai/discover
300
+ - **获取 API Key**: https://hub.openfinclaw.ai/dashboard
301
+ - **GitHub 仓库**: https://github.com/cryptoSUN2049/openFinclaw
@@ -0,0 +1,316 @@
1
+ ---
2
+ name: skill-publish
3
+ description: "Skill Publishing Agent. Use when the user wants to publish a strategy to the server, check publish/backtest status, or view backtest report. Flow: validate → zip → publish → poll verify → get report. Supports FEP v2.0 protocol."
4
+ metadata: { "openclaw": { "requires": { "extensions": ["openfinclaw"] } } }
5
+ ---
6
+
7
+ # Skill Publishing
8
+
9
+ When the user talks about **publishing a strategy**, **submitting a skill**, **checking backtest status**, or **viewing backtest report**, use the skill publishing tools. The server automatically runs backtest after publishing.
10
+
11
+ ## When to trigger
12
+
13
+ - User says: 发布策略、发布 Skill、上传策略、提交策略
14
+ - User asks: 回测状态、发布状态、回测结果、回测报告
15
+ - User wants: 发布到服务器、查看发布结果
16
+
17
+ ## Visibility Warning (IMPORTANT)
18
+
19
+ Before publishing, **always check** `identity.visibility` in the strategy's `fep.yaml`:
20
+
21
+ | Visibility | Behavior |
22
+ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
23
+ | `public` | Strategy will be uploaded to **https://hub.openfinclaw.ai** and made **publicly visible**. Community members can view, fork, and evolve the strategy. |
24
+ | `private` | Strategy is stored privately; only the owner can access it. |
25
+ | `unlisted` | Strategy is accessible via direct link but not listed in public galleries. |
26
+
27
+ **If `visibility: public` is detected:**
28
+
29
+ 1. **Warn the user** before proceeding:
30
+
31
+ > ⚠️ 该策略将上传到 **https://hub.openfinclaw.ai** 并设为**公开**。社区成员可以查看、fork 和进化您的策略。如果您希望保持私有,请将 `fep.yaml` 中的 `identity.visibility` 改为 `private`。
32
+
33
+ 2. **Wait for user confirmation** before zipping/publishing.
34
+
35
+ 3. If user wants private: instruct them to update `fep.yaml`:
36
+ ```yaml
37
+ identity:
38
+ visibility: private # change from public to private
39
+ ```
40
+
41
+ ## Recommended flow
42
+
43
+ 1. **Validate first**: For a **directory** (not yet zipped), use `skill_validate` with `dirPath` first. Only proceed when `valid: true`.
44
+ 2. **Check visibility**: Before zipping, read the `fep.yaml` and check `identity.visibility`:
45
+ - If `visibility: public`: **MUST warn user** that the strategy will be uploaded to **https://hub.openfinclaw.ai** and made **publicly visible** for community evolution/forking. Ask if they want to change to `visibility: private` instead.
46
+ - If `visibility: private` or `unlisted`: Proceed without warning.
47
+ 3. **Create ZIP**: Zip the directory (e.g. `zip -r ../skill.zip fep.yaml scripts/`). The ZIP must contain `fep.yaml` at root.
48
+ 4. **Publish**: Use `skill_publish` with the ZIP `filePath`. The server will:
49
+ - Parse `fep.yaml`
50
+ - Auto-increment version if exists
51
+ - Run automatic backtest
52
+ - Return `submissionId` and `backtestTaskId`
53
+ 5. **Poll verify**: Use `skill_publish_verify` with `submissionId` or `backtestTaskId`. Repeat until `backtestStatus` is:
54
+ - `completed` — Success, `backtestReport` contains full results
55
+ - `failed` — Backtest failed
56
+ - `rejected` — Strategy rejected
57
+ 6. **Get report**: When `backtestStatus === "completed"`, the response includes full `backtestReport` with performance, equity_curve, trade_journal.
58
+
59
+ ## Tools
60
+
61
+ | Tool | Purpose |
62
+ | ---------------------- | ---------------------------------------------------------------------------- |
63
+ | `skill_validate` | Validate strategy package directory locally (FEP v2.0) before zipping |
64
+ | `skill_publish` | POST ZIP to server; returns submissionId, backtestTaskId, and initial status |
65
+ | `skill_publish_verify` | GET publish/backtest status by submissionId or backtestTaskId |
66
+
67
+ ## API Configuration
68
+
69
+ The plugin requires configuration:
70
+
71
+ - `skillApiUrl`: Server URL (default: `https://hub.openfinclaw.ai`)
72
+ - `skillApiKey`: API key with `fch_` prefix (68 chars)
73
+
74
+ Configure via:
75
+
76
+ - Plugin config: `skillApiUrl`, `skillApiKey`
77
+ - Environment: `SKILL_API_URL`, `SKILL_API_KEY`
78
+
79
+ ### ⚠️ API Key Security
80
+
81
+ **IMPORTANT: Never expose your Hub API Key!**
82
+
83
+ - The API Key (`fch_` prefix) is **only** for hub.openfinclaw.ai API authentication
84
+ - **DO NOT** commit API Keys to Git repositories or share publicly
85
+ - **DO NOT** expose real API Keys in public chats, screenshots, or code examples
86
+ - If you suspect a Key has been leaked, regenerate it immediately in Hub settings
87
+
88
+ ## Response fields
89
+
90
+ ### skill_publish response
91
+
92
+ | Field | Description |
93
+ | ---------------- | ---------------------------------------------------------------------- |
94
+ | `slug` | Strategy unique identifier (from fep identity.id) |
95
+ | `entryId` | Strategy entry UUID |
96
+ | `version` | Published version (may be auto-incremented) |
97
+ | `status` | Combined publish+backtest status |
98
+ | `submissionId` | Submission ID for verify endpoint |
99
+ | `backtestTaskId` | Backtest task ID for verify endpoint |
100
+ | `backtestStatus` | Backtest status: submitted/queued/processing/completed/failed/rejected |
101
+ | `backtestReport` | Full report when backtest completed |
102
+
103
+ ### skill_publish_verify response
104
+
105
+ | Field | Description |
106
+ | -------------------- | ------------------------------- |
107
+ | `strategyUploaded` | Strategy saved to database |
108
+ | `backtestCompleted` | Backtest reached terminal state |
109
+ | `backtestReportInDb` | Full report saved to database |
110
+ | `backtestReport` | Complete report when completed |
111
+
112
+ ## Backtest report structure (FEP v2.0)
113
+
114
+ When `backtestStatus === "completed"`:
115
+
116
+ ```json
117
+ {
118
+ "alpha": null,
119
+ "taskId": "bt-2be0c156bfe2",
120
+ "metadata": {
121
+ "id": "tsla-simple-test",
122
+ "name": "TSLA Simple Test Strategy",
123
+ "tags": ["tsla", "simple", "test"],
124
+ "type": "strategy",
125
+ "style": "trend",
126
+ "author": { "name": "OpenFinClaw" },
127
+ "market": "US",
128
+ "license": "MIT",
129
+ "summary": "Simple TSLA strategy for testing",
130
+ "version": "1.0.0"
131
+ },
132
+ "integrity": {
133
+ "fepHash": "sha256:...",
134
+ "codeHash": "sha256:...",
135
+ "contentCID": "Qm...",
136
+ "contentHash": "sha256:...",
137
+ "publishedAt": "2026-03-12T10:18:28.782727+00:00",
138
+ "timestampProof": "..."
139
+ },
140
+ "performance": {
141
+ "totalReturn": 0.22,
142
+ "sharpe": 0.12,
143
+ "maxDrawdown": -0.15,
144
+ "totalTrades": 189,
145
+ "winRate": 68.25,
146
+ "profitFactor": 1.32,
147
+ "sortino": 0.13,
148
+ "annualizedReturn": 0.18,
149
+ "calmar": 0.37,
150
+ "returnsVolatility": 0.25,
151
+ "riskReturnRatio": 0.88,
152
+ "expectancy": 120.5,
153
+ "avgWinner": 350.2,
154
+ "avgLoser": -180.3,
155
+ "maxWinner": 1200.0,
156
+ "maxLoser": -450.0,
157
+ "longRatio": 0.65,
158
+ "pnlTotal": 22000.0,
159
+ "startingBalance": 100000.0,
160
+ "endingBalance": 122000.0,
161
+ "backtestStart": "2024-01-01",
162
+ "backtestEnd": "2024-12-31",
163
+ "totalOrders": 378,
164
+ "hints": ["Strategy performed well in trending markets."]
165
+ },
166
+ "equityCurve": [
167
+ { "date": "2024-01-02", "equity": 100500.0 },
168
+ { "date": "2024-01-03", "equity": 101200.0 }
169
+ ],
170
+ "drawdownCurve": [
171
+ { "date": "2024-01-02", "drawdown": 0.0 },
172
+ { "date": "2024-01-15", "drawdown": -0.05 }
173
+ ],
174
+ "monthlyReturns": [
175
+ { "month": "2024-01", "return": 0.05 },
176
+ { "month": "2024-02", "return": -0.02 }
177
+ ],
178
+ "trades": [
179
+ {
180
+ "open_date": "2024-01-15",
181
+ "close_date": "2024-01-20",
182
+ "side": "BUY",
183
+ "quantity": 100.0,
184
+ "avg_open": 250.0,
185
+ "avg_close": 260.0,
186
+ "realized_pnl": "+$1,000.00",
187
+ "return_pct": 0.04
188
+ }
189
+ ]
190
+ }
191
+ ```
192
+
193
+ ### Top-level fields
194
+
195
+ | Field | Type | Description |
196
+ | ---------------- | ---------------- | ----------------------------------------- |
197
+ | `alpha` | `number \| null` | Alpha coefficient, strategy excess return |
198
+ | `taskId` | `string` | Backtest task unique identifier |
199
+ | `metadata` | `object` | Strategy metadata |
200
+ | `integrity` | `object` | Integrity verification info |
201
+ | `performance` | `object` | Backtest performance metrics |
202
+ | `equityCurve` | `array` | Equity curve data points |
203
+ | `drawdownCurve` | `array` | Drawdown curve data points |
204
+ | `monthlyReturns` | `array` | Monthly returns data |
205
+ | `trades` | `array` | Complete trade records |
206
+
207
+ ### Performance fields (FEP v2.0)
208
+
209
+ #### Core Metrics
210
+
211
+ | Field | Type | Description |
212
+ | -------------- | -------- | ------------------------------ |
213
+ | `totalReturn` | `number` | Total return (decimal) |
214
+ | `sharpe` | `number` | Sharpe ratio (252-day annual) |
215
+ | `maxDrawdown` | `number` | Maximum drawdown (negative) |
216
+ | `totalTrades` | `int` | Number of complete trade round |
217
+ | `winRate` | `number` | Win rate (percentage) |
218
+ | `profitFactor` | `number` | Profit factor |
219
+
220
+ #### Return Analysis
221
+
222
+ | Field | Type | Description |
223
+ | ------------------- | -------- | --------------------------- |
224
+ | `sortino` | `number` | Sortino ratio |
225
+ | `annualizedReturn` | `number` | CAGR annualized return |
226
+ | `calmar` | `number` | Calmar ratio (CAGR / MaxDD) |
227
+ | `returnsVolatility` | `number` | Returns volatility |
228
+ | `riskReturnRatio` | `number` | Risk-return ratio |
229
+
230
+ #### Trade Analysis
231
+
232
+ | Field | Type | Description |
233
+ | ------------ | -------- | ------------------------- |
234
+ | `expectancy` | `number` | Expected profit per trade |
235
+ | `avgWinner` | `number` | Average winning trade |
236
+ | `avgLoser` | `number` | Average losing trade |
237
+ | `maxWinner` | `number` | Largest winning trade |
238
+ | `maxLoser` | `number` | Largest losing trade |
239
+ | `longRatio` | `number` | Long position ratio |
240
+
241
+ #### Extended Metrics
242
+
243
+ | Field | Type | Description |
244
+ | ----------------- | -------- | ------------------------ |
245
+ | `pnlTotal` | `number` | Total profit/loss amount |
246
+ | `startingBalance` | `number` | Initial capital |
247
+ | `endingBalance` | `number` | Final capital |
248
+ | `backtestStart` | `string` | Backtest start date |
249
+ | `backtestEnd` | `string` | Backtest end date |
250
+ | `totalOrders` | `int` | Total number of orders |
251
+
252
+ ### Time Series Data
253
+
254
+ #### equityCurve format
255
+
256
+ ```json
257
+ [
258
+ { "date": "2024-01-02", "equity": 100500.0 },
259
+ { "date": "2024-01-03", "equity": 101200.0 }
260
+ ]
261
+ ```
262
+
263
+ #### drawdownCurve format
264
+
265
+ ```json
266
+ [
267
+ { "date": "2024-01-02", "drawdown": 0.0 },
268
+ { "date": "2024-01-15", "drawdown": -0.05 }
269
+ ]
270
+ ```
271
+
272
+ #### monthlyReturns format
273
+
274
+ ```json
275
+ [
276
+ { "month": "2024-01", "return": 0.05 },
277
+ { "month": "2024-02", "return": -0.02 }
278
+ ]
279
+ ```
280
+
281
+ #### trades format
282
+
283
+ | Field | Type | Description |
284
+ | -------------- | -------- | -------------------------- |
285
+ | `open_date` | `string` | Position open date |
286
+ | `close_date` | `string` | Position close date |
287
+ | `side` | `string` | Trade direction (BUY) |
288
+ | `quantity` | `number` | Position size |
289
+ | `avg_open` | `number` | Average open price |
290
+ | `avg_close` | `number` | Average close price |
291
+ | `realized_pnl` | `string` | Realized P&L with currency |
292
+ | `return_pct` | `number` | Return percentage |
293
+
294
+ ## Post-publish guidance
295
+
296
+ After the strategy is successfully published and backtest completed, inform the user:
297
+
298
+ > ✅ 策略发布成功!请访问 **https://hub.openfinclaw.ai/en/dashboard/entries** 查看策略详情和回测报告。
299
+
300
+ **Do NOT** provide strategy-specific URLs like `https://hub.openfinclaw.ai/en/strategy/{entryId}`. Always direct users to the dashboard entries page.
301
+
302
+ ## Example workflow
303
+
304
+ ```
305
+ User: 发布我的策略到服务器
306
+ Agent:
307
+ 1. skill_validate(dirPath: "/path/to/strategy")
308
+ → valid: true
309
+ 2. [zip directory]
310
+ 3. skill_publish(filePath: "/path/to/skill.zip")
311
+ → submissionId: "abc-123", backtestTaskId: "bt-xyz", status: "pending"
312
+ 4. skill_publish_verify(submissionId: "abc-123")
313
+ → backtestStatus: "processing" (poll again)
314
+ 5. skill_publish_verify(submissionId: "abc-123")
315
+ → backtestStatus: "completed", backtestReport: { ... }
316
+ ```