@alphafox/cli 0.3.14 → 0.3.15
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.
- package/dist/engine-backtest/run-command.js +3 -3
- package/dist/engine-backtest/sweep-command.js +4 -4
- package/dist/engine-backtest/web-ui-config-defaults.d.ts +10 -0
- package/dist/engine-backtest/web-ui-config-defaults.js +46 -0
- package/dist/skills-manifest.json +43 -43
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/account/SKILL.md +1 -1
- package/skills/admin/SKILL.md +1 -1
- package/skills/alphafox/SKILL.md +7 -6
- package/skills/alphafox-shared/SKILL.md +18 -2
- package/skills/auth/SKILL.md +1 -1
- package/skills/cache/SKILL.md +1 -1
- package/skills/engine-backtest/SKILL.md +5 -5
- package/skills/exchange/SKILL.md +1 -1
- package/skills/market/SKILL.md +1 -1
- package/skills/notification/SKILL.md +1 -1
- package/skills/strategy/SKILL.md +3 -3
- package/skills/trading/SKILL.md +8 -2
|
@@ -11,8 +11,8 @@ const client_1 = require("../http/client");
|
|
|
11
11
|
const store_1 = require("../keychain/store");
|
|
12
12
|
const coverage_notice_1 = require("./coverage-notice");
|
|
13
13
|
const errors_1 = require("./errors");
|
|
14
|
-
const dca_first_order_amount_compat_1 = require("./dca-first-order-amount-compat");
|
|
15
14
|
const load_config_1 = require("./load-config");
|
|
15
|
+
const web_ui_config_defaults_1 = require("./web-ui-config-defaults");
|
|
16
16
|
const parse_args_1 = require("./parse-args");
|
|
17
17
|
const sweep_command_1 = require("./sweep-command");
|
|
18
18
|
const persist_1 = require("./persist");
|
|
@@ -195,7 +195,7 @@ async function executeEngineBacktestRun(args, flags, env = process.env, deps = {
|
|
|
195
195
|
if (needsApi) {
|
|
196
196
|
requireAuth(profile, env, tokensFn);
|
|
197
197
|
}
|
|
198
|
-
const config = (0,
|
|
198
|
+
const config = (0, web_ui_config_defaults_1.prepareEngineBacktestConfig)((0, load_config_1.loadEngineBacktestConfig)(args.configRaw, {
|
|
199
199
|
cwd: deps.cwd,
|
|
200
200
|
readFile: deps.readFile,
|
|
201
201
|
}));
|
|
@@ -353,7 +353,7 @@ async function executeEngineBacktestRun(args, flags, env = process.env, deps = {
|
|
|
353
353
|
runId,
|
|
354
354
|
definitionId: args.definitionId,
|
|
355
355
|
configSchemaVersion,
|
|
356
|
-
config: (0,
|
|
356
|
+
config: (0, web_ui_config_defaults_1.prepareEngineBacktestConfig)(plan.effectiveConfig ?? config),
|
|
357
357
|
subscriptionTier,
|
|
358
358
|
initialEquity: args.initialEquity,
|
|
359
359
|
tape: tapeResult.tape,
|
|
@@ -10,8 +10,8 @@ const paths_1 = require("../cache/paths");
|
|
|
10
10
|
const store_1 = require("../keychain/store");
|
|
11
11
|
const coverage_notice_1 = require("./coverage-notice");
|
|
12
12
|
const errors_1 = require("./errors");
|
|
13
|
-
const dca_first_order_amount_compat_1 = require("./dca-first-order-amount-compat");
|
|
14
13
|
const load_config_1 = require("./load-config");
|
|
14
|
+
const web_ui_config_defaults_1 = require("./web-ui-config-defaults");
|
|
15
15
|
const parse_axes_1 = require("./parse-axes");
|
|
16
16
|
const persist_1 = require("./persist");
|
|
17
17
|
const prepared_tape_1 = require("./prepared-tape");
|
|
@@ -72,10 +72,10 @@ async function executeEngineBacktestSweep(args, flags, env = process.env, deps =
|
|
|
72
72
|
if (persist) {
|
|
73
73
|
requireAuth(profile, env, tokensFn);
|
|
74
74
|
}
|
|
75
|
-
const config = asConfigRecord((0, load_config_1.loadEngineBacktestConfig)(args.configRaw, {
|
|
75
|
+
const config = asConfigRecord((0, web_ui_config_defaults_1.prepareEngineBacktestConfig)((0, load_config_1.loadEngineBacktestConfig)(args.configRaw, {
|
|
76
76
|
cwd: deps.cwd,
|
|
77
77
|
readFile: deps.readFile,
|
|
78
|
-
}));
|
|
78
|
+
})));
|
|
79
79
|
const axisInputs = (0, parse_axes_1.parseSweepAxesDocument)((0, load_config_1.loadConfigValue)(args.axesRaw, {
|
|
80
80
|
cwd: deps.cwd,
|
|
81
81
|
readFile: deps.readFile,
|
|
@@ -585,7 +585,7 @@ async function resolveConfigSchemaVersion(client, definitionId, explicit) {
|
|
|
585
585
|
return version;
|
|
586
586
|
}
|
|
587
587
|
async function planCoordinate(input) {
|
|
588
|
-
const nextConfig = asConfigRecord((0,
|
|
588
|
+
const nextConfig = asConfigRecord((0, web_ui_config_defaults_1.prepareEngineBacktestConfig)((0, sweep_kernel_1.applySweepCoordinate)(input.config, input.axes, input.coordinate)));
|
|
589
589
|
try {
|
|
590
590
|
const plan = await input.client.planBacktest({
|
|
591
591
|
definitionId: input.definitionId,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web create / backtest forms seed `common.execution.leverage` to 10
|
|
3
|
+
* (`applyInitialUiDefaults` in alphafox-web). Engine runtime treats a
|
|
4
|
+
* missing or non-positive leverage as 1x, so CLI runs that omit the
|
|
5
|
+
* field used to size positions at 1x while the website ran 10x.
|
|
6
|
+
*/
|
|
7
|
+
export declare const WEB_UI_DEFAULT_LEVERAGE = 10;
|
|
8
|
+
export declare function applyWebUiConfigDefaults(config: unknown): unknown;
|
|
9
|
+
/** Web UI defaults first, then DCA first-order aliases for older wasm. */
|
|
10
|
+
export declare function prepareEngineBacktestConfig(config: unknown): unknown;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WEB_UI_DEFAULT_LEVERAGE = void 0;
|
|
4
|
+
exports.applyWebUiConfigDefaults = applyWebUiConfigDefaults;
|
|
5
|
+
exports.prepareEngineBacktestConfig = prepareEngineBacktestConfig;
|
|
6
|
+
const dca_first_order_amount_compat_1 = require("./dca-first-order-amount-compat");
|
|
7
|
+
/**
|
|
8
|
+
* Web create / backtest forms seed `common.execution.leverage` to 10
|
|
9
|
+
* (`applyInitialUiDefaults` in alphafox-web). Engine runtime treats a
|
|
10
|
+
* missing or non-positive leverage as 1x, so CLI runs that omit the
|
|
11
|
+
* field used to size positions at 1x while the website ran 10x.
|
|
12
|
+
*/
|
|
13
|
+
exports.WEB_UI_DEFAULT_LEVERAGE = 10;
|
|
14
|
+
function applyWebUiConfigDefaults(config) {
|
|
15
|
+
const record = asRecord(config);
|
|
16
|
+
if (!record) {
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
19
|
+
const common = asRecord(record.common) ?? {};
|
|
20
|
+
const execution = asRecord(common.execution) ?? {};
|
|
21
|
+
if (hasPositiveLeverage(execution.leverage)) {
|
|
22
|
+
return config;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
...record,
|
|
26
|
+
common: {
|
|
27
|
+
...common,
|
|
28
|
+
execution: {
|
|
29
|
+
...execution,
|
|
30
|
+
leverage: exports.WEB_UI_DEFAULT_LEVERAGE,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Web UI defaults first, then DCA first-order aliases for older wasm. */
|
|
36
|
+
function prepareEngineBacktestConfig(config) {
|
|
37
|
+
return (0, dca_first_order_amount_compat_1.projectDcaFirstOrderAmountForLegacyRuntime)(applyWebUiConfigDefaults(config));
|
|
38
|
+
}
|
|
39
|
+
function hasPositiveLeverage(value) {
|
|
40
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
41
|
+
}
|
|
42
|
+
function asRecord(value) {
|
|
43
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
44
|
+
? value
|
|
45
|
+
: null;
|
|
46
|
+
}
|
|
@@ -1,153 +1,153 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"packageName": "@alphafox/cli",
|
|
4
|
-
"packageVersion": "0.3.
|
|
4
|
+
"packageVersion": "0.3.15",
|
|
5
5
|
"contractVersion": "2026-08-13",
|
|
6
|
-
"bundleHash": "
|
|
6
|
+
"bundleHash": "5a448dd875e5739dfb875df709ec51e5cf52c13d41e8b090c11150dbf7a8af02",
|
|
7
7
|
"skills": [
|
|
8
8
|
{
|
|
9
9
|
"name": "alphafox",
|
|
10
|
-
"version": "0.3.
|
|
10
|
+
"version": "0.3.15",
|
|
11
11
|
"files": [
|
|
12
12
|
{
|
|
13
13
|
"path": "SKILL.md",
|
|
14
|
-
"sha256": "
|
|
15
|
-
"size":
|
|
14
|
+
"sha256": "99d3b6183d6282092c2a465a7e5eac1f883c7d03103f8ce013a49dd99da38c96",
|
|
15
|
+
"size": 7938
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
|
-
"hash": "
|
|
18
|
+
"hash": "97e82a7f473550fbc30f62498b3c4b67c573d2fcdf375088d145f92a8f2fef26"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "alphafox-account",
|
|
22
|
-
"version": "0.3.
|
|
22
|
+
"version": "0.3.15",
|
|
23
23
|
"files": [
|
|
24
24
|
{
|
|
25
25
|
"path": "SKILL.md",
|
|
26
|
-
"sha256": "
|
|
26
|
+
"sha256": "b6ddf9c10f2ea34f6e79a8f4b748b51172b9ea1250e50fb1cc4239c3af4ce005",
|
|
27
27
|
"size": 784
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
-
"hash": "
|
|
30
|
+
"hash": "e3837a27b7cdc0b48e56ae991fca582821105f4bb4b3969f5d0599c1d7a231d7"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"name": "alphafox-admin",
|
|
34
|
-
"version": "0.3.
|
|
34
|
+
"version": "0.3.15",
|
|
35
35
|
"files": [
|
|
36
36
|
{
|
|
37
37
|
"path": "SKILL.md",
|
|
38
|
-
"sha256": "
|
|
38
|
+
"sha256": "77618ab6cde7ef362842b342d06fa16cc2dbd922027d04f804eec8d7c49e9dbe",
|
|
39
39
|
"size": 788
|
|
40
40
|
}
|
|
41
41
|
],
|
|
42
|
-
"hash": "
|
|
42
|
+
"hash": "a45c5c1c4a5c6fa180573489eaea27f7fea129e707a3cccb77ef3fb103f75e99"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"name": "alphafox-auth",
|
|
46
|
-
"version": "0.3.
|
|
46
|
+
"version": "0.3.15",
|
|
47
47
|
"files": [
|
|
48
48
|
{
|
|
49
49
|
"path": "SKILL.md",
|
|
50
|
-
"sha256": "
|
|
50
|
+
"sha256": "0b45e18fc46856109de426500a30b88ed77695e6569b4d6a1a9dae7d12fa6a8c",
|
|
51
51
|
"size": 2371
|
|
52
52
|
}
|
|
53
53
|
],
|
|
54
|
-
"hash": "
|
|
54
|
+
"hash": "a9672faff2e48abfd767c7999e2880d854062d98b831670e978a81d376403b0e"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"name": "alphafox-cache",
|
|
58
|
-
"version": "0.3.
|
|
58
|
+
"version": "0.3.15",
|
|
59
59
|
"files": [
|
|
60
60
|
{
|
|
61
61
|
"path": "SKILL.md",
|
|
62
|
-
"sha256": "
|
|
62
|
+
"sha256": "73af772f675580a1cfc7508b0f68d7273c25fcaa65eecda10d22c47ec7eb1833",
|
|
63
63
|
"size": 1530
|
|
64
64
|
}
|
|
65
65
|
],
|
|
66
|
-
"hash": "
|
|
66
|
+
"hash": "8975bbab8c376381a67a944112d54452ef55eb5bdbfe5a4622e87268a44e5fa2"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"name": "alphafox-engine-backtest",
|
|
70
|
-
"version": "0.3.
|
|
70
|
+
"version": "0.3.15",
|
|
71
71
|
"files": [
|
|
72
72
|
{
|
|
73
73
|
"path": "SKILL.md",
|
|
74
|
-
"sha256": "
|
|
75
|
-
"size":
|
|
74
|
+
"sha256": "9b4742a67af7b07afb445627a2e14cdba5e8926be7440c18315626e8780572e7",
|
|
75
|
+
"size": 9170
|
|
76
76
|
}
|
|
77
77
|
],
|
|
78
|
-
"hash": "
|
|
78
|
+
"hash": "7cd1f64a9e679938e1afd1e11de1a113445f149691f5e15a7a853c7a5bb042f3"
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "alphafox-exchange",
|
|
82
|
-
"version": "0.3.
|
|
82
|
+
"version": "0.3.15",
|
|
83
83
|
"files": [
|
|
84
84
|
{
|
|
85
85
|
"path": "SKILL.md",
|
|
86
|
-
"sha256": "
|
|
86
|
+
"sha256": "6d1683c0909b392e5f929b2e8de29f218113bbf578a334692eb8eb1662d302e1",
|
|
87
87
|
"size": 744
|
|
88
88
|
}
|
|
89
89
|
],
|
|
90
|
-
"hash": "
|
|
90
|
+
"hash": "5447184c66956611bd2c71ba1faeb367bb95b8717c3e8ca19025de3b6850b375"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"name": "alphafox-market",
|
|
94
|
-
"version": "0.3.
|
|
94
|
+
"version": "0.3.15",
|
|
95
95
|
"files": [
|
|
96
96
|
{
|
|
97
97
|
"path": "SKILL.md",
|
|
98
|
-
"sha256": "
|
|
98
|
+
"sha256": "01224126f29826f83e372fe5bb3aa07d4204cf28455547b013c03dc4a0ac8750",
|
|
99
99
|
"size": 3079
|
|
100
100
|
}
|
|
101
101
|
],
|
|
102
|
-
"hash": "
|
|
102
|
+
"hash": "406ed129748398943d22697766e190907978e63f167e771ed493e70a28cc7846"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
"name": "alphafox-notification",
|
|
106
|
-
"version": "0.3.
|
|
106
|
+
"version": "0.3.15",
|
|
107
107
|
"files": [
|
|
108
108
|
{
|
|
109
109
|
"path": "SKILL.md",
|
|
110
|
-
"sha256": "
|
|
110
|
+
"sha256": "ebfbaee79078a493f1e0d58088a749a742f50d2d8c1f98b258278a257f64878f",
|
|
111
111
|
"size": 699
|
|
112
112
|
}
|
|
113
113
|
],
|
|
114
|
-
"hash": "
|
|
114
|
+
"hash": "e60b39e768b0366b30ad55032c34237debe292abe43fdcd494711399d9470d40"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"name": "alphafox-shared",
|
|
118
|
-
"version": "0.3.
|
|
118
|
+
"version": "0.3.15",
|
|
119
119
|
"files": [
|
|
120
120
|
{
|
|
121
121
|
"path": "SKILL.md",
|
|
122
|
-
"sha256": "
|
|
123
|
-
"size":
|
|
122
|
+
"sha256": "1493f50a85062f93b561f5433d504138f201a56865646bc1d56ed5dc8bee5ff1",
|
|
123
|
+
"size": 6920
|
|
124
124
|
}
|
|
125
125
|
],
|
|
126
|
-
"hash": "
|
|
126
|
+
"hash": "79e698ea6f84599996d348bb2f663af2f189cf11adb073c3691353f665ce3e03"
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
"name": "alphafox-strategy",
|
|
130
|
-
"version": "0.3.
|
|
130
|
+
"version": "0.3.15",
|
|
131
131
|
"files": [
|
|
132
132
|
{
|
|
133
133
|
"path": "SKILL.md",
|
|
134
|
-
"sha256": "
|
|
135
|
-
"size":
|
|
134
|
+
"sha256": "d17d8d3f494aa4a5fbdac8f908d27706ee3f8fe660c026a3546924c300c61217",
|
|
135
|
+
"size": 4862
|
|
136
136
|
}
|
|
137
137
|
],
|
|
138
|
-
"hash": "
|
|
138
|
+
"hash": "c2b543c9118e9a1d3110e6b99ec94477cbb9477b3d90fc78461ac56e2258f7c5"
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
"name": "alphafox-trading",
|
|
142
|
-
"version": "0.3.
|
|
142
|
+
"version": "0.3.15",
|
|
143
143
|
"files": [
|
|
144
144
|
{
|
|
145
145
|
"path": "SKILL.md",
|
|
146
|
-
"sha256": "
|
|
147
|
-
"size":
|
|
146
|
+
"sha256": "8e1809c8bbfad41e445f9f86c3c7fa5b7cc3dc7083cc8e653d21ccc00e390583",
|
|
147
|
+
"size": 4079
|
|
148
148
|
}
|
|
149
149
|
],
|
|
150
|
-
"hash": "
|
|
150
|
+
"hash": "2315ab7a7f460a9ba27daba3123a170ac28ca7dba0a3840c404c8c9d554dd939"
|
|
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.
|
|
3
|
+
export declare const CLI_VERSION = "0.3.15";
|
|
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.
|
|
6
|
+
exports.CLI_VERSION = "0.3.15";
|
|
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
package/skills/account/SKILL.md
CHANGED
package/skills/admin/SKILL.md
CHANGED
package/skills/alphafox/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alphafox
|
|
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.
|
|
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 回测 or 运行策略, include the dashboard URL from the domain skill. When the user asks 排行榜, include https://www.alphafox.app/zh/dashboard/leaderboard. 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.15
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AlphaFox
|
|
@@ -33,15 +33,16 @@ A **trader** is a running strategy instance (paper or live), not a person. Creat
|
|
|
33
33
|
|
|
34
34
|
If several rows apply, load **all** of them (typical: `alphafox-shared` + `alphafox-market` + one domain skill).
|
|
35
35
|
|
|
36
|
-
- “帮我配/建一个网格/DCA/跟单策略” → `alphafox-strategy` (pick definition, ask knobs, validate `{common, strategy}`) **and** `alphafox-market` (resolve tickers) **and** `alphafox-trading` (create the trader). Hidden copy variants still create through `alphafox-trading`.
|
|
37
|
-
- “帮我回测这个配置” → `alphafox-strategy` (definition + config) **and** `alphafox-engine-backtest`.
|
|
36
|
+
- “帮我配/建一个网格/DCA/跟单策略” → `alphafox-strategy` (pick definition, ask knobs, validate `{common, strategy}`) **and** `alphafox-market` (resolve tickers) **and** `alphafox-trading` (create the trader, default `autoStart: true`). Hidden copy variants still create through `alphafox-trading`. After create, include the trader URL from `alphafox-shared`.
|
|
37
|
+
- “帮我回测这个配置” → `alphafox-strategy` (definition + config) **and** `alphafox-engine-backtest`. After a persisted run, include the backtest URL from `alphafox-shared`.
|
|
38
|
+
- “排行榜” → `trader_leaderboard` as below, **and** include `https://www.alphafox.app/zh/dashboard/leaderboard`.
|
|
38
39
|
|
|
39
40
|
## Upgrade reminder
|
|
40
41
|
|
|
41
42
|
The CLI may print this on **stderr** at most once every 24 hours:
|
|
42
43
|
|
|
43
44
|
```text
|
|
44
|
-
[alphafox] update available: 0.3.
|
|
45
|
+
[alphafox] update available: 0.3.14 -> 0.3.15. After the user confirms, run: alphafox update --format json --no-input,
|
|
45
46
|
```
|
|
46
47
|
|
|
47
48
|
If you see that notice (or `updateAvailable: true` from `alphafox update --check`):
|
|
@@ -106,7 +107,7 @@ Present in the operator's language, this shape:
|
|
|
106
107
|
想跟单或者运行策略,告诉我即可。或者您想先看看排行榜,也可以直接告诉我。
|
|
107
108
|
```
|
|
108
109
|
|
|
109
|
-
Do not create a trader from this welcome. When they pick 跟单 / a classic strategy, read `alphafox-strategy` + `alphafox-trading` (+ `alphafox-market` if they name a ticker). When they ask for 排行榜, list `trader_leaderboard` (same flags, no `strategyDefinitionId` unless they named a type) and summarize — do not dump the envelope.
|
|
110
|
+
Do not create a trader from this welcome. When they pick 跟单 / a classic strategy, read `alphafox-strategy` + `alphafox-trading` (+ `alphafox-market` if they name a ticker). When they ask for 排行榜, list `trader_leaderboard` (same flags, no `strategyDefinitionId` unless they named a type), include `https://www.alphafox.app/zh/dashboard/leaderboard`, and summarize — do not dump the envelope.
|
|
110
111
|
|
|
111
112
|
## Do not mix these backtest paths
|
|
112
113
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alphafox-shared
|
|
3
|
-
description: Shared AlphaFox CLI rules for Agents — auth, profiles, envelopes, risk gates,
|
|
4
|
-
version: 0.3.
|
|
3
|
+
description: Shared AlphaFox CLI rules for Agents — auth, profiles, envelopes, risk gates, public operationIds, and dashboard links after 回测 / 运行策略 / 排行榜.
|
|
4
|
+
version: 0.3.15
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AlphaFox shared Agent contract
|
|
@@ -118,6 +118,22 @@ Uncataloged writes cannot carry a non-empty body. Find the `operationId` first.
|
|
|
118
118
|
- Never auto-retry unknown write outcomes.
|
|
119
119
|
- CLI `--yes` is UX only; the server still enforces role, ownership, and scopes.
|
|
120
120
|
|
|
121
|
+
## Dashboard links
|
|
122
|
+
|
|
123
|
+
After a persisted backtest, after creating or starting a trader, or when the operator asks 排行榜, include the matching web URL in the reply. Do not stop at CLI ids or `experimentUrl` alone.
|
|
124
|
+
|
|
125
|
+
Production (default profile):
|
|
126
|
+
|
|
127
|
+
| Surface | URL |
|
|
128
|
+
|---|---|
|
|
129
|
+
| Trader | `https://www.alphafox.app/zh/dashboard/traders/{traderId}` |
|
|
130
|
+
| Backtest | `https://www.alphafox.app/zh/dashboard/traders/backtest/{experimentId}` |
|
|
131
|
+
| Leaderboard | `https://www.alphafox.app/zh/dashboard/leaderboard` |
|
|
132
|
+
|
|
133
|
+
`--profile staging` → host `https://staging.alphafox.app`. `--profile local` → `http://127.0.0.1:3000`. Keep `/zh/dashboard/...`.
|
|
134
|
+
|
|
135
|
+
`traderId` is `data.trader.id` from create (or the id just started). `experimentId` is the persisted Experiment id (`data.experimentId`, or the `--experiment` / create-experiment id). Skip the backtest link only when persist was skipped and there is no Experiment id.
|
|
136
|
+
|
|
121
137
|
## Public operationIds only
|
|
122
138
|
|
|
123
139
|
Skills must reference registry `operationId`s (see `alphafox schema` / `alphafox catalog`). Shortcuts may only compose those operationIds. Do not hardcode internal service URLs or invent a second catalog.
|
package/skills/auth/SKILL.md
CHANGED
package/skills/cache/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alphafox-engine-backtest
|
|
3
|
-
description: Local Engine WASM backtest (alphafox engine-backtest run|sweep) vs catalog experiment CRUD.
|
|
4
|
-
version: 0.3.
|
|
3
|
+
description: Local Engine WASM backtest (alphafox engine-backtest run|sweep) vs catalog experiment CRUD. After a persisted run, include https://www.alphafox.app/zh/dashboard/traders/backtest/{experimentId}.
|
|
4
|
+
version: 0.3.15
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Engine Backtest
|
|
@@ -52,7 +52,7 @@ 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 }`.
|
|
55
|
+
`--config` is `{ common, strategy }` (the source file from skill `alphafox-strategy`). It is not the `validate_config` HTTP body `{ configSchemaVersion, config }`. Missing `common.execution.leverage` is filled to **10** before plan/run (same as the website form). An explicit leverage is kept. Engine runtime still treats a raw omitted field as 1x — do not skip this key in the source file.
|
|
56
56
|
|
|
57
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.
|
|
58
58
|
|
|
@@ -78,7 +78,7 @@ alphafox engine-backtest sweep \
|
|
|
78
78
|
|
|
79
79
|
`--mode` is `neighborhood|range`. `--search-mode` is `standard|fast`. `--concurrency` is 1–8; Free is always serial. After every local coordinate finishes, the command POSTs **one** `engine_backtest.experiments.byId.sweeps.create` summary (4 MiB / point-error caps). It never calls `runs.create` per coordinate and never writes Tape, curves, or full configs. `--no-persist` stays zero-write. A cancelled or incomplete search is not persisted. The same `clientSweepId` is reused if you rebuild the create body for retry; unknown write results (no Sweep id) fail instead of reporting `persisted: true`.
|
|
80
80
|
|
|
81
|
-
`--format jsonl` includes `planning`, `tape`, `sweep`, and `persist` stages. The final envelope includes counts, `elapsedMs`, best coordinate/config, `sweepId`, `persisted`, and an Experiment URL with `?tab=sweep`.
|
|
81
|
+
`--format jsonl` includes `planning`, `tape`, `sweep`, and `persist` stages. The final envelope includes counts, `elapsedMs`, best coordinate/config, `sweepId`, `persisted`, and an Experiment URL with `?tab=sweep`. After persist, include that dashboard URL in the reply (`https://www.alphafox.app/zh/dashboard/traders/backtest/{experimentId}?tab=sweep`).
|
|
82
82
|
|
|
83
83
|
Read / delete history through typed catalog commands. Delete is high-risk-write:
|
|
84
84
|
|
|
@@ -94,7 +94,7 @@ Owner isolation and 7-day expiry are enforced by the server. Applying a coordina
|
|
|
94
94
|
|
|
95
95
|
1. Edit config JSON.
|
|
96
96
|
2. `engine-backtest run` (reuse `--experiment` after the first create).
|
|
97
|
-
3. Read `data.metrics` / `data.engineVersion` / `data.runId` / `data.experimentUrl`. After the run, also read `data.coverageNotice` (`warning` = mid-range candle gaps; `notice` = start / other soft gaps).
|
|
97
|
+
3. Read `data.metrics` / `data.engineVersion` / `data.runId` / `data.experimentId` / `data.experimentUrl`. After the run, also read `data.coverageNotice` (`warning` = mid-range candle gaps; `notice` = start / other soft gaps). When an Experiment id exists, include the backtest dashboard URL from `alphafox-shared` (`https://www.alphafox.app/zh/dashboard/traders/backtest/{experimentId}`) in the reply — do not stop at metrics or the raw CLI `experimentUrl`.
|
|
98
98
|
4. Adjust parameters and run again. Do not invent a token flag if persist returns 401 — `alphafox auth login`.
|
|
99
99
|
5. After a long-range or 1m run, follow `alphafox-cache`: `alphafox cache status`. If `data.tape.large` is true, ask **回测下载的历史数据比较大,要不要我帮你清理本地缓存?** and wait for yes.
|
|
100
100
|
|
package/skills/exchange/SKILL.md
CHANGED
package/skills/market/SKILL.md
CHANGED
|
@@ -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.
|
|
4
|
+
version: 0.3.15
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Market
|
package/skills/strategy/SKILL.md
CHANGED
|
@@ -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.
|
|
4
|
+
version: 0.3.15
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Strategy definitions
|
|
@@ -41,7 +41,7 @@ Explain the type from those fields. Missing a layer → say unknown; do not fill
|
|
|
41
41
|
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
|
-
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.
|
|
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. If the operator does not pick leverage, write `common.execution.leverage: 10` (website form default). Omitting the field is not the same — Engine treats a missing leverage as **1x**.
|
|
45
45
|
3. Write `strategy-config.json` as the trader object:
|
|
46
46
|
|
|
47
47
|
```json
|
|
@@ -74,7 +74,7 @@ alphafox trading strategy_definitions byId validate_config --definitionId <id> -
|
|
|
74
74
|
|
|
75
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.
|
|
76
76
|
|
|
77
|
-
After it validates: create with `alphafox-trading
|
|
77
|
+
After it validates: create with `alphafox-trading` (default `autoStart: true`), or backtest with `alphafox-engine-backtest`. Do not create or backtest from this skill. Dashboard URLs after those actions live in `alphafox-shared`.
|
|
78
78
|
|
|
79
79
|
## operationIds
|
|
80
80
|
|
package/skills/trading/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alphafox-trading
|
|
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.
|
|
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. Default Engine create uses autoStart true (创建即开始). Use autoStart false only when the user asks to create without starting. After create or start, include https://www.alphafox.app/zh/dashboard/traders/{traderId}.
|
|
4
|
+
version: 0.3.15
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Running strategies (traders)
|
|
@@ -40,6 +40,12 @@ alphafox trading traders create --config @./create-trader.json --yes --format js
|
|
|
40
40
|
|
|
41
41
|
`trading.traders.create` is `high-risk-write` and needs `--yes`. Copy creates follow whatever `risk` the schema reports — `--dry-run` first, then `--yes` when required.
|
|
42
42
|
|
|
43
|
+
Default Engine create is **创建即开始**: set `autoStart` to `true` in the body. Omitting `autoStart` is not the same — the server treats a missing flag as do-not-start. Use `autoStart: false` only when the operator explicitly asks to create without starting (创建但不启动 / 暂时不开始 / 先创建不要跑). Do not create-then-`byId.start` as the default path.
|
|
44
|
+
|
|
45
|
+
After a successful create (or a later start), include the trader dashboard URL from `alphafox-shared` (`https://www.alphafox.app/zh/dashboard/traders/{traderId}`).
|
|
46
|
+
|
|
47
|
+
Create `config` must include `common.execution.leverage` unless the operator chose another value. Default **10**, matching the website form. Omitting it is not 10x — Engine uses **1x**.
|
|
48
|
+
|
|
43
49
|
If a required field is missing, re-read the schema and ask the operator. Do not invent ids. The CLI has no authoring-session surface; instantiate from a definition, connector, and config.
|
|
44
50
|
|
|
45
51
|
## High-risk start / stop
|