gangtise-openapi-cli 0.33.0 → 0.34.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 +22 -20
- package/dist/src/cli.js +151 -55
- package/dist/src/core/commandBodies.js +9 -7
- package/dist/src/core/errors.js +38 -4
- package/dist/src/core/quoteSharding.js +11 -11
- package/dist/src/core/titleCache.js +88 -22
- package/dist/src/version.js +1 -1
- package/gangtise-openapi/SKILL.md +36 -35
- package/gangtise-openapi/references/commands/ai.md +2 -3
- package/gangtise-openapi/references/commands/fundamental.md +3 -2
- package/gangtise-openapi/references/commands/indicator.md +49 -33
- package/gangtise-openapi/references/commands/insight.md +10 -11
- package/gangtise-openapi/references/commands/quote.md +44 -25
- package/gangtise-openapi/references/commands/reference-and-lookup.md +3 -3
- package/gangtise-openapi/references/commands/vault.md +2 -1
- package/gangtise-openapi/references/examples.md +7 -7
- package/gangtise-openapi/references/fields.md +2 -2
- package/gangtise-openapi/references/lookup-ids.md +2 -2
- package/gangtise-openapi/references/response-schema.md +4 -4
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ gangtise indicator search --keyword <text> [--limit <n>]
|
|
|
31
31
|
- 返回字段:`indicatorCode` / `indicatorName` / `description`(算法与口径)/ `scopeList`(该指标适用的市场 + 证券类型 + `usageRestriction`)/ `parameterList`(可传的 `--indicator-param` 参数名及枚举)/ `score`
|
|
32
32
|
- **市场范围按指标判断**:`scopeList` 会返回实际覆盖范围,且指标之间不同;不能笼统写成每个指标都覆盖 A / 港 / 美股。覆盖面在持续扩,别把抽查结论当常量:截至 **2026-08-03** 实测 `qte_mkt_cptl`/`shr_tot` 已覆盖 A/港/美股,`finc_pe_ttm` 覆盖 A/港股,`finc_pb_mrq` 仍只有 A 股,`is_op_rev_ttm`/`is_shnp_ttm` 覆盖 A/港股。目标列表含任一 scope 外证券时,本批 EDE 校验不通过,应回退专用接口
|
|
33
33
|
- **`scopeList[].usageRestriction`**:该指标在具体接口上的限制,`null` = 无限制。⚠️ **它是提示不是硬约束**——标着「不支持指标时间序列接口」的 `qte_vol_intvl` 实测调时序照样返数据、不会被拦下(2026-08-02)。当成「口径可能不对、结果别当真」看,别指望它会报错
|
|
34
|
-
- ⚠️ **`scopeList` 是声明不是保证**:它可能**超前于数据**——`finc_pb_mrq` 声称覆盖 A股+港股,实测港股仍无数据(复测 2026-08-08)。反过来也发生过:`qte_mkt_cptl`/`shr_tot` 在 08-02 时声称覆盖港/美股却无数据,08-03
|
|
34
|
+
- ⚠️ **`scopeList` 是声明不是保证**:它可能**超前于数据**——`finc_pb_mrq` 声称覆盖 A股+港股,实测港股仍无数据(复测 2026-08-08)。反过来也发生过:`qte_mkt_cptl`/`shr_tot` 在 08-02 时声称覆盖港/美股却无数据,08-03 数据补上了。**判断成本已经很低**:无数据会保留行列、给一个占位单元格,抽查一行就能看出覆盖情况;code 写错则直接报 `100003`,两种情形不会再混淆。⚠️ **但占位值不统一**——多数指标是 `null`,个别是 `0`(详见下方「缺数据 vs 代码写错」)
|
|
35
35
|
- 美股代码用交易所后缀 `.O`(NASDAQ) / `.N`(NYSE):用 `AAPL.O`,`AAPL.US` 取不到数据
|
|
36
36
|
|
|
37
37
|
```bash
|
|
@@ -50,14 +50,14 @@ gangtise indicator cross-section --indicator <code> [--indicator <code2>] \
|
|
|
50
50
|
- `--security`(**至少 1 个**):证券代码,如 `600519.SH`(A股)/ `09992.HK`(港股)/ `AAPL.O`(美股,用 `.O`/`.N` 后缀,非 `.US`),可重复传多个。**也接受板块 ID**(`reference sector-search` 返回的 10 位 `sectorId`,如 `1000000287` 中信白酒 → 19 只成分股),代码与板块可混传,服务端取并集去重。⚠️ 中信行业码那类 9 位 ID(`100800109`)**不是** `sectorId`,传进去返 0 只
|
|
51
51
|
- `--date`(**必选**):数据日期 `yyyy-MM-dd`。**CLI 把它下发为每个指标各自的 `tradeDate`**(2026-08-01 起服务端取消了根级 date)。日期语义按指标分两类——财务报表指标=报告期末(可为非交易日,实测 `2024-03-31` 可取数)、`finc_pe_ttm` / `finc_pb_mrq` 等日频估值=交易日(详见下方「日期路由」)
|
|
52
52
|
- `--date` 必填是 CLI 的**护栏**,不是协议要求:`cross-section` 本身接受 `indicatorParamList: []`(无参指标如 `pty_op_scope` 照常返值,实测 2026-08-02)。但绝大多数指标吃 `tradeDate`,漏传就是一张空表且退出码 0,所以宁可多带一个无害参数。(`screener` 的 `--date` 也必填,同理)
|
|
53
|
-
-
|
|
53
|
+
- 🔴 **吃 `reportDate` 的指标必须显式传 `reportDate`**:`--indicator-param "code:reportDate=2024-12-31"`。**2026-08-15 起服务端不再接受 `tradeDate`**——只给 `--date` 会报 `100003「指标 xxx 不支持参数 tradeDate; 指标 xxx 缺少必填参数 reportDate」`(此前一版会把 `tradeDate` 归一到所在报告期,现已改为报错)。哪些指标属于这一类看 `indicator search` 的 `parameterList`:`reportDate` 标 `required: true` 且列表里没有 `tradeDate` 的就是。利润表 / 资产负债表 / 现金流量表类(`is_*` 等)都在此列;行情与估值类(`qte_*` / `finc_*`)仍用 `--date` 即可。CLI 检测到你已为某指标传了 `tradeDate` 或 `reportDate` 就不再注入 `--date`,所以补上 `--indicator-param` 就能正常取数
|
|
54
54
|
- `sDate`(区间起始日)**不算**替代日期:它和 `tradeDate` 共存(`tradeDate` 是区间终点且 required),传了 `sDate` 后 `--date` 照常下发
|
|
55
55
|
- `--currency`:币种 `DFT`(原始,默认)/`CNY`/`HKD`/`USD`/`EUR`/`GBP`/`JPY`/`TWD`/`MOP`/`AUD`(**大写**,2026-08-01 起服务端枚举已统一大写)
|
|
56
56
|
- `--scale`:量纲 `0`(个,默认)/`3`(千)/`4`(万)/`6`(百万)/`8`(亿)/`9`(十亿)
|
|
57
|
-
-
|
|
57
|
+
- 根级 `--scale` **只作用于支持该参数的指标**:`qte_close` + `qte_mkt_cptl` 混查加 `--scale 8`,收盘价保持原值、总市值按亿缩放,价格类与金额类可以放心混查。要精确控制到单个指标用 `--indicator-param "code:scale=8"`
|
|
58
58
|
- **支持多指标 × 多证券**(单日横截面)
|
|
59
59
|
- **输出(宽表)**:每行一只证券,列为 `security / name / <各指标名>…`。**没有 `date` 列**——查询日期现在挂在每个指标自己的参数上,各列可以是不同日期
|
|
60
|
-
- **`--key-by name|code`**(默认 `name`):指标列头用显示名还是 `indicatorCode`。**批量按 code 回填必用 `--key-by code`**——指标名会碰撞(多个指标同显示名,如 `cf_finc_exp`/`_qtr` 都叫「财务费用」),唯有 code 唯一(行轴 `security` 本就是 code,`code` 模式整表可按 code 寻址,免去 raw API
|
|
60
|
+
- **`--key-by name|code`**(默认 `name`):指标列头用显示名还是 `indicatorCode`。**批量按 code 回填必用 `--key-by code`**——指标名会碰撞(多个指标同显示名,如 `cf_finc_exp`/`_qtr` 都叫「财务费用」),唯有 code 唯一(行轴 `security` 本就是 code,`code` 模式整表可按 code 寻址,免去 raw API 手工回填)。顺序是稳定的,但**两个轴的排法不一样**:`indicatorList` **= 请求顺序**(请求 `qte_vol,qte_close` 就回 `qte_vol,qte_close`);`securityCodeList` **是按代码升序重排的,不是请求顺序**(请求 `000858,600519,000001` → 回 `000001,000858,600519`)。所以**行序绝不能按请求下标对位**,一律按 `security` 字段取值
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
63
|
# 多证券 × 同一报告期的已实现财务指标
|
|
@@ -79,7 +79,7 @@ gangtise indicator time-series --indicator <code> [--indicator <code2>] \
|
|
|
79
79
|
|
|
80
80
|
- `--indicator` / `--security`:同上,但**只允许「多指标 × 单证券」或「单指标 × 多证券」**,不能两边都多个(要多 × 多用 `cross-section`,否则报 `100003`「仅支持多指标单证券或单指标多证券」)。**单指标时 `--security` 才能传板块 ID**;多指标时只能传一个证券代码、不得传板块 ID
|
|
81
81
|
- `--start-date` / `--end-date`(**均必选**):区间端点 `yyyy-MM-dd`。时序的时间范围由这两个参数统管,**不要**再用 `--indicator-param` 传 `tradeDate` 这类单日期参数
|
|
82
|
-
- ⚠️ **同一 `indicatorCode` 挂多套参数:截面和时序都不支持,这是设计如此,要拆成两次调用**。只有 `screener` 支持(它把指标绑到不同变量 `F1`/`F2` 上,天然可区分)。CLI 也表达不了该请求——`--indicator-param` 按 code 建 Map,同 code
|
|
82
|
+
- ⚠️ **同一 `indicatorCode` 挂多套参数:截面和时序都不支持,这是设计如此,要拆成两次调用**。只有 `screener` 支持(它把指标绑到不同变量 `F1`/`F2` 上,天然可区分)。CLI 也表达不了该请求——`--indicator-param` 按 code 建 Map,同 code 的多组参数会被合并成一组,与服务端设计一致。走 `raw call` 真发出去会报 `100003「指标 xxx 重复配置」`(2026-08-15 实测;此前一版是静默取最后一组)
|
|
83
83
|
- `--calendar-type`:日期类型 `ND`(自然日)/`TD`(交易日,默认)/`WD`(工作日)。`TD` 且跨市场时,`date` 列是各市场交易日的**并集**
|
|
84
84
|
- `--currency` / `--scale`:同 `cross-section`(含根级 `--scale` 的污染坑)
|
|
85
85
|
- **输出(宽表)**:每行一个日期,列为 `date / <各序列名>…`;序列在「单指标」时是各**证券**,在「单证券多指标」时是各**指标**。**板块 ID 算多证券**——传 1 个 `sectorId` 服务端会展开成 N 只成分股,列就是这 N 只(实测中信白酒 → 19 列)
|
|
@@ -128,9 +128,9 @@ gangtise indicator screener --indicator F1:qte_close --indicator F2:qte_close \
|
|
|
128
128
|
# 日收盘价 (F1)=1309.22 / 日收盘价 (F2)=1308.55,与 time-series 对照一致
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
同一指标绑到多个变量(各带不同参数)是 `screener` 支持的用法,结果直接可用;列头会按变量加后缀区分(显示名相同)。
|
|
132
132
|
|
|
133
|
-
>
|
|
133
|
+
> `contains` / `notcontains` 对大小写不敏感(`CONTAINS` / `contains` / 混合写法等价)。
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
136
|
# 文本筛选:白酒板块里经营范围含「酒」的公司
|
|
@@ -162,10 +162,10 @@ gangtise indicator cross-section --indicator qte_close --security 600519.SH \
|
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
- `adjustType`(复权方式):`1`=不复权(默认) `2`=前复权 `3`=后复权 `4`=定点复权(配 `baseDate` 基期)
|
|
165
|
-
- ⚠️ **参数名是 `adjustType`**(不是 `adjustmentType
|
|
165
|
+
- ⚠️ **参数名是 `adjustType`**(不是 `adjustmentType`)。写错名会报 `100003` 并指出是哪个指标的哪个参数,按报错改即可
|
|
166
166
|
- 前复权以最新交易日为基准,所以在**最新交易日上前复权价 == 不复权价**;验证复权是否生效要用历史日期
|
|
167
167
|
- 同一指标多个参数 → 重复 `--indicator-param "code:k1=v1" --indicator-param "code:k2=v2"`
|
|
168
|
-
- **参数名与取值一律以 `indicator search --format json` 的 `parameterList`
|
|
168
|
+
- **参数名与取值一律以 `indicator search --format json` 的 `parameterList` 为准**,不要照抄任何文档里的示例名——参数名会随版本调整。写错会报 `100003` 并指出是哪个指标的哪个参数(2026-08-15 起;此前是静默按默认值取数),按报错改即可。币种枚举**统一大写**(`DFT`/`CNY`/`HKD`…),小写形式不生效
|
|
169
169
|
- `--indicator-param` 与根级 `--currency`/`--scale` 冲突时,以 `--indicator-param` 为准
|
|
170
170
|
|
|
171
171
|
## 必填参数与错误码(取数前必读)
|
|
@@ -194,28 +194,29 @@ gangtise indicator cross-section --indicator qte_close --security 600519.SH \
|
|
|
194
194
|
| 情况 | 服务端怎么返 | CLI |
|
|
195
195
|
| :--- | :--- | :--- |
|
|
196
196
|
| 代码有效、但**无数据 / 无覆盖 / 非交易日 / 未来日期** | 占位单元格(多数 `null`,个别指标 `0`,见上),行列都在 | **退出 0**,不标 partial |
|
|
197
|
-
| **指标码无法解析**(拼错、不存在) |
|
|
198
|
-
| **证券码无法解析**(拼错、后缀错,如 `AAPL.US`) |
|
|
199
|
-
|
|
|
197
|
+
| **指标码无法解析**(拼错、不存在) | `100003「指标 xxx 不存在」` | **退出 1**,报错 |
|
|
198
|
+
| **证券码无法解析**(拼错、后缀错,如 `AAPL.US`) | `100003「xxx 不是有效证券或者板块ID」` | **退出 1**,报错 |
|
|
199
|
+
| **参数名写错 / 同 code 重复配置** | `100003` 并指名参数 / 「重复配置」 | **退出 1**,报错 |
|
|
200
200
|
|
|
201
|
-
2026-08-
|
|
201
|
+
2026-08-15 实测:
|
|
202
202
|
|
|
203
|
-
| 查法 | 服务端返回 |
|
|
204
|
-
| :--- | :--- |
|
|
205
|
-
| `--indicator finc_pb_mrq --security 09992.HK`(港股无 PB 数据) | 1 行,`finc_pb_mrq: null
|
|
206
|
-
| `--indicator
|
|
207
|
-
| `--indicator qte_close --
|
|
208
|
-
| `--indicator
|
|
209
|
-
| `--indicator qte_close --
|
|
210
|
-
|
|
203
|
+
| 查法 | 服务端返回 |
|
|
204
|
+
| :--- | :--- |
|
|
205
|
+
| `--indicator finc_pb_mrq --security 09992.HK`(港股无 PB 数据) | 1 行,`finc_pb_mrq: null`,**退出 0** |
|
|
206
|
+
| `--indicator qte_close --date 2027-01-04`(未来日期) | 1 行,`qte_close: null`,**退出 0** |
|
|
207
|
+
| `--indicator qte_close --indicator not_a_real_code`(有对照物) | `100003 指标 not_a_real_code 不存在` |
|
|
208
|
+
| `--indicator not_a_real_code`(**无对照物**) | `100003 指标 not_a_real_code 不存在` ← 同样报错 |
|
|
209
|
+
| `--indicator qte_close --security 999999.SH` | `100003 999999.SH 不是有效证券或者板块ID` |
|
|
210
|
+
|
|
211
|
+
**代码写错现在一律报错、且消息里带上那个代码**,无论同批有没有别的正确代码——不用再靠「和一个已知有数的标的一起查」推断是哪个写错了。**所以「空表」的含义变干净了:它现在基本只意味着真的没数据**(此前空表既可能是没数据、也可能是整个轴写错)。
|
|
211
212
|
|
|
212
|
-
|
|
213
|
+
⚠️ **唯一还需要对照法的是占位值那一档**:占位**多数是 `null`、个别是 `0`**(见上方 🔴 段),`0` 长得和真值一样。拿 `is_dnrpnp` 这类做筛选或聚合前,仍要和已知有数的标的一起查做对照。
|
|
213
214
|
|
|
214
|
-
|
|
215
|
+
> CLI 侧仍保留 `partial` + `omittedIndicators` / `omittedSecurities` + 退出码 3 的差集检测,但在当前服务端行为下基本收不到样本(错代码在服务端就被拒了)。留着是为了万一服务端回退时还有兜底,不影响正常使用。
|
|
215
216
|
|
|
216
|
-
`screener`
|
|
217
|
+
`screener` 上指标码写错同样直接报 `100003`,不会再走到「缺列」那条路。CLI 的缺列判据(按表达式布尔结构判,整个表达式再无可成立分支 → 退出码 1 且不输出;仍有分支可求值如 `F1 || F2` 只缺 F1 → `partial` + 退出码 3)保留作兜底。
|
|
217
218
|
|
|
218
|
-
⚠️
|
|
219
|
+
⚠️ **`screener` 的空集仍要当心,但原因变了**:现在空集基本只有两种来源——**真的没有标的满足条件**,或者**某个变量的值是占位 `0`**(`F1 > 0` 在 `is_dnrpnp` 全是占位 `0` 时必然筛出空集,见上方 🔴 段)。指标码拼错已不在其列(会直接报错)。
|
|
219
220
|
|
|
220
221
|
标 `partial` 的那档会在 stderr 打印被略过的 code(`--format json` 下 stdout 仍是干净 JSON)。脚本按 `!= 0` 判失败的要注意:3 表示「有数据但不完整」,不是硬失败。
|
|
221
222
|
|
|
@@ -227,7 +228,7 @@ gangtise indicator cross-section --indicator qte_close --security 600519.SH \
|
|
|
227
228
|
| `100003`@400 | 入参/表达式错误:`time-series` 传了「多指标 × 多证券」、`expression` 引用未声明变量、`indicatorParamList` 的 code 不在 `indicatorCodeList` 里 | 按 msg 改;多 × 多改用 `cross-section`。CLI 已在本地拦截「表达式引用未绑定变量」,不会白发一次请求 |
|
|
228
229
|
| `140002`@500 | **终态参数错**:指标必填参数缺失、枚举越界(如「参数 adjustType 的值 99 不在有效范围内 [1,2,3,4]」)、表达式语法错误 | **不重试**(CLI 已把 140002 列为终态码)。读 `search --format json` 的 `parameterList` 改参数名/取值 |
|
|
229
230
|
| `999999` | 系统故障。2026-08-01 起「无数据」不再用此码,所以它基本只剩真故障(2026-07-26 曾出现 EDE 取数端全线 999999,08-01 已恢复)。⚠️ 别把它和空表混为一谈:无数据现在是占位单元格(多数 `null`、个别指标 `0`),空表表示整轴 code 未识别 | CLI 对 indicator 端点**不重试此码**(v0.27.0);确认参数无误仍报错就是服务端问题 |
|
|
230
|
-
| `110003` | **超出账号数据权限的时间范围**。⚠️ EDE
|
|
231
|
+
| `110003` | **超出账号数据权限的时间范围**。⚠️ EDE 三个接口的可查范围可能不一致:出现过同日同指标同证券 `cross-section` 正常出数、而 `screener` 报此码 | 把日期移进范围;`screener` 撞界时先用 `cross-section` 查同一天验证,能取到就改用它拉数再本地筛 |
|
|
231
232
|
| `130001`(旧 `410004`) | 数据未找到,或**该指标无权限**(内层信封失败会带具体 msg,如"指标无权限";此码被服务端复用) | 检查查询条件与指标权限;换证券/日期仍失败多为无权限,联系管理员开通 |
|
|
232
233
|
|
|
233
234
|
### 必填参数(`140002` 的根因)
|
|
@@ -237,7 +238,7 @@ gangtise indicator cross-section --indicator qte_close --security 600519.SH \
|
|
|
237
238
|
| 参数 | 适用指标 | 示例 |
|
|
238
239
|
| :--- | :--- | :--- |
|
|
239
240
|
| `periodNum` | N 期统计(N 期均值/最值,如 `finc_roe_avg_avg` 平均ROE N期均值) | `--indicator-param "finc_roe_avg_avg:periodNum=4"`;部分还需配**年报日期**才出数(实测 `finc_roe_avg_avg`@`2026-03-31` 空、@`2025-12-31` 有) |
|
|
240
|
-
| `sDate` | 区间类的**起始日**(如 `qte_vol_intvl` 区间成交量、`qte_avg_vol` 区间日均成交量),格式 `yyyy-MM-dd` | `--indicator-param "qte_vol_intvl:sDate=2024-01-02"`。⚠️ **`sDate` 不能替代 `tradeDate`**——它是区间起点,`tradeDate`(=区间终点)仍是 required,`--date`
|
|
241
|
+
| `sDate` | 区间类的**起始日**(如 `qte_vol_intvl` 区间成交量、`qte_avg_vol` 区间日均成交量),格式 `yyyy-MM-dd` | `--indicator-param "qte_vol_intvl:sDate=2024-01-02"`。⚠️ **`sDate` 不能替代 `tradeDate`**——它是区间起点,`tradeDate`(=区间终点)仍是 required,`--date` 会照常下发。区间起始日的参数名就是 `sDate`,写成 `startDate` 会报 `100003 不支持参数 startDate`(2026-08-15 起;此前是被静默忽略、套用默认区间返回一个合理但错误的数)。⚠️ **不传 `sDate` 不报错**——它是可选参数,缺了就按默认区间算,所以要的是特定区间就必须显式传。另:`qte_amp_mo`(月振幅)等周期变体现在只吃 `tradeDate`,没有起始日参数 |
|
|
241
242
|
| `fiscalYear` | 年度/报告期类(如 `div_cash_yr` 年度现金分红) | `--indicator-param "div_cash_yr:fiscalYear=2025"` |
|
|
242
243
|
| `industryType` + `industryLevel` | `scr_indu` 所属行业(两个都 required,缺任一报 `140002`) | `--indicator-param "scr_indu:industryType=1" --indicator-param "scr_indu:industryLevel=0"` |
|
|
243
244
|
|
|
@@ -275,7 +276,22 @@ gangtise indicator cross-section --indicator scr_indu \
|
|
|
275
276
|
|
|
276
277
|
体系与市场要配对:A 股查恒生 / GICS、美股查申万,都返 `null`(实测茅台 `industryType=3/4` 均为 `null`)。
|
|
277
278
|
|
|
278
|
-
|
|
279
|
+
**行业组合指标(2026-08-14 新增,3 个)**——把体系写进指标编码,省掉 `industryType`:
|
|
280
|
+
|
|
281
|
+
| 指标 | 体系 | 参数 |
|
|
282
|
+
| :-- | :-- | :-- |
|
|
283
|
+
| `scr_indu_citic` | 中信行业 | `tradeDate`(必填)+ `industryLevel`(**可选**) |
|
|
284
|
+
| `scr_indu_sw` | 申万行业 | 同上 |
|
|
285
|
+
| `scr_indu_gics` | GICS 行业 | 同上 |
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
gangtise indicator cross-section --indicator scr_indu_citic --indicator scr_indu_sw \
|
|
289
|
+
--security 600519.SH --date 2026-08-13
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
与 `scr_indu` 的取舍:**只要一套体系就用组合指标**(少一个必填参数,且 `industryLevel` 可省),**要在同一次请求里横比多套体系**才用 `scr_indu`(换 `industryType` 即可,不必记三个编码)。恒生体系没有组合指标,仍走 `scr_indu:industryType=3`。
|
|
293
|
+
|
|
294
|
+
**`finc_pb_mrq`(市净率 MRQ)是日频指标**:每个交易日都有数且逐日变动,别按报告期末取(那会拿到几个月前的陈值)。
|
|
279
295
|
|
|
280
296
|
## 取数最佳实践
|
|
281
297
|
|
|
@@ -288,11 +304,11 @@ gangtise indicator cross-section --indicator scr_indu \
|
|
|
288
304
|
- 现金流量表附注/间接法科目(多数 `cf_`)→ **只在年报/半年报披露**,季报日期取不到,改用年报日期 `2025-12-31`
|
|
289
305
|
- 行情类(`qte_` 等)→ 用**交易日**,但常规行情仍应改走 `quote`
|
|
290
306
|
- **混合日期语义要拆查询**:同时要“某报告期营收 / EPS”和“估值 PE / PB”时,按各自有效日期分别调用 `cross-section` 再按 `security` 合并(财务=报告期末、PE/PB=最新交易日);不要把不同日期语义的指标塞进同一个 `--date`
|
|
291
|
-
-
|
|
307
|
+
- **探索性取数**:缺值会保留行列并给占位单元格(含 1×1 的最简形态),但**占位值不统一**(多数 `null`、个别 `0`,见上);code 写错会直接报 `100003`,不会伪装成缺值。看趋势用 `time-series` + 覆盖报告期的区间,但不能把缺值当成通过语义 / scope 校验。
|
|
292
308
|
- **名称反查 code 要核对,别取首条**:存在同显示名的兄弟指标——单季 `cf_finc_exp_qtr` 与累计 `cf_finc_exp` 都叫「财务费用」,`bs_fmt`/`cf_fmt`/`is_fmt` 都叫「报表格式」。`search` 按名称模糊匹配,目标 code 高概率在 top1 但不绝对,要看 `indicatorCode` 确认。
|
|
293
309
|
- **批量查询做失败拆分**:某指标**缺必填参数**或入参错误时会整批报 `140002`,逐指标单查能定位是哪个指标缺参/不可查。留意 stderr 的「整列/整行被略过」警告——那不是报错,而是**有 code 没被服务端认出来**,先查拼写和证券后缀。
|
|
294
|
-
-
|
|
295
|
-
-
|
|
310
|
+
- **市值量纲**:`qte_mkt_cptl`(总市值)与 `shr_tot`(总股本)**A/港/美股均有数**;**默认返原始「元」**(茅台 ≈ `1.7e12`,即 1.7 万亿),别误当天文数字。用 `scale` 数字码缩放(`0`元 / `3`千 / `4`万 / `6`百万 / `8`亿 / `9`十亿——`scale=8` → `16883` 亿元)、`currency` 换币种(**大写** `DFT`本币 / `CNY` / `HKD` / `USD` …)。**跨证券比市值前先统一 `scale`+`currency`**。
|
|
311
|
+
- **币种与汇率**:`DFT`(原始币种)按市场识别——A股=CNY、港股行情=HKD、美股=USD;汇率换算自洽(互逆且三角一致)。⚠️ 但**同一只港股,行情类的原始币种是 HKD、财务类可能是 CNY**(如泡泡玛特财报以人民币计),跨市场比财务数据时显式传 `--currency CNY` 别依赖 `DFT`。另:财务类指标的汇率按**报告期**折算、行情类按查询日折算,两者隐含汇率会有细微差异,属正常口径差别。
|
|
296
312
|
- **EDE 财务指标的 `reportType`(2026-08-01 裁决)**:`enumList` 的 label 已与实际取数**一致**,按 label 传即可。⚠️ 但同一份 `search` 响应里的 `paramDescription` 仍留着**相反的旧映射文字**——**以 `enumList` 和下方实测值为准,别读 `paramDescription`**:
|
|
297
313
|
|
|
298
314
|
| value | 口径 | 说明 |
|
|
@@ -327,7 +343,7 @@ gangtise indicator cross-section --indicator scr_indu \
|
|
|
327
343
|
|
|
328
344
|
判别方法(**已验证的是 `finc_pe_ttm` / `peTtm`**):用**总市值 ÷ PE 反推隐含净利润**,再对照利润表的滚动 TTM(= 上年全年 − 上年同期累计 + 本年累计),就能判出哪一侧用的是陈值。`finc_pb_mrq` 等非 TTM 口径的指标同样会在报告期节点变化,但分母是净资产(MRQ)不是 TTM,切换规则未单独验证——分叉时按同法反推净资产对照资产负债表。
|
|
329
345
|
|
|
330
|
-
⚠️ **不要用 `fundamental income-statement` 的 `announcementDate`
|
|
346
|
+
⚠️ **不要用 `fundamental income-statement` 的 `announcementDate` 做时点对齐**——它在部分证券上各期取值相同。**改用同一响应里的 `earliestAnncDate`(首次公告日)**;要交叉核实披露日就查 `insight announcement list`。
|
|
331
347
|
|
|
332
348
|
|
|
333
349
|
## 通用说明
|
|
@@ -335,5 +351,5 @@ gangtise indicator cross-section --indicator scr_indu \
|
|
|
335
351
|
- **发现流程**:`indicator search --format json` → 核对 `indicatorName` + `description`、`scopeList`(含 `usageRestriction`)、`parameterList`(**参数名以此为准**)→ 三项都通过才用 `cross-section` / `time-series` / `screener`
|
|
336
352
|
- **积分**:`search` 免费;`cross-section` / `time-series` / `screener` 按请求单元格数量计费,标价为每 100 单元格 A 股 0.05 / 港股 0.1 / 美股 0.2 积分,每次查询不足 100 单元格按 100 计
|
|
337
353
|
- **空结果排查顺序**:2026-08-08 起真无数据会返回占位单元格(多数 `null`、个别指标 `0`)而不是空表,所以**空表基本等于「没有任何 code 被认出来」或参数名写错**。按序排查:① 证券代码与后缀对不对(美股 `.O`/`.N`,不是 `.US`)② 指标 code 拼写对不对 ③ 参数名对不对(`indicator search` 的 `parameterList`)④ 日期语义对不对(`tradeDate` vs `reportDate`)
|
|
338
|
-
-
|
|
354
|
+
- **数据权限**:正式账号行情 / 财务 / 指标类可回溯的年限按服务等级而定,试用账号更短。⚠️ **同一账号下三个 EDE 接口的可查范围可能不一致**:出现过同一天、同一指标、同一证券在 `cross-section` 取得到、而 `screener` 报 `110003`(超出时间范围)的情况。**选股撞到 `110003` 时先别改日期格式**——用 `cross-section` 拉同一天的数据验证一下,能取到就说明是接口间范围差异,改用 `cross-section` 拉数再本地筛即可
|
|
339
355
|
- 所有格式(table/json/jsonl/csv/markdown)均可用;导出宽表给 Excel 直接用 `--format csv --output xxx.csv`
|
|
@@ -6,19 +6,18 @@
|
|
|
6
6
|
|
|
7
7
|
支持 `--rank-type` 的命令:opinion / summary / **pamirs-summary** / research / foreign-report / announcement / announcement-hk / announcement-us / foreign-opinion / independent-opinion / official-account。
|
|
8
8
|
|
|
9
|
-
⚠️ **`--rank-type`
|
|
9
|
+
⚠️ **`--rank-type` 的效果依赖 `--keyword`**:没有关键词时综合排序无从计算,两种取值结果一致,这不是参数失效。
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
**`--rank-type 1`(综合排序,默认)按相关度挑选条目**,`--rank-type 2` 严格按 `publishTime` 倒序取最新的。两者从同一结果集里取的是**不同的子集**,不是同一批内容换个排法:
|
|
12
12
|
|
|
13
|
-
|
|
|
14
|
-
| :--- | :--- |
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
| `research` | 与 `2` **完全相同** | 有差异,同样只在并列处(4 处并列) |
|
|
13
|
+
| 想要 | 用 |
|
|
14
|
+
| :--- | :--- |
|
|
15
|
+
| 最相关的内容(可以是旧的) | `--rank-type 1` + `--keyword` + `--search-type 2`(全文) |
|
|
16
|
+
| 最新的内容(按时间铺) | `--rank-type 2` |
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
同一个查询下,`--rank-type 1` 取回的条目时间跨度更宽(每天只挑相关度高的几条),`--rank-type 2` 则集中在最近几天(把最新的逐条铺出来)。
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
⚠️ **别用「返回结果是不是按时间倒序」判断综合排序有没有生效** —— `--rank-type 1` **挑完之后仍按时间倒序排列**,所以两种取值下返回序列都是时间单调的。要看差别就**比条目 ID 集合**,不是比排序。
|
|
22
21
|
**不支持** `--rank-type` 的命令:roadshow / site-visit / strategy / forum(API 无此参数)。
|
|
23
22
|
|
|
24
23
|
`--rank-type`:`1` 综合排序(默认)| `2` 时间倒序
|
|
@@ -63,7 +62,7 @@ gangtise insight pamirs-summary download --summary-id <id> [--file-type <n>] [--
|
|
|
63
62
|
|
|
64
63
|
- **筛选项比 `summary` 少**:没有 `--source` / `--institution` / `--participant-role`。不认识的 body 字段会被丢弃且不报错,所以别照搬 `summary` 的参数,那样只会拿到没过滤的全量
|
|
65
64
|
- `--search-type`:`1` 标题搜索(默认)| `2` 全文搜索。同一关键词全文搜索的命中数明显多于标题搜索
|
|
66
|
-
- `--rank-type`:`1` 综合排序(默认)| `2` 时间倒序。⚠️ 效果依赖 `--keyword
|
|
65
|
+
- `--rank-type`:`1` 综合排序(默认)| `2` 时间倒序。⚠️ 效果依赖 `--keyword`,详见本文开头的公共说明
|
|
67
66
|
- `--category`:`companyAnalysis` 公司分析 | `industryAnalysis` 行业分析(两者过滤均生效,公司分析占绝大多数)
|
|
68
67
|
- `--market`:`aShares` | `hkStocks` | `usChinaConcept` | `usStocks`
|
|
69
68
|
- `--research-area`:**行业码两套都生效**——citic `1008001xx` 和申万 `104xx0000`。申万码这点与多数 insight list 不同(那些只有 summary 认申万码)。⚠️ 反过来,**方向码 `122000xxx` 在本端点返 0**,别在这里传方向
|
|
@@ -196,7 +195,7 @@ gangtise insight foreign-opinion list [--rank-type <n>] [--security <code>] [--r
|
|
|
196
195
|
```
|
|
197
196
|
|
|
198
197
|
- `--security`:境外证券代码,如 `UBER.N`
|
|
199
|
-
- ⚠️ `--region`:`cn` | `cnHk` | `cnTw` | `us` | `jp` | `uk` | `gl
|
|
198
|
+
- ⚠️ `--region`:`cn` | `cnHk` | `cnTw` | `us` | `jp` | `uk` | `gl`——**本端点上该过滤当前取不到数据**:除 `gl` 外的取值返回 `null` payload 而不是报错。需要按区域筛请不带该参数取回后按 `region` 字段本地筛。注意这是本端点的情况,`insight foreign-report` 的 `--region` 可正常收窄结果
|
|
200
199
|
- ⚠️ `--industry`:**当前传任何值都拿不到数据**(中信码 / 申万码 / 乱码一样,不报错、退出码 0)。🔴 **返回的 payload 是字面 `null`,不是 `{total:0,list:[]}`** ——按空列表解析的脚本(`data.list.length`、`for row in data["list"]`)会在这里抛错或静默跳过,务必先判 `null`。需要按行业筛时不带该参数取回后本地按 `industryList[]` 筛
|
|
201
200
|
- `--broker`:外资券商 ID(见 `references/lookup-ids.md`)
|
|
202
201
|
- `--rating` / `--rating-change`:同研报
|
|
@@ -6,41 +6,54 @@
|
|
|
6
6
|
|
|
7
7
|
**关键规则**:查"最近"K线必须显式 `--start-date`/`--end-date` 拉范围,再从 `tradeDate` 取尾部最近 N 条;不要只用 `--limit N`(会截取查询窗口开头)。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
🔴 **全市场关键字换了(2026-08-14)**:`quote day-kline` 的 `--security all` **已不再支持**,改为三个市场关键字之一——`aShares` / `hkStocks` / `usStocks`,且**必须单独传**(不能与证券代码或另一个关键字混填)。传 `all` 或混填 CLI 会直接报错并提示正确写法。三个已下线的旧命令(`day-kline-hk` / `day-kline-us` / `index-day-kline`)仍认 `all`。
|
|
10
|
+
|
|
11
|
+
**自动分片**:全市场关键字跨日期范围时 CLI 自动按日切片并并发执行,合并结果返回,无需手动分批。分片粒度按各市场单个交易日的行数规模定,保证单请求不撞 10000 行的 API 上限:
|
|
12
|
+
|
|
13
|
+
| 命令 | 全市场关键字 | 分片粒度 |
|
|
14
|
+
| :-- | :-- | :-- |
|
|
15
|
+
| `day-kline` | `aShares` | 1 天/片 |
|
|
16
|
+
| `day-kline` | `hkStocks` | 2 天/片 |
|
|
17
|
+
| `day-kline` | `usStocks` | 1 天/片 |
|
|
18
|
+
| `fund-flow` | `aShares` | 1 天/片 |
|
|
19
|
+
| `day-kline-hk` / `day-kline-us` / `index-day-kline`(旧) | `all` | 2 / 1 / 15 天/片 |
|
|
20
|
+
|
|
21
|
+
分片路径会自动把 `limit` 抬到 10000(API 上限),避免默认 6000 行截断;按日分片自动跳过周六日。
|
|
10
22
|
|
|
11
23
|
**日K线历史性**(v0.14.0 起 API 文档明确):所有日K线接口仅返回**历史数据**,不提供实时行情。盘中实时数据请改用 `quote realtime`。当日数据入库时间:A 股约 15:30、港股约 16:30、美股约 07:00(北京时间)。
|
|
12
24
|
|
|
13
25
|
---
|
|
14
26
|
|
|
15
|
-
## 日 K
|
|
27
|
+
## 日 K 线(统一,A 股 / 港股 / 美股 / 指数) `quote day-kline`
|
|
16
28
|
|
|
17
29
|
```bash
|
|
18
30
|
gangtise quote day-kline [--security <code>] [--start-date <YYYY-MM-DD>] [--end-date <YYYY-MM-DD>] [--limit <n>] [--field <name>]
|
|
19
31
|
```
|
|
20
32
|
|
|
21
|
-
-
|
|
22
|
-
- `--limit` 默认 6000,上限 10000
|
|
23
|
-
- 常用字段:`open` `high` `low` `close` `pctChange` `volume` `amount`
|
|
24
|
-
|
|
25
|
-
## 日 K 线(港股) `quote day-kline-hk`
|
|
33
|
+
**2026-08-14 起这一个命令覆盖全部品种**,港股 / 美股 / 指数不用再换命令,也可以在一次请求里混着传:
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
| 品种 | 代码格式 | 示例 |
|
|
36
|
+
| :-- | :-- | :-- |
|
|
37
|
+
| A 股 | `.SH` `.SZ` `.BJ` | `600519.SH` `835305.BJ` |
|
|
38
|
+
| 港股 | `.HK` | `00700.HK` |
|
|
39
|
+
| 美股 | `.O` 纳斯达克 / `.N` 纽交所 / `.A` AMEX | `AAPL.O` |
|
|
40
|
+
| 交易所指数 | `.SH` `.SZ` `.BJ` | `000001.SH` 上证指数、`399006.SZ` 创业板指 |
|
|
41
|
+
| 概念指数 | `.GT` | `880134.GT` 机器人 |
|
|
42
|
+
| 行业指数 | `.CI` 中信 / `.SWI` 申万(一二三级) | `821031.SWI` |
|
|
30
43
|
|
|
31
|
-
-
|
|
44
|
+
- **全市场**:`--security aShares` / `hkStocks` / `usStocks`,**必须单独传**(见文件开头)。⚠️ 指数**不支持**全市场关键字,必须逐个传代码
|
|
45
|
+
- 混市场查询时各证券只返回其所属交易所的交易日:春节期间 A 股休市而美股正常,则当期只有美股行;美国独立日反之
|
|
32
46
|
- `--limit` 默认 6000,上限 10000
|
|
47
|
+
- 常用字段:`open` `high` `low` `close` `pctChange` `volume` `amount` `adjustFactor`
|
|
48
|
+
- `adjustFactor` 复权因子:后复权价 = 不复权价 × `adjustFactor`;前复权价 = 不复权价 × `adjustFactor` ÷ 最新交易日的 `adjustFactor`。**指数无复权因子,该字段为 `null`**
|
|
33
49
|
|
|
34
|
-
##
|
|
50
|
+
## ⚠️ 已下线的三个旧命令(仍可调用)
|
|
35
51
|
|
|
36
|
-
|
|
37
|
-
gangtise quote day-kline-us [--security <code>] [--start-date <YYYY-MM-DD>] [--end-date <YYYY-MM-DD>] [--limit <n>] [--field <name>]
|
|
38
|
-
```
|
|
52
|
+
`quote day-kline-hk` / `quote day-kline-us` / `quote index-day-kline` 的能力已并入上面的 `day-kline`,官方于 2026-08-14 把它们从菜单下线,接口仍可调用。**新代码一律用 `day-kline`**,理由不止是少记三个命令:
|
|
39
53
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- 字段与 A 股/港股相同,货币单位为美元
|
|
54
|
+
- 旧命令**不校验证券代码**——传错代码返回 `{"total":0}` 而不是报错,与「该票该区间真无数据」无法区分;`day-kline` 会报 `120001`
|
|
55
|
+
- 参数与字段和 `day-kline` 完全一致(`--security` / `--start-date` / `--end-date` / `--limit` / `--field`),迁移只是换命令名
|
|
56
|
+
- 三者的全市场关键字仍是 `all`(不是 `aShares` 那套)
|
|
44
57
|
|
|
45
58
|
## 实时行情 `quote realtime`
|
|
46
59
|
|
|
@@ -48,8 +61,9 @@ gangtise quote day-kline-us [--security <code>] [--start-date <YYYY-MM-DD>] [--e
|
|
|
48
61
|
gangtise quote realtime [--security <code>] [--field <name>]
|
|
49
62
|
```
|
|
50
63
|
|
|
51
|
-
-
|
|
52
|
-
- **全市场关键字**:`--security aShares` 全部 A 股 /
|
|
64
|
+
- **覆盖三大市场 + 指数**:A 股 / 港股 / 美股个股与交易所指数(`.SH`/`.SZ`/`.BJ`)、概念指数(`.GT`)、行业指数(`.CI`/`.SWI`)可混合传入(如 `--security 600519.SH --security 00700.HK --security 000001.SH --security 880134.GT`)
|
|
65
|
+
- **全市场关键字**:`--security aShares` 全部 A 股 / `hkStocks` 全部港股 / `usStocks` 全部美股,**必须单独传**(不能与代码或另一个关键字混填,CLI 会本地拦截);建议配合 `--field` 精简返回字段。⚠️ 指数不支持全市场关键字
|
|
66
|
+
- 指数返回的是点位,无货币单位;概念 / 行业指数交易时间与 A 股一致
|
|
53
67
|
- 返回**最新时刻**的行情快照(最新价/开高低/涨跌/成交量额/振幅)
|
|
54
68
|
- 非交易时间返回最近一个交易日的收盘快照;停牌证券返回停牌前最后一个有效快照
|
|
55
69
|
- **实测全量字段(16 个,2026-07-24)**:`securityCode` `exchange` `tradeDate` `tradeTime` `open` `high` `low` `latestPrice` `preClose` `change` `pctChange` `volume` `amount` `turnoverRate` `amplitude` `volumeRatio`
|
|
@@ -74,24 +88,29 @@ gangtise quote fund-flow [--security <code>] [--start-date <YYYY-MM-DD>] [--end-
|
|
|
74
88
|
- 金额单位:元;占比单位:%(各分类流入占比之和 = 100)
|
|
75
89
|
- 无积分消耗
|
|
76
90
|
|
|
77
|
-
## 指数日 K 线 `quote index-day-kline`
|
|
91
|
+
## 指数日 K 线 `quote index-day-kline`(⚠️ 已下线,改用 `day-kline`)
|
|
78
92
|
|
|
79
93
|
```bash
|
|
80
94
|
gangtise quote index-day-kline [--security <code>] [--start-date <YYYY-MM-DD>] [--end-date <YYYY-MM-DD>] [--limit <n>] [--field <name>]
|
|
81
95
|
```
|
|
82
96
|
|
|
83
|
-
- 沪深京指数:如 `000001.SH` 上证综指、`399001.SZ` 深成指;`--security all`
|
|
97
|
+
- 沪深京指数:如 `000001.SH` 上证综指、`399001.SZ` 深成指;`--security all` 全市场指数(**仍是 `all`,不是 `aShares` 那套**)
|
|
84
98
|
- `--limit` 默认 6000,上限 10000
|
|
85
99
|
- 常用字段:`securityCode` `securityName` `tradeDate` `open` `high` `low` `close` `preClose` `change` `pctChange` `volume` `amount`
|
|
86
100
|
- `securityName` 为指数名称(如 `上证指数`),v0.15.0 起返回
|
|
101
|
+
- **还值得用它的两个场景**(都是 `day-kline` 做不到的,实测 2026-08-13):
|
|
102
|
+
1. **一次拿全部沪深京指数**(`--security all`)——`day-kline` 的指数必须逐个传代码
|
|
103
|
+
2. **要指数名称**——`index-day-kline` 返回 `securityName`(如「上证指数」),`day-kline` **没有这个字段**,查指数只拿得到代码
|
|
104
|
+
- 反过来 `day-kline` 独有 `adjustFactor`(复权因子),但指数本来就没有复权,该字段查指数时恒为 `null`
|
|
87
105
|
|
|
88
|
-
## 分钟 K
|
|
106
|
+
## 分钟 K 线 `quote minute-kline`
|
|
89
107
|
|
|
90
108
|
```bash
|
|
91
109
|
gangtise quote minute-kline --security <code> [--start-time <datetime>] [--end-time <datetime>] [--limit <n>] [--field <name>]
|
|
92
110
|
```
|
|
93
111
|
|
|
94
|
-
-
|
|
112
|
+
- 支持**沪深** A 股个股(`.SH` / `.SZ`,不含北交所)、交易所指数(`.SH` / `.SZ`)、概念指数(`.GT`)、行业指数(`.CI` / `.SWI`),2026-08-14 起扩展;**必须传 `--security`**(否则返回 `100003`,msg 为「securityCode不可为空」;2026-07-20 实测)
|
|
113
|
+
- **一次只能查一只**(参数是 `securityCode` 单值,不是列表),要多只就循环调用
|
|
95
114
|
- `--start-time` / `--end-time`:`yyyy-MM-dd HH:mm:ss`(兼容 `yyyy-MM-dd` 自动补全)
|
|
96
115
|
- `--limit` 默认 6000,上限 10000
|
|
97
116
|
- 常用字段:`securityCode` `tradeTime` `open` `high` `low` `close` `change` `pctChange` `volume` `amount`
|
|
@@ -108,7 +108,7 @@ gangtise reference constant-category [--format json]
|
|
|
108
108
|
>
|
|
109
109
|
> 先记住三套码的归属,**别把行业码算到 `gangtiseIndustry` 头上**:`citicIndustry` = 30 条行业码 `1008001xx`;`swIndustry` = 31 条行业码 `104xx0000`;`gangtiseIndustry` = **只有 6 条方向码** `122000xxx`(宏观 `122000001` / 策略 `122000002` / 固收 `122000003` / 金工 `122000004` / 海外 `122000005` / 其他 `122000007`),里面**没有任何行业**,去它那里找「食品饮料」永远找不到。
|
|
110
110
|
>
|
|
111
|
-
> - **`--industry`(industryList)→ 用 `citicIndustry`(`1008001xx`)**:opinion / research / foreign-report / official-account 正确过滤。`swIndustry`(`104xx0000`)在这 4 个上**也生效,但不是等效**——两套码的行业成分不同,4 个里有 2 个结果集对不上(research / foreign-report 完全一致;**opinion 与 official-account 传两套码取回的条数相差约 2%–5%**)。所以**统一用中信码**,同一批查询里别把两套码混着传。方向码 `122000xxx` 在 `--industry` 上一律返 0。⚠️
|
|
111
|
+
> - **`--industry`(industryList)→ 用 `citicIndustry`(`1008001xx`)**:opinion / research / foreign-report / official-account 正确过滤。`swIndustry`(`104xx0000`)在这 4 个上**也生效,但不是等效**——两套码的行业成分不同,4 个里有 2 个结果集对不上(research / foreign-report 完全一致;**opinion 与 official-account 传两套码取回的条数相差约 2%–5%**)。所以**统一用中信码**,同一批查询里别把两套码混着传。方向码 `122000xxx` 在 `--industry` 上一律返 0。⚠️ 一个例外:`insight foreign-opinion` / `independent-opinion` 只要传 `--industry` 就拿不到数据(不报错,且 **payload 是字面 `null`、不是空 list**,详见 `insight.md`),只能不带该过滤取回后本地筛。`vault wechat-message-list` 的 `--industry` **只认中信码**,申万码会被静默忽略并返回全量(详见 `vault.md`)。
|
|
112
112
|
> - **`--research-area`(researchAreaList)→ 用 `citicIndustry` 行业码 `1008001xx`,方向再叠 `gangtiseIndustry` 的 `122000xxx`**。⚠️ **申万码 `104xx0000` 只有 `summary` / `pamirs-summary` 认**,其余端点返 0(与传乱码表现一致,不报错)。逐端点实测(同一行业分别传三套码,✅ = 正常过滤,❌ = 返 0):
|
|
113
113
|
>
|
|
114
114
|
> | 端点 | 中信 `1008001xx` | 申万 `104xx0000` | 方向 `122000xxx` |
|
|
@@ -224,9 +224,9 @@ gangtise lookup meeting-org list # 会议/牵头机构全量(--instit
|
|
|
224
224
|
| 银行 / 银行股 | 银行 | `104480000` | `821047.SWI` |
|
|
225
225
|
| 汽车 / 新车 | 汽车 | `104280000` | `821036.SWI` |
|
|
226
226
|
|
|
227
|
-
> ¹ 第 3 列是**申万码**(`104xx0000`),仅在 opinion / research / foreign-report / official-account 上可作 `--industry` 使用,且**与中信码不等效**(opinion / official-account 两套码结果集不同,见上方 ⭐ 权威口径);用于 `--research-area` 时只有 summary / pamirs-summary 认,其余端点返 0。`vault wechat-message-list` 的 `--industry`
|
|
227
|
+
> ¹ 第 3 列是**申万码**(`104xx0000`),仅在 opinion / research / foreign-report / official-account 上可作 `--industry` 使用,且**与中信码不等效**(opinion / official-account 两套码结果集不同,见上方 ⭐ 权威口径);用于 `--research-area` 时只有 summary / pamirs-summary 认,其余端点返 0。`vault wechat-message-list` 的 `--industry` **只认中信码,申万码被静默忽略**。通用/推荐的**中信码**(`1008001xx`)见 `references/lookup-ids.md` 中信表或 `constant-list --category citicIndustry`。
|
|
228
228
|
|
|
229
|
-
> **参数名选择**:`--industry`(industryList,用 `citicIndustry` 码 `1008001xx`)用于 opinion / research / foreign-report / official-account
|
|
229
|
+
> **参数名选择**:`--industry`(industryList,用 `citicIndustry` 码 `1008001xx`)用于 opinion / research / foreign-report / official-account / `vault wechat-message-list`(后者只认中信码);`foreign-opinion` / `independent-opinion` 也有这个参数,但**当前不生效**,见上方 ⭐ 权威口径;`--research-area`(researchAreaList,行业用 `citicIndustry` 码 `1008001xx`、方向用 `gangtiseIndustry` 码 `122000xxx`)用于 opinion / summary / pamirs-summary / roadshow / site-visit / forum / my-conference;`--gts-code` 仅用于 `ai security-clue`(需申万格式 `821xxx.SWI`,不是数字 ID)。注意 strategy(线下策略会)无 `--research-area`,只按 `--institution` / `--location` 筛。
|
|
230
230
|
|
|
231
231
|
> **"消费"歧义**:用户说"消费/大消费"覆盖多个子行业(食品饮料 `104340000` / 商贸零售 `104450000` / 社会服务 `104460000` / 家电 `104330000` / 纺织服饰 `104350000` / 美容护理 `104770000`),需向用户确认具体方向,或用 `--keyword 消费` 做宽泛搜索。
|
|
232
232
|
|
|
@@ -49,7 +49,8 @@ gangtise vault wechat-message-list [--keyword <text>] [--security <code>] [--wec
|
|
|
49
49
|
|
|
50
50
|
- 数据权限:仅用户已绑定并激活群消息助理、且助理已入群的群消息
|
|
51
51
|
- `--security`:按证券代码过滤(如 `000001.SZ`),可重复
|
|
52
|
-
- `--industry
|
|
52
|
+
- `--industry`:**只认中信码**(`1008001xx`,见 `reference constant-list --category citicIndustry`)。⚠️ 申万码(`104xx0000`)和任何不认识的值都会被**静默忽略、返回未过滤的全量**,不报错——所以别混用码表,拿到的条数与不加过滤一样时先核对码系。返回行里不含行业标签字段,过滤在服务端完成
|
|
53
|
+
- 🔴 **`--industry` 是收窄工具,不是全量召回**:行业标签由服务端标注,**同一条消息可能挂多个行业,也可能一个都没挂**。实测同一个关键词加上「本行业」过滤后,命中数掉到三到四成——**少掉的既有没打标签的,也有被标到相邻行业去的**(如半导体相关的消息在计算机 / 机械 / 通信下同样查得到)。所以「按行业筛出 N 条」不能读成「该行业只有 N 条」;要尽量全,用 `--keyword` 取回后本地判断,或把相邻行业码一起查再去重
|
|
53
54
|
- `--wechat-group-id`:先用 `vault wechat-chatroom-list` 查;可重复
|
|
54
55
|
- `--category`:`text` | `image` | `documents` | `url`(可重复)
|
|
55
56
|
- `--tag`:`roadShow` | `research` | `strategyMeeting` | `meetingSummary` | `industryComment` | `companyComment` | `earningsReview`(可重复)
|
|
@@ -74,13 +74,13 @@
|
|
|
74
74
|
**用户**:"比亚迪 A 股和港股最近的日 K 线"
|
|
75
75
|
|
|
76
76
|
```
|
|
77
|
-
1. 路由 → quote day-kline
|
|
77
|
+
1. 路由 → quote day-kline(2026-08-14 起一个命令覆盖 A/港/美股,跨市场可一次查完)
|
|
78
78
|
2. 比亚迪 A 股 002594.SZ,港股 01211.HK
|
|
79
79
|
"最近" → K 线默认今日往前 45 天(保证含最近 10 个交易日)
|
|
80
80
|
3. Pre-flight:认证 OK
|
|
81
|
-
4. gangtise quote day-kline --security 002594.SZ --start-date 2026-03-19 --end-date 2026-05-03 --format json
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
4. gangtise quote day-kline --security 002594.SZ --security 01211.HK --start-date 2026-03-19 --end-date 2026-05-03 --format json
|
|
82
|
+
5. 按 securityCode 分组,各自按 tradeDate 取尾部最近 10 个交易日
|
|
83
|
+
注意:两地交易日历不同(A 股与港股假期不重合),同一日期未必两边都有行——按 securityCode 分组后再取尾部,别按行下标对齐
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
## 例 6:指数最近值(务必拉范围)
|
|
@@ -88,10 +88,10 @@
|
|
|
88
88
|
**用户**:"查上证综指最近的指数"
|
|
89
89
|
|
|
90
90
|
```
|
|
91
|
-
1. 路由 → quote index-day-kline
|
|
91
|
+
1. 路由 → quote day-kline(指数已并入,index-day-kline 已下线)
|
|
92
92
|
2. 上证综指 → 000001.SH;"最近" → 今日往前 45 天
|
|
93
93
|
3. Pre-flight:认证 OK;今天若周末 end-date 仍填当天,API 返回最近交易日
|
|
94
|
-
4. gangtise quote
|
|
94
|
+
4. gangtise quote day-kline --security 000001.SH --start-date 2026-03-19 --end-date 2026-05-03 --format json
|
|
95
95
|
5. 按 tradeDate 取尾部最近 10 个交易日。**不要用 --limit 20**(截取的是窗口开头)
|
|
96
96
|
```
|
|
97
97
|
|
|
@@ -257,7 +257,7 @@
|
|
|
257
257
|
--date 2026-07-31 --key-by code --format json
|
|
258
258
|
4. 按 security 合并两张宽表(列头即 indicatorCode,各取所需日期的值);不要把不同日期语义的指标塞进同一个 --date。
|
|
259
259
|
5. 计费:search 免费;两次取数各按请求单元格数量计费,每次不足 100 单元格按 100 计。
|
|
260
|
-
6. 无数据(无覆盖 / 非交易日 / 未来日期)一律保留行列并给占位单元格,退出码 0——但占位值多数是 null、个别指标(如 is_dnrpnp)是 0,0 会穿过比较与聚合,别当真值(见 commands/indicator.md
|
|
260
|
+
6. 无数据(无覆盖 / 非交易日 / 未来日期)一律保留行列并给占位单元格,退出码 0——但占位值多数是 null、个别指标(如 is_dnrpnp)是 0,0 会穿过比较与聚合,别当真值(见 commands/indicator.md)。代码写错或参数名写错则直接报 100003 并点名是哪个(指标码拼错、证券后缀错如美股写成 .US、参数名写错、同 code 重复配置),按报错改即可。
|
|
261
261
|
```
|
|
262
262
|
|
|
263
263
|
## 例 15b:帕米尔专家纪要(新库,筛选项与踩坑都和 summary 不同)
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
## Quote 行情
|
|
8
8
|
|
|
9
|
-
### 日K
|
|
9
|
+
### 日K线 `quote day-kline`(A股 / 港股 / 美股 / 各类指数;旧的 `day-kline-hk` / `day-kline-us` 已下线,字段相同)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
各市场字段相同(货币单位随市场:A股=元、港股=港元、美股=美元;**指数为点位、无货币单位,且 `adjustFactor` 恒为 `null`**):
|
|
12
12
|
|
|
13
13
|
| 字段 | 含义 | 字段 | 含义 |
|
|
14
14
|
|------|------|------|------|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
## 中信行业分类(--industry 参数)
|
|
8
8
|
|
|
9
|
-
完整列表用 `reference constant-list --category citicIndustry`(30 条)。**`--industry` 全命令通用首选用这套(`1008001xx`)**——opinion / research / foreign-report / official-account
|
|
9
|
+
完整列表用 `reference constant-list --category citicIndustry`(30 条)。**`--industry` 全命令通用首选用这套(`1008001xx`)**——opinion / research / foreign-report / official-account 都正确过滤,`vault wechat-message-list` 也认这一套(⚠️ 两个例外:`insight foreign-opinion` / `independent-opinion` 传了 `--industry` 拿不到数据、且 **payload 是字面 `null` 不是空 list**);这套 ID 同时也是 `--research-area` **行业维度唯一全端点通吃的一套**(见下方研究方向)。
|
|
10
10
|
|
|
11
11
|
| ID | 行业 | ID | 行业 |
|
|
12
12
|
|----|------|----|------|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
## 申万行业(--industry 参数)
|
|
32
32
|
|
|
33
|
-
完整列表用 `reference constant-list --category swIndustry`(31 条)。⚠️ 申万码(`104xx0000`)只在**部分** insight list 上可作 `--industry` 使用,且**与中信码不等效**——两套码行业成分不同,实测 opinion 与 official-account 上取回的结果集就对不上(同一行业相差约 2%–5%),别混用;用于 `--research-area` 时**只有 `summary` / `pamirs-summary` 认,其余端点返 0**(不报错,与传乱码表现一致)。`vault wechat-message-list` 的 `--industry`
|
|
33
|
+
完整列表用 `reference constant-list --category swIndustry`(31 条)。⚠️ 申万码(`104xx0000`)只在**部分** insight list 上可作 `--industry` 使用,且**与中信码不等效**——两套码行业成分不同,实测 opinion 与 official-account 上取回的结果集就对不上(同一行业相差约 2%–5%),别混用;用于 `--research-area` 时**只有 `summary` / `pamirs-summary` 认,其余端点返 0**(不报错,与传乱码表现一致)。`vault wechat-message-list` 的 `--industry` **只认中信码**,传申万码会被静默忽略并返回全量——哪套码用于哪些命令的**权威口径见 `references/commands/reference-and-lookup.md`「行业 / 研究方向过滤——选哪套 category」**(含逐端点实测矩阵),勿在此重复枚举。拿不准就统一用上方中信码。
|
|
34
34
|
|
|
35
35
|
| ID | 行业 | ID | 行业 | ID | 行业 |
|
|
36
36
|
|----|------|----|------|----|------|
|
|
@@ -4,7 +4,7 @@ CLI 自动处理 envelope:`{code, msg, data}` 信封会按 `code === "000000"`
|
|
|
4
4
|
|
|
5
5
|
> 例外:`indicator`(EDE)四个接口(`search` / `cross-section` / `time-series` / `screener`)成功时**双层信封**(`data` 里再裹一层 `{code, status, data}`)。内层字段名 2026-08-01 起为 `securityCodeList` / `securityNameList` / `indicatorList[{code,name,dataType}]`(screener 另带 `field`),`values` 是 2D 矩阵:**截面与 screener 为 `[证券][指标]`**(该版转置过,此前是 `[指标][证券]`)、时序仍为 `[序列][日期]`。
|
|
6
6
|
>
|
|
7
|
-
> **缺数据 vs 代码写错**(2026-08-
|
|
7
|
+
> **缺数据 vs 代码写错**(2026-08-15 实测):无数据 / 无覆盖一律保留行列并给占位单元格——**多数指标是 `null`,个别(如 `is_dnrpnp`)是 `0`,`0` 会穿过比较与聚合,详见 `commands/indicator.md`**。**代码写错则直接报 `100003` 并点名**(指标 code 拼错 →「指标 xxx 不存在」;证券 code 后缀错 →「xxx 不是有效证券或者板块ID」,美股是 `.O`/`.N` 不是 `.US`),**无论同批有没有正确的 code 都会报**。CLI 的 `indicator` 子命令已二次解包、拍平成宽表;`partial` + `omittedIndicators`/`omittedSecurities` + 退出码 3 的差集检测仍保留作兜底,但当前服务端行为下基本收不到样本。**`screener` 例外**:把缺列的变量当作无法求值,按表达式的**布尔结构**判断是否还有分支能成立(`A && B` 要两边、`A || B` 只要一边)。一条都不剩 → **退出码 1 且不输出**(那些行以「通过了该条件」的名义呈现,而条件根本无法证明被执行过);仍有分支可求值、或缺的只是输出用的辅助变量 → `partial` + 退出码 3。直接 `raw call indicator.*` 只会剥外层,内层需自行处理。
|
|
8
8
|
|
|
9
9
|
## 通用模式(5 类)
|
|
10
10
|
|
|
@@ -23,7 +23,7 @@ CLI 自动处理 envelope:`{code, msg, data}` 信封会按 `code === "000000"`
|
|
|
23
23
|
| insight opinion list | `{list, total}` | `list[].id` / `list[].title` / `list[].publishDate` / `list[].chiefName` / `list[].securityCode` / `list[].institutionName` |
|
|
24
24
|
| insight summary list | `{list, total}` | `list[].summaryId` / `list[].title` / `list[].publishTime` |
|
|
25
25
|
| insight summary download | 文件路径(stdout) | — |
|
|
26
|
-
| insight pamirs-summary list | `{list, total}` | `list[].summaryId` / `list[].title` / `list[].brief` / `list[].summaryTime`(纪要生成时间)/ `list[].publishTime`(发布时间)/ `list[].securityList[]{securityCode, securityName}` / `list[].researchAreaList[]{researchAreaId, researchAreaName}` / `list[].conceptList[]{conceptId, conceptName}` / `list[].categoryList` / `list[].marketList`。⚠️
|
|
26
|
+
| insight pamirs-summary list | `{list, total}` | `list[].summaryId` / `list[].title` / `list[].brief` / `list[].summaryTime`(纪要生成时间)/ `list[].publishTime`(发布时间)/ `list[].securityList[]{securityCode, securityName}` / `list[].researchAreaList[]{researchAreaId, researchAreaName}` / `list[].conceptList[]{conceptId, conceptName}` / `list[].categoryList` / `list[].marketList`。⚠️ `conceptList` / `categoryList` / `marketList` 三个标签字段**稀疏,且是否有值随记录和查法而变**:不带筛选时经常整条为空,用 `--category` 或 `--market` 任一过滤时回填率明显更高(这两个字段绑定,一起有或一起没有)。所以**别拉全量再本地分组**(会漏记录),也**别据此断言某条记录没有该属性**(为空只说明这次没回填)。详见 `commands/insight.md` |
|
|
27
27
|
| insight pamirs-summary download | 文件路径(stdout) | — |
|
|
28
28
|
| insight roadshow / site-visit / strategy / forum list | `{list, total}` | `list[].id` / `list[].title` / `list[].publishTime` / `list[].institution.institutionName` |
|
|
29
29
|
| insight research list | `{list, total}` | `list[].reportId` / `list[].title` / `list[].brief`(全文摘要) / `list[].publishTime` / `list[].publisher.brokerName` / `list[].securityList[].rating` |
|
|
@@ -56,11 +56,11 @@ CLI 自动处理 envelope:`{code, msg, data}` 信封会按 `code === "000000"`
|
|
|
56
56
|
| reference concept-search | `{returnedCount, list}` | `list[].conceptId` / `list[].conceptName` / `list[].matchScore` |
|
|
57
57
|
| reference sector-search | `{returnedCount, list}` | `list[].sectorId` / `list[].sectorName` / `list[].hierarchy`(层级路径) / `list[].matchScore` |
|
|
58
58
|
| reference sector-constituents | `{total, list}` | `list[].gtsCode` / `list[].gtsName`;total=0 说明 sectorId 不对(先 sector-search 确认) |
|
|
59
|
-
| quote day-kline
|
|
59
|
+
| quote day-kline(及已下线的 day-kline-hk / day-kline-us / index-day-kline) | `{fieldList, list}` 或规范化后 `{list: [{...}]}` | `tradeDate` / `securityCode` / `open` / `close` / `pctChange` / `volume` / `adjustFactor`(指数为 `null`);`index-day-kline` 另含 `securityName`(指数名称,v0.15.0 起) |
|
|
60
60
|
| quote minute-kline | `{list: [{...}]}` | `tradeTime` / `open` / `close` / `volume` |
|
|
61
61
|
| quote realtime | `{fieldList, list, total}` 或规范化后 `{list: [{...}]}` | `securityCode` / `exchange` / `tradeDate` / `tradeTime` / `open` / `high` / `low` / `latestPrice` / `preClose` / `change` / `pctChange` / `volume` / `amount` / `turnoverRate` / `amplitude` / `volumeRatio`(共 16 个,**无 `close`、无市值**) |
|
|
62
62
|
| quote fund-flow | `{fieldList, list, total}` 列式 → 规范化后 `{list: [{...}], total}` 宽表 | `securityCode` / `tradeDate` + 请求的字段(`mainNetInflow` / `largeInflow` / `xlargeOutflow` / …) |
|
|
63
|
-
| fundamental income-statement / balance-sheet / cash-flow(含 quarterly / -hk / -us) | `{total, list: [{...}]}` | `fiscalYear` / `period` / `endDate` / `companyName` / `companyType` / `currency` / `unit` + 各 `--field` 字段;港股/美股另含 `timeCovered`(不规则跨度)。⚠️
|
|
63
|
+
| fundamental income-statement / balance-sheet / cash-flow(含 quarterly / -hk / -us) | `{total, list: [{...}]}` | `fiscalYear` / `period` / `endDate` / `companyName` / `companyType` / `currency` / `unit` + 各 `--field` 字段;港股/美股另含 `timeCovered`(不规则跨度)。⚠️ A 股 `*-quarterly` 单季表的 `companyType` 返回未映射的数字码(如 `102119999`),`currency` 正常;累计口径的三张表两列均正确。科目数字不受影响 |
|
|
64
64
|
| fundamental main-business | `{fieldList, list}` 列式 → 规范化后 `{list: [{...}]}` | 前 3 列恒定:`periodName` / `periodEndDate` / `categoryName`(分项名,随 `--breakdown` 变)+ `opRevenue` / `opRevenueYoy` / `opRevenueRatio` / `opCost` / `opCostYoy` / `opCostRatio` / `grossProfit` / `grossProfitYoy` / `grossProfitRatio` / `grossMargin` / `grossMarginYoy` / `grossMarginRatio`(共 15 个,实测 2026-07-24)。`--field` 只能从后 12 个里选 |
|
|
65
65
|
| fundamental valuation-analysis(仅 A 股) | `{fieldList, list}` 列式 → 规范化后 `{list: [{...}]}` | `tradeDate` / `value` / `percentileRank` / `average` / `median` / `upper1Std` / `lower1Std`(共 7 个,实测 2026-07-24);**无 `securityCode`**——误传会拿到一列重复的 `tradeDate` |
|
|
66
66
|
| fundamental earning-forecast(仅 A 股) | `{securityCode, securityName, updateList: [...]}` | `updateList[].date` / `updateList[].fieldList[].forecastYear` + 各 consensus 指标 |
|