@v587d/capital-generation 2.31.6 → 2.31.8
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/CHANGELOG.md +35 -0
- package/README.md +2 -2
- package/automation/package.json +1 -1
- package/chart-ui/package.json +1 -1
- package/config/package.json +1 -1
- package/lib/sources/fuyao-rest.js +11 -6
- package/lib/sources/tencent-http.js +9 -3
- package/lib/web-retriever/local-fetch.d.ts +1 -1
- package/lib/web-retriever/local-fetch.js +1 -1
- package/lib/web-retriever/wind-client.d.ts +1 -1
- package/lib/web-retriever/wind-client.js +1 -1
- package/package.json +1 -1
- package/watchlist/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,41 @@
|
|
|
7
7
|
- **第三位(patch)**:不破坏既有工具 / 配置 / 会话的新增与修复(如 2.1.1、2.1.2)。
|
|
8
8
|
- **第二位(minor)**:有需要用户知晓的行为变更,且段内附迁移说明(如 2.1.0 的图表呈现通道重做、2.2.0 的数据源与检索来源扩容、2.4.0 的**必须换宿主版本**、2.9.0 的选择器收敛与质检前置——本插件自己的工具与数据契约没变,所以只抬第二位)。
|
|
9
9
|
|
|
10
|
+
## [2.31.8] - 2026-11-28
|
|
11
|
+
|
|
12
|
+
修复全量契约巡检新暴露的腾讯分笔时间回退与盘中成交额误核对。
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- `tencent_ticks` 以 `seq` 为权威顺序,容忍上游单笔时间戳向后修正;序号回退仍响亮失败。
|
|
17
|
+
- 成交额核对只在行情快照日期为上海当天且已收盘时执行,避免把上一交易日快照与当日/上一交易日分笔
|
|
18
|
+
错配比较;收盘后的真实缺量仍会失败。
|
|
19
|
+
|
|
20
|
+
### Notes
|
|
21
|
+
|
|
22
|
+
- 真实腾讯分笔复测:4,729 行、`missing_seq=0`,通过。
|
|
23
|
+
- 回归:`npm test` **1921 pass / 0 fail**。
|
|
24
|
+
- 版本:根包 + 四个随包嵌套包 + `LOCAL_FETCH_CLIENT_VERSION` / `WIND_CLIENT_VERSION` 同步 2.31.8。
|
|
25
|
+
|
|
26
|
+
## [2.31.7] - 2026-11-28
|
|
27
|
+
|
|
28
|
+
修复 GitHub Actions 全量契约巡检暴露的 5 条 Fuyao 契约不一致,并把腾讯已解析结构错误纳入 `GUARD`。
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- Fuyao 行 schema 与生产 guard 对齐:required 字段仍必填,但显式 `null` 合法;`json?` 不再生成
|
|
33
|
+
`oneOf: [{}, {type:'null'}]`,避免 null 命中两个分支。
|
|
34
|
+
- `dragon_tiger.thscode`、`fund_asset_allocation.report_date_ms`、`fund_top_holders.holder_id`
|
|
35
|
+
的上游真实 null 值不再被误报;描述明确可转债、缺失报告日和持有人 ID 的识别方式。
|
|
36
|
+
- `fund_diagnostics` 的 JSON 字段描述改为可为对象、数组或 null,与真实报文一致。
|
|
37
|
+
- `tencent_invalid_response` 归 `GUARD`,不再埋进 `TRANSPORT`。
|
|
38
|
+
|
|
39
|
+
### Notes
|
|
40
|
+
|
|
41
|
+
- 真实 Fuyao 报文复测:上述 5 条 `validateOutput` 与 `output_schema` 均为通过。
|
|
42
|
+
- 回归:`npm test` **1920 pass / 0 fail**。
|
|
43
|
+
- 版本:根包 + 四个随包嵌套包 + `LOCAL_FETCH_CLIENT_VERSION` / `WIND_CLIENT_VERSION` 同步 2.31.7。
|
|
44
|
+
|
|
10
45
|
## [2.31.6] - 2026-11-28
|
|
11
46
|
|
|
12
47
|
数据契约巡检加固:修复巡检假绿、SEC 日索引解析与路径、FINRA 多票结算日发现,并补齐 11 条新增能力的
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green" alt="License"></a>
|
|
4
4
|
<a href="https://github.com/v587d/capital-generation"><img src="https://img.shields.io/badge/Financial%20Market-CN%20%7C%20HK%20%7C%20US-orange" alt="Market·CN+HK+US"></a>
|
|
5
5
|
<a href="https://github.com/deepseek-ai"><img src="https://img.shields.io/badge/DSH%20Baseline-0.2.2--rc.5-blue" alt="DSH@0.2.2-rc.5"></a>
|
|
6
|
-
<a href="https://github.com/v587d/capital-generation/releases"><img src="https://img.shields.io/badge/version-2.31.
|
|
6
|
+
<a href="https://github.com/v587d/capital-generation/releases"><img src="https://img.shields.io/badge/version-2.31.8-9cf" alt="Version"></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/@v587d/capital-generation"><img src="https://img.shields.io/npm/v/%40v587d%2Fcapital-generation" alt="npm version"></a>
|
|
8
8
|
</p>
|
|
9
9
|
|
|
@@ -230,7 +230,7 @@ Capital Generation 是运行在 [DeepSeek Harness(DSH)](https://github.com/d
|
|
|
230
230
|
- **配置在哪?** 打开「插件」→ 已安装的 **Capital Generation**,插件介绍下方就是「数据源 / 投研自动化 / 精选 Skills / 包含的组件 / 分析环境」五格,五把密钥都在第一格;第二格可指定任务统一使用的默认工作区,也能改自动检查间隔与最长运行时间等上限;第五格准备 Python 分析环境;不在 DSH 的普通「设置」页面,也不用点进任何一行组件。保存密钥后新建会话再试。
|
|
231
231
|
- **升级到 2.9.0 后,分析师和绘图专员去哪了?** 这一版把它们收进自动模式内部,不再出现在选择器与预设管理里,避免误开一个没有取数入口的空会话。旧会话仍能按原身份恢复;新任务直接用自动模式提出即可。
|
|
232
232
|
- **宿主更新后插件显示异常、三个模式消失?** 插件只支持**同一 minor** 的宿主(本版是 `>=0.2.2-rc.5 <0.2.3-0`):宿主跨到 0.2.3 及以上时,旧插件会被启动拒载(插件页显示「异常」)。先把宿主升到与插件同一条 minor,再在插件页更新插件;应急可用版本豁免(有崩溃风险,见 CHANGELOG 的 Migration)。日志里出现「宿主 dsh … 未逐项验证」说明你跑在同一 minor 的未验证补丁版上——能跑,但遇异常请先升级插件并把那行日志附在 issue 里。
|
|
233
|
-
- **桌面端升级后仍是旧版?** 桌面端安装时会固定所解析的版本,不会自动升级。卸载后重新安装,再到插件详情查看版本号;如需指定版本,可在地址末尾加 `#v2.31.
|
|
233
|
+
- **桌面端升级后仍是旧版?** 桌面端安装时会固定所解析的版本,不会自动升级。卸载后重新安装,再到插件详情查看版本号;如需指定版本,可在地址末尾加 `#v2.31.8` 或 `@2.31.8`。
|
|
234
234
|
- **刚发布的新版本装不到?** 桌面端取包时会跳过**刚发布不久**的版本(宿主侧包管理器的发布冷却策略,实测会静默装成上一个版本),国内镜像的同步也可能滞后一段时间。急着用最新代码,改用仓库地址安装最直接;但仓库地址安装的是 git 依赖,插件页不显示「版本」检查。
|
|
235
235
|
- **插件页的「版本」段怎么用?** 只有用包名从 npm 安装的版本才有;它只列比当前新的版本。回旧版要先卸载,再安装 `@v587d/capital-generation@版本号`(桌面端地址末尾加 `#v版本号`);旧版必须匹配当前 DSH 基线,对应关系见 [CHANGELOG 的 Migration](CHANGELOG.md)。
|
|
236
236
|
- **网页抓取失败?** 配置卡片中的「允许启动本地提取网页内容」默认开启:AnySearch 提取失败时可尝试本机直连。关闭后,本机直连的具名来源查询也不可用;请检查该开关和网络连接。
|
package/automation/package.json
CHANGED
package/chart-ui/package.json
CHANGED
package/config/package.json
CHANGED
|
@@ -340,6 +340,7 @@ const klineOutput = envelopeData({ type: 'array', items: { type: 'object', prope
|
|
|
340
340
|
const calendarOutput = envelopeData({ type: 'array', items: { type: 'object', properties: { date_ms: { type: 'integer' }, date: { type: 'string' } }, additionalProperties: true } });
|
|
341
341
|
function rowSchema(fields) {
|
|
342
342
|
const properties = {};
|
|
343
|
+
const required = [];
|
|
343
344
|
for (const [name, spec] of Object.entries(fields)) {
|
|
344
345
|
const base = spec.endsWith('?') ? spec.slice(0, -1) : spec;
|
|
345
346
|
const optional = spec.endsWith('?');
|
|
@@ -349,9 +350,13 @@ function rowSchema(fields) {
|
|
|
349
350
|
: base === 'array' ? { type: 'array', items: {} }
|
|
350
351
|
: base === 'json' ? {}
|
|
351
352
|
: { type: 'object', additionalProperties: true };
|
|
352
|
-
|
|
353
|
+
// The guard accepts explicit null for every field; missing required keys still fail there.
|
|
354
|
+
// An empty schema already matches null, so wrapping `json` in oneOf would match twice.
|
|
355
|
+
properties[name] = base === 'json' ? {} : { oneOf: [jsonType, { type: 'null' }] };
|
|
356
|
+
if (!optional)
|
|
357
|
+
required.push(name);
|
|
353
358
|
}
|
|
354
|
-
return { type: 'object', properties, additionalProperties: true };
|
|
359
|
+
return { type: 'object', properties, required, additionalProperties: true };
|
|
355
360
|
}
|
|
356
361
|
const tickerFields = { thscode: 'text', ticker: 'text?', name: 'text?', exchange: 'text?', asset_type: 'text?', currency: 'text?', list_date: 'text?', end_date: 'text?', last_trade_date: 'text?', last_delivery_date: 'text?' };
|
|
357
362
|
const valuationFields = { thscode: 'text', ticker: 'text?', name: 'text?', pe_ttm: 'number?', pe_mrq: 'number?', pb_mrq: 'number?', ps_ttm: 'number?', pcf_ttm: 'number?' };
|
|
@@ -1464,7 +1469,7 @@ function endpointDefinitions() {
|
|
|
1464
1469
|
name: 'get_a_share_special_data_dragon_tiger_list',
|
|
1465
1470
|
capability: 'dragon_tiger',
|
|
1466
1471
|
summary: 'A 股龙虎榜(全部/机构榜/游资榜,不分页)',
|
|
1467
|
-
description: '按交易日返回 A 股龙虎榜整体榜单,一个接口覆盖全部 / 机构榜 / 游资榜,固定全量返回、不分页。board_type 取 all / org / hot_money(默认 all);date 格式 yyyy-MM-dd,只支持一年内且必须是交易日(显式传非交易日返回 1002,不自动回退),省略时取最近可用交易日。data 含 board_type、trade_date、count(上游记录数,同一股票可能同时上当日榜与 3 日榜)、stock_count(去重数量)、stock_items[](board_type=all/org 时填充)与 hot_money_items[](board_type=hot_money
|
|
1472
|
+
description: '按交易日返回 A 股龙虎榜整体榜单,一个接口覆盖全部 / 机构榜 / 游资榜,固定全量返回、不分页。board_type 取 all / org / hot_money(默认 all);date 格式 yyyy-MM-dd,只支持一年内且必须是交易日(显式传非交易日返回 1002,不自动回退),省略时取最近可用交易日。data 含 board_type、trade_date、count(上游记录数,同一股票可能同时上当日榜与 3 日榜)、stock_count(去重数量)、stock_items[](board_type=all/org 时填充)与 hot_money_items[](board_type=hot_money 时填充);两者互斥为空数组。`thscode` 对可转债等品种可能为 null,此时用 `ticker`/`name` 识别,不猜交易所后缀。注意 change 与 net_rate 是**小数形式**(0.09994 表示 9.994%),与行情接口的百分数原值口径不同;概念、机构与游资净买入字段见 output_schema。',
|
|
1468
1473
|
path: '/api/a-share/special-data/dragon-tiger-list',
|
|
1469
1474
|
inputSchema: objectSchema({
|
|
1470
1475
|
board_type: { type: 'string', enum: DRAGON_TIGER_BOARDS, description: '榜单类型:all 全部(默认)/ org 机构榜 / hot_money 游资榜' },
|
|
@@ -1637,7 +1642,7 @@ function endpointDefinitions() {
|
|
|
1637
1642
|
name: 'get_fund_portfolio_asset_allocation',
|
|
1638
1643
|
capability: 'fund_asset_allocation',
|
|
1639
1644
|
summary: '基金资产配置比例(按报告期)',
|
|
1640
|
-
description: '获取单只基金按报告期的资产配置比例。thscode 必填带后缀。item[] 含 report_date_ms
|
|
1645
|
+
description: '获取单只基金按报告期的资产配置比例。thscode 必填带后缀。item[] 含 report_date_ms(报告期,毫秒时间戳;上游可能返回 null,不要补 0)与 stock_ratio_pct / bond_ratio_pct / deposit_ratio_pct / other_ratio_pct(股票/债券/存款/其他占比,**均为百分数原值**)。data.timestamp 为接口响应时间戳。',
|
|
1641
1646
|
path: '/api/fund/portfolio/asset-allocation',
|
|
1642
1647
|
inputSchema: objectSchema({
|
|
1643
1648
|
thscode: { type: 'string', description: '完整基金代码(如 510300.SH)' },
|
|
@@ -1696,7 +1701,7 @@ function endpointDefinitions() {
|
|
|
1696
1701
|
name: 'get_fund_holders_top',
|
|
1697
1702
|
capability: 'fund_top_holders',
|
|
1698
1703
|
summary: '基金前十大持有人(含多报告期)',
|
|
1699
|
-
description: '获取基金前十大持有人名单。thscode 必填带后缀;limit 可选、取值 1~10(实测 0 / 11 / 201 均返回 1003)。**实测 limit 限定的是报告期数而不是返回行数**:limit=10 时返回 10 个报告期、共 99 行,因此引用条数时必须用 item 的实际长度,不要把 limit 当作行数;data.limit 是服务端实际采用的上限。item[] 含 holder_id / holder_code / holder_name / holder_type / rank / hold_share(持有份额,单位文档未给出)/ hold_rate_pct(持有比例,百分数原值)/ report_date_ms / publish_date_ms。',
|
|
1704
|
+
description: '获取基金前十大持有人名单。thscode 必填带后缀;limit 可选、取值 1~10(实测 0 / 11 / 201 均返回 1003)。**实测 limit 限定的是报告期数而不是返回行数**:limit=10 时返回 10 个报告期、共 99 行,因此引用条数时必须用 item 的实际长度,不要把 limit 当作行数;data.limit 是服务端实际采用的上限。item[] 含 holder_id / holder_code / holder_name / holder_type / rank / hold_share(持有份额,单位文档未给出)/ hold_rate_pct(持有比例,百分数原值)/ report_date_ms / publish_date_ms。`holder_id` 可能为 null,此时用 `holder_name` 识别,不编造 ID。',
|
|
1700
1705
|
path: '/api/fund/holders/top',
|
|
1701
1706
|
inputSchema: objectSchema({
|
|
1702
1707
|
thscode: { type: 'string', description: '完整基金代码(如 510300.SH)' },
|
|
@@ -2030,7 +2035,7 @@ function endpointDefinitions() {
|
|
|
2030
2035
|
name: 'get_fund_diagnostics_detail',
|
|
2031
2036
|
capability: 'fund_diagnostics',
|
|
2032
2037
|
summary: '基金诊断(多维画像与同类对比)',
|
|
2033
|
-
description: '获取单只基金的诊断画像。thscode 必填带后缀。item[] 含 thscode / ticker / fund_type / peer_code(同类比较分组代码,如 ETF-INDEX
|
|
2038
|
+
description: '获取单只基金的诊断画像。thscode 必填带后缀。item[] 含 thscode / ticker / fund_type / peer_code(同类比较分组代码,如 ETF-INDEX)与六个**保留上游结构的 JSON 字段**:dimensions、peer_dimensions、probabilities、ranges、resilience、peer_resilience(实测可为对象、数组或 null,内部键名文档未给出)。因此这些字段按原样转述,不要假设固定类型或内部键名。',
|
|
2034
2039
|
path: '/api/fund/diagnostics/detail',
|
|
2035
2040
|
inputSchema: objectSchema({
|
|
2036
2041
|
thscode: { type: 'string', description: '完整基金代码(如 510300.SH)' },
|
|
@@ -355,6 +355,11 @@ async function executeKline(params, signal) {
|
|
|
355
355
|
throw new Error(`Tencent K-line ${symbol} returned no rows`);
|
|
356
356
|
return { data: all, schema: klineOutput };
|
|
357
357
|
}
|
|
358
|
+
function todayShanghai() {
|
|
359
|
+
const parts = new Intl.DateTimeFormat('en-CA', { timeZone: 'Asia/Shanghai', year: 'numeric', month: '2-digit', day: '2-digit' }).formatToParts(new Date());
|
|
360
|
+
const of = (type) => parts.find((part) => part.type === type)?.value ?? '';
|
|
361
|
+
return `${of('year')}-${of('month')}-${of('day')}`;
|
|
362
|
+
}
|
|
358
363
|
function parseSnapshot(text, symbol) {
|
|
359
364
|
const match = new RegExp(`v_${symbol}="([^"]*)"`).exec(text);
|
|
360
365
|
if (!match)
|
|
@@ -406,8 +411,9 @@ async function executeTicks(params, signal) {
|
|
|
406
411
|
side: fields[6],
|
|
407
412
|
};
|
|
408
413
|
const expected = rows.length === 0 ? 0 : Number(rows[rows.length - 1].seq) + 1;
|
|
409
|
-
|
|
410
|
-
|
|
414
|
+
// Sequence is authoritative: upstream can correct one timestamp backwards without reordering ticks.
|
|
415
|
+
if (row.seq < expected)
|
|
416
|
+
throw sourceError(`Tencent ticks ${symbol} sequence moved backwards`, 'tencent_invalid_response');
|
|
411
417
|
if (row.seq > expected) {
|
|
412
418
|
if (row.time <= TICK_SESSION_END)
|
|
413
419
|
throw sourceError(`Tencent ticks ${symbol} has missing continuous-session sequence ${expected}-${row.seq - 1}`, 'tencent_incomplete');
|
|
@@ -423,7 +429,7 @@ async function executeTicks(params, signal) {
|
|
|
423
429
|
if (after.date !== before.date)
|
|
424
430
|
throw sourceError(`Tencent ticks crossed trading day ${before.date} -> ${after.date}`, 'tencent_incomplete');
|
|
425
431
|
const continuousAmount = rows.filter((row) => String(row.time) <= TICK_SESSION_END).reduce((sum, row) => sum + Number(row.amount), 0);
|
|
426
|
-
if (after.amount === before.amount && Math.abs(continuousAmount - before.amount) > before.amount * 0.001 + 1000)
|
|
432
|
+
if (after.date === todayShanghai() && after.clock >= '150000' && after.amount === before.amount && Math.abs(continuousAmount - before.amount) > before.amount * 0.001 + 1000)
|
|
427
433
|
throw sourceError(`Tencent ticks ${symbol} amount ${continuousAmount} does not match quote ${before.amount}`, 'tencent_incomplete');
|
|
428
434
|
return {
|
|
429
435
|
data: { date: before.date, code: code.canonical, tencent_symbol: symbol, rows, missing_seq: missingSeq },
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Known limit: DNS resolves per request but the IP is not pinned to the connection,
|
|
4
4
|
* so a rebinding window remains (same trade-off as dsh-search-first).
|
|
5
5
|
*/
|
|
6
|
-
export declare const LOCAL_FETCH_CLIENT_VERSION = "2.31.
|
|
6
|
+
export declare const LOCAL_FETCH_CLIENT_VERSION = "2.31.8";
|
|
7
7
|
export declare const LOCAL_FETCH_MAX_URL_LENGTH = 2048;
|
|
8
8
|
export type LocalFetchErrorCode = 'ABORTED' | 'TIMEOUT' | 'INVALID_URL' | 'BLOCKED_URL' | 'DNS' | 'REDIRECT' | 'HTTP' | 'TOO_LARGE' | 'UNSUPPORTED_CONTENT_TYPE';
|
|
9
9
|
export declare class LocalFetchError extends Error {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* so a rebinding window remains (same trade-off as dsh-search-first).
|
|
5
5
|
*/
|
|
6
6
|
import { htmlToMarkdown, stripInvisibleText } from './html-markdown.js';
|
|
7
|
-
export const LOCAL_FETCH_CLIENT_VERSION = '2.31.
|
|
7
|
+
export const LOCAL_FETCH_CLIENT_VERSION = '2.31.8';
|
|
8
8
|
export const LOCAL_FETCH_MAX_URL_LENGTH = 2048;
|
|
9
9
|
export class LocalFetchError extends Error {
|
|
10
10
|
code;
|
|
@@ -35,7 +35,7 @@ export interface WindCallResult {
|
|
|
35
35
|
code?: WindErrorCode;
|
|
36
36
|
}
|
|
37
37
|
/** Must match `package.json` version; a test pins the two together. */
|
|
38
|
-
export declare const WIND_CLIENT_VERSION = "2.31.
|
|
38
|
+
export declare const WIND_CLIENT_VERSION = "2.31.8";
|
|
39
39
|
export interface WindClient {
|
|
40
40
|
callTool(toolName: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<WindCallResult>;
|
|
41
41
|
}
|
|
@@ -19,7 +19,7 @@ export const WIND_SERVER_ENDPOINTS = {
|
|
|
19
19
|
analytics_data: 'https://mcp.wind.com.cn/vserver_analytics_data/mcp/',
|
|
20
20
|
};
|
|
21
21
|
/** Must match `package.json` version; a test pins the two together. */
|
|
22
|
-
export const WIND_CLIENT_VERSION = '2.31.
|
|
22
|
+
export const WIND_CLIENT_VERSION = '2.31.8';
|
|
23
23
|
function errorText(error) {
|
|
24
24
|
return error instanceof Error ? error.message : String(error);
|
|
25
25
|
}
|
package/package.json
CHANGED
package/watchlist/package.json
CHANGED