gangtise-openapi-cli 0.13.0 → 0.14.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.
package/README.md CHANGED
@@ -4,6 +4,16 @@
4
4
 
5
5
  ## Changelog
6
6
 
7
+ ### v0.14.0 — 2026-05-22
8
+
9
+ **新增接口**
10
+ - `quote realtime` — 个股实时行情快照,单接口同时覆盖 A 股 / 港股 / 美股;支持代码混合传入或市场关键字(`aShares` / `hkStocks` / `usStocks`)批量查询全市场
11
+ - `quote day-kline-us` — 美股历史日 K 线,数据范围 NYSE / NASDAQ / AMEX;支持 `--security all` 全市场(CLI 自动按 2 天/片切分并发拉取)
12
+
13
+ **接口变更**
14
+ - `quote day-kline` / `quote day-kline-hk` 明确仅返回**历史**日 K 线,不包含盘中实时数据;当日数据入库时间:A 股 ~15:30 / 港股 ~16:30(北京时间)。盘中实时请走 `quote realtime`
15
+ - `fundamental valuation-analysis` 返回字段移除 `p10` / `p25` / `p75` / `p90`(仍保留 `value` / `percentileRank` / `average` / `median` / `upper1Std` / `lower1Std`)
16
+
7
17
  ### v0.13.0 — 2026-05-15
8
18
 
9
19
  **新增接口**
@@ -129,11 +139,12 @@ gangtise-openapi/
129
139
  └── references/
130
140
  ├── commands/ # 按命令组拆分的详细参数文档(agent 按需 Read)
131
141
  │ ├── ai.md # AI 能力命令(one-pager / earnings-review / viewpoint-debate 等)
132
- │ ├── fundamental.md # 财务数据命令(三大报表 / 估值 / 盈利预测 / 股东)
142
+ │ ├── alternative.md # 行业指标数据库(EDB search / EDB data)
143
+ │ ├── fundamental.md # 财务数据命令(A股/港股三大报表 / 估值 / 盈利预测 / 股东)
133
144
  │ ├── insight.md # 投研内容命令(研报 / 观点 / 纪要 / 公告 / 外资)
134
145
  │ ├── quote.md # 行情命令(A股/港股/指数 K 线)
135
146
  │ ├── reference-and-lookup.md # GTS Code 搜索与枚举速查
136
- │ └── vault.md # 云盘/录音/会议/群消息
147
+ │ └── vault.md # 云盘/录音/会议/群消息/股票池
137
148
  ├── examples.md # 典型场景的端到端示例
138
149
  ├── fields.md # K线/财务字段中英文对照速查表
139
150
  ├── lookup-ids.md # 常用 ID 速查表(行业/券商/机构/公告分类等)
@@ -186,11 +197,13 @@ cp -r gangtise-openapi ~/.hermes/skills/gangtise-openapi
186
197
  | | `foreign-opinion list` | 外资机构观点 |
187
198
  | | `independent-opinion list` / `download` | 外资独立分析师观点(含原文/翻译HTML下载) |
188
199
  | **Reference** | `securities-search` | GTS Code 搜索(按名称/代码/拼音匹配) |
189
- | **Quote** | `day-kline` / `day-kline-hk` | A股/港股日K线 |
200
+ | **Quote** | `day-kline` / `day-kline-hk` / `day-kline-us` | A股/港股/美股历史日K线 |
190
201
  | | `index-day-kline` | 沪深京指数日K线 |
191
202
  | | `minute-kline` | A股分钟K线 |
192
- | **Fundamental** | `income-statement` / `balance-sheet` / `cash-flow` | 三大财务报表(累计) |
193
- | | `income-statement-quarterly` / `cash-flow-quarterly` | 利润表/现金流量表(单季度) |
203
+ | | `realtime` | 个股实时行情快照(A股/港股/美股) |
204
+ | **Fundamental** | `income-statement` / `balance-sheet` / `cash-flow` | A股三大财务报表(累计) |
205
+ | | `income-statement-quarterly` / `cash-flow-quarterly` | A股利润表/现金流量表(单季度) |
206
+ | | `income-statement-hk` / `balance-sheet-hk` / `cash-flow-hk` | 港股三大财务报表(中国会计准则) |
194
207
  | | `main-business` | 主营构成(按地区/产品拆分) |
195
208
  | | `valuation-analysis` | 估值分析 |
196
209
  | | `earning-forecast` | 盈利预测(一致预期) |
@@ -212,6 +225,9 @@ cp -r gangtise-openapi ~/.hermes/skills/gangtise-openapi
212
225
  | | `record-list` / `record-download` | 录音速记列表与下载 |
213
226
  | | `my-conference-list` / `my-conference-download` | 我的会议列表与下载 |
214
227
  | | `wechat-message-list` / `wechat-chatroom-list` | 群消息列表与群ID查询 |
228
+ | | `stock-pool-list` / `stock-pool-stocks` | 自选股股票池列表与证券明细 |
229
+ | **Alternative** | `edb-search` | 行业指标搜索(按关键词匹配,返回 indicatorId 等元信息) |
230
+ | | `edb-data` | 行业指标时序数据(批量拉取,最多10个指标) |
215
231
  | **Raw** | `call` | 原始接口调用(可访问任意 endpoint) |
216
232
 
217
233
  ## 命令概览
@@ -223,6 +239,7 @@ cp -r gangtise-openapi ~/.hermes/skills/gangtise-openapi
223
239
  - `gangtise fundamental ...`
224
240
  - `gangtise ai ...`
225
241
  - `gangtise vault ...`
242
+ - `gangtise alternative ...`
226
243
  - `gangtise reference ...`
227
244
  - `gangtise raw call ...`
228
245
 
@@ -257,7 +274,7 @@ gangtise ai knowledge-batch --query 比亚迪 --query 最近热门概念
257
274
  - **流式输出**:`jsonl`/`csv` 格式且 `--output` 指定时,超过 1000 行自动切换为逐行写盘,避免一次性构建百 MB 字符串。
258
275
  - **自动重试**:5xx / `ECONNRESET` / `ETIMEDOUT` / `999999` 系统错误自动指数退避重试 2 次。
259
276
  - **Token 自愈**:调用返回 8000014/8000015 时自动强制刷新 Token 并重试一次。
260
- - **K线自动分片**:`quote day-kline --security all` 等全市场查询自动按日期切分(A股 2 天/片、HK 3 天/片、指数 30 天/片),并发执行后合并结果。
277
+ - **K线自动分片**:`quote day-kline --security all` 等全市场查询自动按日期切分(A股 / 美股 2 天/片、HK 3 天/片、指数 30 天/片),并发执行后合并结果。
261
278
  - **Token 内存缓存**:Token 在进程内存中缓存,避免每次请求读盘。
262
279
  - **`--verbose`**:打印每个请求的方法、路径、状态码、耗时和响应大小到 stderr,方便定位慢查询。
263
280
 
@@ -379,12 +396,22 @@ gangtise quote day-kline --security all --start-date 2026-04-01 --end-date 2026-
379
396
  gangtise quote day-kline-hk --security 00700.HK --start-date 2026-03-01 --end-date 2026-03-31
380
397
  # 港股全市场
381
398
  gangtise quote day-kline-hk --security all --start-date 2026-04-01 --end-date 2026-04-01 --limit 100 --format json
399
+ # 美股日K线(NASDAQ/NYSE/AMEX,历史)
400
+ gangtise quote day-kline-us --security AAPL.O --security MSFT.O --start-date 2026-04-22 --end-date 2026-05-22 --field tradeDate --field open --field close --field volume
401
+ # 美股全市场(自动分片)
402
+ gangtise quote day-kline-us --security all --start-date 2026-04-01 --end-date 2026-04-02 --field securityCode --field close --format json
382
403
  # 沪深京指数日K线
383
404
  gangtise quote index-day-kline --security 000001.SH --security 399001.SZ --start-date 2024-05-01 --end-date 2024-05-20 --field securityCode --field tradeDate --field close --field volume
384
405
  # A股分钟K线
385
406
  gangtise quote minute-kline --security 600519.SH --start-time "2026-04-15 09:30:00" --end-time "2026-04-15 15:00:00" --field open --field close --field volume
407
+ # 实时行情:三大市场混合查询
408
+ gangtise quote realtime --security 600519.SH --security 00700.HK --security AAPL.O --field securityCode --field tradeTime --field latestPrice --field pctChange --field volume --format json
409
+ # 实时行情:全市场批量(建议配合 --field 精简字段)
410
+ gangtise quote realtime --security aShares --field securityCode --field latestPrice --field pctChange --field volume --format json
386
411
  ```
387
412
 
413
+ > **历史 vs 实时**:`day-kline*` 仅返回历史数据(当日数据入库时间:A 股 ~15:30 / 港股 ~16:30 / 美股 ~07:00 北京时间)。盘中需要最新成交价、振幅等实时字段必须走 `quote realtime`。
414
+
388
415
  ### Fundamental
389
416
 
390
417
  ```bash
@@ -413,6 +440,14 @@ gangtise fundamental cash-flow-quarterly --security-code 600519.SH --fiscal-year
413
440
  gangtise fundamental top-holders --security-code 600519.SH --holder-type top10 --fiscal-year 2025 --format json
414
441
  # 前十大流通股东(按日期范围)
415
442
  gangtise fundamental top-holders --security-code 600519.SH --holder-type top10Float --start-date 2025-01-01 --end-date 2025-12-31 --period q3 --format json
443
+
444
+ # 港股三大报表(中国会计准则,--security-code 用港股代码)
445
+ gangtise fundamental income-statement-hk --security-code 09992.HK --fiscal-year 2025 --period annual --field netProfit --field basicEPS
446
+ gangtise fundamental income-statement-hk --security-code 09992.HK --fiscal-year 2023 --fiscal-year 2024 --fiscal-year 2025 --period annual --field netProfit
447
+ gangtise fundamental balance-sheet-hk --security-code 09992.HK --fiscal-year 2025 --period h1 --field totalCurrAssets --field totalNonCurrAssets --field totalCurrLiab --field totalNonCurrLiab
448
+ gangtise fundamental cash-flow-hk --security-code 09992.HK --fiscal-year 2025 --period annual --field netOpCashFlows --field netInvCashFlows --field netFinCashFlows
449
+ # 最新一期完整港股利润表
450
+ gangtise fundamental income-statement-hk --security-code 09992.HK --format json
416
451
  ```
417
452
 
418
453
  ### AI
@@ -431,8 +466,11 @@ gangtise ai hot-topic --start-date 2026-03-22 --end-date 2026-03-27 --category m
431
466
  # 不传 --category 默认查全部类型(早报+午报+盘中快报+晚报),--with-related-securities 和 --with-close-reading 默认开启,可用 --no-with-related-securities / --no-with-close-reading 关闭
432
467
  gangtise ai hot-topic --start-date 2026-04-15 --end-date 2026-04-17
433
468
  gangtise ai research-outline --security-code 600519.SH
434
- # 管理层讨论-财报
469
+ # 管理层讨论-财报(三个细分维度)
435
470
  gangtise ai management-discuss-announcement --report-date 2025-06-30 --security-code 000001.SZ --dimension businessOperation
471
+ gangtise ai management-discuss-announcement --report-date 2025-12-31 --security-code 000001.SZ --dimension financialPerformance
472
+ # 传入 all 返回完整管理层讨论内容(内容较长,谨慎使用)
473
+ gangtise ai management-discuss-announcement --report-date 2025-12-31 --security-code 000001.SZ --dimension all
436
474
  # 管理层讨论-业绩会
437
475
  gangtise ai management-discuss-earnings-call --report-date 2025-06-30 --security-code 000001.SZ --dimension financialPerformance
438
476
  # 观点PK(异步,返回 dataId)
@@ -466,6 +504,39 @@ gangtise vault my-conference-download --conference-id 43319 --content-type asr
466
504
  # 群消息:先按群名称查群ID,再按群ID查消息
467
505
  gangtise vault wechat-chatroom-list --room-name "AI学习群,投研分享群" --size 50
468
506
  gangtise vault wechat-message-list --keyword AI应用 --wechat-group-id ueKEGyhdjFGkjyebh --category text --category url --tag roadShow --tag meetingSummary --size 50
507
+ # 按证券代码过滤群消息
508
+ gangtise vault wechat-message-list --security 000001.SZ --security 300750.SZ --size 50
509
+
510
+ # 自选股股票池
511
+ gangtise vault stock-pool-list
512
+ # 查询指定股票池中的证券
513
+ gangtise vault stock-pool-stocks --pool-id 808477293
514
+ # 查询所有股票池中的全量证券(默认行为)
515
+ gangtise vault stock-pool-stocks
516
+ ```
517
+
518
+ ### Alternative(行业指标数据库 EDB)
519
+
520
+ ```bash
521
+ # Step 1:按关键词搜索指标,获取 indicatorId
522
+ gangtise alternative edb-search --keyword 空调 --limit 50 --format table
523
+ gangtise alternative edb-search --keyword "海尔销量"
524
+
525
+ # Step 2:按 indicatorId 拉取时间序列数据(最多10个指标)
526
+ gangtise alternative edb-data \
527
+ --indicator-id S14001618 \
528
+ --indicator-id S14001620 \
529
+ --start-date 2024-01-01 \
530
+ --end-date 2024-12-31 \
531
+ --format table
532
+
533
+ # 导出为 CSV
534
+ gangtise alternative edb-data \
535
+ --indicator-id S14001618 \
536
+ --start-date 2023-01-01 \
537
+ --end-date 2024-12-31 \
538
+ --format csv \
539
+ --output ./indicator.csv
469
540
  ```
470
541
 
471
542
  ### Raw
package/dist/src/cli.js CHANGED
@@ -284,6 +284,10 @@ quote.command("day-kline-hk").option("--security <code>", "Security code (HK sto
284
284
  const client = await createClient();
285
285
  await printData(await callKlineWithSharding(client, "quote.day-kline-hk", buildQuoteKlineBody(options), { shardDays: 3 }), parseOutputFormat(options.format), options.output);
286
286
  });
287
+ quote.command("day-kline-us").option("--security <code>", "Security code (US stock: e.g. AAPL.O, or 'all' for full market)", collectList, []).option("--start-date <date>", "Start date (default: 1 year before end-date)").option("--end-date <date>", "End date (default: latest)").option("--limit <number>", "Max rows per request (default: 6000, max: 10000)").option("--field <field>", "Field", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
288
+ const client = await createClient();
289
+ await printData(await callKlineWithSharding(client, "quote.day-kline-us", buildQuoteKlineBody(options), { shardDays: 2 }), parseOutputFormat(options.format), options.output);
290
+ });
287
291
  quote.command("index-day-kline").option("--security <code>", "Index code (.SH/.SZ/.BJ, or 'all' for full market)", collectList, []).option("--start-date <date>", "Start date (default: 1 year before end-date)").option("--end-date <date>", "End date (default: latest)").option("--limit <number>", "Max rows per request (default: 6000, max: 10000)").option("--field <field>", "Field", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
288
292
  const client = await createClient();
289
293
  await printData(await callKlineWithSharding(client, "quote.index-day-kline", buildQuoteKlineBody(options), { shardDays: 30 }), parseOutputFormat(options.format), options.output);
@@ -292,6 +296,10 @@ quote.command("minute-kline").option("--security <code>", "Security code (A-shar
292
296
  const client = await createClient();
293
297
  await printData(await client.call("quote.minute-kline", { securityCode: options.security, startTime: options.startTime, endTime: options.endTime, limit: parseOptionalNumberOption(options.limit, "--limit", { integer: true, min: 1 }), fieldList: maybeArray(options.field) }), parseOutputFormat(options.format), options.output);
294
298
  });
299
+ quote.command("realtime").description("Realtime quote snapshot (A-share / HK / US)").option("--security <code>", "Security code (e.g. 600519.SH / 00700.HK / AAPL.O), or market keyword: aShares / hkStocks / usStocks", collectList, []).option("--field <field>", "Field", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
300
+ const client = await createClient();
301
+ await printData(await client.call("quote.realtime", { securityList: maybeArray(options.security), fieldList: maybeArray(options.field) }), parseOutputFormat(options.format), options.output);
302
+ });
295
303
  program.addCommand(quote);
296
304
  const fundamental = new Command("fundamental").description("Fundamental APIs");
297
305
  const addFinancialReport = (name, endpointKey, periodHelp = "Period") => fundamental.command(name).requiredOption("--security-code <code>").option("--start-date <date>").option("--end-date <date>").option("--fiscal-year <year>", "Fiscal year", collectList, []).option("--period <period>", periodHelp, collectList, []).option("--report-type <type>", "Report type", collectList, []).option("--field <field>", "Field", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>").action(async (options) => {
@@ -217,14 +217,21 @@ export const ENDPOINTS = {
217
217
  method: "POST",
218
218
  path: "/application/open-quote/kline/daily",
219
219
  kind: "json",
220
- description: "Query A-share daily kline (SH/SZ/BJ)",
220
+ description: "Query A-share historical daily kline (SH/SZ/BJ)",
221
221
  },
222
222
  "quote.day-kline-hk": {
223
223
  key: "quote.day-kline-hk",
224
224
  method: "POST",
225
225
  path: "/application/open-quote/kline-hk/daily",
226
226
  kind: "json",
227
- description: "Query HK stock daily kline (HK)",
227
+ description: "Query HK stock historical daily kline (HK)",
228
+ },
229
+ "quote.day-kline-us": {
230
+ key: "quote.day-kline-us",
231
+ method: "POST",
232
+ path: "/application/open-quote/kline-us/daily",
233
+ kind: "json",
234
+ description: "Query US stock historical daily kline (NYSE/NASDAQ/AMEX)",
228
235
  },
229
236
  "quote.index-day-kline": {
230
237
  key: "quote.index-day-kline",
@@ -240,6 +247,13 @@ export const ENDPOINTS = {
240
247
  kind: "json",
241
248
  description: "Query A-share minute kline (SH/SZ/BJ)",
242
249
  },
250
+ "quote.realtime": {
251
+ key: "quote.realtime",
252
+ method: "POST",
253
+ path: "/application/open-quote/quote/realtime",
254
+ kind: "json",
255
+ description: "Query realtime quote snapshot (A-share / HK / US)",
256
+ },
243
257
  // ─── fundamental ───
244
258
  "fundamental.income-statement": {
245
259
  key: "fundamental.income-statement",
@@ -1,2 +1,2 @@
1
1
  // Auto-generated — DO NOT EDIT
2
- export const CLI_VERSION = "0.13.0";
2
+ export const CLI_VERSION = "0.14.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gangtise-openapi-cli",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "CLI for Gangtise OpenAPI",
5
5
  "license": "MIT",
6
6
  "repository": {