echopai 2.2.0 → 2.4.0

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 (47) hide show
  1. package/README.md +63 -348
  2. package/dist/bin.js +8302 -149
  3. package/package.json +11 -13
  4. package/dist/_generated/commands.js +0 -282
  5. package/dist/_generated/help.js +0 -195
  6. package/dist/_generated/operations.js +0 -1529
  7. package/dist/runtime/auth.js +0 -95
  8. package/dist/runtime/envelope.js +0 -52
  9. package/dist/runtime/errors.js +0 -186
  10. package/dist/runtime/filters.js +0 -153
  11. package/dist/runtime/format.js +0 -143
  12. package/dist/runtime/http.js +0 -65
  13. package/dist/runtime/idempotency.js +0 -18
  14. package/dist/runtime/invoker.js +0 -387
  15. package/dist/runtime/io.js +0 -16
  16. package/dist/runtime/paginator.js +0 -146
  17. package/dist/runtime/trace.js +0 -99
  18. package/dist/runtime/tty.js +0 -51
  19. package/dist/runtime/verb_cmd.js +0 -70
  20. package/dist/runtime/verb_runner.js +0 -152
  21. package/dist/runtime/whoami_cache.js +0 -109
  22. package/dist/tools/api.js +0 -81
  23. package/dist/tools/completion.js +0 -116
  24. package/dist/tools/config.js +0 -123
  25. package/dist/tools/doctor.js +0 -183
  26. package/dist/tools/login.js +0 -99
  27. package/dist/tools/mcp.js +0 -141
  28. package/dist/tools/raw.js +0 -96
  29. package/dist/tools/schema.js +0 -58
  30. package/dist/tools/trace.js +0 -54
  31. package/dist/tools/welcome.js +0 -190
  32. package/dist/tools/whoami.js +0 -132
  33. package/dist/verbs/_spec.js +0 -15
  34. package/dist/verbs/bars_batch.js +0 -66
  35. package/dist/verbs/chart.js +0 -110
  36. package/dist/verbs/digest.js +0 -344
  37. package/dist/verbs/financials.js +0 -212
  38. package/dist/verbs/hot.js +0 -29
  39. package/dist/verbs/index.js +0 -57
  40. package/dist/verbs/lookup.js +0 -72
  41. package/dist/verbs/news.js +0 -67
  42. package/dist/verbs/quote.js +0 -53
  43. package/dist/verbs/scan.js +0 -42
  44. package/dist/verbs/search.js +0 -105
  45. package/dist/verbs/sentiment.js +0 -46
  46. package/dist/verbs/views.js +0 -83
  47. package/dist/version.js +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echopai",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "Command-line interface for the EchoPai Open Platform: stock-market data, news, analyst views, sentiment, signals, backtests.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://echopai.com",
@@ -25,18 +25,18 @@
25
25
  "echopai": "dist/bin.js"
26
26
  },
27
27
  "files": [
28
- "dist",
28
+ "dist/bin.js",
29
29
  "README.md"
30
30
  ],
31
31
  "scripts": {
32
32
  "codegen": "cd .. && (test -x scripts/codegen/.venv/bin/python || (python3 -m venv scripts/codegen/.venv && scripts/codegen/.venv/bin/pip install -q -r scripts/codegen/requirements.txt)) && scripts/codegen/.venv/bin/python scripts/codegen/generate_cli_v2.py --in docs/api-contract/openapi.yaml --out cli/src/_generated",
33
- "prebuild": "npm run codegen",
34
- "build": "tsc",
35
- "pretest": "npm run codegen",
36
- "test": "vitest run",
37
- "test:watch": "vitest",
38
- "dev": "npm run codegen && tsx src/bin.ts",
39
- "prepublishOnly": "npm run build"
33
+ "typecheck": "tsc --noEmit",
34
+ "build": "bun run codegen && bun build src/bin.ts --target=node --packages=external --outfile=dist/bin.js",
35
+ "compile": "bun run codegen && bun run scripts/compile.ts",
36
+ "test": "bun run codegen && bun test",
37
+ "test:watch": "bun test --watch",
38
+ "dev": "bun run codegen && bun run src/bin.ts",
39
+ "prepublishOnly": "bun run build"
40
40
  },
41
41
  "dependencies": {
42
42
  "@modelcontextprotocol/sdk": "^1.29.0",
@@ -45,14 +45,12 @@
45
45
  "commander": "^12.1.0",
46
46
  "jmespath": "^0.16.0",
47
47
  "smol-toml": "^1.4.2",
48
- "undici": "^7.16.0",
49
48
  "zod": "^4.4.3"
50
49
  },
51
50
  "devDependencies": {
51
+ "@types/bun": "^1.1.14",
52
52
  "@types/jmespath": "^0.15.2",
53
53
  "@types/node": "^20.0.0",
54
- "tsx": "^4.20.6",
55
- "typescript": "^5.6.3",
56
- "vitest": "^2.1.9"
54
+ "typescript": "^5.6.3"
57
55
  }
58
56
  }
@@ -1,282 +0,0 @@
1
- /**
2
- * AUTO-GENERATED — DO NOT EDIT BY HAND.
3
- *
4
- * Source: docs/api-contract/openapi.yaml
5
- * Generator: scripts/codegen/generate_cli_v2.py
6
- */
7
- import { Option } from "commander";
8
- import { OPERATIONS } from "./operations.js";
9
- /**
10
- * commander v12 把 --since-hours 自动 camelCase 成 sinceHours,但 OpenAPI 这
11
- * 边期待 snake_case (since_hours)。一次性 camelCase → snake_case 反转。
12
- */
13
- function camelToSnake(s) {
14
- return s.replace(/[A-Z]/g, (m) => "_" + m.toLowerCase());
15
- }
16
- function attachOperation(cmd, op, dispatch) {
17
- cmd.description(op.summary || op.description);
18
- // positional args
19
- for (const pname of op.positional) {
20
- const required = (op.inputSchema.required || []).includes(pname);
21
- cmd.argument(required ? `<${pname}>` : `[${pname}]`, String(op.inputSchema.properties[pname]?.description ?? ""));
22
- }
23
- // remaining params → --flag (dashes for ergonomics; reverse camelCase later)
24
- for (const [pname, pschema] of Object.entries(op.inputSchema.properties)) {
25
- if (op.positional.includes(pname))
26
- continue;
27
- const required = (op.inputSchema.required || []).includes(pname);
28
- const flagName = `--${pname.replace(/_/g, "-")} <value>`;
29
- const desc = String(pschema?.description ?? "");
30
- const opt = new Option(flagName, desc);
31
- if (required)
32
- opt.makeOptionMandatory(true);
33
- cmd.addOption(opt);
34
- }
35
- cmd.addOption(new Option("--output <format>", "Output format: json|ndjson|table|csv|tsv|yaml").choices(["json", "ndjson", "table", "csv", "tsv", "yaml"]).default(op.outputDefault));
36
- if (op.pagination !== 'none') {
37
- cmd.addOption(new Option("--all", "Fetch all pages and stream NDJSON"));
38
- cmd.addOption(new Option("--max-pages <n>", "Stop after N pages (default 1000)"));
39
- cmd.addOption(new Option("--max-items <n>", "Stop after N items (default 100000)"));
40
- }
41
- if (op.idempotencyRequired) {
42
- cmd.addOption(new Option("--idempotency-key <uuid>", "Override auto-generated Idempotency-Key (debug / replay)"));
43
- }
44
- // WS stream options removed (--reconnect / --max-frames). CLI no longer
45
- // exposes /v1/ws/{news,views} as commands; codegen now drops x-cli-key
46
- // for those ops so `op.stream` is always false here.
47
- cmd.action(async (...rawArgs) => {
48
- const opts = cmd.opts();
49
- // reverse commander's camelCase: sinceHours → since_hours
50
- const args = {};
51
- for (const [k, v] of Object.entries(opts)) {
52
- args[camelToSnake(k)] = v;
53
- }
54
- op.positional.forEach((pname, i) => {
55
- if (rawArgs[i] !== undefined)
56
- args[pname] = rawArgs[i];
57
- });
58
- await dispatch(op, args);
59
- });
60
- }
61
- export function buildCommandTree(program, dispatch) {
62
- {
63
- const noun = program.command("agent");
64
- noun.description("agent commands");
65
- {
66
- const cmd = noun.command("session-end");
67
- attachOperation(cmd, OPERATIONS["agent.session-end"], dispatch);
68
- }
69
- {
70
- const cmd = noun.command("session-start");
71
- attachOperation(cmd, OPERATIONS["agent.session-start"], dispatch);
72
- }
73
- {
74
- const cmd = noun.command("session-usage");
75
- attachOperation(cmd, OPERATIONS["agent.session-usage"], dispatch);
76
- }
77
- }
78
- {
79
- const noun = program.command("auth");
80
- noun.description("auth commands");
81
- {
82
- const cmd = noun.command("whoami");
83
- attachOperation(cmd, OPERATIONS["auth.whoami"], dispatch);
84
- }
85
- }
86
- {
87
- const noun = program.command("bars");
88
- noun.description("bars commands");
89
- {
90
- const cmd = noun.command("daily");
91
- attachOperation(cmd, OPERATIONS["bars.daily"], dispatch);
92
- }
93
- {
94
- const cmd = noun.command("daily-batch");
95
- attachOperation(cmd, OPERATIONS["bars.daily-batch"], dispatch);
96
- }
97
- {
98
- const cmd = noun.command("minute");
99
- attachOperation(cmd, OPERATIONS["bars.minute"], dispatch);
100
- }
101
- {
102
- const cmd = noun.command("minute-batch");
103
- attachOperation(cmd, OPERATIONS["bars.minute-batch"], dispatch);
104
- }
105
- }
106
- {
107
- const noun = program.command("digest");
108
- noun.description("digest commands");
109
- {
110
- const cmd = noun.command("get");
111
- attachOperation(cmd, OPERATIONS["digest.get"], dispatch);
112
- }
113
- }
114
- {
115
- const noun = program.command("financials");
116
- noun.description("financials commands");
117
- {
118
- const cmd = noun.command("pit");
119
- attachOperation(cmd, OPERATIONS["financials.pit"], dispatch);
120
- }
121
- {
122
- const cmd = noun.command("quote-snapshot");
123
- attachOperation(cmd, OPERATIONS["financials.quote-snapshot"], dispatch);
124
- }
125
- {
126
- const cmd = noun.command("reports");
127
- attachOperation(cmd, OPERATIONS["financials.reports"], dispatch);
128
- }
129
- {
130
- const cmd = noun.command("series");
131
- attachOperation(cmd, OPERATIONS["financials.series"], dispatch);
132
- }
133
- }
134
- {
135
- const noun = program.command("index");
136
- noun.description("index commands");
137
- {
138
- const cmd = noun.command("daily-bars");
139
- attachOperation(cmd, OPERATIONS["index.daily-bars"], dispatch);
140
- }
141
- {
142
- const cmd = noun.command("minute-bars");
143
- attachOperation(cmd, OPERATIONS["index.minute-bars"], dispatch);
144
- }
145
- {
146
- const cmd = noun.command("snapshot");
147
- attachOperation(cmd, OPERATIONS["index.snapshot"], dispatch);
148
- }
149
- }
150
- {
151
- const noun = program.command("market");
152
- noun.description("market commands");
153
- {
154
- const cmd = noun.command("status");
155
- attachOperation(cmd, OPERATIONS["market.status"], dispatch);
156
- }
157
- }
158
- {
159
- const noun = program.command("news");
160
- noun.description("news commands");
161
- {
162
- const cmd = noun.command("feed");
163
- attachOperation(cmd, OPERATIONS["news.feed"], dispatch);
164
- }
165
- {
166
- const cmd = noun.command("get");
167
- attachOperation(cmd, OPERATIONS["news.get"], dispatch);
168
- }
169
- {
170
- const cmd = noun.command("list");
171
- attachOperation(cmd, OPERATIONS["news.list"], dispatch);
172
- }
173
- {
174
- const cmd = noun.command("search");
175
- attachOperation(cmd, OPERATIONS["news.search"], dispatch);
176
- }
177
- }
178
- {
179
- const noun = program.command("payment");
180
- noun.description("payment commands");
181
- {
182
- const cmd = noun.command("plans");
183
- attachOperation(cmd, OPERATIONS["payment.plans"], dispatch);
184
- }
185
- }
186
- {
187
- const noun = program.command("quote");
188
- noun.description("quote commands");
189
- {
190
- const cmd = noun.command("quote");
191
- attachOperation(cmd, OPERATIONS["quote"], dispatch);
192
- }
193
- {
194
- const cmd = noun.command("scan");
195
- attachOperation(cmd, OPERATIONS["quote.scan"], dispatch);
196
- }
197
- }
198
- {
199
- const noun = program.command("search");
200
- noun.description("search commands");
201
- {
202
- const cmd = noun.command("semantic");
203
- attachOperation(cmd, OPERATIONS["search.semantic"], dispatch);
204
- }
205
- }
206
- {
207
- const noun = program.command("securities");
208
- noun.description("securities commands");
209
- {
210
- const cmd = noun.command("industry");
211
- attachOperation(cmd, OPERATIONS["securities.industry"], dispatch);
212
- }
213
- }
214
- {
215
- const noun = program.command("semantic");
216
- noun.description("semantic commands");
217
- {
218
- const cmd = noun.command("find");
219
- attachOperation(cmd, OPERATIONS["semantic.find"], dispatch);
220
- }
221
- }
222
- {
223
- const noun = program.command("sentiment");
224
- noun.description("sentiment commands");
225
- {
226
- const cmd = noun.command("breadth");
227
- attachOperation(cmd, OPERATIONS["sentiment.breadth"], dispatch);
228
- }
229
- {
230
- const cmd = noun.command("overview");
231
- attachOperation(cmd, OPERATIONS["sentiment.overview"], dispatch);
232
- }
233
- {
234
- const cmd = noun.command("pct-distribution");
235
- attachOperation(cmd, OPERATIONS["sentiment.pct-distribution"], dispatch);
236
- }
237
- {
238
- const cmd = noun.command("turnover");
239
- attachOperation(cmd, OPERATIONS["sentiment.turnover"], dispatch);
240
- }
241
- }
242
- {
243
- const noun = program.command("squawk");
244
- noun.description("squawk commands");
245
- {
246
- const cmd = noun.command("audio");
247
- attachOperation(cmd, OPERATIONS["squawk.audio"], dispatch);
248
- }
249
- {
250
- const cmd = noun.command("waveform");
251
- attachOperation(cmd, OPERATIONS["squawk.waveform"], dispatch);
252
- }
253
- }
254
- {
255
- const noun = program.command("stocks");
256
- noun.description("stocks commands");
257
- {
258
- const cmd = noun.command("hot");
259
- attachOperation(cmd, OPERATIONS["stocks.hot"], dispatch);
260
- }
261
- {
262
- const cmd = noun.command("social-hot");
263
- attachOperation(cmd, OPERATIONS["stocks.social-hot"], dispatch);
264
- }
265
- }
266
- {
267
- const noun = program.command("views");
268
- noun.description("views commands");
269
- {
270
- const cmd = noun.command("feed");
271
- attachOperation(cmd, OPERATIONS["views.feed"], dispatch);
272
- }
273
- {
274
- const cmd = noun.command("get");
275
- attachOperation(cmd, OPERATIONS["views.get"], dispatch);
276
- }
277
- {
278
- const cmd = noun.command("recent");
279
- attachOperation(cmd, OPERATIONS["views.recent"], dispatch);
280
- }
281
- }
282
- }
@@ -1,195 +0,0 @@
1
- /**
2
- * AUTO-GENERATED — DO NOT EDIT BY HAND.
3
- */
4
- export const HELP = {
5
- "agent.session-end": {
6
- "summary": "End a billable agent session",
7
- "description": "关闭 `/v1/agent/session/start` 开启的会话,最终用量提交入库。",
8
- "example": "echopai agent session-end VALUE"
9
- },
10
- "agent.session-start": {
11
- "summary": "Start a billable agent session",
12
- "description": "开启 agent kind 凭据的计费会话。返回 session_id,用于将多次调用归并到一次 billable 单位。需要 `Idempotency-Key` 头。",
13
- "example": "echopai agent session-start --agent-id agent-prod-1 --budget-usd 1.0"
14
- },
15
- "agent.session-usage": {
16
- "summary": "Get cumulative usage of an agent session",
17
- "description": "返回 session 内累计 billable 调用次数、各 scope 配额消耗。",
18
- "example": "echopai agent session-usage VALUE"
19
- },
20
- "auth.whoami": {
21
- "summary": "Token introspection (CLI/MCP capability discovery)",
22
- "description": "Returns the calling token's kind, scopes, audience, app metadata,\nrate_limit, allowed_clients, agent_budget (if kind=agent), api_version,\nfeature_flags. Any valid JWT can call — no specific scope required.\n\nCLI/MCP call this once at startup, cache 5 minutes in-process, and use\nthe response to derive `verbs.available` (intersection of curated verb\nscopes with token scopes) and to populate `echopai doctor` checks.\n\nSee `docs/PLAN_CLI_V2_AGENT_SURFACE.md` §5.1.\n",
23
- "example": "echopai auth whoami"
24
- },
25
- "bars.daily": {
26
- "summary": "Daily OHLC bars for one A-share security",
27
- "description": "Daily OHLC bars for one A-share security over a date range. Returns open / high / low / close / volume / turnover per trading day. Requires `bars:30d` (last 30 trading days) or `bars:full` (full history) scope.",
28
- "example": "echopai bars daily --code SSE:600519 --from 2026-01-01 --to 2026-05-01"
29
- },
30
- "bars.daily-batch": {
31
- "summary": "Batch daily OHLC bars for up to 100 A-share securities",
32
- "description": "Batch daily OHLC bars for multiple A-share securities. Up to 100 codes\nper call, up to 1-year date range. Single round-trip; ClickHouse `IN(...)`\nunder the hood.\n\nReturns partial success envelope: codes denied by `allowed_securities`\nappear in `errors[]`, others in `items[]` (with empty `bars[]` if no\ndata found). Order in `items[]` matches input order.\n\nRequires `bars:30d` or `bars:full` scope.\n",
33
- "example": "echopai bars daily-batch --codes ['SSE:600519', 'SZSE:000001']"
34
- },
35
- "bars.minute": {
36
- "summary": "Minute-level OHLC bars for one A-share security",
37
- "description": "Minute-level OHLC bars for one A-share security on a single trade date. Requires `bars:30d` or `bars:full` scope.",
38
- "example": "echopai bars minute --code SSE:600519 --date 2026-05-09"
39
- },
40
- "bars.minute-batch": {
41
- "summary": "Batch minute OHLC bars for up to 20 A-share securities",
42
- "description": "Batch minute OHLC bars for multiple A-share securities. Up to 20 codes\nper call, up to 7 calendar days (≈5 trading days) date range. Single\nClickHouse round-trip; app groups rows by canonical_code.\n\nPartial success envelope same as daily-batch: codes denied by\n`allowed_securities` go to `errors[]`; others to `items[]` with flat\n`bars[]` (each bar carries its own `trade_date` for client grouping).\n\nRequires `bars:30d` or `bars:full` scope.\n",
43
- "example": "echopai bars minute-batch --codes ['SSE:600519', 'SZSE:000001']"
44
- },
45
- "digest.get": {
46
- "summary": "One-shot research digest for a single security (composite)",
47
- "description": "Composite endpoint: in one HTTP call returns views (PRIMARY research),\nreal-time quote, valuation snapshot (PE/PB/PS/换手率/股息率/量比 等 14 字段),\nmarket sentiment context, and supplementary news.\nPartial-failure tolerant:\neach bucket is independently fetched and per-bucket failures surface\nin `meta.partial_failures[]` rather than poisoning the response. If\nevery sub-bucket fails the endpoint returns 502.\n\nBucket scopes are checked *per bucket* (not at gateway level): a\ntoken with only `views:read` gets the views bucket populated and the\nrest reported as `scope_insufficient` partial failures. This mirrors\nthe CLI fan-out contract exactly so `echopai digest` can either call\nthis endpoint (preferred, single round-trip) or fall back to local\nfan-out without behavior drift.\n\nSee `docs/PLAN_CLI_V2_AGENT_SURFACE.md` §3.3 (digest spec) and §11\nPhase 5.2 (server endpoint).\n",
48
- "example": "echopai digest get VALUE"
49
- },
50
- "financials.pit": {
51
- "summary": "Point-in-time financial indicators for one A-share at a given date",
52
- "description": "基于 TDX 财务数据的 Point-in-time 查询。给定 `code` 和 `date`,返回该\n`trade_date` 当时市场上可见的最新一期财务报告(`announce_date <= date`,\n无公告日时保守延迟 90 天)。专为回测、AI agent、量化策略防未来函数泄漏。\n\n返回字段包括:EPS(基本/扣非/稀释)、BPS、ROE、毛利率、营收/净利润/总资产/\n归母权益等核心 ~25 字段。\n",
53
- "example": "echopai financials pit --code SSE:600519 --date 2024-11-01"
54
- },
55
- "financials.quote-snapshot": {
56
- "summary": "Real-time valuation / share / turnover snapshot for one A-share",
57
- "description": "一站式估值快照 —— 一次返回 14 个字段,**全部基于 TDX 原始数据 + Sina 实时\n价自算,不依赖 Tushare**:\n\n- 估值: `pe` / `pe_ttm` / `pb` / `ps` / `ps_ttm`\n- 股本(万股): `total_share` / `float_share` / `free_share`\n- 市值(万元): `total_mv` / `circ_mv`\n- 流动性: `turnover_rate` / `turnover_rate_f`(%)/ `volume_ratio`(倍)\n- 分红: `dv_ratio` / `dv_ttm`(%)\n\n计算口径:\n- PE-TTM = 当前总市值 / 近 4 季度滚动净利润(PIT 表 `ni_parent_ttm`)\n- PE = 当前总市值 / 上年报净利润(`ni_parent_last1y`)\n- PB = 当前总市值 / 归母净资产(`equity_parent`,PIT 防穿越)\n- 换手率 = 当日累计成交量 / 流通股本 × 100\n- 量比 = 当日累计 / 近 5 日同时段累计平均(实时模式)\n / 近 5 日全日成交量平均(指定历史日期模式)\n- 股息率 = Σ(去年 / 近12月内派息事件 派现/10) / 现价 × 100\n\n默认 `date` 留空 → 实时(Sina 5s 快照价 + 当日累计成交量);\n给 `date=YYYY-MM-DD` 则按当日 close 取值(用于历史回测 / 校验)。\n\n财报数据走 `security_financial_indicators_pit` PIT 视图:保证 `visible_date`\n≤ trade_date,避免未来函数。\n\n准确性已对照 Tushare `daily_basic` 校验(见 `scripts/validation/validate_quote_snapshot_vs_tushare.py`)。\n",
58
- "example": "echopai financials quote-snapshot --code SSE:600519 --date 2026-05-13"
59
- },
60
- "financials.reports": {
61
- "summary": "Recent financial reports for one A-share security",
62
- "description": "返回该股票最近 N 期财务报告的核心指标(EPS/BPS/ROE/毛利率/营收/净利润/总\n资产/归母权益/经营现金流/总股本 等 ~25 字段)。可按 `kind` 过滤季报/半年报/\n年报。每期 `announce_date` 字段告知何时市场可见,建议结合回测时使用。\n",
63
- "example": "echopai financials reports --code SSE:600519"
64
- },
65
- "financials.series": {
66
- "summary": "Time series of a single financial metric for one security",
67
- "description": "返回某只股票某个财务指标的历史时间序列(按报告期排列)。`metric` 是\nindicators 表中的字段名(如 `roe_simple` / `revenue` / `ni_parent` /\n`debt_asset_ratio` / `gross_margin` / `eps_basic` 等共 150 个)。\n\n典型用法:画茅台 10 年 ROE 走势、对比 5 只白酒股 net_margin。\n",
68
- "example": "echopai financials series --code SSE:600519 --metric roe_simple"
69
- },
70
- "index.daily-bars": {
71
- "summary": "Daily OHLC bars for one A-share index",
72
- "description": "指数日线 OHLC。覆盖 v2 表中的指数(上证综指 `SSE:000001` / 深证成指\n`SZSE:399001` / 沪深300 `SSE:000300` / 北证50 `BSE:899050` / 中证系列 `CSI:000922` 等)。\n与 `/v1/bars/daily` 同语义,但 index 没有 `turnover_rate` / `paused` 等股票特有字段。\n",
73
- "example": "echopai index daily-bars --code SSE:000001 --from 2024-01-01 --to 2024-12-31"
74
- },
75
- "index.minute-bars": {
76
- "summary": "Minute OHLC bars for one A-share index",
77
- "description": "指数 1min OHLC。日期范围 ≤ 7 天(与 `/v1/bars/minute-batch` 对齐)。\n返回 `bar_time` / `trade_date` / OHLC / volume / amount / pct_change。\n",
78
- "example": "echopai index minute-bars --code SSE:000001"
79
- },
80
- "index.snapshot": {
81
- "summary": "Real-time snapshot of all Sina-OK A-share indices (172 indices)",
82
- "description": "Returns the latest real-time snapshot for the 172 indices that Sina\nexposes a quote for (SSE / SZSE / BSE — includes 北证50 `BSE:899050`\nand 专精特新 `899601.BJ`). Source is the Redis hash\n`stockpulse:index_snapshots:latest` which the Rust collector refreshes\nevery ~15 seconds during market hours; outside trading hours the last\nintraday snapshot is returned.\n\nUse `codes` to narrow to a subset (canonical format `SSE:000001` (exchange-prefix; legacy `000001.SH` is also accepted but discouraged)).\nOmit to receive all 172.\n\nNote: CSI-series indices (e.g. `CSI:000922`) are not available here —\nSina has no quote feed for them. Daily/minute history for those still\nlives behind `/api/internal/index/{daily-bars,minute-bars-range}`.\n\nRequires `quote:l1`, `quote:l2`, or `quote:delayed` scope.\n",
83
- "example": "echopai index snapshot --codes SSE:000001,SZSE:399001,BSE:899050"
84
- },
85
- "market.status": {
86
- "summary": "Current A-share market session state",
87
- "description": "Current A-share market session: pre-open / open / lunch / closed; current and next trading day; holiday flag. Requires `market:read` or any `quote:*` scope.",
88
- "example": "echopai market status"
89
- },
90
- "news.feed": {
91
- "summary": "List recent news (alias of /v1/news/list)",
92
- "description": "与 `/v1/news/list` 行为一致,旧客户端兼容用。",
93
- "example": "echopai news feed"
94
- },
95
- "news.get": {
96
- "summary": "Fetch a single news item by id",
97
- "description": "返回新闻完整内容:title、content snippet、tagged securities。(采集端字段 source / source_id / source_url 对外不暴露,admin 路径 /v1/admin/news/{id} 可见。)",
98
- "example": "echopai news get VALUE"
99
- },
100
- "news.list": {
101
- "summary": "List news mentioning a specific security",
102
- "description": "List news mentioning a specific A-share security, ordered by published_at desc. Requires `news:read` scope.",
103
- "example": "echopai news list --security SSE:600519"
104
- },
105
- "news.search": {
106
- "summary": "Full-text search recent news",
107
- "description": "Full-text search recent news / market briefs. Returns title, published_at, snippet, tagged securities. (Internal collector identifiers — `source`/`source_id`/`source_url` — are NOT exposed publicly; admin tools see them via /v1/admin/*.) Requires `news:read` scope. Note: news fields are user-generated; meta.untrusted_text_fields lists fields that need sanitization before passing to an LLM.",
108
- "example": "echopai news search --query 光伏龙头"
109
- },
110
- "payment.plans": {
111
- "summary": "List subscription plans",
112
- "description": "返回订阅计划清单(plan_id + 价格 + 时长 + 描述)。",
113
- "example": "echopai payment plans"
114
- },
115
- "quote": {
116
- "summary": "Real-time quote for one or more A-share securities",
117
- "description": "Real-time quote for one or more A-share securities. Returns last price, volume, change %, bid/ask. Up to 200 codes per call. Requires `quote:l1`, `quote:l2`, or `quote:delayed` scope.",
118
- "example": "echopai quote --codes ['SSE:600519', 'SZSE:000001']"
119
- },
120
- "quote.scan": {
121
- "summary": "Full-market real-time quote scan (~5800 A-share securities)",
122
- "description": "Dumps the entire Redis snapshot of A-share real-time quotes in a single\nround-trip. Use for \"全市场扫描\" / agent universe-of-interest discovery\nwhen you don't yet know which codes to query.\n\nFiltering:\n- `exchange=SSE|SZSE|BSE` narrows to one exchange (canonical_code prefix)\n- `app.allowed_securities` is ALWAYS applied; codes outside drop silently\n\nResponse size: ~3 MB unfiltered (~5800 items). CLI users should pair\nwith `--max-bytes` / `--fields` / `--query` from Phase 1.4.\n\n9:00–9:14 集合竞价时段返回空 items + `note` 字段说明。\n\nRequires `quote:l1`, `quote:l2`, or `quote:delayed` scope.\n",
123
- "example": "echopai quote scan"
124
- },
125
- "search.semantic": {
126
- "summary": "Hybrid semantic search across news + analyst views",
127
- "description": "语义 + 模糊泛化搜索。结合 entity 精确匹配(公司代码/分析师)、向量召回(pgvector\n+ DashScope embedding)、trigram 模糊、ILIKE 精确四路召回,RRF 融合后用 reranker\n精排,叠时间衰减 + views 加权(views 主源优先)。\n\n- 搜\"锂电池\"会带出新能源产业链(正极/负极/碳酸锂/宁德时代…)\n- 搜\"芯片\"会带出存储芯片/洁净室/晶圆代工…\n- mode=exact 兼容老 ILIKE 行为,仅在精确关键词命中时返回。\n",
128
- "example": "echopai search semantic --q 锂电池"
129
- },
130
- "securities.industry": {
131
- "summary": "TDX + 申万 industry classification for one A-share security",
132
- "description": "返回该股票的 TDX 自定义行业代码(T1001 食品饮料等)与申万行业三级代码\nL1/L2/L3(X5001 食品饮料 / X500102 白酒 等)。\n\n用法:\n- 股票详情页\"申万行业:白酒 / 食品饮料\"标签\n- 筛选器交叉过滤:行业 + ROE/营收增长率\n- AI agent `find_peers(code)` 用申万二级行业找同业\n",
133
- "example": "echopai securities industry --code SSE:600519"
134
- },
135
- "semantic.find": {
136
- "summary": "Find A-share securities by name / code / pinyin",
137
- "description": "Find A-share securities matching a name (Chinese), code (e.g. 600519), or pinyin initials (e.g. gzmt). Use this when an agent has a description and needs canonical codes.",
138
- "example": "echopai semantic find --query 贵州茅台"
139
- },
140
- "sentiment.breadth": {
141
- "summary": "Intraday breadth time series",
142
- "description": "Intraday breadth time series. Requires `sentiment:read` scope.",
143
- "example": "echopai sentiment breadth"
144
- },
145
- "sentiment.overview": {
146
- "summary": "Aggregate market sentiment indicators",
147
- "description": "Aggregate sentiment: limit-up/down counts, breadth, divergence index, top movers. Requires `sentiment:read` scope.",
148
- "example": "echopai sentiment overview --scope main_board"
149
- },
150
- "sentiment.pct-distribution": {
151
- "summary": "Distribution of intraday percent change across the universe",
152
- "description": "返回 A 股全市场涨跌幅分桶(≤-10% / -9% / ... / +10% / 涨停)的家数分布,用于市场宽度可视化。",
153
- "example": "echopai sentiment pct-distribution"
154
- },
155
- "sentiment.turnover": {
156
- "summary": "Intraday turnover time series",
157
- "description": "Intraday turnover time series. Requires `sentiment:read` scope.",
158
- "example": "echopai sentiment turnover"
159
- },
160
- "squawk.audio": {
161
- "summary": "Stream squawk TTS audio",
162
- "description": "返回 squawk 项的 TTS 音频(MP3)。直接 stream,可作为 `<audio>` src 用。",
163
- "example": "echopai squawk audio VALUE"
164
- },
165
- "squawk.waveform": {
166
- "summary": "Waveform peaks for squawk audio",
167
- "description": "返回 squawk 音频的预计算波形 peak 数据,用于客户端波形可视化。",
168
- "example": "echopai squawk waveform VALUE"
169
- },
170
- "stocks.hot": {
171
- "summary": "Today's hot-stock leaderboard",
172
- "description": "今日最热股票榜(来源 East-Money),按搜索 / 关注 / 评论综合分排序。",
173
- "example": "echopai stocks hot"
174
- },
175
- "stocks.social-hot": {
176
- "summary": "Cross-platform social-hot stocks",
177
- "description": "跨平台(微博 / 雪球 / Twitter)社交媒体提及聚合榜,按提及量 / 情感打分。",
178
- "example": "echopai stocks social-hot"
179
- },
180
- "views.feed": {
181
- "summary": "List analyst views",
182
- "description": "分析师观点 / 卖方研报 / 长文本观点流。可按机构 / 分析师 / 证券 / hours 过滤。需要 `views:read` scope。",
183
- "example": "echopai views feed"
184
- },
185
- "views.get": {
186
- "summary": "Fetch a single analyst view",
187
- "description": "返回单条 view 完整内容、附件图片、tagged securities、AI 摘要。",
188
- "example": "echopai views get VALUE"
189
- },
190
- "views.recent": {
191
- "summary": "Recent broker / analyst views",
192
- "description": "List recent broker / analyst views (research notes, price targets, ratings). Filter by analyst, institution, or a specific security. Requires `views:read` scope.",
193
- "example": "echopai views recent"
194
- }
195
- };