gangtise-openapi-cli 0.13.1 → 0.14.1

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,21 @@
4
4
 
5
5
  ## Changelog
6
6
 
7
+ ### v0.14.1 — 2026-05-22
8
+
9
+ **Bug fix**
10
+ - `quote day-kline-us --security all` 分片由 2 天/片改为 **1 天/片**。美股全市场单日约 5800 行,原 2 天/片会在第一个 shard 命中默认 `--limit 6000` 上限,导致 shard 内第二日数据被截断到几百行。改 1 天/片后每个 shard 数据完整。
11
+
12
+ ### v0.14.0 — 2026-05-22
13
+
14
+ **新增接口**
15
+ - `quote realtime` — 个股实时行情快照,单接口同时覆盖 A 股 / 港股 / 美股;支持代码混合传入或市场关键字(`aShares` / `hkStocks` / `usStocks`)批量查询全市场
16
+ - `quote day-kline-us` — 美股历史日 K 线,数据范围 NYSE / NASDAQ / AMEX;支持 `--security all` 全市场(CLI 自动按 1 天/片切分并发拉取,美股全市场单日约 5800 行)
17
+
18
+ **接口变更**
19
+ - `quote day-kline` / `quote day-kline-hk` 明确仅返回**历史**日 K 线,不包含盘中实时数据;当日数据入库时间:A 股 ~15:30 / 港股 ~16:30(北京时间)。盘中实时请走 `quote realtime`
20
+ - `fundamental valuation-analysis` 返回字段移除 `p10` / `p25` / `p75` / `p90`(仍保留 `value` / `percentileRank` / `average` / `median` / `upper1Std` / `lower1Std`)
21
+
7
22
  ### v0.13.0 — 2026-05-15
8
23
 
9
24
  **新增接口**
@@ -187,9 +202,10 @@ cp -r gangtise-openapi ~/.hermes/skills/gangtise-openapi
187
202
  | | `foreign-opinion list` | 外资机构观点 |
188
203
  | | `independent-opinion list` / `download` | 外资独立分析师观点(含原文/翻译HTML下载) |
189
204
  | **Reference** | `securities-search` | GTS Code 搜索(按名称/代码/拼音匹配) |
190
- | **Quote** | `day-kline` / `day-kline-hk` | A股/港股日K线 |
205
+ | **Quote** | `day-kline` / `day-kline-hk` / `day-kline-us` | A股/港股/美股历史日K线 |
191
206
  | | `index-day-kline` | 沪深京指数日K线 |
192
207
  | | `minute-kline` | A股分钟K线 |
208
+ | | `realtime` | 个股实时行情快照(A股/港股/美股) |
193
209
  | **Fundamental** | `income-statement` / `balance-sheet` / `cash-flow` | A股三大财务报表(累计) |
194
210
  | | `income-statement-quarterly` / `cash-flow-quarterly` | A股利润表/现金流量表(单季度) |
195
211
  | | `income-statement-hk` / `balance-sheet-hk` / `cash-flow-hk` | 港股三大财务报表(中国会计准则) |
@@ -263,7 +279,7 @@ gangtise ai knowledge-batch --query 比亚迪 --query 最近热门概念
263
279
  - **流式输出**:`jsonl`/`csv` 格式且 `--output` 指定时,超过 1000 行自动切换为逐行写盘,避免一次性构建百 MB 字符串。
264
280
  - **自动重试**:5xx / `ECONNRESET` / `ETIMEDOUT` / `999999` 系统错误自动指数退避重试 2 次。
265
281
  - **Token 自愈**:调用返回 8000014/8000015 时自动强制刷新 Token 并重试一次。
266
- - **K线自动分片**:`quote day-kline --security all` 等全市场查询自动按日期切分(A股 2 天/片、HK 3 天/片、指数 30 天/片),并发执行后合并结果。
282
+ - **K线自动分片**:`quote day-kline --security all` 等全市场查询自动按日期切分(A股 2 天/片、美股 1 天/片、HK 3 天/片、指数 30 天/片),并发执行后合并结果。
267
283
  - **Token 内存缓存**:Token 在进程内存中缓存,避免每次请求读盘。
268
284
  - **`--verbose`**:打印每个请求的方法、路径、状态码、耗时和响应大小到 stderr,方便定位慢查询。
269
285
 
@@ -385,12 +401,22 @@ gangtise quote day-kline --security all --start-date 2026-04-01 --end-date 2026-
385
401
  gangtise quote day-kline-hk --security 00700.HK --start-date 2026-03-01 --end-date 2026-03-31
386
402
  # 港股全市场
387
403
  gangtise quote day-kline-hk --security all --start-date 2026-04-01 --end-date 2026-04-01 --limit 100 --format json
404
+ # 美股日K线(NASDAQ/NYSE/AMEX,历史)
405
+ 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
406
+ # 美股全市场(自动分片)
407
+ gangtise quote day-kline-us --security all --start-date 2026-04-01 --end-date 2026-04-02 --field securityCode --field close --format json
388
408
  # 沪深京指数日K线
389
409
  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
390
410
  # A股分钟K线
391
411
  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
412
+ # 实时行情:三大市场混合查询
413
+ gangtise quote realtime --security 600519.SH --security 00700.HK --security AAPL.O --field securityCode --field tradeTime --field latestPrice --field pctChange --field volume --format json
414
+ # 实时行情:全市场批量(建议配合 --field 精简字段)
415
+ gangtise quote realtime --security aShares --field securityCode --field latestPrice --field pctChange --field volume --format json
392
416
  ```
393
417
 
418
+ > **历史 vs 实时**:`day-kline*` 仅返回历史数据(当日数据入库时间:A 股 ~15:30 / 港股 ~16:30 / 美股 ~07:00 北京时间)。盘中需要最新成交价、振幅等实时字段必须走 `quote realtime`。
419
+
394
420
  ### Fundamental
395
421
 
396
422
  ```bash
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: 1 }), 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.1";
2
+ export const CLI_VERSION = "0.14.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gangtise-openapi-cli",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
4
4
  "description": "CLI for Gangtise OpenAPI",
5
5
  "license": "MIT",
6
6
  "repository": {