@alphafox/cli 0.3.2 → 0.3.4

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 (69) hide show
  1. package/README.md +4 -3
  2. package/dist/auth/loopback-callback.js +6 -6
  3. package/dist/catalog/allowlist.d.ts +1 -1
  4. package/dist/catalog/allowlist.js +1 -1
  5. package/dist/catalog/generated/registry.json +338 -49
  6. package/dist/catalog/generated/schemas.json +1880 -779
  7. package/dist/catalog/omit.d.ts +6 -0
  8. package/dist/catalog/omit.js +11 -0
  9. package/dist/catalog/operations.d.ts +1 -1
  10. package/dist/catalog/operations.js +5 -2
  11. package/dist/commands/run.js +10 -3
  12. package/dist/engine-backtest/load-config.d.ts +4 -0
  13. package/dist/engine-backtest/load-config.js +44 -0
  14. package/dist/engine-backtest/parse-args.d.ts +3 -1
  15. package/dist/engine-backtest/parse-args.js +87 -3
  16. package/dist/engine-backtest/parse-axes.d.ts +3 -0
  17. package/dist/engine-backtest/parse-axes.js +167 -0
  18. package/dist/engine-backtest/persist.d.ts +60 -1
  19. package/dist/engine-backtest/persist.js +196 -1
  20. package/dist/engine-backtest/return-curve.d.ts +27 -0
  21. package/dist/engine-backtest/return-curve.js +80 -0
  22. package/dist/engine-backtest/run-command.d.ts +1 -4
  23. package/dist/engine-backtest/run-command.js +61 -45
  24. package/dist/engine-backtest/sweep-command.d.ts +13 -0
  25. package/dist/engine-backtest/sweep-command.js +749 -0
  26. package/dist/engine-backtest/sweep-kernel/caps.d.ts +26 -0
  27. package/dist/engine-backtest/sweep-kernel/caps.js +48 -0
  28. package/dist/engine-backtest/sweep-kernel/index.d.ts +13 -0
  29. package/dist/engine-backtest/sweep-kernel/index.js +34 -0
  30. package/dist/engine-backtest/sweep-kernel/plan.d.ts +22 -0
  31. package/dist/engine-backtest/sweep-kernel/plan.js +320 -0
  32. package/dist/engine-backtest/sweep-kernel/results.d.ts +72 -0
  33. package/dist/engine-backtest/sweep-kernel/results.js +150 -0
  34. package/dist/engine-backtest/sweep-kernel/session.d.ts +55 -0
  35. package/dist/engine-backtest/sweep-kernel/session.js +56 -0
  36. package/dist/engine-backtest/sweep-kernel/types.d.ts +36 -0
  37. package/dist/engine-backtest/sweep-kernel/types.js +2 -0
  38. package/dist/engine-backtest/types.d.ts +130 -0
  39. package/dist/install/exec.js +5 -1
  40. package/dist/install/wizard.js +26 -29
  41. package/dist/resolve-symbols/catalog.d.ts +3 -0
  42. package/dist/resolve-symbols/catalog.js +50 -0
  43. package/dist/resolve-symbols/errors.d.ts +18 -0
  44. package/dist/resolve-symbols/errors.js +26 -0
  45. package/dist/resolve-symbols/exchanges.d.ts +8 -0
  46. package/dist/resolve-symbols/exchanges.js +53 -0
  47. package/dist/resolve-symbols/match.d.ts +6 -0
  48. package/dist/resolve-symbols/match.js +250 -0
  49. package/dist/resolve-symbols/parse-args.d.ts +5 -0
  50. package/dist/resolve-symbols/parse-args.js +106 -0
  51. package/dist/resolve-symbols/run-command.d.ts +21 -0
  52. package/dist/resolve-symbols/run-command.js +149 -0
  53. package/dist/resolve-symbols/types.d.ts +37 -0
  54. package/dist/resolve-symbols/types.js +2 -0
  55. package/dist/version.d.ts +1 -1
  56. package/dist/version.js +1 -1
  57. package/docs/alphafox-cli-installation-guide.md +2 -2
  58. package/package.json +1 -1
  59. package/skills/account/SKILL.md +1 -1
  60. package/skills/admin/SKILL.md +1 -1
  61. package/skills/alphafox/SKILL.md +38 -0
  62. package/skills/alphafox-shared/SKILL.md +5 -1
  63. package/skills/auth/SKILL.md +1 -1
  64. package/skills/engine-backtest/SKILL.md +48 -6
  65. package/skills/exchange/SKILL.md +1 -1
  66. package/skills/market/SKILL.md +27 -4
  67. package/skills/notification/SKILL.md +1 -1
  68. package/skills/strategy/SKILL.md +7 -20
  69. package/skills/trading/SKILL.md +3 -1
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveSymbolsHelpData = resolveSymbolsHelpData;
4
+ exports.executeResolveSymbols = executeResolveSymbols;
5
+ exports.cmdResolveSymbols = cmdResolveSymbols;
6
+ const profiles_1 = require("../config/profiles");
7
+ const envelope_1 = require("../envelope");
8
+ const client_1 = require("../http/client");
9
+ const catalog_1 = require("./catalog");
10
+ const errors_1 = require("./errors");
11
+ const exchanges_1 = require("./exchanges");
12
+ const match_1 = require("./match");
13
+ const parse_args_1 = require("./parse-args");
14
+ function extractErrorMessage(json, fallback) {
15
+ if (json && typeof json === "object") {
16
+ const o = json;
17
+ if (typeof o.message === "string")
18
+ return o.message;
19
+ if (typeof o.detail === "string")
20
+ return o.detail;
21
+ if (typeof o.error === "string")
22
+ return o.error;
23
+ if (o.error && typeof o.error === "object") {
24
+ const e = o.error;
25
+ if (typeof e.message === "string")
26
+ return e.message;
27
+ }
28
+ }
29
+ return fallback || "Request failed";
30
+ }
31
+ function extractErrorCode(json) {
32
+ if (json && typeof json === "object") {
33
+ const o = json;
34
+ if (typeof o.code === "string" || typeof o.code === "number")
35
+ return o.code;
36
+ }
37
+ return undefined;
38
+ }
39
+ function resolveSymbolsHelpData() {
40
+ return {
41
+ name: "resolve-symbols",
42
+ usage: parse_args_1.RESOLVE_SYMBOLS_USAGE,
43
+ notes: [
44
+ "Resolves user-mentioned tickers against the public linear-perp catalog from market.symbols.list",
45
+ "Default --exchange is binance (binance_perp_usdt). Aliases: binance|okx|bybit|bitget|hyperliquid|aster",
46
+ "Do not guess CCXT symbols. Exact match may be used directly; a single close match needs user confirmation; multiple close matches must be chosen by the user",
47
+ "Catalog CRUD remains alphafox market symbols list --exchange <id>",
48
+ ],
49
+ };
50
+ }
51
+ async function executeResolveSymbols(args, flags, env = process.env, deps = {}) {
52
+ if (args.help) {
53
+ throw new errors_1.ResolveSymbolsError({
54
+ type: "usage",
55
+ message: "internal: help should be handled by the command wrapper",
56
+ });
57
+ }
58
+ const exchange = (0, exchanges_1.resolveSymbolsExchangeId)(args.exchange);
59
+ const profile = (0, profiles_1.resolveProfile)(flags.profile, env, {
60
+ unsafeCustomEndpoint: flags.unsafeCustomEndpoint,
61
+ });
62
+ const api = deps.apiRequest ?? client_1.apiRequest;
63
+ const res = await api({
64
+ method: "GET",
65
+ path: (0, catalog_1.marketSymbolsPath)(exchange.id),
66
+ profile,
67
+ }, env);
68
+ if (res.status >= 400) {
69
+ throw new errors_1.ResolveSymbolsError({
70
+ type: "http",
71
+ status: res.status,
72
+ message: extractErrorMessage(res.json, res.bodyText),
73
+ code: extractErrorCode(res.json),
74
+ hint: res.status === 401 || res.status === 403
75
+ ? "Run alphafox auth login. Tokens live in the OS keychain."
76
+ : undefined,
77
+ details: res.json,
78
+ });
79
+ }
80
+ const catalog = (0, match_1.indexCatalogSymbols)((0, catalog_1.extractCatalogSymbols)(res.json));
81
+ return {
82
+ exchange: exchange.id,
83
+ exchangeLabel: exchange.label,
84
+ catalogSize: catalog.length,
85
+ queries: args.queries.map((query) => (0, match_1.resolveQueryAgainstCatalog)(query, catalog, args.limit)),
86
+ };
87
+ }
88
+ async function cmdResolveSymbols(args, flags, env = process.env, deps = {}) {
89
+ let parsed;
90
+ try {
91
+ parsed = (0, parse_args_1.parseResolveSymbolsArgs)(args);
92
+ }
93
+ catch (err) {
94
+ if ((0, errors_1.isResolveSymbolsError)(err)) {
95
+ (0, envelope_1.writeError)({
96
+ type: err.type,
97
+ subtype: err.subtype,
98
+ message: err.message,
99
+ hint: err.hint,
100
+ status: err.status,
101
+ details: err.details,
102
+ }, { exitCode: err.status === 401 || err.status === 403 ? 77 : undefined });
103
+ }
104
+ throw err;
105
+ }
106
+ if (parsed.help) {
107
+ (0, envelope_1.writeSuccess)(resolveSymbolsHelpData(), {
108
+ format: flags.format,
109
+ jq: flags.jq,
110
+ });
111
+ return 0;
112
+ }
113
+ const exchange = (0, exchanges_1.resolveSymbolsExchangeId)(parsed.exchange);
114
+ if (flags.dryRun) {
115
+ (0, envelope_1.writeSuccess)({
116
+ dryRun: true,
117
+ operationId: "market.symbols.list",
118
+ method: "GET",
119
+ path: (0, catalog_1.marketSymbolsPath)(exchange.id),
120
+ exchange: exchange.id,
121
+ exchangeLabel: exchange.label,
122
+ queries: parsed.queries,
123
+ }, { format: flags.format, jq: flags.jq });
124
+ return 0;
125
+ }
126
+ try {
127
+ const result = await executeResolveSymbols(parsed, flags, env, deps);
128
+ (0, envelope_1.writeSuccess)(result, {
129
+ format: flags.format,
130
+ jq: flags.jq,
131
+ meta: { operationId: "market.symbols.list" },
132
+ });
133
+ return 0;
134
+ }
135
+ catch (err) {
136
+ if ((0, errors_1.isResolveSymbolsError)(err)) {
137
+ (0, envelope_1.writeError)({
138
+ type: err.type,
139
+ subtype: err.subtype,
140
+ message: err.message,
141
+ hint: err.hint,
142
+ status: err.status,
143
+ code: err.code,
144
+ details: err.details,
145
+ }, { exitCode: err.status === 401 || err.status === 403 ? 77 : undefined });
146
+ }
147
+ throw err;
148
+ }
149
+ }
@@ -0,0 +1,37 @@
1
+ export type ResolveSymbolsStatus = "exact" | "close" | "ambiguous" | "none";
2
+ export type ResolveSymbolsMatchReason = "exact_canonical" | "exact_compact" | "exact_pair" | "exact_base" | "prefix" | "contains" | "close";
3
+ export interface ResolveSymbolsMatch {
4
+ readonly symbol: string;
5
+ readonly reason: ResolveSymbolsMatchReason;
6
+ readonly score: number;
7
+ }
8
+ export interface ResolveSymbolsQueryResult {
9
+ readonly query: string;
10
+ readonly status: ResolveSymbolsStatus;
11
+ readonly resolved: string | null;
12
+ readonly needsConfirmation: boolean;
13
+ readonly matches: readonly ResolveSymbolsMatch[];
14
+ readonly matchCount: number;
15
+ }
16
+ export interface ResolveSymbolsSuccess {
17
+ readonly exchange: string;
18
+ readonly exchangeLabel: string;
19
+ readonly catalogSize: number;
20
+ readonly queries: readonly ResolveSymbolsQueryResult[];
21
+ }
22
+ export interface ResolveSymbolsRunArgs {
23
+ readonly help: boolean;
24
+ readonly queries: readonly string[];
25
+ readonly exchange: string;
26
+ readonly limit: number;
27
+ }
28
+ export interface CatalogSymbol {
29
+ readonly symbol: string;
30
+ readonly base: string;
31
+ readonly quote: string;
32
+ readonly pair: string;
33
+ readonly compact: string;
34
+ readonly searchKey: string;
35
+ readonly baseKey: string;
36
+ readonly compactKey: string;
37
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
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.2";
3
+ export declare const CLI_VERSION = "0.3.4";
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.2";
6
+ exports.CLI_VERSION = "0.3.4";
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; } });
@@ -88,8 +88,8 @@ Parse the JSON envelope: `ok === true` means success. Errors land on
88
88
  ## Step 4: Tell the user to restart
89
89
 
90
90
  Ask the user to **restart the AI tool** so the new Skills are loaded.
91
- Then they can ask the Agent to use Alphafox (auth, catalog, trading,
92
- engine-backtest, …).
91
+ Then they can ask the Agent to use Alphafox. The entry skill `alphafox` routes
92
+ to auth, market, engine-backtest, strategy, trading, and the rest.
93
93
 
94
94
  ## Human wizard (do not run this from an Agent)
95
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphafox/cli",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
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.2
4
+ version: 0.3.4
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.2
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
7
  # Admin
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: alphafox
3
+ description: Alphafox CLI entry router. Use for any Alphafox request — install, login, whoami, 回测, engine backtest, strategy chat, traders, ticker/标的 resolve, market data, exchange connectors, wallet, subscriptions, notifications, or admin. Start here, then open the routed domain skill. Do not guess alphafox-engine-backtest vs alphafox-strategy from memory.
4
+ version: 0.3.4
5
+ ---
6
+
7
+ # Alphafox
8
+
9
+ This skill only routes. After choosing a row, **read that skill's `SKILL.md` and follow it**. Do not improvise domain procedures from this file.
10
+
11
+ Also read `alphafox-shared` before any CLI invocation (envelope, auth, risk, schema-first writes). Always `--format json --no-input`. Never `--token`.
12
+
13
+ Human-mentioned tickers go through `alphafox-market` (`alphafox resolve-symbols`) **before** they enter config, backtest, or writes.
14
+
15
+ ## Route
16
+
17
+ | User intent | Skill |
18
+ |---|---|
19
+ | Install, doctor, version, catalog, how to call the CLI | `alphafox-shared` |
20
+ | Login, logout, whoami, profile, staging vs production | `alphafox-auth` |
21
+ | Coin / ticker / 标的 / `BTC/USDT:USDT` / resolve a misspelled symbol | `alphafox-market` |
22
+ | Engine WASM backtest, experiment, `engine-backtest run`, persist a local run | `alphafox-engine-backtest` |
23
+ | Strategy chat, compiled strategy | `alphafox-strategy` |
24
+ | List / start / stop traders | `alphafox-trading` |
25
+ | Exchange connectors | `alphafox-exchange` |
26
+ | Account, wallet, subscription | `alphafox-account` |
27
+ | Notification channels | `alphafox-notification` |
28
+ | Admin-only operations | `alphafox-admin` |
29
+
30
+ If several rows apply, load **all** of them (typical: `alphafox-shared` + `alphafox-market` + one domain skill).
31
+
32
+ ## Do not mix these backtest paths
33
+
34
+ - Local Engine tape + wasm + optional persist → `alphafox-engine-backtest` (`alphafox engine-backtest run`, hyphen).
35
+ - Experiment catalog CRUD → same skill, underscore catalog `engine_backtest.*`.
36
+ - Chat-attached `/api/v1/backtests` (`backtests.*`) is **not** a CLI surface. Do not call it via typed commands, `schema`, or `alphafox api`.
37
+
38
+ Ambiguous “帮我回测” → `alphafox-engine-backtest`, after resolving symbols.
@@ -1,11 +1,13 @@
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.2
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
7
  # Alphafox shared Agent contract
8
8
 
9
+ User-facing entry is skill `alphafox` (router). This file is the shared CLI contract every domain skill assumes.
10
+
9
11
  Co-versioned with `@alphafox/cli`. Query compatibility with `alphafox version --format json` (`version`, `contractVersion`, `catalogVersion`) and `alphafox catalog`.
10
12
 
11
13
  ## Install / identity
@@ -54,6 +56,8 @@ Wrong environment / missing permission / missing `--yes`: stop. Do not retry wit
54
56
 
55
57
  ## Commands
56
58
 
59
+ User-mentioned tickers (including typos) must be resolved with `alphafox resolve-symbols` before they are written into config. See `skills/market`.
60
+
57
61
  1. Prefer typed catalog: `alphafox schema <operationId>` then invoke domain commands.
58
62
  2. Raw escape hatch only for allowlisted facade:
59
63
 
@@ -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.2
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
7
  # Auth Skill
@@ -1,26 +1,32 @@
1
1
  ---
2
2
  name: alphafox-engine-backtest
3
- description: Local Engine WASM backtest (alphafox engine-backtest run) vs catalog experiment CRUD vs chat backtests stub.
4
- version: 0.3.2
3
+ description: Local Engine WASM backtest (alphafox engine-backtest run|sweep) vs catalog experiment CRUD.
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
7
  # Engine Backtest
8
8
 
9
9
  Always `--format json --no-input` (or `--format jsonl` when you need progress). Never `--token`. Tokens live in the OS keychain via `alphafox auth login`.
10
10
 
11
+ Human-mentioned tickers must be resolved with `alphafox resolve-symbols` (`skills/market`) before they go into `--config`. Use `data.queries[].resolved` only when `status` is `exact`, or `close` after confirming with the human. Do not invent `BTC/USDT:USDT`. Aster is in the public catalog but is **not** an Engine tape source.
12
+
11
13
  ## Which command
12
14
 
13
15
  | Intent | Use | Do not |
14
16
  |---|---|---|
15
17
  | Iterate a strategy locally (pull tape + run wasm + optional persist) | `alphafox engine-backtest run` (hyphen, built-in) | Do not treat this as server-side execution of `engine_backtest.experiments.byId.runs.create` |
18
+ | Local parameter search with explicit axes; persist one Sweep after completion | `alphafox engine-backtest sweep` | Never loop `runs.create` per coordinate. Do not call Chat `backtests.*` |
19
+ | Local search with zero writes | `alphafox engine-backtest sweep ... --no-persist` | Do not persist a cancelled or incomplete search |
20
+ | List / get / delete persisted Sweeps | Catalog `engine_backtest.experiments.byId.sweeps.*` | Do not invent a second catalog. Delete is high-risk and needs `--yes` |
16
21
  | List / get / create / rename / delete experiments and persisted runs | Catalog `engine_backtest.*` (underscore) | Do not invent a second catalog |
17
- | Chat-attached `/api/v1/backtests` job | `skills/strategy` + `backtests.*` | That stub is **not** the Engine WASM runner |
22
+ | Chat-attached `/api/v1/backtests` job | | Not a CLI surface. Do not call `backtests.*` or `/api/v1/backtests` |
18
23
 
19
- Read the create-experiment body with `alphafox schema` **before** composing JSON. Do not invent experiment fields. Large create/run payloads use `--config @file`, never a guessed `--body`.
24
+ Read the create-experiment body with `alphafox schema` **before** composing JSON. Do not invent experiment fields. Large create/run/sweep payloads use `--config @file`, never a guessed `--body`.
20
25
 
21
26
  ```bash
22
27
  alphafox schema engine_backtest.experiments.create --format json --no-input
23
28
  alphafox engine_backtest experiments create --config @./experiment.json --format json --no-input
29
+ alphafox schema engine_backtest.experiments.byId.sweeps.create --format json --no-input
24
30
  ```
25
31
 
26
32
  ## Local run
@@ -50,6 +56,38 @@ Also valid: `--from` / `--to` instead of `--range`. `--create-experiment --name
50
56
 
51
57
  `--format jsonl` writes one JSON object per progress line (`{event:"progress",stage,fraction}`), then a final `{ok:true,data:{...}}` envelope.
52
58
 
59
+ ## Local sweep
60
+
61
+ `alphafox engine-backtest sweep` reuses the same Experiment / definition / config / exchange / range / initial equity / replay timeframe / data quality / execution model / tier flags as `run`. Axes are explicit JSON (`--axes @file`); each axis must name a config path and `min`/`max`/`step` or `values`. The command does not guess parameter paths.
62
+
63
+ ```bash
64
+ alphafox engine-backtest sweep \
65
+ --experiment <uuid> \
66
+ --definition grid \
67
+ --config @./grid.json \
68
+ --axes @./axes.json \
69
+ --exchange binance \
70
+ --range 2026-08-01..2026-08-08 \
71
+ --initial-equity 10000 \
72
+ --mode neighborhood \
73
+ --search-mode standard \
74
+ --format jsonl --no-input
75
+ ```
76
+
77
+ `--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`.
78
+
79
+ `--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`.
80
+
81
+ Read / delete history through typed catalog commands. Delete is high-risk-write:
82
+
83
+ ```bash
84
+ alphafox engine_backtest experiments sweeps list --experimentId <uuid> --format json --no-input
85
+ alphafox engine_backtest experiments sweeps get --experimentId <uuid> --sweepId <uuid> --format json --no-input
86
+ alphafox engine_backtest experiments sweeps delete --experimentId <uuid> --sweepId <uuid> --yes --format json --no-input
87
+ ```
88
+
89
+ Owner isolation and 7-day expiry are enforced by the server. Applying a coordinate to a formal Run is a separate `engine-backtest run`.
90
+
53
91
  ## Iterate
54
92
 
55
93
  1. Edit config JSON.
@@ -62,10 +100,14 @@ Also valid: `--from` / `--to` instead of `--range`. `--create-experiment --name
62
100
  - Unauthenticated persist/create fails like `whoami` (HTTP 401, exit 77).
63
101
  - `strict` data quality: missing/gapped tape **stops**. Do not retry as `basic` unless the operator asks.
64
102
  - `planBacktest` unsupported → fail with the plan reason. Do not degrade to a guessed universe.
65
- - Catalog `engine_backtest.experiments.byId.update` / `.delete` are high-risk-write and are **not** this command.
103
+ - Catalog `engine_backtest.experiments.byId.update` / `.delete` / `.sweeps.byId.delete` are high-risk-write and are **not** this command's run/sweep path.
66
104
 
67
105
  ## operationIds (catalog only)
68
106
 
69
107
  - `engine_backtest.experiments.create` / `.list` / `.byId.get`
70
108
  - `engine_backtest.experiments.byId.runs.create` / `.list`
71
- - High-risk (not this skill's run path): `engine_backtest.experiments.byId.update` / `.byId.delete` / `.byId.runs.byId.delete`
109
+ - `engine_backtest.experiments.byId.sweeps.create` / `.list`
110
+ - `engine_backtest.experiments.byId.sweeps.byId.get`
111
+ - High-risk (not this skill's run/sweep path): `engine_backtest.experiments.byId.update` / `.byId.delete` / `.byId.runs.byId.delete` / `.byId.sweeps.byId.delete`
112
+
113
+ Chat `backtests.*` is not an Engine Sweep or Engine Run surface. Do not call it from this skill.
@@ -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.2
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
7
  # Exchange connectors
@@ -1,19 +1,42 @@
1
1
  ---
2
2
  name: alphafox-market
3
- description: Market data and spread-radar readonly queries.
4
- version: 0.3.2
3
+ description: Market data, ticker resolution, and spread-radar readonly queries.
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
7
  # Market
8
8
 
9
9
  Always `--format json --no-input`. Prefer readonly scopes. No mock success if upstream fails.
10
10
 
11
+ ## Resolve tickers first
12
+
13
+ Whenever a human mentions a coin, ticker, or contract — including typos — resolve it **before** putting a symbol into strategy config, backtest, chat settings, or any write.
14
+
15
+ ```bash
16
+ alphafox resolve-symbols BTC ETH 龙虾 --exchange binance --format json --no-input
17
+ ```
18
+
19
+ - Default `--exchange` is Binance (`binance_perp_usdt`). Aliases: `binance|okx|bybit|bitget|hyperliquid|aster`.
20
+ - This built-in loads the public linear-perp catalog via `market.symbols.list` (`GET /api/v1/market/symbols?exchange=...`) and matches locally. Do not guess `BTC/USDT:USDT` from memory. Do not pull a second ccxt universe.
21
+ - Read `data.queries[]`. `resolved` is a CCXT linear swap id (`BTC/USDT:USDT`). `matchCount` is the full hit count; `matches` may be capped by `--limit`.
22
+
23
+ | `status` | Agent action |
24
+ |---|---|
25
+ | `exact` | Use `resolved`. No confirmation. |
26
+ | `close` | One near match already in `resolved`. Use it, then **confirm with the human**. |
27
+ | `ambiguous` | `resolved` is null. Show `matches[].symbol` and ask the human to pick. Do not pick. |
28
+ | `none` | Stop. Ask the human for another ticker. Do not invent a symbol. |
29
+
30
+ Do not treat `close` as exact. Do not retry a failed resolve as a different exchange unless the operator names one.
31
+
32
+ Raw catalog dump (no matching):
33
+
11
34
  ```bash
35
+ alphafox market symbols list --exchange binance_perp_usdt --format json --no-input
12
36
  alphafox api GET /api/v1/spread-radar/pairs --format json --no-input
13
- alphafox api GET /api/v1/market/symbols --format json --no-input
14
37
  ```
15
38
 
16
39
  ## operationIds
17
40
 
41
+ - `market.symbols.list` (used by `alphafox resolve-symbols`)
18
42
  - `spread_radar.pairs.list`
19
- - `market.symbols.list`
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-notification
3
3
  description: Notification channels and subscriptions.
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
7
  # Notification
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  name: alphafox-strategy
3
- description: Strategy definitions, chats, and backtests via public operationIds.
4
- version: 0.3.2
3
+ description: Strategy definitions and chats via public operationIds.
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
- # Strategy / Chat / Backtest
7
+ # Strategy / Chat
8
8
 
9
- Always `--format json --no-input`. Read scopes `trading:read` / `backtests:read`; writes `chats:write` / `backtests:write`.
9
+ Always `--format json --no-input`. Read scopes `trading:read`; writes `chats:write`.
10
+
11
+ Whenever the human names a coin or ticker, resolve it with `alphafox resolve-symbols` (`skills/market`) before writing strategy config or symbols arrays. Exact matches may be used; a single close match needs confirmation; multiple close matches must be chosen by the human.
10
12
 
11
13
  ## Read
12
14
 
@@ -28,24 +30,9 @@ alphafox chats create --body '{"strategyGenerationMode":"simple"}' --format json
28
30
 
29
31
  Requires auth. Sends `Idempotency-Key` when available. Duplicate key → `409`; do not invent a new key unless the operator asks to create another chat.
30
32
 
31
- Engine strategy backtest (WASM tape + persist) is `skills/engine-backtest` (`alphafox engine-backtest run`). Do not treat `/api/v1/backtests` as the Engine WASM runnerthat stub is the chat backtest job below.
32
-
33
- ## Long-running backtest
34
-
35
- ```bash
36
- alphafox schema backtests.create --format json --no-input
37
- alphafox api POST /api/v1/backtests --body '{"chatId":"<chat-id>"}' --format json --no-input
38
- alphafox api GET /api/v1/backtests/{backtestId} --format json --no-input
39
- alphafox api GET /api/v1/backtests/{backtestId}/stream --format jsonl --no-input
40
- alphafox api POST /api/v1/backtests/{backtestId}/cancel --body '{}' --format json --no-input
41
- ```
42
-
43
- `backtests.create` requires `chatId`. `strategyId` is optional: the facade resolves a compiled strategy on that chat. A chat with no compiled strategy returns `CHAT_HAS_NO_COMPILED_STRATEGY` (not `JOB_NOT_FOUND`). Optional `backtestSettings` overlays chat settings when it is a settingsJson object.
44
-
45
- If the stream drops, `GET` the backtest by id — do not assume success. Cancel is explicit; interruption must remain queryable.
33
+ Engine strategy backtest (WASM tape + persist) is `skills/engine-backtest` (`alphafox engine-backtest run`). Chat-attached `/api/v1/backtests` (`backtests.*`) is not a CLI surface do not call it.
46
34
 
47
35
  ## operationIds
48
36
 
49
37
  - `trading.strategy_definitions.list`
50
38
  - `chats.create`
51
- - `backtests.create` / `backtests.byId.get` / `backtests.byId.stream` / `backtests.byId.cancel`
@@ -1,13 +1,15 @@
1
1
  ---
2
2
  name: alphafox-trading
3
3
  description: Traders list and high-risk start/stop with confirmation gates.
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  ---
6
6
 
7
7
  # Trading
8
8
 
9
9
  Always `--format json --no-input`. Read first. Writes need scopes `trading:write`; start/stop also `trading:high-risk`.
10
10
 
11
+ Human-mentioned tickers must be resolved with `alphafox resolve-symbols` (`skills/market`) before they are written into trader config.
12
+
11
13
  ## Read
12
14
 
13
15
  ```bash