gangtise-openapi-cli 0.13.1 → 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
  **新增接口**
@@ -187,9 +197,10 @@ cp -r gangtise-openapi ~/.hermes/skills/gangtise-openapi
187
197
  | | `foreign-opinion list` | 外资机构观点 |
188
198
  | | `independent-opinion list` / `download` | 外资独立分析师观点(含原文/翻译HTML下载) |
189
199
  | **Reference** | `securities-search` | GTS Code 搜索(按名称/代码/拼音匹配) |
190
- | **Quote** | `day-kline` / `day-kline-hk` | A股/港股日K线 |
200
+ | **Quote** | `day-kline` / `day-kline-hk` / `day-kline-us` | A股/港股/美股历史日K线 |
191
201
  | | `index-day-kline` | 沪深京指数日K线 |
192
202
  | | `minute-kline` | A股分钟K线 |
203
+ | | `realtime` | 个股实时行情快照(A股/港股/美股) |
193
204
  | **Fundamental** | `income-statement` / `balance-sheet` / `cash-flow` | A股三大财务报表(累计) |
194
205
  | | `income-statement-quarterly` / `cash-flow-quarterly` | A股利润表/现金流量表(单季度) |
195
206
  | | `income-statement-hk` / `balance-sheet-hk` / `cash-flow-hk` | 港股三大财务报表(中国会计准则) |
@@ -263,7 +274,7 @@ gangtise ai knowledge-batch --query 比亚迪 --query 最近热门概念
263
274
  - **流式输出**:`jsonl`/`csv` 格式且 `--output` 指定时,超过 1000 行自动切换为逐行写盘,避免一次性构建百 MB 字符串。
264
275
  - **自动重试**:5xx / `ECONNRESET` / `ETIMEDOUT` / `999999` 系统错误自动指数退避重试 2 次。
265
276
  - **Token 自愈**:调用返回 8000014/8000015 时自动强制刷新 Token 并重试一次。
266
- - **K线自动分片**:`quote day-kline --security all` 等全市场查询自动按日期切分(A股 2 天/片、HK 3 天/片、指数 30 天/片),并发执行后合并结果。
277
+ - **K线自动分片**:`quote day-kline --security all` 等全市场查询自动按日期切分(A股 / 美股 2 天/片、HK 3 天/片、指数 30 天/片),并发执行后合并结果。
267
278
  - **Token 内存缓存**:Token 在进程内存中缓存,避免每次请求读盘。
268
279
  - **`--verbose`**:打印每个请求的方法、路径、状态码、耗时和响应大小到 stderr,方便定位慢查询。
269
280
 
@@ -385,12 +396,22 @@ gangtise quote day-kline --security all --start-date 2026-04-01 --end-date 2026-
385
396
  gangtise quote day-kline-hk --security 00700.HK --start-date 2026-03-01 --end-date 2026-03-31
386
397
  # 港股全市场
387
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
388
403
  # 沪深京指数日K线
389
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
390
405
  # A股分钟K线
391
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
392
411
  ```
393
412
 
413
+ > **历史 vs 实时**:`day-kline*` 仅返回历史数据(当日数据入库时间:A 股 ~15:30 / 港股 ~16:30 / 美股 ~07:00 北京时间)。盘中需要最新成交价、振幅等实时字段必须走 `quote realtime`。
414
+
394
415
  ### Fundamental
395
416
 
396
417
  ```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: 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.1";
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.1",
3
+ "version": "0.14.0",
4
4
  "description": "CLI for Gangtise OpenAPI",
5
5
  "license": "MIT",
6
6
  "repository": {