@alphafox/cli 0.3.13 → 0.3.14

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 (32) hide show
  1. package/dist/engine-backtest/activity.d.ts +60 -0
  2. package/dist/engine-backtest/activity.js +215 -0
  3. package/dist/engine-backtest/dca-first-order-amount-compat.d.ts +7 -0
  4. package/dist/engine-backtest/dca-first-order-amount-compat.js +71 -0
  5. package/dist/engine-backtest/load-config.d.ts +6 -2
  6. package/dist/engine-backtest/load-config.js +23 -0
  7. package/dist/engine-backtest/persist.d.ts +3 -0
  8. package/dist/engine-backtest/persist.js +22 -1
  9. package/dist/engine-backtest/prepared-tape.d.ts +10 -0
  10. package/dist/engine-backtest/prepared-tape.js +136 -0
  11. package/dist/engine-backtest/result-attribution.d.ts +35 -0
  12. package/dist/engine-backtest/result-attribution.js +156 -0
  13. package/dist/engine-backtest/run-command.js +21 -13
  14. package/dist/engine-backtest/sweep-command.d.ts +2 -2
  15. package/dist/engine-backtest/sweep-command.js +70 -51
  16. package/dist/engine-backtest/types.d.ts +18 -2
  17. package/dist/skills-manifest.json +40 -40
  18. package/dist/version.d.ts +1 -1
  19. package/dist/version.js +1 -1
  20. package/package.json +1 -1
  21. package/skills/account/SKILL.md +1 -1
  22. package/skills/admin/SKILL.md +1 -1
  23. package/skills/alphafox/SKILL.md +2 -2
  24. package/skills/alphafox-shared/SKILL.md +1 -1
  25. package/skills/auth/SKILL.md +1 -1
  26. package/skills/cache/SKILL.md +1 -1
  27. package/skills/engine-backtest/SKILL.md +3 -1
  28. package/skills/exchange/SKILL.md +1 -1
  29. package/skills/market/SKILL.md +1 -1
  30. package/skills/notification/SKILL.md +1 -1
  31. package/skills/strategy/SKILL.md +17 -11
  32. package/skills/trading/SKILL.md +1 -1
@@ -1,153 +1,153 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "packageName": "@alphafox/cli",
4
- "packageVersion": "0.3.13",
4
+ "packageVersion": "0.3.14",
5
5
  "contractVersion": "2026-08-13",
6
- "bundleHash": "6957fd9e293dff1afdc94922f9947590398cff0743f99eba5a2b2abb215df12c",
6
+ "bundleHash": "a303dae6ad43e08069748976c7caeb15cfc3ba298613937d27889943635521c4",
7
7
  "skills": [
8
8
  {
9
9
  "name": "alphafox",
10
- "version": "0.3.13",
10
+ "version": "0.3.14",
11
11
  "files": [
12
12
  {
13
13
  "path": "SKILL.md",
14
- "sha256": "9662240fd4497442711c155723e94ae60a9de84d2f433bbfac81a25d11caf9bd",
14
+ "sha256": "939e05b9b4ce70d295244d11405d7d2aae4bdd8e3a3702d842baaa65736a8fb7",
15
15
  "size": 7426
16
16
  }
17
17
  ],
18
- "hash": "8d4578a474c6063ff13ea22c45f9e2d75c1ab518567e077d838bd1bef6ec566e"
18
+ "hash": "438cc8c9d80833f35692b3a179c2e9f105c6a3527d88572589160f5d544c8b79"
19
19
  },
20
20
  {
21
21
  "name": "alphafox-account",
22
- "version": "0.3.13",
22
+ "version": "0.3.14",
23
23
  "files": [
24
24
  {
25
25
  "path": "SKILL.md",
26
- "sha256": "74fa3573aa94a54d995f8f78412a06269fc3ef903009f8b7b590f87a23ef2271",
26
+ "sha256": "e6d03f7993d0b0c44be224757401981e268dc0cf74f8902786ae7bf7666af436",
27
27
  "size": 784
28
28
  }
29
29
  ],
30
- "hash": "3f2644be04b0e3b1b4f4bc9c6f47708cb7576c715d50a8ac6d3ccc7143c75565"
30
+ "hash": "b67a97de103f05bb5b1df458e2afe50e084caf22f7ef043c9fa91546717c4321"
31
31
  },
32
32
  {
33
33
  "name": "alphafox-admin",
34
- "version": "0.3.13",
34
+ "version": "0.3.14",
35
35
  "files": [
36
36
  {
37
37
  "path": "SKILL.md",
38
- "sha256": "7fe8f8aa9f0031c46e3b0f5989eb5964fe0d64fc4be3d3ea187ebd11f8fde729",
38
+ "sha256": "9bc1859f7d3f3f7bf3fd9d48fb3d21e7553f4bf52944b9727af3d17a76d0e5fa",
39
39
  "size": 788
40
40
  }
41
41
  ],
42
- "hash": "c0bf71914f23455168a3d7e0471a107f8d92de8c2edb958c4749d61ed413d418"
42
+ "hash": "3e28bca0bd00951477125844aac06e00253e8d4247d5728ccf427a462b5ddf93"
43
43
  },
44
44
  {
45
45
  "name": "alphafox-auth",
46
- "version": "0.3.13",
46
+ "version": "0.3.14",
47
47
  "files": [
48
48
  {
49
49
  "path": "SKILL.md",
50
- "sha256": "f76da1d4e97f3bc7d71afe9487de0e87258afc0e5de85e3cee588b656dfcfef7",
50
+ "sha256": "6bb282a22450e2ef55f3e7cf1488c8d2f878cb0d863e56f1bd79c1506b2cbd40",
51
51
  "size": 2371
52
52
  }
53
53
  ],
54
- "hash": "d2fafe541e2be36e4672ad9ee9473113d8f4f4649247148ff5daacc2dfaefd21"
54
+ "hash": "da361f46c23f048449e92a22206e359f8cc91568ec0472678ffdf5c3810f3f83"
55
55
  },
56
56
  {
57
57
  "name": "alphafox-cache",
58
- "version": "0.3.13",
58
+ "version": "0.3.14",
59
59
  "files": [
60
60
  {
61
61
  "path": "SKILL.md",
62
- "sha256": "da4cd692abb0e5a62a892b8e8c30cb39c0c77c14ec5f388bdfccf3a692a06d0b",
62
+ "sha256": "e23b41a9f268fcce0fab4c16cac275aa63b3b6a967403f81a4965361441957bb",
63
63
  "size": 1530
64
64
  }
65
65
  ],
66
- "hash": "bb6ee2004dc699d0392fedefd046520db202fffae856bc665bf6d79b21c2d26f"
66
+ "hash": "6ca7dac2f003c65e233be6de10a027e1a3bb35ef6c7ebe978f150873fe515394"
67
67
  },
68
68
  {
69
69
  "name": "alphafox-engine-backtest",
70
- "version": "0.3.13",
70
+ "version": "0.3.14",
71
71
  "files": [
72
72
  {
73
73
  "path": "SKILL.md",
74
- "sha256": "fbdf4e90837243fa7c4385e2078b4b80f6a8e0b1df97f5477ef69a9dfb340fef",
75
- "size": 8278
74
+ "sha256": "69f05e144065d8333d8aafa857c824a524e40e21e432565542a7872bb645b12f",
75
+ "size": 8443
76
76
  }
77
77
  ],
78
- "hash": "d0222abf0dbced2551c049483d8381ff85f8ab36e9b89f44dca65adbaaf301d9"
78
+ "hash": "b7002fac218ff2a7d016815175b8f01fdc1615f8c1dd538d80c84295b30cee77"
79
79
  },
80
80
  {
81
81
  "name": "alphafox-exchange",
82
- "version": "0.3.13",
82
+ "version": "0.3.14",
83
83
  "files": [
84
84
  {
85
85
  "path": "SKILL.md",
86
- "sha256": "a82200ac4fd9b1ebb07f2be560f484e4cc39a5b6365b1cf8f09da237206b3b9f",
86
+ "sha256": "3c3d8f2085f5e6b443c51da49d280eb955307d3bca83bba87f04d386dfc7450c",
87
87
  "size": 744
88
88
  }
89
89
  ],
90
- "hash": "49168e1b6cf992d1a357dd2e86a1cc2a41466aa3cb0c17cc058ef75027d309bb"
90
+ "hash": "7e9ee14179eb097e8e166aeedb96edc5d60c33e41614434b99926feeadec8f35"
91
91
  },
92
92
  {
93
93
  "name": "alphafox-market",
94
- "version": "0.3.13",
94
+ "version": "0.3.14",
95
95
  "files": [
96
96
  {
97
97
  "path": "SKILL.md",
98
- "sha256": "a824b1a49a29cb36f0a9c1d74187420f570137566f3a74f1685a38f7c1023032",
98
+ "sha256": "5e53acb8b08a853377c4bc2df6bf07afced7b32e04eabdaac6095a30ba94dd1b",
99
99
  "size": 3079
100
100
  }
101
101
  ],
102
- "hash": "4d5fb1a2e765811c504decf024ab6260969486776b42da1534f977e238ca399b"
102
+ "hash": "4fb075aa2d9e90b932a5645bafbdfb4a14b3db2eceb43625cd014e0f3251e7b2"
103
103
  },
104
104
  {
105
105
  "name": "alphafox-notification",
106
- "version": "0.3.13",
106
+ "version": "0.3.14",
107
107
  "files": [
108
108
  {
109
109
  "path": "SKILL.md",
110
- "sha256": "2425c81589f89db06eb361f61d3bcf817ed862a42d00174d31005385b736b681",
110
+ "sha256": "e8f68d39df1472a86b84ec9dbf260300745a462371f1e1ce4288e38c2f747553",
111
111
  "size": 699
112
112
  }
113
113
  ],
114
- "hash": "1d2d4243dba2410517c0d5add310709f20a3642bc5206e777bccd200d2fcb7ad"
114
+ "hash": "10d397d049af7ab75c35af14c48d6362ffc9bc4703ebb91f471b037a984dcb98"
115
115
  },
116
116
  {
117
117
  "name": "alphafox-shared",
118
- "version": "0.3.13",
118
+ "version": "0.3.14",
119
119
  "files": [
120
120
  {
121
121
  "path": "SKILL.md",
122
- "sha256": "895d98df84caa7813ed4083d23124bbb9572a93036578fdbaacb02574c29317d",
122
+ "sha256": "519a457d1889cb8eeca669fa6e9016468e34d4107b5a68212b803b9d47465950",
123
123
  "size": 5960
124
124
  }
125
125
  ],
126
- "hash": "df50ec696f3b3e4f58cc2f66b2ded0d4dd5b898e2a6aa822eb779f978d04062d"
126
+ "hash": "bea3bc79da430a1e5bfb3cd0291da3cb1cfe7f5550ba4f83eacaac2b16f00972"
127
127
  },
128
128
  {
129
129
  "name": "alphafox-strategy",
130
- "version": "0.3.13",
130
+ "version": "0.3.14",
131
131
  "files": [
132
132
  {
133
133
  "path": "SKILL.md",
134
- "sha256": "ebf636f9d4656f98e9c5ba3ba7c00f0816d5e564dece2fbab3242ccd1138f325",
135
- "size": 4398
134
+ "sha256": "31c3a39dc972625a540e782940006b2a7561332439849b2c0e5e605dc7b5612b",
135
+ "size": 4587
136
136
  }
137
137
  ],
138
- "hash": "4b4fcc5c20337ab2c50499bd58c33c5c0bf3eb167c48f2a53aa48ab06cedba5a"
138
+ "hash": "3a6d9c3ab1a9ee5912509e7e05a75cc64070181fb5df306de669c33c6f15ca08"
139
139
  },
140
140
  {
141
141
  "name": "alphafox-trading",
142
- "version": "0.3.13",
142
+ "version": "0.3.14",
143
143
  "files": [
144
144
  {
145
145
  "path": "SKILL.md",
146
- "sha256": "da1c8504eafcd201b8b0d6a06ab2c3ac19185c03a60c723ef8cb7e1d06213ca8",
146
+ "sha256": "6ce2a99527334d6beddd65eee8e17f4aae257fce2d93edf7f69e0680435adf53",
147
147
  "size": 3123
148
148
  }
149
149
  ],
150
- "hash": "154e7456e7abceacff29feeb082365fd81ed528004ebcb7899485a2dfef37f51"
150
+ "hash": "d235a9bfc387b32d992131ef1f589f86aa0100600c9bc8f61bf0261fb9b5e606"
151
151
  }
152
152
  ]
153
153
  }
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const CLI_NAME = "alphafox";
2
2
  export declare const CLI_PACKAGE = "@alphafox/cli";
3
- export declare const CLI_VERSION = "0.3.13";
3
+ export declare const CLI_VERSION = "0.3.14";
4
4
  export { CATALOG_VERSION as CLI_CONTRACT_VERSION } from "./catalog/operations";
package/dist/version.js CHANGED
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CLI_CONTRACT_VERSION = exports.CLI_VERSION = exports.CLI_PACKAGE = exports.CLI_NAME = void 0;
4
4
  exports.CLI_NAME = "alphafox";
5
5
  exports.CLI_PACKAGE = "@alphafox/cli";
6
- exports.CLI_VERSION = "0.3.13";
6
+ exports.CLI_VERSION = "0.3.14";
7
7
  var operations_1 = require("./catalog/operations");
8
8
  Object.defineProperty(exports, "CLI_CONTRACT_VERSION", { enumerable: true, get: function () { return operations_1.CATALOG_VERSION; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphafox/cli",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "AlphaFox CLI — Agent/Human entry for the public Application API.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-account
3
3
  description: Account, wallet, and subscription read paths.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Account / wallet
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-admin
3
3
  description: Admin-only operations reusing Web role authorization.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Admin
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox
3
3
  description: AlphaFox CLI entry router. Use for any AlphaFox request — install, update, login, whoami, 回测, engine backtest, 清理回测缓存 / 历史数据, strategy definitions, create/list/start/stop a running strategy (trader), ticker/标的 resolve (美股 or crypto), market data, exchange connectors, wallet, subscriptions, notifications, or admin. After a successful install and login, present the 新人引导 in this file (Lite square 带单员 + classic strategies). If a CLI command prints `[alphafox] update available`, ask the user「检测到新的版本,是否需要我帮你升级?」and only then run `alphafox update --format json --no-input`. After a large backtest, if tape cache is large, ask「回测下载的历史数据比较大,要不要我帮你清理本地缓存?」then open `alphafox-cache`. Start here, then open the routed domain skill. Do not guess alphafox-engine-backtest vs alphafox-strategy vs alphafox-trading from memory.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # AlphaFox
@@ -41,7 +41,7 @@ If several rows apply, load **all** of them (typical: `alphafox-shared` + `alpha
41
41
  The CLI may print this on **stderr** at most once every 24 hours:
42
42
 
43
43
  ```text
44
- [alphafox] update available: 0.3.12 -> 0.3.13. After the user confirms, run: alphafox update --format json --no-input,
44
+ [alphafox] update available: 0.3.13 -> 0.3.14. After the user confirms, run: alphafox update --format json --no-input,
45
45
  ```
46
46
 
47
47
  If you see that notice (or `updateAvailable: true` from `alphafox update --check`):
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-shared
3
3
  description: Shared AlphaFox CLI rules for Agents — auth, profiles, envelopes, risk gates, and public operationIds only.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # AlphaFox shared Agent contract
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-auth
3
3
  description: Login, status, logout, whoami, and environment isolation for AlphaFox CLI.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Auth Skill
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-cache
3
3
  description: Inspect and clean local Engine backtest caches (downloaded OHLCV tape and wasm runtime). Use when the user asks to 清理缓存, free disk, or after a large historical backtest.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Cache
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-engine-backtest
3
3
  description: Local Engine WASM backtest (alphafox engine-backtest run|sweep) vs catalog experiment CRUD.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Engine Backtest
@@ -52,6 +52,8 @@ alphafox engine-backtest run \
52
52
  --format jsonl --no-input
53
53
  ```
54
54
 
55
+ `--config` is `{ common, strategy }` (the source file from skill `alphafox-strategy`). It is not the `validate_config` HTTP body `{ configSchemaVersion, config }`.
56
+
55
57
  Also valid: `--from` / `--to` instead of `--range`. `--create-experiment --name "..."` when there is no `--experiment` (needs `strategyDefinitionId` + `strategyDefinitionDisplay` `{zh,en}`; pass `--definition-label-zh` / `--definition-label-en` or the CLI falls back to the definition id). Persisted runs use the account tier from `subscriptions.me.get`; if `--tier` is supplied, it must match. With `--no-persist`, `runs.create` is skipped and `--tier` may simulate `free|pro|pro_max` (default `pro`). `--data-quality` defaults to `basic` (soft gaps finish the run and appear as `coverageNotice`; `prefix_gap` is less severe than `internal_gap`). `--data-quality strict` still fails on any gap. `--replay-timeframe` defaults to `1m` (allowed `1m|3m|5m|15m|30m|1h|4h`); this is the replay/download bar and is merged with plan indicator timeframes so a 4h RSI grid still replays on 1m. `runs.create` is `write`, not `high-risk-write` — do not add `--yes`. Do not update or delete experiments through this command.
56
58
 
57
59
  `--format jsonl` writes one JSON object per progress line (`{event:"progress",stage,fraction}`), then a final `{ok:true,data:{...}}` envelope.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-exchange
3
3
  description: Exchange connectors list and connection management via Public API.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Exchange connectors
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-market
3
3
  description: Market data and ticker resolution for US equity perps, RWAs, and crypto on the same perp catalog. Use when the user names 美股, NVDA, AAPL, BTC, or any 标的. Keep the operator's asset class via symbolMetadata — do not rewrite NVDA into a crypto coin.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Market
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-notification
3
3
  description: Notification channels and subscriptions.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Notification
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-strategy
3
3
  description: Strategy definitions — list types, read a definition's contract, and validate config. Creating a running strategy is creating a trader; use alphafox-trading for that. Local Engine backtest is alphafox-engine-backtest.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Strategy definitions
@@ -42,28 +42,34 @@ The human answers knobs. You write JSON.
42
42
 
43
43
  1. Confirm the definition from `byId.get` in the operator's language (what it is, what drives it, how positions change).
44
44
  2. From `strategyConfigSchema` plus common required fields, ask **only** values the human must choose: symbols (resolve first), direction / mode, size, signal source, leverage. Do not walk every optional key.
45
- 3. Write `strategy-config.json` as:
45
+ 3. Write `strategy-config.json` as the trader object:
46
46
 
47
47
  ```json
48
48
  {
49
- "configSchemaVersion": 4,
50
- "config": {
51
- "common": {},
52
- "strategy": {}
53
- }
49
+ "common": {},
50
+ "strategy": {}
54
51
  }
55
52
  ```
56
53
 
57
- `configSchemaVersion` comes from the definition (`configSchemaVersion` on `byId.get` / list). Omit it only when the schema says it is optional; when present it must match the definition. `common` is shared risk / SLTP / execution / market. `strategy` is this type's parameters and decision logic. Do not use top-level `settings`, `policyId`, or `policyParams`.
54
+ `common` is shared risk / SLTP / execution / market. `strategy` is this type's parameters and decision logic. Do not use top-level `settings`, `policyId`, or `policyParams`. `configSchemaVersion` comes from the definition (`byId.get` / list); keep it off this file.
58
55
 
59
- 4. Keys and enums come from the definition schema, not from this skill. Do not ship a default `grid.json` / `dca.json`.
56
+ 4. Keys and enums come from the definition schema, not from this skill. Do not ship a default `grid.json` / `dca.json`. Reuse this source file for `engine-backtest --config` and as `trading.traders.create` `config`.
60
57
 
61
58
  ## Validate config
62
59
 
63
- Read `alphafox schema trading.strategy_definitions.byId.validate_config` first. Catalog `request.body` may look like a free `JsonObject`; still send the envelope above. The server checks the definition schema.
60
+ Read `alphafox schema trading.strategy_definitions.byId.validate_config` first. Catalog `request.body` may look like a free `JsonObject`; still send the HTTP envelope, wrapping the source file do not overwrite `strategy-config.json`:
61
+
62
+ ```json
63
+ {
64
+ "configSchemaVersion": 4,
65
+ "config": { "common": {}, "strategy": {} }
66
+ }
67
+ ```
68
+
69
+ `config` is the contents of `strategy-config.json`. `configSchemaVersion` must match the definition.
64
70
 
65
71
  ```bash
66
- alphafox trading strategy_definitions byId validate_config --definitionId <id> --config @./strategy-config.json --format json --no-input
72
+ alphafox trading strategy_definitions byId validate_config --definitionId <id> --config @./validate-config.json --format json --no-input
67
73
  ```
68
74
 
69
75
  `body_schema` / `body_schema_missing` (exit `64`): re-read the operation schema. Server field-path errors: fix that path. Do not retry with a different envelope.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-trading
3
3
  description: Running strategies (traders) — create, list, start, and stop. A trader is a live or paper strategy instance (grid, dca, copy, …), not a person.
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  ---
6
6
 
7
7
  # Running strategies (traders)