@alphafox/cli 0.3.6 → 0.3.8

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.
@@ -1,14 +1,26 @@
1
1
  export type ResolveSymbolsStatus = "exact" | "close" | "ambiguous" | "none";
2
+ export type ResolveAssetClassFilter = "all" | "equity_perp" | "rwa_perp" | "crypto";
3
+ export interface SymbolMetadata {
4
+ readonly isTradFiRwa?: boolean;
5
+ readonly assetClass?: string;
6
+ readonly minAmount?: number;
7
+ readonly minCost?: number;
8
+ readonly contractSize?: number;
9
+ }
2
10
  export type ResolveSymbolsMatchReason = "exact_canonical" | "exact_compact" | "exact_pair" | "exact_base" | "prefix" | "contains" | "close";
3
11
  export interface ResolveSymbolsMatch {
4
12
  readonly symbol: string;
5
13
  readonly reason: ResolveSymbolsMatchReason;
6
14
  readonly score: number;
15
+ readonly assetClass: string | null;
16
+ readonly isTradFiRwa: boolean;
7
17
  }
8
18
  export interface ResolveSymbolsQueryResult {
9
19
  readonly query: string;
10
20
  readonly status: ResolveSymbolsStatus;
11
21
  readonly resolved: string | null;
22
+ readonly assetClass: string | null;
23
+ readonly isTradFiRwa: boolean;
12
24
  readonly needsConfirmation: boolean;
13
25
  readonly matches: readonly ResolveSymbolsMatch[];
14
26
  readonly matchCount: number;
@@ -24,6 +36,7 @@ export interface ResolveSymbolsRunArgs {
24
36
  readonly queries: readonly string[];
25
37
  readonly exchange: string;
26
38
  readonly limit: number;
39
+ readonly assetClass: ResolveAssetClassFilter;
27
40
  }
28
41
  export interface CatalogSymbol {
29
42
  readonly symbol: string;
@@ -34,4 +47,5 @@ export interface CatalogSymbol {
34
47
  readonly searchKey: string;
35
48
  readonly baseKey: string;
36
49
  readonly compactKey: string;
50
+ readonly metadata?: SymbolMetadata;
37
51
  }
@@ -1,141 +1,141 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "packageName": "@alphafox/cli",
4
- "packageVersion": "0.3.6",
4
+ "packageVersion": "0.3.8",
5
5
  "contractVersion": "2026-08-13",
6
- "bundleHash": "1eb4c16a941eee4c125efc6bb64ed7bb0db1d12b71f71cae66e55e64f600cf9a",
6
+ "bundleHash": "cd05f4eb6f9e1a7c9188ac5770196698c6f2c9ff6aaebfbfbaba3581ef08d226",
7
7
  "skills": [
8
8
  {
9
9
  "name": "alphafox",
10
- "version": "0.3.6",
10
+ "version": "0.3.8",
11
11
  "files": [
12
12
  {
13
13
  "path": "SKILL.md",
14
- "sha256": "a60f579e6321533d4f965c607f1158ddb50d1a89905d8793eca0b401b3f67fd2",
15
- "size": 3055
14
+ "sha256": "e8eadf96f36f6aa124b36d15a912465e839389e5228dbf9dfd9ad2f1ec86f65a",
15
+ "size": 3553
16
16
  }
17
17
  ],
18
- "hash": "c47e6e2d6154e831a681b731e123053c2d20c6c77654191f0a78ae2137ce5304"
18
+ "hash": "fb41a55fcd363231cb69e30e4c0fe7b1ad2e17b12e2bb90cfda7d6e9ccd2f02c"
19
19
  },
20
20
  {
21
21
  "name": "alphafox-account",
22
- "version": "0.3.6",
22
+ "version": "0.3.8",
23
23
  "files": [
24
24
  {
25
25
  "path": "SKILL.md",
26
- "sha256": "c60baab539cca008ccc48d53f0262d7a019db82b3945402d16b5ac84624b475f",
26
+ "sha256": "9925573bf644b998ea683df7a20276a835d33cb83b0548ee0d1c43429ad99582",
27
27
  "size": 783
28
28
  }
29
29
  ],
30
- "hash": "e828192ec19a24bc18ce64d07a583eaba498e6a0c356214dbe18ccae6e9f6a6d"
30
+ "hash": "934bcd76d1bea875324673ffcc3d1c52e3f4065f776c4958ffc230cf911bac21"
31
31
  },
32
32
  {
33
33
  "name": "alphafox-admin",
34
- "version": "0.3.6",
34
+ "version": "0.3.8",
35
35
  "files": [
36
36
  {
37
37
  "path": "SKILL.md",
38
- "sha256": "87bbc12b803be021d94ad8161293263ce69e1d6c50f887a245ebe5c0a285e4f6",
38
+ "sha256": "e9ae0b433cead54e9c284f0ea8859dd9e96123f842788938319404b96bc085e7",
39
39
  "size": 787
40
40
  }
41
41
  ],
42
- "hash": "2881be10858efaad4543ffbe94f3bf87a91d4b0a4f3d905c3e0a5b8463e8756b"
42
+ "hash": "1346e798f18582c16cfbb887667272406f170e775d3027131d3d88e1f1a656e3"
43
43
  },
44
44
  {
45
45
  "name": "alphafox-auth",
46
- "version": "0.3.6",
46
+ "version": "0.3.8",
47
47
  "files": [
48
48
  {
49
49
  "path": "SKILL.md",
50
- "sha256": "99e954df23206b0deb32761ce39396897d5af2ee8852e3a8340ed1b9c2e88a46",
51
- "size": 1919
50
+ "sha256": "8ec9f081d9a1d40606ac7c18cba5dae9f1b6144ddc0079005b16af54be8f2f46",
51
+ "size": 2370
52
52
  }
53
53
  ],
54
- "hash": "659ca92bdfa0b31bcd1d39d7af151c308f1f9e7cd541bd38cf89326a825a38b8"
54
+ "hash": "854910a6792aa6d0a8b9cd796afb41753a34cef79df95c5b50de432f03a4e67a"
55
55
  },
56
56
  {
57
57
  "name": "alphafox-engine-backtest",
58
- "version": "0.3.6",
58
+ "version": "0.3.8",
59
59
  "files": [
60
60
  {
61
61
  "path": "SKILL.md",
62
- "sha256": "176c329a665709461403671d34e73dd5b58bf389a328010c8a32cec5b949a9c5",
63
- "size": 7346
62
+ "sha256": "e5f37b8541c510a27f84cbf9eea7524efe0b8f9c60c4faf17521b6cac298f92b",
63
+ "size": 7584
64
64
  }
65
65
  ],
66
- "hash": "23db5ab285f8600a43561ce3d4b7641ea45cd55c7c3b16d9f6fb7ff0c862b379"
66
+ "hash": "efb614f145763f514c33d02e112657bd42868cc746f13dbcb3cceaa0ecb770e4"
67
67
  },
68
68
  {
69
69
  "name": "alphafox-exchange",
70
- "version": "0.3.6",
70
+ "version": "0.3.8",
71
71
  "files": [
72
72
  {
73
73
  "path": "SKILL.md",
74
- "sha256": "089db4794cd55ba04278d4616cd6d5e92bc4c1d4c7c183001ea363bc4eeba578",
74
+ "sha256": "118141754916741f4f8b449cf307a89cdfa11f234302726ba4d6b58e396327b5",
75
75
  "size": 743
76
76
  }
77
77
  ],
78
- "hash": "d4b0fe876ced82185eb477a23420cb24a8990f3dcbb6d4d5e9412dfd4cd2c279"
78
+ "hash": "3933f12a2d8c55db465d4a11cf1f7d40f90fff81b3931f398e2fe3bcaf064d62"
79
79
  },
80
80
  {
81
81
  "name": "alphafox-market",
82
- "version": "0.3.6",
82
+ "version": "0.3.8",
83
83
  "files": [
84
84
  {
85
85
  "path": "SKILL.md",
86
- "sha256": "79fd7431c119b9d9318566c0419e2820ad9b06f0fda2882fdf9d1d7f4c1b9566",
87
- "size": 1801
86
+ "sha256": "0e77dcc697fe60f742e1075986685db5018d9d659a4d8f44f9cc343117c1c74b",
87
+ "size": 3078
88
88
  }
89
89
  ],
90
- "hash": "8814883b9b5bfb7eab4406fe1236091410dcb1130d4904dae8756e1302a02687"
90
+ "hash": "710c45c6124583d3fa9c9584f67bbc665bad35c9e6d1294c7416f493b8a6b184"
91
91
  },
92
92
  {
93
93
  "name": "alphafox-notification",
94
- "version": "0.3.6",
94
+ "version": "0.3.8",
95
95
  "files": [
96
96
  {
97
97
  "path": "SKILL.md",
98
- "sha256": "9a90360b83b72bb252349612cb052ffded40d00e07ca8568b76a6b13479252ac",
98
+ "sha256": "712aa6a4de8090bb7ee57373d35dd95c62bad7a24e443747afa4f11fb6e79b68",
99
99
  "size": 698
100
100
  }
101
101
  ],
102
- "hash": "99f8309b235b2b89734ed49d0a9e0e8981b5216025815fbe69f9101cf4f412cc"
102
+ "hash": "5f2feef0e17912a593bafae0961f983e3f781d12800e4808c136004897321ab2"
103
103
  },
104
104
  {
105
105
  "name": "alphafox-shared",
106
- "version": "0.3.6",
106
+ "version": "0.3.8",
107
107
  "files": [
108
108
  {
109
109
  "path": "SKILL.md",
110
- "sha256": "60051a6c9b789e306ec968d3c8762a75039c34a0db2470dfddd1063bf2a3553f",
111
- "size": 5071
110
+ "sha256": "c6bab01f9c8369f9c2a29eebf7b46462887f14d3bec7ad00e2a159d395346508",
111
+ "size": 5385
112
112
  }
113
113
  ],
114
- "hash": "20832738f9f15063291309871197b6274fd24f2630bd2525092ac017f7491b68"
114
+ "hash": "2b78fe080877af19b659964a8c965720e5ab731dd157ced10d2ee598b8c574a0"
115
115
  },
116
116
  {
117
117
  "name": "alphafox-strategy",
118
- "version": "0.3.6",
118
+ "version": "0.3.8",
119
119
  "files": [
120
120
  {
121
121
  "path": "SKILL.md",
122
- "sha256": "e4188e115eca6610c482bbcdf11ab1eb455cb5b6f242af96d1d8090e6ce9ce9d",
123
- "size": 1450
122
+ "sha256": "03f1d1c6d048d7b0a23d725c6585d1d019445579be9779dc93095ebafb3fcf5a",
123
+ "size": 1826
124
124
  }
125
125
  ],
126
- "hash": "878fd5c365eb33a431e91f6922a8cf45bcf94a7136b0105d50f3b487112c3573"
126
+ "hash": "ebf375c6eeaf13c971a3090d05beda7037f253325ee2236c35b26ad540922827"
127
127
  },
128
128
  {
129
129
  "name": "alphafox-trading",
130
- "version": "0.3.6",
130
+ "version": "0.3.8",
131
131
  "files": [
132
132
  {
133
133
  "path": "SKILL.md",
134
- "sha256": "098e0f975ae9f0169b0da696b76e74ffd3c6748e898e7c4f8c8f8a33aec47dc8",
135
- "size": 1435
134
+ "sha256": "4b597f23ff6c8ce384e8fd56fab73c6128d373741285bac6df0b061e7ee50242",
135
+ "size": 3122
136
136
  }
137
137
  ],
138
- "hash": "99b72870808f871ddeffd69ee89872e8532f2847494a0e5ad83de48ad58c675a"
138
+ "hash": "d7e818482ec3ba9aeab50af72e72f990288f0e2e6714e1227cba441db05fa75a"
139
139
  }
140
140
  ]
141
141
  }
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.6";
3
+ export declare const CLI_VERSION = "0.3.8";
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";
6
+ exports.CLI_VERSION = "0.3.8";
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.6",
3
+ "version": "0.3.8",
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.6
4
+ version: 0.3.8
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.6
4
+ version: 0.3.8
5
5
  ---
6
6
 
7
7
  # Admin
@@ -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 chat, traders, ticker/标的 resolve, market data, exchange connectors, wallet, subscriptions, notifications, or admin. If a CLI command prints `[alphafox] update available`, ask the user「检测到新的版本,是否需要我帮你升级?」and only then run `alphafox update --format json --no-input`. Start here, then open the routed domain skill. Do not guess alphafox-engine-backtest vs alphafox-strategy from memory.
4
- version: 0.3.6
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. If a CLI command prints `[alphafox] update available`, ask the user「检测到新的版本,是否需要我帮你升级?」and only then run `alphafox update --format json --no-input`. 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.8
5
5
  ---
6
6
 
7
7
  # AlphaFox
@@ -10,7 +10,9 @@ This skill only routes. After choosing a row, **read that skill's `SKILL.md` and
10
10
 
11
11
  Also read `alphafox-shared` before any CLI invocation (envelope, auth, risk, schema-first writes). Always `--format json --no-input`. Never `--token`.
12
12
 
13
- Human-mentioned tickers go through `alphafox-market` (`alphafox resolve-symbols`) **before** they enter config, backtest, or writes.
13
+ Human-mentioned tickers go through `alphafox-market` (`alphafox resolve-symbols`) **before** they enter config, backtest, or writes. Keep the operator's asset class (美股 → `equity_perp` on `binance_perp_usdt`).
14
+
15
+ A **trader** is a running strategy instance (paper or live), not a person. Creating a strategy means creating a trader.
14
16
 
15
17
  ## Route
16
18
 
@@ -18,23 +20,23 @@ Human-mentioned tickers go through `alphafox-market` (`alphafox resolve-symbols`
18
20
  |---|---|
19
21
  | Install, update, Skills status/sync, doctor, version, catalog, how to call the CLI | `alphafox-shared` |
20
22
  | Login, logout, whoami, profile, staging vs production | `alphafox-auth` |
21
- | Coin / ticker / 标的 / `BTC/USDT:USDT` / resolve a misspelled symbol | `alphafox-market` |
23
+ | Ticker / 标的 / 美股 / crypto / resolve a misspelled symbol | `alphafox-market` |
22
24
  | 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
+ | Strategy types / definitions / validate config (grid, dca, copy, …) | `alphafox-strategy` |
26
+ | Create, list, start, or stop a running strategy (trader), including copy | `alphafox-trading` |
25
27
  | Exchange connectors | `alphafox-exchange` |
26
28
  | Account, wallet, subscription | `alphafox-account` |
27
29
  | Notification channels | `alphafox-notification` |
28
30
  | Admin-only operations | `alphafox-admin` |
29
31
 
30
- If several rows apply, load **all** of them (typical: `alphafox-shared` + `alphafox-market` + one domain skill).
32
+ If several rows apply, load **all** of them (typical: `alphafox-shared` + `alphafox-market` + one domain skill). “帮我建一个网格/DCA/跟单策略” → `alphafox-strategy` (pick the definition) **and** `alphafox-trading` (create the trader).
31
33
 
32
34
  ## Upgrade reminder
33
35
 
34
36
  The CLI may print this on **stderr** at most once every 24 hours:
35
37
 
36
38
  ```text
37
- [alphafox] update available: 0.3.5 -> 0.3.6. After the user confirms, run: alphafox update --format json --no-input
39
+ [alphafox] update available: 0.3.7 -> 0.3.8. After the user confirms, run: alphafox update --format json --no-input,
38
40
  ```
39
41
 
40
42
  If you see that notice (or `updateAvailable: true` from `alphafox update --check`):
@@ -55,6 +57,6 @@ Do not install Skills from GitHub. Details and dry-run / check commands live in
55
57
 
56
58
  - Local Engine tape + wasm + optional persist → `alphafox-engine-backtest` (`alphafox engine-backtest run`, hyphen).
57
59
  - Experiment catalog CRUD → same skill, underscore catalog `engine_backtest.*`.
58
- - Chat-attached `/api/v1/backtests` (`backtests.*`) is **not** a CLI surface. Do not call it via typed commands, `schema`, or `alphafox api`.
60
+ - Web `/api/v1/backtests` (`backtests.*`) is **not** a CLI surface. Do not call it via typed commands, `schema`, or `alphafox api`.
59
61
 
60
62
  Ambiguous “帮我回测” → `alphafox-engine-backtest`, after resolving symbols.
@@ -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.6
4
+ version: 0.3.8
5
5
  ---
6
6
 
7
7
  # AlphaFox shared Agent contract
@@ -67,16 +67,17 @@ alphafox auth login --no-wait --format json --no-input
67
67
  # show verification_uri / user_code to the human, then:
68
68
  alphafox auth login --device-code <device_code> --format json --no-input
69
69
  alphafox auth status --verify --format json --no-input
70
- alphafox whoami --format json --no-input
71
70
  ```
72
71
 
72
+ Access tokens last ~10 minutes; the CLI refreshes them. After idle, run **one** `auth status --verify` — not `whoami` in parallel. `session: active` means logged in. A past `expiresAt` is not logout. Re-login only when `session` is `none` or `refresh_failed`.
73
+
73
74
  Local browser: `alphafox auth login --browser --format json --no-input` (loopback 127.0.0.1). If the browser cannot open, copy `authorizeUrl` from the error; do not invent a Device Flow retry unless the operator is headless.
74
75
 
75
76
  Wrong environment / missing permission / missing `--yes`: stop. Do not retry with a different profile.
76
77
 
77
78
  ## Commands
78
79
 
79
- User-mentioned tickers (including typos) must be resolved with `alphafox resolve-symbols` before they are written into config. See `skills/market`.
80
+ User-mentioned tickers (including typos) must be resolved with `alphafox resolve-symbols` before they are written into config. See `skills/market`. 美股 are `equity_perp` on `binance_perp_usdt`; do not swap them for a crypto coin.
80
81
 
81
82
  1. Prefer typed catalog: `alphafox schema <operationId>` then invoke domain commands.
82
83
  2. Raw escape hatch only for allowlisted facade:
@@ -104,7 +105,7 @@ Uncataloged writes cannot carry a non-empty body. Find the `operationId` first.
104
105
  ## Risk
105
106
 
106
107
  - `high-risk-write` and uncataloged mutations (`unknown`) require `--yes` (exit code `10` if missing).
107
- - Prefer `--dry-run` first for trader start/stop, withdrawals, admin writes.
108
+ - Prefer `--dry-run` first for trader create/start/stop, withdrawals, admin writes.
108
109
  - Never auto-retry unknown write outcomes.
109
110
  - CLI `--yes` is UX only; the server still enforces role, ownership, and scopes.
110
111
 
@@ -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.6
4
+ version: 0.3.8
5
5
  ---
6
6
 
7
7
  # Auth Skill
@@ -19,23 +19,26 @@ Always `--format json --no-input`. Never `--token`.
19
19
  1. `alphafox auth login --no-wait --format json --no-input`
20
20
  2. Present `verification_uri` / `user_code` to the human.
21
21
  3. After approval: `alphafox auth login --device-code <device_code> --format json --no-input`
22
- 4. `alphafox whoami --format json --no-input` / `alphafox auth status --verify --format json --no-input`
22
+ 4. `alphafox auth status --verify --format json --no-input` (do not also run `whoami` in parallel)
23
23
 
24
24
  ### Browser loopback (human, local machine)
25
25
 
26
26
  1. `alphafox auth login --browser --format json --no-input`
27
27
  2. CLI binds `127.0.0.1` and opens the system browser. Do not copy codes or verifiers.
28
- 3. After the localhost callback, `alphafox whoami` / `alphafox auth status --verify`
28
+ 3. After the localhost callback, `alphafox auth status --verify --format json --no-input`
29
29
  4. If the browser cannot open, the error includes a copyable `authorizeUrl`. Do not retry as Device Flow unless the human is headless.
30
30
 
31
31
  ### Status / logout
32
32
 
33
- - `alphafox auth status --verify --format json --no-input`
33
+ - `alphafox auth status --verify --format json --no-input` is enough. Do **not** also run `whoami` in parallel — concurrent refresh can kill the session.
34
+ - Access tokens last ~10 minutes. The CLI refreshes them automatically. A past `expiresAt` is **not** logout.
35
+ - Logged in: `session` is `active` (or `authenticated: true` after status). Re-login only when `session` is `none` or `refresh_failed`.
34
36
  - `alphafox auth logout --format json --no-input` (server revoke + local keychain clear). If `remoteRevoke` is `failed`, local tokens are still cleared but exit is non-zero — do not claim a full logout.
35
37
 
36
38
  ### Recovery
37
39
 
38
- - `401` / `expired_token`: re-run Device Flow or browser login. Do not reuse a token from another profile.
40
+ - `session: refresh_failed` / refresh grant `invalid_grant`: re-run Device Flow or browser login. Do not reuse a token from another profile.
41
+ - Do not treat a short idle or an expired access token as a missing login.
39
42
  - Cross-env: production tokens are rejected on staging/local. Switch `--profile` only with explicit operator intent.
40
43
 
41
44
  ## Safety
@@ -1,25 +1,25 @@
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.6
4
+ version: 0.3.8
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.
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, and only when `assetClass` matches the operator (美股 → `equity_perp`). Local Engine tape is Binance-style USDT-M perps (`binance|okx|bybit|bitget|hyperliquid`), which is the same catalog that lists equity perps. Aster is in the public catalog but is **not** an Engine tape source. Do not rewrite `NVDA/USDT:USDT` into a crypto coin to force a backtest.
12
12
 
13
13
  ## Which command
14
14
 
15
15
  | Intent | Use | Do not |
16
16
  |---|---|---|
17
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.*` |
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 `backtests.*` |
19
19
  | Local search with zero writes | `alphafox engine-backtest sweep ... --no-persist` | Do not persist a cancelled or incomplete search |
20
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` |
21
21
  | List / get / create / rename / delete experiments and persisted runs | Catalog `engine_backtest.*` (underscore) | Do not invent a second catalog |
22
- | Chat-attached `/api/v1/backtests` job | — | Not a CLI surface. Do not call `backtests.*` or `/api/v1/backtests` |
22
+ | Web `/api/v1/backtests` job | — | Not a CLI surface. Do not call `backtests.*` or `/api/v1/backtests` |
23
23
 
24
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`.
25
25
 
@@ -110,4 +110,4 @@ Owner isolation and 7-day expiry are enforced by the server. Applying a coordina
110
110
  - `engine_backtest.experiments.byId.sweeps.byId.get`
111
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
112
 
113
- Chat `backtests.*` is not an Engine Sweep or Engine Run surface. Do not call it from this skill.
113
+ `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.6
4
+ version: 0.3.8
5
5
  ---
6
6
 
7
7
  # Exchange connectors
@@ -1,33 +1,53 @@
1
1
  ---
2
2
  name: alphafox-market
3
- description: Market data, ticker resolution, and spread-radar readonly queries.
4
- version: 0.3.6
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.8
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
11
+ ## Asset class first
12
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.
13
+ Binance US stocks are **equity perps in the same** `binance_perp_usdt` catalog (`NVDA/USDT:USDT`). They are not a second exchange. `symbolMetadata` tags them:
14
+
15
+ | Tag | Meaning |
16
+ |---|---|
17
+ | `assetClass: "equity_perp"` and `isTradFiRwa: true` | US stock perp (NVDA, AAPL, TSLA) |
18
+ | `assetClass: "rwa_perp"` and `isTradFiRwa: true` | TradFi RWA perp (XAU, XAG) |
19
+ | untagged / not TradFi | Crypto perp (BTC, ETH) |
20
+
21
+ | Operator said | Resolve with |
22
+ |---|---|
23
+ | 美股 / US stocks / 持仓 / NVDA the company | `--exchange binance --asset-class equity_perp` |
24
+ | 黄金 / 白银 / RWA | `--exchange binance --asset-class rwa_perp` |
25
+ | BTC / ETH / 加密永续 | `--exchange binance` or `--asset-class crypto` |
26
+
27
+ `NVDA/USDT:USDT` with `equity_perp` **is** the US stock product. Do not replace it with a different crypto base.
28
+
29
+ ## Resolve tickers
30
+
31
+ Whenever a human mentions a stock, coin, ticker, or contract — including typos — resolve it **before** putting a symbol into strategy config, backtest, trader settings, or any write.
14
32
 
15
33
  ```bash
16
- alphafox resolve-symbols BTC ETH 龙虾 --exchange binance --format json --no-input
34
+ alphafox resolve-symbols BTC ETH --exchange binance --format json --no-input
35
+ alphafox resolve-symbols NVDA AAPL TSLA --exchange binance --asset-class equity_perp --format json --no-input
17
36
  ```
18
37
 
19
38
  - 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`.
39
+ - This built-in loads `GET /api/v1/market/symbols?exchange=...` (includes `symbolMetadata`) and matches locally. Do not invent a symbol from memory. Do not pull a second ccxt universe.
40
+ - Read `data.queries[]`. `resolved` is a catalog id such as `NVDA/USDT:USDT` or `BTC/USDT:USDT`. Also read `assetClass` and `isTradFiRwa` on the query and on `matches[]`.
41
+ - `matchCount` is the full hit count; `matches` may be capped by `--limit`.
22
42
 
23
43
  | `status` | Agent action |
24
44
  |---|---|
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. |
45
+ | `exact` | Use `resolved` when `assetClass` matches the operator (美股 → `equity_perp`). |
46
+ | `close` | One near match already in `resolved`. Confirm with the human, and confirm the asset class. |
47
+ | `ambiguous` | `resolved` is null. Show `matches[].symbol` plus `assetClass` and ask the human to pick. Do not pick. |
48
+ | `none` | Stop. Ask for another ticker. Do not invent a symbol and do not swap in a crypto coin. |
29
49
 
30
- Do not treat `close` as exact. Do not retry a failed resolve as a different exchange unless the operator names one.
50
+ Do not treat `close` as exact. Do not retry a failed equity resolve as a different crypto base.
31
51
 
32
52
  Raw catalog dump (no matching):
33
53
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: alphafox-notification
3
3
  description: Notification channels and subscriptions.
4
- version: 0.3.6
4
+ version: 0.3.8
5
5
  ---
6
6
 
7
7
  # Notification
@@ -1,38 +1,40 @@
1
1
  ---
2
2
  name: alphafox-strategy
3
- description: Strategy definitions and chats via public operationIds.
4
- version: 0.3.6
3
+ description: Strategy definitions — list types (grid, dca, copy, …) and validate config. Creating a running strategy is creating a trader; use alphafox-trading for that.
4
+ version: 0.3.8
5
5
  ---
6
6
 
7
- # Strategy / Chat
7
+ # Strategy definitions
8
8
 
9
- Always `--format json --no-input`. Read scopes `trading:read`; writes `chats:write`.
9
+ Always `--format json --no-input`. Read scopes `trading:read`; validate is `trading:write`.
10
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.
11
+ A **definition** is a strategy type (grid, dca, copy, …). A **trader** is one running instance of a definition. Instantiating a definition is `alphafox-trading`, not this skill.
12
+
13
+ Whenever the human names a ticker (US stock, coin, or contract), resolve it with `alphafox resolve-symbols` (`skills/market`) before writing symbols into a config you later validate or hand to create. 美股 are equity perps in `binance_perp_usdt` (`NVDA/USDT:USDT`, `assetClass=equity_perp`) — do not swap them for a crypto coin.
12
14
 
13
15
  ## Read
14
16
 
15
17
  ```bash
16
18
  alphafox schema trading.strategy_definitions.list --format json --no-input
17
19
  alphafox api GET /api/v1/trading/strategy-definitions --format json --no-input
20
+ alphafox trading strategy_definitions byId get --definitionId <id> --format json --no-input
18
21
  ```
19
22
 
20
- ## Write (ordinary)
23
+ Use the list to pick the definition the operator named. Copy / rebate-copy / DCA / grid are rows in this catalog, not a separate product.
24
+
25
+ ## Validate config
21
26
 
22
- Read `request.body` first. Do not invent chat or strategy fields.
27
+ Read `request.body` first. Do not invent definition or config fields.
23
28
 
24
29
  ```bash
25
- alphafox schema chats.create --format json --no-input
26
- alphafox chats create --body '{"strategyGenerationMode":"simple"}' --format json --no-input
27
- # large / nested bodies:
28
- # alphafox chats create --config @./create-chat.json --format json --no-input
30
+ alphafox schema trading.strategy_definitions.byId.validate_config --format json --no-input
31
+ alphafox trading strategy_definitions byId validate_config --definitionId <id> --config @./strategy-config.json --format json --no-input
29
32
  ```
30
33
 
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.
32
-
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.
34
+ After the config validates, create the running instance with `alphafox-trading`.
34
35
 
35
36
  ## operationIds
36
37
 
37
38
  - `trading.strategy_definitions.list`
38
- - `chats.create`
39
+ - `trading.strategy_definitions.byId.get`
40
+ - `trading.strategy_definitions.byId.validate_config`