@v587d/capital-generation 2.31.8 → 2.32.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/CHANGELOG.md +68 -0
- package/README.md +11 -7
- package/automation/package.json +1 -1
- package/chart-ui/package.json +1 -1
- package/config/package.json +1 -1
- package/lib/analysis/artifact.d.ts +35 -0
- package/lib/analysis/artifact.js +250 -0
- package/lib/analysis/registry.d.ts +16 -2
- package/lib/analysis/registry.js +133 -23
- package/lib/analysis/runtime.d.ts +46 -19
- package/lib/analysis/runtime.js +485 -116
- package/lib/analysis/schemas.d.ts +46 -0
- package/lib/analysis/schemas.js +260 -7
- package/lib/analysis/snapshot.d.ts +10 -3
- package/lib/analysis/snapshot.js +298 -46
- package/lib/analysis/storage.d.ts +29 -1
- package/lib/analysis/storage.js +39 -6
- package/lib/analysis/tools.js +270 -29
- package/lib/analysis/types.d.ts +257 -3
- package/lib/analysis/types.js +31 -1
- package/lib/analysis/validation.d.ts +37 -1
- package/lib/analysis/validation.js +315 -1
- package/lib/chart/tool.js +1 -0
- package/lib/data-collector/store.d.ts +7 -1
- package/lib/data-collector/store.js +14 -0
- package/lib/python-runtime/child-env.d.ts +4 -2
- package/lib/python-runtime/child-env.js +21 -14
- package/lib/python-runtime/manager.d.ts +8 -0
- package/lib/python-runtime/manager.js +30 -14
- package/lib/sources/ftshare-rest.js +1 -1
- package/lib/sources/tencent-http.js +210 -53
- 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 +2 -1
- package/plugin-page/README.en.md +1 -1
- package/plugin-page/README.zh.md +1 -1
- package/preset/capital-generation/agent.patch.yml +1 -1
- package/preset/capital-generation/skills/capital-analysis-evidence/SKILL.md +15 -2
- package/preset/capital-generation/skills/capital-analysis-synthesis/SKILL.md +54 -9
- package/preset/capital-generation/skills/capital-analysis-validation/SKILL.md +41 -7
- package/preset/capital-generation/skills/capital-equity-research/SKILL.md +1 -1
- package/preset/capital-generation/skills/capital-event-impact/SKILL.md +20 -1
- package/preset/capital-generation/skills/capital-orchestration/SKILL.md +1 -1
- package/preset/capital-generation/skills/capital-senior-analysis/SKILL.md +38 -8
- package/python/analysis/lib/__init__.py +9 -0
- package/python/analysis/lib/errors.py +12 -0
- package/python/analysis/lib/eventstudy.py +164 -0
- package/python/analysis/lib/frames.py +95 -0
- package/python/analysis/lib/gaps.py +54 -0
- package/python/analysis/lib/jsonio.py +61 -0
- package/python/analysis/lib/metrics.py +147 -0
- package/python/analysis/lib/pit.py +84 -0
- package/python/analysis/lib/prices.py +140 -0
- package/python/analysis/lib/timeaxis.py +142 -0
- package/python/analysis/lib/version.py +3 -0
- package/python/analysis/modules/comps_valuation/module.py +26 -59
- package/python/analysis/modules/earnings_bridge/module.py +20 -77
- package/python/analysis/modules/event_study/LICENSE +21 -0
- package/python/analysis/modules/event_study/module.json +217 -0
- package/python/analysis/modules/event_study/module.py +979 -0
- package/python/analysis/modules/financial_quality/module.py +25 -88
- package/python/analysis/modules/hello/module.py +4 -0
- package/python/analysis/modules/kline_quality/module.py +26 -132
- package/python/analysis/modules/portfolio_stress/module.py +27 -112
- package/python/analysis/modules/returns_risk/module.json +108 -25
- package/python/analysis/modules/returns_risk/module.py +68 -227
- package/python/analysis/modules/scenario_sensitivity/module.py +11 -44
- package/python/analysis/modules/simple_backtest/module.json +244 -36
- package/python/analysis/modules/simple_backtest/module.py +1146 -459
- package/python/analysis/modules/statement_integrity/module.py +35 -87
- package/python/analysis/modules/technical_indicators/module.py +33 -152
- package/python/analysis/modules/valuation_sensitivity/module.py +30 -61
- package/python/worker.py +5 -0
- package/watchlist/package.json +1 -1
|
@@ -4,11 +4,18 @@ import { isLikelyIndex, normalizeSecurityCodes, parseSecurityCode, requireTencen
|
|
|
4
4
|
// Shared core holds HK/US snapshots, smartbox and the one throttle chain; this file only defines
|
|
5
5
|
// capabilities and K-line/tick orchestration. Two throttles = no throttle.
|
|
6
6
|
import { QUOTE_URL, aShareQuoteTime, callIfzqHosts, fetchOffshoreIndexQuotes, fetchOffshoreQuotes, isRecord, normalizeHkCode, normalizeOffshoreIndexCode, normalizeUsCode, numberOrNull, offshoreQuoteTime, requiredNumber, resolveUsKlineSymbol, sourceError, US_QUOTE_FIELDS, tencentGetText as getText, } from './tencent-public-core.js';
|
|
7
|
-
const TICK_URL = 'https://
|
|
7
|
+
const TICK_URL = 'https://web.ifzq.gtimg.cn/appstock/app/dealinfo/getMingxiV2';
|
|
8
8
|
const KLINE_MINUTES = new Set(['m1', 'm5', 'm15', 'm30', 'm60']);
|
|
9
9
|
const KLINE_PERIODS = new Set(['day', 'week', 'month', 'm1', 'm5', 'm15', 'm30', 'm60']);
|
|
10
10
|
const KLINE_SPAN_DAYS = { day: 700, week: 3650, month: 18250 };
|
|
11
|
-
|
|
11
|
+
// Tencent serves the tick list from several copies that split/merge trades differently, so seq is only
|
|
12
|
+
// comparable inside one batch. Page backwards from the newest print and splice copies only at a whole
|
|
13
|
+
// second whose trades match byte for byte (upstream v3.10.5). Copies differ by 3-8 sequence numbers.
|
|
14
|
+
const TICK_BATCH = 100;
|
|
15
|
+
const TICK_OVERLAP = 20;
|
|
16
|
+
const TICK_ANCHOR = 5;
|
|
17
|
+
const TICK_RETRIES = 5;
|
|
18
|
+
const TICK_MAX_CALLS = 400;
|
|
12
19
|
const TICK_SESSION_END = '15:00:59';
|
|
13
20
|
const quoteOutput = {
|
|
14
21
|
type: 'array',
|
|
@@ -85,18 +92,18 @@ const ticksOutput = {
|
|
|
85
92
|
items: {
|
|
86
93
|
type: 'object',
|
|
87
94
|
properties: {
|
|
88
|
-
time: { type: 'string' },
|
|
89
|
-
seq: { type: 'integer' },
|
|
95
|
+
time: { type: 'string', description: '北京时间 HH:MM:SS' },
|
|
96
|
+
seq: { type: 'integer', description: '本次调用从 0 起重新编的序号;腾讯各份明细的原始编号不可比(连续竞价缺号会失败,盘后缺号见 missing_seq)' },
|
|
90
97
|
price: { type: 'number' },
|
|
91
|
-
change: { type: 'number' },
|
|
92
|
-
volume: { type: 'number' },
|
|
93
|
-
amount: { type: 'number' },
|
|
98
|
+
change: { type: 'number', description: '较上一笔的价差' },
|
|
99
|
+
volume: { type: 'number', description: '成交量,单位手(科创板也是手,与 tencent_kline 的 volume_unit 不同)' },
|
|
100
|
+
amount: { type: 'number', description: '成交额,单位元' },
|
|
94
101
|
side: { enum: ['B', 'S', 'M'] },
|
|
95
102
|
},
|
|
96
103
|
additionalProperties: true,
|
|
97
104
|
},
|
|
98
105
|
},
|
|
99
|
-
missing_seq: { type: 'array', items: { type: 'integer' } },
|
|
106
|
+
missing_seq: { type: 'array', items: { type: 'integer' }, description: '盘后定价段跳过的序号(按本能力的 seq 编号);末尾缺的从序号看不出来' },
|
|
100
107
|
},
|
|
101
108
|
required: ['date', 'code', 'tencent_symbol', 'rows', 'missing_seq'],
|
|
102
109
|
additionalProperties: true,
|
|
@@ -373,6 +380,170 @@ function parseSnapshot(text, symbol) {
|
|
|
373
380
|
const date = `${fields[30].slice(0, 4)}-${fields[30].slice(4, 6)}-${fields[30].slice(6, 8)}`;
|
|
374
381
|
return { date, clock: fields[30].slice(8), amount: requiredNumber(parts[2], 'amount') };
|
|
375
382
|
}
|
|
383
|
+
function tickTradeDate(value, symbol) {
|
|
384
|
+
const text = String(value ?? '').trim();
|
|
385
|
+
const match = /^(\d{4})(\d{2})(\d{2})$/.exec(text) ?? /^(\d{4})-(\d{2})-(\d{2})$/.exec(text);
|
|
386
|
+
if (!match)
|
|
387
|
+
throw sourceError(`Tencent ticks ${symbol} returned an unreadable trade date ${JSON.stringify(value)}`, 'tencent_invalid_response');
|
|
388
|
+
const date = `${match[1]}-${match[2]}-${match[3]}`;
|
|
389
|
+
const parsed = new Date(`${date}T00:00:00Z`);
|
|
390
|
+
if (Number.isNaN(parsed.getTime()) || parsed.toISOString().slice(0, 10) !== date)
|
|
391
|
+
throw sourceError(`Tencent ticks ${symbol} returned an invalid trade date ${JSON.stringify(value)}`, 'tencent_invalid_response');
|
|
392
|
+
return date;
|
|
393
|
+
}
|
|
394
|
+
/** One page of the tick feed: up to 100 prints with source sequence <= cursor (newest page when cursor is null). */
|
|
395
|
+
async function fetchTickBatch(symbol, cursor, signal) {
|
|
396
|
+
const url = new URL(TICK_URL);
|
|
397
|
+
url.searchParams.set('code', symbol);
|
|
398
|
+
url.searchParams.set('limit', String(TICK_BATCH));
|
|
399
|
+
url.searchParams.set('direction', '1');
|
|
400
|
+
if (cursor !== null)
|
|
401
|
+
url.searchParams.set('id', String(cursor));
|
|
402
|
+
const text = await getText(url.toString(), signal);
|
|
403
|
+
let payload;
|
|
404
|
+
try {
|
|
405
|
+
payload = JSON.parse(text);
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
throw sourceError(`Tencent ticks ${symbol} returned non-JSON, probably an error page`, 'tencent_invalid_response');
|
|
409
|
+
}
|
|
410
|
+
// `code` must be the integer 0: the source sends JSON false for bad requests and false would pass `== 0`.
|
|
411
|
+
if (!isRecord(payload) || payload.code !== 0 || !isRecord(payload.data))
|
|
412
|
+
throw sourceError(`Tencent ticks ${symbol} returned an unexpected payload`, 'tencent_invalid_response');
|
|
413
|
+
const data = payload.data;
|
|
414
|
+
const items = data.data;
|
|
415
|
+
if (!Array.isArray(items) || !items.every((item) => typeof item === 'string'))
|
|
416
|
+
throw sourceError(`Tencent ticks ${symbol} data.data is not a string list`, 'tencent_invalid_response');
|
|
417
|
+
const rows = [];
|
|
418
|
+
for (const raw of [...items].reverse()) { // the endpoint lists the newest print first
|
|
419
|
+
const fields = raw.split('/');
|
|
420
|
+
if (fields.length !== 7 || !/^\d+$/.test(fields[0]) || !/^([01]\d|2[0-3]):[0-5]\d:[0-5]\d$/.test(fields[1]) || !['B', 'S', 'M'].includes(fields[6])) {
|
|
421
|
+
throw sourceError(`Tencent ticks ${symbol} row shape changed: ${JSON.stringify(raw).slice(0, 80)}`, 'tencent_invalid_response');
|
|
422
|
+
}
|
|
423
|
+
const seq = Number(fields[0]);
|
|
424
|
+
if (!Number.isSafeInteger(seq))
|
|
425
|
+
throw sourceError(`Tencent ticks ${symbol} has an unusable sequence ${fields[0]}`, 'tencent_invalid_response');
|
|
426
|
+
rows.push({
|
|
427
|
+
seq,
|
|
428
|
+
time: fields[1],
|
|
429
|
+
price: requiredNumber(fields[2], 'price'),
|
|
430
|
+
change: requiredNumber(fields[3], 'change'),
|
|
431
|
+
volume: requiredNumber(fields[4], 'volume'),
|
|
432
|
+
amount: requiredNumber(fields[5], 'amount'),
|
|
433
|
+
side: fields[6],
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
for (let index = 1; index < rows.length; index += 1) {
|
|
437
|
+
if (rows[index].seq <= rows[index - 1].seq || rows[index].time < rows[index - 1].time) {
|
|
438
|
+
throw sourceError(`Tencent ticks ${symbol} batch has sequence or time going backwards`, 'tencent_invalid_response');
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (cursor !== null && rows.length > 0 && rows[rows.length - 1].seq > cursor) {
|
|
442
|
+
throw sourceError(`Tencent ticks ${symbol} asked for sequences up to ${cursor} but got ${rows[rows.length - 1].seq}; the interface may have changed`, 'tencent_invalid_response');
|
|
443
|
+
}
|
|
444
|
+
return { day: rows.length === 0 ? null : tickTradeDate(data.date, symbol), rows };
|
|
445
|
+
}
|
|
446
|
+
function stageTicks(rows) {
|
|
447
|
+
return rows.map((row, index) => ({ ...row, step: index === 0 ? 1 : row.seq - rows[index - 1].seq }));
|
|
448
|
+
}
|
|
449
|
+
/** First whole-second boundary in a batch: index of the first print of a later second, or null if all prints share one second. */
|
|
450
|
+
function tickBoundary(rows) {
|
|
451
|
+
for (let index = 1; index < rows.length; index += 1)
|
|
452
|
+
if (rows[index].time > rows[index - 1].time)
|
|
453
|
+
return index;
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
/** End of the join anchor, exclusive: from the boundary, at least TICK_ANCHOR prints and cut at the next whole second. */
|
|
457
|
+
function tickAnchorEnd(rows, boundary) {
|
|
458
|
+
for (let index = boundary + TICK_ANCHOR; index < rows.length; index += 1)
|
|
459
|
+
if (rows[index].time > rows[index - 1].time)
|
|
460
|
+
return index;
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
function tickTradeKey(row) {
|
|
464
|
+
return `${row.time}/${row.price}/${row.change}/${row.volume}/${row.amount}/${row.side}`;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* How an older batch joins in front of `rows`: result is `batch.slice(0, start + count)` followed by
|
|
468
|
+
* `rows.slice(boundary + count)`. Joins only at a whole second whose prints are complete on both copies
|
|
469
|
+
* and identical outside seq; the batch must also carry a later second, so that second is complete too.
|
|
470
|
+
* Copies only split one print into adjacent seconds (#66), never inside a shared whole second.
|
|
471
|
+
*/
|
|
472
|
+
function tickJunction(rows, batch) {
|
|
473
|
+
const boundary = tickBoundary(rows);
|
|
474
|
+
if (boundary === null)
|
|
475
|
+
return null;
|
|
476
|
+
const end = tickAnchorEnd(rows, boundary);
|
|
477
|
+
if (end === null)
|
|
478
|
+
return null;
|
|
479
|
+
const count = end - boundary;
|
|
480
|
+
const start = batch.findIndex((row) => row.time >= rows[boundary].time);
|
|
481
|
+
if (start <= 0 || batch.length <= start + count)
|
|
482
|
+
return null;
|
|
483
|
+
if (batch[start + count].time <= rows[end - 1].time)
|
|
484
|
+
return null;
|
|
485
|
+
for (let offset = 0; offset < count; offset += 1) {
|
|
486
|
+
if (tickTradeKey(batch[start + offset]) !== tickTradeKey(rows[boundary + offset]))
|
|
487
|
+
return null;
|
|
488
|
+
}
|
|
489
|
+
return { boundary, start, count };
|
|
490
|
+
}
|
|
491
|
+
/** Walk the copies from the newest print back to source sequence 0 and renumber the joined list from 0. */
|
|
492
|
+
async function fetchTickDay(symbol, signal) {
|
|
493
|
+
const first = await fetchTickBatch(symbol, null, signal);
|
|
494
|
+
const day = first.day;
|
|
495
|
+
let rows = stageTicks(first.rows);
|
|
496
|
+
let edge = rows.length;
|
|
497
|
+
let edgeSeq = null;
|
|
498
|
+
let calls = 1;
|
|
499
|
+
while (rows.length > 0 && rows[0].seq > 0) {
|
|
500
|
+
const boundary = tickBoundary(rows);
|
|
501
|
+
const end = boundary === null ? null : tickAnchorEnd(rows, boundary);
|
|
502
|
+
if (end === null) {
|
|
503
|
+
throw sourceError(`Tencent ticks ${symbol} earliest row (${rows[0].time}) has sequence ${rows[0].seq}, not 0, and the rows behind it cannot form a whole-second anchor of ${TICK_ANCHOR}+ prints`, 'tencent_incomplete');
|
|
504
|
+
}
|
|
505
|
+
// Ask for the anchor's next print plus TICK_OVERLAP numbers in the newest copy's numbering, so a copy
|
|
506
|
+
// whose sequence is a few numbers off still returns the anchor (and any post-close sequence gap is covered).
|
|
507
|
+
const cursor = (end === edge ? (edgeSeq ?? rows[end].seq) : rows[end].seq) + TICK_OVERLAP;
|
|
508
|
+
let sawEarlier = false;
|
|
509
|
+
let junction = null;
|
|
510
|
+
let batch = [];
|
|
511
|
+
for (let attempt = 0; attempt <= TICK_RETRIES; attempt += 1) {
|
|
512
|
+
if (calls >= TICK_MAX_CALLS)
|
|
513
|
+
throw sourceError(`Tencent ticks ${symbol} still incomplete after ${TICK_MAX_CALLS} requests; the interface may have changed`, 'tencent_incomplete');
|
|
514
|
+
const fetched = await fetchTickBatch(symbol, cursor, signal);
|
|
515
|
+
calls += 1;
|
|
516
|
+
if (fetched.rows.length > 0 && fetched.day !== day)
|
|
517
|
+
throw sourceError(`Tencent ticks ${symbol} crossed trading day ${day} -> ${fetched.day} during fetch`, 'tencent_incomplete');
|
|
518
|
+
batch = fetched.rows;
|
|
519
|
+
const earliest = batch[0];
|
|
520
|
+
// A copy that restarts at 0 counts as earlier only when it shares the earliest second (auction prints).
|
|
521
|
+
const earlier = earliest !== undefined && (earliest.time < rows[0].time || (earliest.seq === 0 && earliest.time === rows[0].time));
|
|
522
|
+
sawEarlier = sawEarlier || earlier;
|
|
523
|
+
junction = earlier ? tickJunction(rows, batch) : null;
|
|
524
|
+
if (junction !== null)
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
if (junction === null) {
|
|
528
|
+
if (!sawEarlier)
|
|
529
|
+
throw sourceError(`Tencent ticks ${symbol} earliest row (${rows[0].time}) has sequence ${rows[0].seq}, not 0, and retries returned no earlier print: the copy is missing its start, retry later`, 'tencent_incomplete');
|
|
530
|
+
throw sourceError(`Tencent ticks ${symbol} cannot join any copy older than ${rows[0].time} (the copies differ in that segment), retry later`, 'tencent_incomplete');
|
|
531
|
+
}
|
|
532
|
+
const joined = junction;
|
|
533
|
+
const newer = stageTicks(batch.slice(0, joined.start + joined.count));
|
|
534
|
+
// The first row of the older tail keeps its step: its predecessor is the same print as the anchor's last row.
|
|
535
|
+
edge = joined.start + joined.count;
|
|
536
|
+
edgeSeq = batch[edge].seq;
|
|
537
|
+
rows = newer.concat(rows.slice(joined.boundary + joined.count));
|
|
538
|
+
}
|
|
539
|
+
const renumbered = [];
|
|
540
|
+
for (let index = 0; index < rows.length; index += 1) {
|
|
541
|
+
const step = index === 0 ? 1 : rows[index].step;
|
|
542
|
+
const seq = index === 0 ? 0 : renumbered[index - 1].seq + step;
|
|
543
|
+
renumbered.push({ ...rows[index], seq, gap: step - 1 });
|
|
544
|
+
}
|
|
545
|
+
return { day, rows: renumbered };
|
|
546
|
+
}
|
|
376
547
|
async function executeTicks(params, signal) {
|
|
377
548
|
const code = requireTencentSecurity(parseSecurityCode(params.code, 'code'), 'code');
|
|
378
549
|
if (isLikelyIndex(code))
|
|
@@ -381,58 +552,44 @@ async function executeTicks(params, signal) {
|
|
|
381
552
|
const before = parseSnapshot(await getText(`${QUOTE_URL}${symbol}`, signal, 'gbk'), symbol);
|
|
382
553
|
if (before.amount === 0)
|
|
383
554
|
throw new Error(`${symbol} has no turnover for ${before.date}`);
|
|
384
|
-
const rows =
|
|
555
|
+
const { day, rows } = await fetchTickDay(symbol, signal);
|
|
556
|
+
if (rows.length === 0)
|
|
557
|
+
throw new Error(`${symbol} returned no tick rows`);
|
|
558
|
+
if (day !== before.date)
|
|
559
|
+
throw sourceError(`Tencent ticks ${symbol} trade date ${day} does not match quote snapshot ${before.date}`, 'tencent_incomplete');
|
|
385
560
|
const missingSeq = [];
|
|
386
|
-
for (let
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
break;
|
|
395
|
-
const match = new RegExp(`^v_detail_data_${symbol}=\\[(\\d+),"([^"]*)"\\];?$`).exec(text);
|
|
396
|
-
if (!match || Number(match[1]) !== page)
|
|
397
|
-
throw sourceError(`Tencent ticks ${symbol} page ${page} shape changed`, 'tencent_invalid_response');
|
|
398
|
-
if (!match[2])
|
|
399
|
-
break;
|
|
400
|
-
for (const raw of match[2].split('|')) {
|
|
401
|
-
const fields = raw.split('/');
|
|
402
|
-
if (fields.length !== 7 || !/^\d{2}:\d{2}:\d{2}$/.test(fields[1]) || !['B', 'S', 'M'].includes(fields[6]))
|
|
403
|
-
throw sourceError(`Tencent ticks ${symbol} page ${page} row shape changed`, 'tencent_invalid_response');
|
|
404
|
-
const row = {
|
|
405
|
-
time: fields[1],
|
|
406
|
-
seq: integer(Number(fields[0]), 'source seq', 0, Number.MAX_SAFE_INTEGER),
|
|
407
|
-
price: requiredNumber(fields[2], 'price'),
|
|
408
|
-
change: requiredNumber(fields[3], 'change'),
|
|
409
|
-
volume: requiredNumber(fields[4], 'volume'),
|
|
410
|
-
amount: requiredNumber(fields[5], 'amount'),
|
|
411
|
-
side: fields[6],
|
|
412
|
-
};
|
|
413
|
-
const expected = rows.length === 0 ? 0 : Number(rows[rows.length - 1].seq) + 1;
|
|
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');
|
|
417
|
-
if (row.seq > expected) {
|
|
418
|
-
if (row.time <= TICK_SESSION_END)
|
|
419
|
-
throw sourceError(`Tencent ticks ${symbol} has missing continuous-session sequence ${expected}-${row.seq - 1}`, 'tencent_incomplete');
|
|
420
|
-
for (let seq = expected; seq < row.seq; seq += 1)
|
|
421
|
-
missingSeq.push(seq);
|
|
422
|
-
}
|
|
423
|
-
rows.push(row);
|
|
561
|
+
for (let index = 1; index < rows.length; index += 1) {
|
|
562
|
+
if (rows[index].time < rows[index - 1].time)
|
|
563
|
+
throw sourceError(`Tencent ticks ${symbol} time moved backwards at sequence ${rows[index].seq}`, 'tencent_invalid_response');
|
|
564
|
+
if (rows[index].gap > 0) {
|
|
565
|
+
if (rows[index].time <= TICK_SESSION_END)
|
|
566
|
+
throw sourceError(`Tencent ticks ${symbol} has missing continuous-session sequence ${rows[index - 1].seq + 1}-${rows[index].seq - 1}`, 'tencent_incomplete');
|
|
567
|
+
for (let seq = rows[index - 1].seq + 1; seq < rows[index].seq; seq += 1)
|
|
568
|
+
missingSeq.push(seq);
|
|
424
569
|
}
|
|
425
570
|
}
|
|
426
|
-
if (rows.length === 0)
|
|
427
|
-
throw new Error(`${symbol} returned no tick rows`);
|
|
428
571
|
const after = parseSnapshot(await getText(`${QUOTE_URL}${symbol}`, signal, 'gbk'), symbol);
|
|
429
572
|
if (after.date !== before.date)
|
|
430
573
|
throw sourceError(`Tencent ticks crossed trading day ${before.date} -> ${after.date}`, 'tencent_incomplete');
|
|
431
|
-
const
|
|
432
|
-
|
|
574
|
+
const sessionAmounts = rows.filter((row) => String(row.time) <= TICK_SESSION_END).map((row) => Number(row.amount));
|
|
575
|
+
const continuousAmount = sessionAmounts.reduce((sum, amount) => sum + amount, 0);
|
|
576
|
+
// Per-print amounts are rounded to yuan, so the slack is at most one yuan per print; a tiny turnover keeps
|
|
577
|
+
// the old 0.1% + 1000 yuan floor. A wrongly spliced print or two usually blows past this, unlike 0.1%.
|
|
578
|
+
// Only a closed day's snapshot can witness the joined prints: a past snapshot day is over, today needs 15:00+.
|
|
579
|
+
// Restricting this to "today" let an incomplete copy pass silently for every previous trading day.
|
|
580
|
+
const closed = after.date !== todayShanghai() || after.clock >= '150000';
|
|
581
|
+
const tolerance = Math.min(sessionAmounts.length + 1, before.amount * 0.001 + 1000);
|
|
582
|
+
if (closed && after.amount === before.amount && Math.abs(continuousAmount - before.amount) > tolerance) {
|
|
433
583
|
throw sourceError(`Tencent ticks ${symbol} amount ${continuousAmount} does not match quote ${before.amount}`, 'tencent_incomplete');
|
|
584
|
+
}
|
|
434
585
|
return {
|
|
435
|
-
data: {
|
|
586
|
+
data: {
|
|
587
|
+
date: before.date,
|
|
588
|
+
code: code.canonical,
|
|
589
|
+
tencent_symbol: symbol,
|
|
590
|
+
rows: rows.map((row) => ({ time: row.time, seq: row.seq, price: row.price, change: row.change, volume: row.volume, amount: row.amount, side: row.side })),
|
|
591
|
+
missing_seq: missingSeq,
|
|
592
|
+
},
|
|
436
593
|
schema: ticksOutput,
|
|
437
594
|
};
|
|
438
595
|
}
|
|
@@ -997,7 +1154,7 @@ export function createTencentSources() {
|
|
|
997
1154
|
capability: 'tencent_ticks',
|
|
998
1155
|
name: 'get_tencent_ticks',
|
|
999
1156
|
summary: '腾讯最近交易日分笔成交明细',
|
|
1000
|
-
description: '获取单只 SH/SZ 股票或 ETF 最近一个交易日的腾讯分笔成交。不是 Level-2 逐笔委托;约 3 秒一笔,volume
|
|
1157
|
+
description: '获取单只 SH/SZ 股票或 ETF 最近一个交易日的腾讯分笔成交。不是 Level-2 逐笔委托;约 3 秒一笔,volume 单位为手(科创板也是手,与 tencent_kline 按股/手分两套不同)、amount 单位为元,side 为 B/S/M。只有最近交易日,不支持历史、BJ 或指数。⛔ **seq 是本次调用从 0 起重新编的号**:腾讯后台的当日明细有多份、分笔略有不同(同一时刻有时一笔、有时拆成两笔),本能力从最新一笔往前翻、只在整秒分界处按内容拼接,所以同一交易日两次调用的笔数可能差几笔,不要把 seq 当交易所原始序号。明细自带的交易日与行情快照不一致会失败(开盘前腾讯可能还给着上一交易日)。收盘后(快照日期是上海当天且已收盘)会把连续竞价段成交额与腾讯行情快照核对,容差是「笔数 + 1」元(成交额很小时用 0.1% + 1000 元,取小的);连续竞价缺号或成交额对不上会失败;盘后定价段跳过的序号写入 missing_seq,末尾缺的从序号上看不出。',
|
|
1001
1158
|
inputSchema: { type: 'object', properties: { code: { type: 'string', description: '单只股票或 ETF 完整代码,如 000001.SZ 或 510300.SH' } }, required: ['code'], additionalProperties: false },
|
|
1002
1159
|
outputSchema: ticksOutput,
|
|
1003
1160
|
paginated: false,
|
|
@@ -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.
|
|
6
|
+
export declare const LOCAL_FETCH_CLIENT_VERSION = "2.32.1";
|
|
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.
|
|
7
|
+
export const LOCAL_FETCH_CLIENT_VERSION = '2.32.1';
|
|
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.
|
|
38
|
+
export declare const WIND_CLIENT_VERSION = "2.32.1";
|
|
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.
|
|
22
|
+
export const WIND_CLIENT_VERSION = '2.32.1';
|
|
23
23
|
function errorText(error) {
|
|
24
24
|
return error instanceof Error ? error.message : String(error);
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v587d/capital-generation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.1",
|
|
4
4
|
"description": "Capital Generation:面向中国散户的 AI 投资助手插件",
|
|
5
5
|
"icon": "assets/cg-icon.png",
|
|
6
6
|
"author": "v587d",
|
|
@@ -175,6 +175,7 @@
|
|
|
175
175
|
"docs:capabilities": "npm run build && node scripts/gen-capability-table.mjs",
|
|
176
176
|
"verify:sessions": "node scripts/verify-sessions.mjs",
|
|
177
177
|
"audit:tool-errors": "node scripts/audit-tool-errors.mjs",
|
|
178
|
+
"audit:answers": "node scripts/audit-final-answers.mjs",
|
|
178
179
|
"ptc:report": "node scripts/ptc-session-report.mjs",
|
|
179
180
|
"report:skill-usage": "node scripts/skill-usage-report.mjs"
|
|
180
181
|
},
|
package/plugin-page/README.en.md
CHANGED
|
@@ -23,7 +23,7 @@ Auto never fetches data or draws charts directly; every number needs a source an
|
|
|
23
23
|
|
|
24
24
|
## Senior analyst
|
|
25
25
|
|
|
26
|
-
Questions that need judgement (financial quality, returns and risk, event impact, trends, valuation, scenarios) are handed to the **senior analyst** inside Auto: it runs fixed analysis modules and writes the conclusion with numbers that trace back to the data, plus counter-arguments and invalidation conditions. It does not fetch data, draw charts or write the final answer, and gives no buy/sell, position-size or target-price advice.
|
|
26
|
+
Questions that need judgement (financial quality, returns and risk, event impact, trends, valuation, scenarios) are handed to the **senior analyst** inside Auto: it runs fixed analysis modules and writes the conclusion with numbers that trace back to the data, plus counter-arguments and invalidation conditions; artifacts carry a version and content hash, old versions are read-only, and pre-upgrade analysis snapshots must be rebuilt. It does not fetch data, draw charts or write the final answer, and gives no buy/sell, position-size or target-price advice.
|
|
27
27
|
|
|
28
28
|
See [README senior analyst](https://github.com/v587d/capital-generation#senior-analyst) for the modules, example questions and limits.
|
|
29
29
|
|
package/plugin-page/README.zh.md
CHANGED
|
@@ -22,7 +22,7 @@ Capital Generation 是运行在 [DeepSeek Harness](https://github.com/deepseek-a
|
|
|
22
22
|
|
|
23
23
|
## 高级分析师
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
需要判断的问题(财务质量、收益与风险、事件影响、趋势、估值、情景)会在自动模式里交给**高级分析师**:它在固定分析模块里算指标、写结论,结论中的数字要能对回数据,并附正反论据与失效条件;结论产物带版本与内容哈希,旧版本只读,升级后旧分析快照需要重建。它不取数、不出图、不写最终答复,也不给买卖、仓位或目标价建议。
|
|
26
26
|
|
|
27
27
|
内置模块、能回答的问题与边界见 [README 高级分析师](https://github.com/v587d/capital-generation#senior-analyst)。
|
|
28
28
|
|
|
@@ -525,7 +525,7 @@
|
|
|
525
525
|
读文件只用 read:只读 skill 分册与工作区文件;不读 capital-data/ 落盘,不读 ~/.dsh/;
|
|
526
526
|
分册整册读完才算读过。
|
|
527
527
|
用户倾向与外界观点皆为待检验假设;风险如实说明并给边界。
|
|
528
|
-
|
|
528
|
+
仅在有模型或回测时报告胜率/盈亏比/概率,披露区间、样本、方法与失效;回测/事件研究须带等级与风险;否则明确「无法可靠测算」。
|
|
529
529
|
不自动下单;不索取凭据与不必要仓位信息;不保证收益或准确率。
|
|
530
530
|
|
|
531
531
|
# TIME DISCIPLINE
|
|
@@ -41,6 +41,10 @@ description: Use when freezing or reviewing the inputs of a Capital analysis —
|
|
|
41
41
|
- `excerpt` 是摘要,不是全文;正文留在检索侧,快照不存大段文本。
|
|
42
42
|
- refs 逐份校验:任意一份读不到、过期或不属于本会话,整次建快照失败并点名是哪一份——先修 ref,不要删掉它硬建。
|
|
43
43
|
- 同一任务重跑要**重建**快照;旧快照不会因为主 Agent 补了新数据而更新。
|
|
44
|
+
- **事件研究(`event_study`)的证据与输入**:每个事件一条 evidence,`published_at` 写公告实际发布时间(ISO 时间戳
|
|
45
|
+
带时区最好);只有日期时可以研究,但模块会按下一交易日保守对齐并在缺口里点名。事件研究还需要标的行情、
|
|
46
|
+
基准行情(指数或可比序列)与交易日历(可选);缺基准会直接 `blocked`。证据的 `title` 要能分辨事件类型,
|
|
47
|
+
首次披露/更正/实施分开列;`verification` 按实际来源填,媒体转述不能写成官方核实。
|
|
44
48
|
|
|
45
49
|
## 3. 读 profile 的纪律
|
|
46
50
|
|
|
@@ -104,8 +108,17 @@ description: Use when freezing or reviewing the inputs of a Capital analysis —
|
|
|
104
108
|
- `technical_indicators`:同一价格序列 + 指标窗口(`sma_windows`/`ema_windows`/`rsi_period`/`macd_*`/
|
|
105
109
|
`boll_*`/`atr_period`,至少给一组);窗口不足的指标写缺口。指标是复盘条件,不是方向预测。
|
|
106
110
|
- `simple_backtest`:价格序列 + `rule`(`sma_cross`/`price_above_sma`)+ `fast_window`(`sma_cross` 另给
|
|
107
|
-
`slow_window`)+ `
|
|
108
|
-
|
|
111
|
+
`slow_window`)+ 成本参数(`commission_rate`/`min_commission`/`slippage_bps`,可选 `stamp_duty_rate`/
|
|
112
|
+
`transfer_fee_rate`)、`simulation_mode`(`auto`/`constrained`/`signal_replay`)、可选成交量列与
|
|
113
|
+
`calendar_dataset_id`;信号 t 根收盘、t+1 根收盘执行;样本内、参数由你给,不做寻优;结果带模拟等级与
|
|
114
|
+
审计,不许写成策略推荐。
|
|
115
|
+
|
|
116
|
+
**事件证据**
|
|
117
|
+
|
|
118
|
+
- `event_study`:标的行情 + 基准行情(必需)+ 交易日历(可选)+ 快照 evidence(每个事件一条,`published_at`
|
|
119
|
+
写发布时间);`params` `evidence_ids`、`event_window_before`/`event_window_after`、`estimation_window`、
|
|
120
|
+
`benchmark_model`(`market_adjusted`/`market_model`)、`benchmark_dataset_id`、`timezone`。窗口必须先声明、
|
|
121
|
+
不事后挑选;缺基准或发布时间 → `blocked`,样本不足 → `partial`/`blocked`;输出带有效样本与因果强度,只描述。
|
|
109
122
|
|
|
110
123
|
**横截面 / 组合**
|
|
111
124
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: capital-analysis-synthesis
|
|
3
|
-
description: Use when writing the conclusion layer of a Capital analysis — turning module metrics and evidence into claims (fact /
|
|
3
|
+
description: Use when writing the conclusion layer of a Capital analysis — turning module metrics and evidence into claims (fact / inference / assumption / scenario) with an explicit causal strength, counter-claims, alternative explanations, contradictions, scenarios and invalidation conditions, and assembling the AnalysisArtifact fields around them.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# 结论综合(完整版)
|
|
@@ -22,7 +22,7 @@ description: Use when writing the conclusion layer of a Capital analysis — tur
|
|
|
22
22
|
| `support_claims` / `counter_claims` | 正反论据数组 | 每条 ≤600 字符 |
|
|
23
23
|
| `alternative_explanations` | 还能怎么解释同一组数据 | 空数组会记提示 |
|
|
24
24
|
| `contradictions` | 来源/口径之间的冲突 | 有冲突必须写 |
|
|
25
|
-
| `calculations` | 引用模块指标的计算记录 | id
|
|
25
|
+
| `calculations` | 引用模块指标的计算记录 | 只填 id / `analysis_run_ref` / `metric_key` / `unit`(值由宿主从 run 取) |
|
|
26
26
|
| `scenarios` | 情景(≤8) | 每个必须有 `assumptions` |
|
|
27
27
|
| `invalidation_conditions` | 能推翻主判断的条件 | 至少一条,且引用 claim_id 或 calculation_id |
|
|
28
28
|
| `unresolved_gaps` | 还没解决的数据缺口 | 与 `data_gaps` 呼应 |
|
|
@@ -35,27 +35,41 @@ description: Use when writing the conclusion layer of a Capital analysis — tur
|
|
|
35
35
|
|
|
36
36
|
## 2. claims 怎么写
|
|
37
37
|
|
|
38
|
-
四类 `type
|
|
38
|
+
四类 `type`(旧词 `observation` / `hypothesis` 已废弃,提交会被 schema 拒):
|
|
39
39
|
|
|
40
40
|
- `fact`:可直接核对的事实("2024 年报披露营业收入 1000 亿元,来源 ev_annual_2024")。
|
|
41
|
-
- `
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
41
|
+
- `inference`:从数据里算出来或推出来的观察与判断("毛利率 18.00%,较上期提升 1.33 个百分点")。
|
|
42
|
+
- `assumption`:本次分析采用的假设("若原材料价格维持,毛利率有望保持"),不是证据。
|
|
43
|
+
- `scenario`:情景描述("若需求下滑,收入承压"),不是预测。
|
|
44
|
+
|
|
45
|
+
因果强度 `causal_strength`(可选,默认按类型理解)决定这句话能被怎么读:
|
|
46
|
+
|
|
47
|
+
| 取值 | 允许写在哪 | 含义 |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `descriptive` | 任意类型 | 只描述观察到的现象,不声称因果 |
|
|
50
|
+
| `associational` | `inference` | 与某因素相关,不排除其他解释 |
|
|
51
|
+
| `causal_with_assumptions` | `inference`,且必须带 `falsifier` | 在写明假设下成立;缺 `falsifier` 会被硬拒 |
|
|
52
|
+
| `not_supported` | `inference` / `assumption` | 目前没有证据支持因果关系 |
|
|
53
|
+
|
|
54
|
+
`fact` / `scenario` 只能写 `descriptive`;`assumption` 不能声称 `associational` 或
|
|
55
|
+
`causal_with_assumptions`。单事件、小样本一律不要写 `causal_with_assumptions`。
|
|
44
56
|
|
|
45
57
|
每条 claim 必填:
|
|
46
58
|
|
|
47
59
|
```json
|
|
48
|
-
{ "claim_id": "claim_margin_trend", "type": "
|
|
60
|
+
{ "claim_id": "claim_margin_trend", "type": "inference",
|
|
49
61
|
"statement": "毛利率 18.00%,较上期提升 1.33 个百分点",
|
|
50
62
|
"evidence_refs": ["ev_annual_2024"],
|
|
51
63
|
"number_anchors": [{ "value": 0.18, "unit": "ratio", "period": "2024-4",
|
|
52
64
|
"source": { "kind": "dataset", "ref": "ds_income" }, "precision": 6 }],
|
|
53
65
|
"confidence": "medium", "confidence_basis": "由利润表直接计算,与现金流量表交叉无矛盾",
|
|
66
|
+
"causal_strength": "descriptive",
|
|
54
67
|
"falsifier": "若下期毛利率回落至本期以下,该观察不再成立" }
|
|
55
68
|
```
|
|
56
69
|
|
|
57
70
|
- `confidence` 必须带 `confidence_basis`(一句话说明依据),否则记警告。
|
|
58
|
-
- `falsifier`
|
|
71
|
+
- `causal_with_assumptions` 必须带 `falsifier`;其余强度下 `falsifier` 不是必填,但写出来会显著
|
|
72
|
+
提高可审阅性。
|
|
59
73
|
- `claim_id` 起可读的名字(`claim_<主题>`),后面失效条件与回执都要引用它。
|
|
60
74
|
- 一条 claim 只讲一件事;把两个判断塞进一条 `statement`,审阅时无法分别推翻。
|
|
61
75
|
|
|
@@ -95,6 +109,7 @@ description: Use when writing the conclusion layer of a Capital analysis — tur
|
|
|
95
109
|
| `insufficient` | partial / blocked | 不能写 completed |
|
|
96
110
|
|
|
97
111
|
- 有任何 Tier 2 警告,宿主会把产物降级为 `partial` 并标 `validation.status = "warning"`。
|
|
112
|
+
- `unresolved_gaps` 非空时 `completed` 会降级为 `partial`:缺口没解决就不要声称完成。
|
|
98
113
|
- `blocked` 是诚实结果:写清缺什么、谁补、补上后能得出什么结论。
|
|
99
114
|
|
|
100
115
|
## 8. headline 与 thesis
|
|
@@ -104,7 +119,37 @@ description: Use when writing the conclusion layer of a Capital analysis — tur
|
|
|
104
119
|
- 数字写法与锚点一一对应:写 18.00% 就备好 0.18 的锚点(`capital-analysis-validation`)。
|
|
105
120
|
- 不出现评级、目标价、买入/卖出建议;判断用"财务质量/偿债能力/现金转换"这类可核查的口径词。
|
|
106
121
|
|
|
107
|
-
## 9.
|
|
122
|
+
## 9. 历史模拟结论怎么写
|
|
123
|
+
|
|
124
|
+
回测/模拟结果(`simple_backtest`)不是行情描述,也不是策略背书。写结论时:
|
|
125
|
+
|
|
126
|
+
- 先读 `run_analysis` 回执的 `simulation`:`grade`、`cost_basis`、`constraints`(T+1/涨跌停/停牌/整手/
|
|
127
|
+
费用)、`audit.status` 与 `uncovered_risks`。**`grade` 与审计状态必须出现在 headline 或 thesis 里**
|
|
128
|
+
(如「样本内 constrained_simulation,审计 WARN」),`signal_replay` 要写明它弱于约束模拟。
|
|
129
|
+
- `submit_analysis` 用 `simulation_run_ref` 指向回测 run,让宿主把等级与审计复制进产物;不要自己写
|
|
130
|
+
`simulation` 字段,也不要引用没跑过的 run。
|
|
131
|
+
- 只描述这段样本内发生了什么:不给概率、目标价、仓位或买卖建议;因果强度最多 `associational`,
|
|
132
|
+
单标的回测不具备「证明策略有效」的资格。
|
|
133
|
+
- 未覆盖风险至少点一名:容量/冲击成本、停牌与涨跌停不可成交、未复权跳变、样本长度、样本外有效性。
|
|
134
|
+
- 禁止「实盘验证」「已证明可执行」「保证收益」「稳赚」等表述——宿主会硬拒,否定句也别拿来暗示
|
|
135
|
+
(「不是实盘验证,但基本等价」)。
|
|
136
|
+
|
|
137
|
+
## 10. 事件研究结论怎么写
|
|
138
|
+
|
|
139
|
+
事件研究(`event_study`)只回答"这次公告/事件前后,标的相对基准的表现如何",不是因果证明。写结论时:
|
|
140
|
+
|
|
141
|
+
- 先读回执的 `event_study`:`method` / `methodology_version`、`window`(−before..+after)、`sample_size`、
|
|
142
|
+
`excluded_events`、`causal_strength`、`clustering`、`multiple_testing`、`audit.status` 与 `uncovered_risks`。
|
|
143
|
+
`sample_size`、窗口与 `audit.status` 必须出现在 headline 或 thesis 里(如「单事件,descriptive,审计 WARN」)。
|
|
144
|
+
- `submit_analysis` 用 `event_study_run_ref` 指向该 run,让宿主复制事件窗、样本与因果强度;不要自己写
|
|
145
|
+
`event_study` 字段,也不要引用没跑过的 run。
|
|
146
|
+
- 单事件(`causal_strength=descriptive`)只写描述:CAR/AR 的数值、方向、事件前趋势,不写"导致""造成";
|
|
147
|
+
多事件写平均/中位 CAR 并点明事件日聚集(同一天多个事件)与多重检验未校正,`associational` 是上限。
|
|
148
|
+
- 写清替代解释:同期市场/行业波动、其他公告或事件、预期已部分反映、窗口与基准的选择。不写就按 Tier 2 降级。
|
|
149
|
+
- 失败处置:`sample_size=0` 或审计 FAIL 时不要给事件窗结论,按 `blocked`/`partial` 如实写缺什么;
|
|
150
|
+
事件时间只有日期、停牌顺延、基准是单一指数都要进 `limitations`。
|
|
151
|
+
|
|
152
|
+
## 11. 回执里的 peer_exchanges
|
|
108
153
|
|
|
109
154
|
- 每条往返写 `{ "peer": "data-junior", "type": "analysis_calculation_request", "request_id": "...", "answered": true|false }`。
|
|
110
155
|
- 按实际往返填写,**不得超过 3 条**(超出会被宿主按预算拒);有 `answered:false` 就不能写 completed。
|