stock-analysis-plugin 0.2.6 → 0.2.7
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 +76 -14
- package/package.json +2 -1
- package/pi/index.ts +817 -71
- package/schemas/market_review_schema.json +12 -5
- package/schemas/report_schema.json +65 -1
- package/scripts/cli-timeout.mjs +27 -0
- package/scripts/json-input.mjs +26 -0
- package/skills/event-driven/SKILL.md +4 -0
- package/skills/growth-quality/SKILL.md +4 -0
- package/skills/market-review/SKILL.md +2 -0
- package/skills/stock-analysis/SKILL.md +17 -3
- package/skills/stock-analysis/references/stateless-analysis.md +66 -0
- package/skills/stock-screener/SKILL.md +5 -1
- package/skills/strategy-backtest/SKILL.md +9 -0
- package/templates/market_review/full.md.j2 +7 -0
- package/templates/stock_analysis/_evidence.md.j2 +11 -0
- package/templates/stock_analysis/brief.md.j2 +2 -0
- package/templates/stock_analysis/full.md.j2 +2 -0
- package/tools/_subproc.py +66 -11
- package/tools/backtest.py +73 -14
- package/tools/capabilities.py +8 -0
- package/tools/cli_budgets.json +26 -0
- package/tools/gather.py +4 -6
- package/tools/market_review.py +30 -9
- package/tools/screener.py +57 -15
- package/tools/signal_tracker.py +77 -6
- package/tools/stateless_analysis.py +630 -0
- package/tools/stock_data.py +90 -15
- package/tools/watchlist_context.py +18 -7
package/pi/index.ts
CHANGED
|
@@ -1,8 +1,51 @@
|
|
|
1
|
+
import { withJsonInput } from "../scripts/json-input.mjs";
|
|
1
2
|
import type { ExtensionAPI } from "pi-agent";
|
|
2
3
|
import { existsSync } from "fs";
|
|
3
4
|
import { fileURLToPath } from "url";
|
|
4
5
|
|
|
6
|
+
import { commandTimeout } from "../scripts/cli-timeout.mjs";
|
|
7
|
+
|
|
5
8
|
export default (pi: ExtensionAPI) => {
|
|
9
|
+
const tools: Parameters<ExtensionAPI["registerTool"]>[0][] = [];
|
|
10
|
+
const registerTool: ExtensionAPI["registerTool"] = (tool) => {
|
|
11
|
+
tools.push(tool);
|
|
12
|
+
pi.registerTool({ ...tool, defaultActive: false });
|
|
13
|
+
};
|
|
14
|
+
let discoveryEnabled: boolean | undefined;
|
|
15
|
+
const exposeAllTools = () => {
|
|
16
|
+
for (const tool of tools) pi.registerTool(tool);
|
|
17
|
+
discoveryEnabled = false;
|
|
18
|
+
};
|
|
19
|
+
const initializeDiscovery = () => {
|
|
20
|
+
if (discoveryEnabled !== undefined) return;
|
|
21
|
+
// Exposure metadata distinguishes native discovery from older tool-list APIs.
|
|
22
|
+
if (!pi.getAllTools || !pi.getActiveTools || !pi.setActiveTools
|
|
23
|
+
|| !pi.getAllTools().some(tool => tool.name === "tool_search" && tool.exposure === "model-only")) {
|
|
24
|
+
exposeAllTools();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
pi.setActiveTools([...new Set([...pi.getActiveTools(), "tool_search"])]);
|
|
28
|
+
if (!pi.getActiveTools().includes("tool_search")) {
|
|
29
|
+
exposeAllTools();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
for (const tool of tools) pi.registerTool({ ...tool, exposure: "deferred" });
|
|
33
|
+
discoveryEnabled = true;
|
|
34
|
+
};
|
|
35
|
+
pi.on("session_start", initializeDiscovery);
|
|
36
|
+
pi.on("before_agent_start", () => {
|
|
37
|
+
initializeDiscovery();
|
|
38
|
+
if (discoveryEnabled && !pi.getActiveTools?.().includes("tool_search")) {
|
|
39
|
+
exposeAllTools();
|
|
40
|
+
}
|
|
41
|
+
return discoveryEnabled ? {
|
|
42
|
+
message: {
|
|
43
|
+
customType: "stock-analysis-discovery",
|
|
44
|
+
content: "Stock analysis tools are available through tool_search. Search using English keywords or exact tool names (e.g. get_quote, get_financials, screen_stocks, run_backtest); its search does not tokenize Chinese. Load the tools needed for the task, then call them normally.",
|
|
45
|
+
display: false,
|
|
46
|
+
},
|
|
47
|
+
} : undefined;
|
|
48
|
+
});
|
|
6
49
|
// Resolve the plugin root robustly: __dirname under jiti/CJS-style loaders,
|
|
7
50
|
// else import.meta.url under native ESM (where __dirname is undefined).
|
|
8
51
|
const baseDir =
|
|
@@ -15,14 +58,717 @@ export default (pi: ExtensionAPI) => {
|
|
|
15
58
|
const venvPython = `${baseDir}/.venv/${isWin ? "Scripts/python.exe" : "bin/python3"}`;
|
|
16
59
|
// Fallback: on Windows "python3" is usually the Microsoft Store stub — prefer "python".
|
|
17
60
|
const python = existsSync(venvPython) ? venvPython : isWin ? "python" : "python3";
|
|
18
|
-
const py = (script: string, args: string[]) =>
|
|
19
|
-
pi.exec(python, [`${toolsDir}/${script}`, ...args]);
|
|
61
|
+
const py = async (script: string, args: string[]) => {
|
|
62
|
+
const result = await pi.exec(python, [`${toolsDir}/${script}`, ...args], { timeout: commandTimeout(script, args) });
|
|
63
|
+
if (result.killed || !result.stdout.trim()) {
|
|
64
|
+
return {...result, stdout: JSON.stringify({error: result.killed ? "Python command timed out" : "Python command returned no JSON"})};
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
20
68
|
const asText = (text: string) => ({
|
|
21
69
|
content: [{ type: "text" as const, text }],
|
|
22
70
|
details: {},
|
|
23
71
|
});
|
|
24
72
|
|
|
25
|
-
|
|
73
|
+
registerTool({
|
|
74
|
+
name: "compare_stocks",
|
|
75
|
+
description: "无状态同行指标比较:先用现有财务/行情工具取数,再传companies;仅相同unit/basis/period可排序,缺失不填零,不生成买卖综合分。",
|
|
76
|
+
parameters: {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"properties": {
|
|
79
|
+
"companies": {
|
|
80
|
+
"type": "array",
|
|
81
|
+
"items": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"symbol": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"description": "唯一股票代码"
|
|
87
|
+
},
|
|
88
|
+
"period": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"description": "统一可比期间;财务用报告期,估值用估值日"
|
|
91
|
+
},
|
|
92
|
+
"metrics": {
|
|
93
|
+
"type": "array",
|
|
94
|
+
"items": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"properties": {
|
|
97
|
+
"name": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "指标名,如pe/roe/net_income"
|
|
100
|
+
},
|
|
101
|
+
"value": {
|
|
102
|
+
"anyOf": [
|
|
103
|
+
{
|
|
104
|
+
"type": "number"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"type": "null"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"description": "有限数值;缺失为null"
|
|
111
|
+
},
|
|
112
|
+
"unit": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"description": "精确单位,如multiple/percent/fraction/CNY/USD"
|
|
115
|
+
},
|
|
116
|
+
"basis": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"description": "口径,如TTM/annual/consolidated;区分累计与单季"
|
|
119
|
+
},
|
|
120
|
+
"source": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "原始证据URL或字段路径"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"required": [
|
|
126
|
+
"name",
|
|
127
|
+
"value",
|
|
128
|
+
"unit",
|
|
129
|
+
"basis"
|
|
130
|
+
],
|
|
131
|
+
"additionalProperties": false
|
|
132
|
+
},
|
|
133
|
+
"description": "结构化指标,单位、口径明确,缺失不填零"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"required": [
|
|
137
|
+
"symbol",
|
|
138
|
+
"period",
|
|
139
|
+
"metrics"
|
|
140
|
+
],
|
|
141
|
+
"additionalProperties": false
|
|
142
|
+
},
|
|
143
|
+
"description": "2..30家公司,调用方确认可比性"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"required": [
|
|
147
|
+
"companies"
|
|
148
|
+
],
|
|
149
|
+
"additionalProperties": false
|
|
150
|
+
},
|
|
151
|
+
async execute(_id, params) {
|
|
152
|
+
return asText(await withJsonInput(params, async (path: string) =>
|
|
153
|
+
(await py("stateless_analysis.py", ["peers", "--input", path])).stdout));
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
registerTool({
|
|
158
|
+
name: "analyze_disclosure_changes",
|
|
159
|
+
description: "无状态公告财报比较:传新旧正文及指标,返回变更行号、来源与财务变化;负/零基数增长率为null。不下载PDF、不代替经济解读。",
|
|
160
|
+
parameters: {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"properties": {
|
|
163
|
+
"previous": {
|
|
164
|
+
"type": "object",
|
|
165
|
+
"properties": {
|
|
166
|
+
"text": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"description": "已核实正文,最多200000字符;保留换行,PDF需宿主提取"
|
|
169
|
+
},
|
|
170
|
+
"source": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"description": "原文URL或文档标识"
|
|
173
|
+
},
|
|
174
|
+
"period": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"description": "报告期,如2025年度"
|
|
177
|
+
},
|
|
178
|
+
"metrics": {
|
|
179
|
+
"type": "array",
|
|
180
|
+
"items": {
|
|
181
|
+
"type": "object",
|
|
182
|
+
"properties": {
|
|
183
|
+
"name": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"description": "指标名,如pe/roe/net_income"
|
|
186
|
+
},
|
|
187
|
+
"value": {
|
|
188
|
+
"anyOf": [
|
|
189
|
+
{
|
|
190
|
+
"type": "number"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"type": "null"
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"description": "有限数值;缺失为null"
|
|
197
|
+
},
|
|
198
|
+
"unit": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"description": "精确单位,如multiple/percent/fraction/CNY/USD"
|
|
201
|
+
},
|
|
202
|
+
"basis": {
|
|
203
|
+
"type": "string",
|
|
204
|
+
"description": "口径,如TTM/annual/consolidated;区分累计与单季"
|
|
205
|
+
},
|
|
206
|
+
"source": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"description": "原始证据URL或字段路径"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"required": [
|
|
212
|
+
"name",
|
|
213
|
+
"value",
|
|
214
|
+
"unit",
|
|
215
|
+
"basis"
|
|
216
|
+
],
|
|
217
|
+
"additionalProperties": false
|
|
218
|
+
},
|
|
219
|
+
"description": "结构化指标,单位、口径明确,缺失不填零"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"required": [
|
|
223
|
+
"text",
|
|
224
|
+
"source",
|
|
225
|
+
"period",
|
|
226
|
+
"metrics"
|
|
227
|
+
],
|
|
228
|
+
"additionalProperties": false
|
|
229
|
+
},
|
|
230
|
+
"current": {
|
|
231
|
+
"type": "object",
|
|
232
|
+
"properties": {
|
|
233
|
+
"text": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"description": "已核实正文,最多200000字符;保留换行,PDF需宿主提取"
|
|
236
|
+
},
|
|
237
|
+
"source": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"description": "原文URL或文档标识"
|
|
240
|
+
},
|
|
241
|
+
"period": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"description": "报告期,如2025年度"
|
|
244
|
+
},
|
|
245
|
+
"metrics": {
|
|
246
|
+
"type": "array",
|
|
247
|
+
"items": {
|
|
248
|
+
"type": "object",
|
|
249
|
+
"properties": {
|
|
250
|
+
"name": {
|
|
251
|
+
"type": "string",
|
|
252
|
+
"description": "指标名,如pe/roe/net_income"
|
|
253
|
+
},
|
|
254
|
+
"value": {
|
|
255
|
+
"anyOf": [
|
|
256
|
+
{
|
|
257
|
+
"type": "number"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"type": "null"
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
"description": "有限数值;缺失为null"
|
|
264
|
+
},
|
|
265
|
+
"unit": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"description": "精确单位,如multiple/percent/fraction/CNY/USD"
|
|
268
|
+
},
|
|
269
|
+
"basis": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"description": "口径,如TTM/annual/consolidated;区分累计与单季"
|
|
272
|
+
},
|
|
273
|
+
"source": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"description": "原始证据URL或字段路径"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
"required": [
|
|
279
|
+
"name",
|
|
280
|
+
"value",
|
|
281
|
+
"unit",
|
|
282
|
+
"basis"
|
|
283
|
+
],
|
|
284
|
+
"additionalProperties": false
|
|
285
|
+
},
|
|
286
|
+
"description": "结构化指标,单位、口径明确,缺失不填零"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"required": [
|
|
290
|
+
"text",
|
|
291
|
+
"source",
|
|
292
|
+
"period",
|
|
293
|
+
"metrics"
|
|
294
|
+
],
|
|
295
|
+
"additionalProperties": false
|
|
296
|
+
},
|
|
297
|
+
"max_changes": {
|
|
298
|
+
"type": "number",
|
|
299
|
+
"description": "变化上限1..100,默认30"
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
"required": [
|
|
303
|
+
"previous",
|
|
304
|
+
"current"
|
|
305
|
+
],
|
|
306
|
+
"additionalProperties": false
|
|
307
|
+
},
|
|
308
|
+
async execute(_id, params) {
|
|
309
|
+
return asText(await withJsonInput(params, async (path: string) =>
|
|
310
|
+
(await py("stateless_analysis.py", ["disclosure", "--input", path])).stdout));
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
registerTool({
|
|
315
|
+
name: "analyze_portfolio_risk",
|
|
316
|
+
description: "无状态现货多头组合风险:输入持仓、基准币种现金与汇率,返回集中度、币种/行业敞口、价格盈亏和止损情景。缺汇率报错;不保存账户。",
|
|
317
|
+
parameters: {
|
|
318
|
+
"type": "object",
|
|
319
|
+
"properties": {
|
|
320
|
+
"positions": {
|
|
321
|
+
"type": "array",
|
|
322
|
+
"items": {
|
|
323
|
+
"type": "object",
|
|
324
|
+
"properties": {
|
|
325
|
+
"symbol": {
|
|
326
|
+
"type": "string",
|
|
327
|
+
"description": "唯一代码,重复持仓先汇总"
|
|
328
|
+
},
|
|
329
|
+
"quantity": {
|
|
330
|
+
"type": "number",
|
|
331
|
+
"description": "正持仓数量"
|
|
332
|
+
},
|
|
333
|
+
"price": {
|
|
334
|
+
"type": "number",
|
|
335
|
+
"description": "正现价"
|
|
336
|
+
},
|
|
337
|
+
"currency": {
|
|
338
|
+
"type": "string",
|
|
339
|
+
"description": "持仓币种,如CNY/USD/HKD"
|
|
340
|
+
},
|
|
341
|
+
"cost": {
|
|
342
|
+
"type": "number",
|
|
343
|
+
"description": "同币种正成本价,可选"
|
|
344
|
+
},
|
|
345
|
+
"stop_price": {
|
|
346
|
+
"type": "number",
|
|
347
|
+
"description": "同币种正止损价,可选"
|
|
348
|
+
},
|
|
349
|
+
"sector": {
|
|
350
|
+
"type": "string",
|
|
351
|
+
"description": "统一行业分类,可选"
|
|
352
|
+
},
|
|
353
|
+
"as_of": {
|
|
354
|
+
"type": "string",
|
|
355
|
+
"description": "实际估值时点,建议ISO8601"
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
"required": [
|
|
359
|
+
"symbol",
|
|
360
|
+
"quantity",
|
|
361
|
+
"price",
|
|
362
|
+
"currency"
|
|
363
|
+
],
|
|
364
|
+
"additionalProperties": false
|
|
365
|
+
},
|
|
366
|
+
"description": "1..100个现货多头持仓"
|
|
367
|
+
},
|
|
368
|
+
"base_currency": {
|
|
369
|
+
"type": "string",
|
|
370
|
+
"description": "基准币种"
|
|
371
|
+
},
|
|
372
|
+
"cash": {
|
|
373
|
+
"type": "number",
|
|
374
|
+
"description": "基准币种现金,非负"
|
|
375
|
+
},
|
|
376
|
+
"fx_rates": {
|
|
377
|
+
"type": "array",
|
|
378
|
+
"items": {
|
|
379
|
+
"type": "object",
|
|
380
|
+
"properties": {
|
|
381
|
+
"currency": {
|
|
382
|
+
"type": "string",
|
|
383
|
+
"description": "唯一非基准币种"
|
|
384
|
+
},
|
|
385
|
+
"rate": {
|
|
386
|
+
"type": "number",
|
|
387
|
+
"description": "一单位该币种对应多少基准币种,正数"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
"required": [
|
|
391
|
+
"currency",
|
|
392
|
+
"rate"
|
|
393
|
+
],
|
|
394
|
+
"additionalProperties": false
|
|
395
|
+
},
|
|
396
|
+
"description": "显式现价汇率;基准币种隐含1,不得重复"
|
|
397
|
+
},
|
|
398
|
+
"histories": {
|
|
399
|
+
"type": "array",
|
|
400
|
+
"items": {
|
|
401
|
+
"type": "object",
|
|
402
|
+
"properties": {
|
|
403
|
+
"symbol": {
|
|
404
|
+
"type": "string",
|
|
405
|
+
"description": "对应唯一持仓股票"
|
|
406
|
+
},
|
|
407
|
+
"prices": {
|
|
408
|
+
"type": "array",
|
|
409
|
+
"items": {
|
|
410
|
+
"type": "object",
|
|
411
|
+
"properties": {
|
|
412
|
+
"date": {
|
|
413
|
+
"type": "string",
|
|
414
|
+
"description": "YYYY-MM-DD,唯一日期"
|
|
415
|
+
},
|
|
416
|
+
"close": {
|
|
417
|
+
"type": "number",
|
|
418
|
+
"description": "正有限收盘价"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
"required": [
|
|
422
|
+
"date",
|
|
423
|
+
"close"
|
|
424
|
+
],
|
|
425
|
+
"additionalProperties": false
|
|
426
|
+
},
|
|
427
|
+
"description": "完整日K收盘序列,2..20000条,不得跨股票或混用复权口径"
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"required": [
|
|
431
|
+
"symbol",
|
|
432
|
+
"prices"
|
|
433
|
+
],
|
|
434
|
+
"additionalProperties": false
|
|
435
|
+
},
|
|
436
|
+
"description": "可选历史,共同日期本币价格收益相关性,不计汇率"
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"required": [
|
|
440
|
+
"positions",
|
|
441
|
+
"base_currency",
|
|
442
|
+
"cash"
|
|
443
|
+
],
|
|
444
|
+
"additionalProperties": false
|
|
445
|
+
},
|
|
446
|
+
async execute(_id, params) {
|
|
447
|
+
return asText(await withJsonInput(params, async (path: string) =>
|
|
448
|
+
(await py("stateless_analysis.py", ["portfolio", "--input", path])).stdout));
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
registerTool({
|
|
453
|
+
name: "calculate_position_size",
|
|
454
|
+
description: "无状态多头仓位预算:同币种金额,按现金/风险预算/最大仓位/交易单位取最小数量,双边费用和滑点参与止损情景;不执行交易。",
|
|
455
|
+
parameters: {
|
|
456
|
+
"type": "object",
|
|
457
|
+
"properties": {
|
|
458
|
+
"equity": {
|
|
459
|
+
"type": "number",
|
|
460
|
+
"description": "总权益,正数"
|
|
461
|
+
},
|
|
462
|
+
"cash": {
|
|
463
|
+
"type": "number",
|
|
464
|
+
"description": "可用现金,0..equity"
|
|
465
|
+
},
|
|
466
|
+
"entry_price": {
|
|
467
|
+
"type": "number",
|
|
468
|
+
"description": "计划入场价,正数"
|
|
469
|
+
},
|
|
470
|
+
"stop_price": {
|
|
471
|
+
"type": "number",
|
|
472
|
+
"description": "正止损价,低于入场价"
|
|
473
|
+
},
|
|
474
|
+
"risk_fraction": {
|
|
475
|
+
"type": "number",
|
|
476
|
+
"description": "单笔风险占权益比例0..1,如0.01"
|
|
477
|
+
},
|
|
478
|
+
"lot_size": {
|
|
479
|
+
"type": "number",
|
|
480
|
+
"description": "正整数交易单位,用户确认,不猜港股每手数量"
|
|
481
|
+
},
|
|
482
|
+
"max_position_fraction": {
|
|
483
|
+
"type": "number",
|
|
484
|
+
"description": "本次买入最大资金占比0..1,默认1;已有同股持仓先扣减额度"
|
|
485
|
+
},
|
|
486
|
+
"fee_rate": {
|
|
487
|
+
"type": "number",
|
|
488
|
+
"description": "每边比例费用0..0.1,默认0;不含未提供税费/最低收费"
|
|
489
|
+
},
|
|
490
|
+
"slippage_rate": {
|
|
491
|
+
"type": "number",
|
|
492
|
+
"description": "每边滑点0..0.1,默认0"
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
"required": [
|
|
496
|
+
"equity",
|
|
497
|
+
"cash",
|
|
498
|
+
"entry_price",
|
|
499
|
+
"stop_price",
|
|
500
|
+
"risk_fraction",
|
|
501
|
+
"lot_size"
|
|
502
|
+
],
|
|
503
|
+
"additionalProperties": false
|
|
504
|
+
},
|
|
505
|
+
async execute(_id, params) {
|
|
506
|
+
return asText(await withJsonInput(params, async (path: string) =>
|
|
507
|
+
(await py("stateless_analysis.py", ["position_size", "--input", path])).stdout));
|
|
508
|
+
},
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
registerTool({
|
|
512
|
+
name: "analyze_event_study",
|
|
513
|
+
description: "无状态事件研究:提供同市场股票及基准完整价格、事件日期;事件前一交易日收盘为基点,计算交易日窗口收益差。缺窗口/基准为null,标注重叠,不推断因果。",
|
|
514
|
+
parameters: {
|
|
515
|
+
"type": "object",
|
|
516
|
+
"properties": {
|
|
517
|
+
"prices": {
|
|
518
|
+
"type": "array",
|
|
519
|
+
"items": {
|
|
520
|
+
"type": "object",
|
|
521
|
+
"properties": {
|
|
522
|
+
"date": {
|
|
523
|
+
"type": "string",
|
|
524
|
+
"description": "YYYY-MM-DD,唯一日期"
|
|
525
|
+
},
|
|
526
|
+
"close": {
|
|
527
|
+
"type": "number",
|
|
528
|
+
"description": "正有限收盘价"
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
"required": [
|
|
532
|
+
"date",
|
|
533
|
+
"close"
|
|
534
|
+
],
|
|
535
|
+
"additionalProperties": false
|
|
536
|
+
},
|
|
537
|
+
"description": "完整日K收盘序列,2..20000条,不得跨股票或混用复权口径"
|
|
538
|
+
},
|
|
539
|
+
"benchmark_prices": {
|
|
540
|
+
"type": "array",
|
|
541
|
+
"items": {
|
|
542
|
+
"type": "object",
|
|
543
|
+
"properties": {
|
|
544
|
+
"date": {
|
|
545
|
+
"type": "string",
|
|
546
|
+
"description": "YYYY-MM-DD,唯一日期"
|
|
547
|
+
},
|
|
548
|
+
"close": {
|
|
549
|
+
"type": "number",
|
|
550
|
+
"description": "正有限收盘价"
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
"required": [
|
|
554
|
+
"date",
|
|
555
|
+
"close"
|
|
556
|
+
],
|
|
557
|
+
"additionalProperties": false
|
|
558
|
+
},
|
|
559
|
+
"description": "完整日K收盘序列,2..20000条,不得跨股票或混用复权口径"
|
|
560
|
+
},
|
|
561
|
+
"event_dates": {
|
|
562
|
+
"type": "array",
|
|
563
|
+
"items": {
|
|
564
|
+
"type": "string",
|
|
565
|
+
"description": "YYYY-MM-DD,盘后公告传下一交易日"
|
|
566
|
+
},
|
|
567
|
+
"description": "1..100个唯一事件日"
|
|
568
|
+
},
|
|
569
|
+
"price_basis": {
|
|
570
|
+
"type": "string",
|
|
571
|
+
"description": "仅显式prices模式必需;代码模式报告实际提供方标记,缺失为unknown,须核实"
|
|
572
|
+
},
|
|
573
|
+
"horizons": {
|
|
574
|
+
"type": "array",
|
|
575
|
+
"items": {
|
|
576
|
+
"type": "number",
|
|
577
|
+
"description": "0=事件日,1=下一交易日;整数0..250"
|
|
578
|
+
},
|
|
579
|
+
"description": "1..20个窗口,默认0/1/5/10/20"
|
|
580
|
+
},
|
|
581
|
+
"start_date": {
|
|
582
|
+
"type": "string",
|
|
583
|
+
"description": "代码模式必需,YYYY-MM-DD,包含事件前基准日或训练窗口"
|
|
584
|
+
},
|
|
585
|
+
"end_date": {
|
|
586
|
+
"type": "string",
|
|
587
|
+
"description": "代码模式必需,YYYY-MM-DD,晚于start_date"
|
|
588
|
+
},
|
|
589
|
+
"symbol": {
|
|
590
|
+
"type": "string",
|
|
591
|
+
"description": "股票代码;与benchmark/start_date/end_date一起直接取数,和prices模式互斥"
|
|
592
|
+
},
|
|
593
|
+
"benchmark": {
|
|
594
|
+
"type": "string",
|
|
595
|
+
"description": "同市场基准代码;与symbol一起使用"
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
"required": [
|
|
599
|
+
"event_dates"
|
|
600
|
+
],
|
|
601
|
+
"additionalProperties": false
|
|
602
|
+
},
|
|
603
|
+
async execute(_id, params) {
|
|
604
|
+
return asText(await withJsonInput(params, async (path: string) =>
|
|
605
|
+
(await py("stateless_analysis.py", ["event_study", "--input", path])).stdout));
|
|
606
|
+
},
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
registerTool({
|
|
610
|
+
name: "validate_backtest",
|
|
611
|
+
description: "无状态回测稳健性:输入历史OHLCV和完整候选DSL;滚动训练选参数、后续不重叠窗口验证,列出全部样本内敏感性及跨标的结果。仅next_open,不自动优化或保存。",
|
|
612
|
+
parameters: {
|
|
613
|
+
"type": "object",
|
|
614
|
+
"properties": {
|
|
615
|
+
"datasets": {
|
|
616
|
+
"type": "array",
|
|
617
|
+
"items": {
|
|
618
|
+
"type": "object",
|
|
619
|
+
"properties": {
|
|
620
|
+
"symbol": {
|
|
621
|
+
"type": "string",
|
|
622
|
+
"description": "唯一股票代码"
|
|
623
|
+
},
|
|
624
|
+
"price_basis": {
|
|
625
|
+
"type": "string",
|
|
626
|
+
"description": "已核实复权/原始价格口径"
|
|
627
|
+
},
|
|
628
|
+
"bars": {
|
|
629
|
+
"type": "array",
|
|
630
|
+
"items": {
|
|
631
|
+
"type": "object",
|
|
632
|
+
"properties": {
|
|
633
|
+
"date": {
|
|
634
|
+
"type": "string",
|
|
635
|
+
"description": "YYYY-MM-DD"
|
|
636
|
+
},
|
|
637
|
+
"open": {
|
|
638
|
+
"type": "number",
|
|
639
|
+
"description": "有限OHLCV;价格为正、volume非负"
|
|
640
|
+
},
|
|
641
|
+
"high": {
|
|
642
|
+
"type": "number",
|
|
643
|
+
"description": "有限OHLCV;价格为正、volume非负"
|
|
644
|
+
},
|
|
645
|
+
"low": {
|
|
646
|
+
"type": "number",
|
|
647
|
+
"description": "有限OHLCV;价格为正、volume非负"
|
|
648
|
+
},
|
|
649
|
+
"close": {
|
|
650
|
+
"type": "number",
|
|
651
|
+
"description": "有限OHLCV;价格为正、volume非负"
|
|
652
|
+
},
|
|
653
|
+
"volume": {
|
|
654
|
+
"type": "number",
|
|
655
|
+
"description": "有限OHLCV;价格为正、volume非负"
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
"required": [
|
|
659
|
+
"date",
|
|
660
|
+
"open",
|
|
661
|
+
"high",
|
|
662
|
+
"low",
|
|
663
|
+
"close",
|
|
664
|
+
"volume"
|
|
665
|
+
],
|
|
666
|
+
"additionalProperties": false
|
|
667
|
+
},
|
|
668
|
+
"description": "日期递增完整OHLCV,每组最多2000条,至少train_bars+test_bars"
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
"required": [
|
|
672
|
+
"symbol",
|
|
673
|
+
"price_basis",
|
|
674
|
+
"bars"
|
|
675
|
+
],
|
|
676
|
+
"additionalProperties": false
|
|
677
|
+
},
|
|
678
|
+
"description": "1..5个标的,复用get_kline取数"
|
|
679
|
+
},
|
|
680
|
+
"strategies": {
|
|
681
|
+
"type": "array",
|
|
682
|
+
"items": {
|
|
683
|
+
"type": "object",
|
|
684
|
+
"properties": {
|
|
685
|
+
"name": {
|
|
686
|
+
"type": "string",
|
|
687
|
+
"description": "唯一候选名"
|
|
688
|
+
},
|
|
689
|
+
"strategy": {
|
|
690
|
+
"type": "object",
|
|
691
|
+
"additionalProperties": true,
|
|
692
|
+
"description": "完整既有YAML DSL对应JSON,允许parameters引用;仅next_open"
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
"required": [
|
|
696
|
+
"name",
|
|
697
|
+
"strategy"
|
|
698
|
+
],
|
|
699
|
+
"additionalProperties": false
|
|
700
|
+
},
|
|
701
|
+
"description": "1..5个预先确定的候选,禁止测试结果回调参数"
|
|
702
|
+
},
|
|
703
|
+
"train_bars": {
|
|
704
|
+
"type": "number",
|
|
705
|
+
"description": "训练交易日数30..1000,默认126"
|
|
706
|
+
},
|
|
707
|
+
"test_bars": {
|
|
708
|
+
"type": "number",
|
|
709
|
+
"description": "测试交易日数30..1000,默认63"
|
|
710
|
+
},
|
|
711
|
+
"capital": {
|
|
712
|
+
"type": "number",
|
|
713
|
+
"description": "每窗口初始资金,默认1000000"
|
|
714
|
+
},
|
|
715
|
+
"start_date": {
|
|
716
|
+
"type": "string",
|
|
717
|
+
"description": "代码模式必需,YYYY-MM-DD,包含事件前基准日或训练窗口"
|
|
718
|
+
},
|
|
719
|
+
"end_date": {
|
|
720
|
+
"type": "string",
|
|
721
|
+
"description": "代码模式必需,YYYY-MM-DD,晚于start_date"
|
|
722
|
+
},
|
|
723
|
+
"symbols": {
|
|
724
|
+
"type": "array",
|
|
725
|
+
"items": {
|
|
726
|
+
"type": "string"
|
|
727
|
+
},
|
|
728
|
+
"description": "1..5个唯一股票代码,配合start_date/end_date直接取数;和datasets互斥"
|
|
729
|
+
}
|
|
730
|
+
},
|
|
731
|
+
"required": [
|
|
732
|
+
"strategies"
|
|
733
|
+
],
|
|
734
|
+
"additionalProperties": false
|
|
735
|
+
},
|
|
736
|
+
async execute(_id, params) {
|
|
737
|
+
return asText(await withJsonInput(params, async (path: string) =>
|
|
738
|
+
(await py("stateless_analysis.py", ["robustness", "--input", path])).stdout));
|
|
739
|
+
},
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
registerTool({
|
|
743
|
+
name: "compare_analysis_snapshots",
|
|
744
|
+
description: "无状态快照比较:传新旧JSON,返回JSON Pointer及新增/删除/变化/失效/恢复;不保存快照。数组整体比较,调用前按symbol对齐。",
|
|
745
|
+
parameters: {
|
|
746
|
+
"type": "object",
|
|
747
|
+
"properties": {
|
|
748
|
+
"previous": {
|
|
749
|
+
"type": "object",
|
|
750
|
+
"additionalProperties": true,
|
|
751
|
+
"description": "JSON对象,详见共享Skill与README"
|
|
752
|
+
},
|
|
753
|
+
"current": {
|
|
754
|
+
"type": "object",
|
|
755
|
+
"additionalProperties": true,
|
|
756
|
+
"description": "JSON对象,详见共享Skill与README"
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
"required": [
|
|
760
|
+
"previous",
|
|
761
|
+
"current"
|
|
762
|
+
],
|
|
763
|
+
"additionalProperties": false
|
|
764
|
+
},
|
|
765
|
+
async execute(_id, params) {
|
|
766
|
+
return asText(await withJsonInput(params, async (path: string) =>
|
|
767
|
+
(await py("stateless_analysis.py", ["snapshot", "--input", path])).stdout));
|
|
768
|
+
},
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
registerTool({
|
|
26
772
|
name: "get_announcements",
|
|
27
773
|
description: "查询A股巨潮公告标题、日期、类型和原文PDF链接;按日期范围/类别筛选,默认近90天,top=1..500。第一版不提取正文,truncated提示截断。",
|
|
28
774
|
parameters: {
|
|
@@ -71,7 +817,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
71
817
|
},
|
|
72
818
|
});
|
|
73
819
|
|
|
74
|
-
|
|
820
|
+
registerTool({
|
|
75
821
|
name: "get_us_holdings",
|
|
76
822
|
description: "查询SEC 13F:mode=auto默认有13F申报时查机构,否则按发行人CIK反查持仓机构;manager/issuer可显式指定。发行人通过官方13D/G精确映射CUSIP,扫描最新已发布13F窗口,处理重述/补充修订,返回实际报告期、截止日及映射覆盖。首次约100MB下载,后续缓存;无映射明确报错,不做名称猜测。需SEC_USER_AGENT含真实联系邮箱,不是实时或全部证券持仓。",
|
|
77
823
|
parameters: {
|
|
@@ -93,7 +839,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
93
839
|
},
|
|
94
840
|
});
|
|
95
841
|
|
|
96
|
-
|
|
842
|
+
registerTool({
|
|
97
843
|
name: "get_insider_trades",
|
|
98
844
|
description: "查询美股发行人近期Form 4/4-A内部人交易(SEC官方XML),保留人员职务、交易代码、买卖方向、数量、价格、脚注和衍生品标志。需SEC_USER_AGENT含真实联系邮箱;days按申报日期筛选,top限制文件数,修订勿重复计数。",
|
|
99
845
|
parameters: {
|
|
@@ -124,7 +870,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
124
870
|
|
|
125
871
|
// --- Data Tools ---
|
|
126
872
|
|
|
127
|
-
|
|
873
|
+
registerTool({
|
|
128
874
|
name: "get_valuation_history",
|
|
129
875
|
description: "查询A/HK股票历史PE-TTM/PB、当前正值分位和10/25/50/75/90分位Band,返回实际采样区间;亏损估值分位为null。years=1..10,按天缓存。HK配置LIXINGER_TOKEN时优先理杏仁非金融公司日历史,失败降级百度,不混接来源。",
|
|
130
876
|
parameters: {
|
|
@@ -149,7 +895,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
149
895
|
},
|
|
150
896
|
});
|
|
151
897
|
|
|
152
|
-
|
|
898
|
+
registerTool({
|
|
153
899
|
name: "get_index_valuation",
|
|
154
900
|
description: "查询中国指数估值历史分位与Band;乐咕乐股PE/PB优先,中证官方历史补充滚动PE并保留近期PE1口径。缺PB时可用LIXINGER_TOKEN补充理杏仁mcw历史,来源与算法分别标明,不混接同一指标。",
|
|
155
901
|
parameters: {
|
|
@@ -174,7 +920,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
174
920
|
},
|
|
175
921
|
});
|
|
176
922
|
|
|
177
|
-
|
|
923
|
+
registerTool({
|
|
178
924
|
name: "get_earnings_calendar",
|
|
179
925
|
description: "查询财报日历:A股report_date必填季度期末,返回预约/修订/实际披露与业绩预告;HK需symbol,优先HKEX已公告业绩审批董事会排期(不是实际披露日),缺失时返回供应商日期。HK可按已知财政期末过滤,未知期次另列。",
|
|
180
926
|
parameters: {
|
|
@@ -201,7 +947,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
201
947
|
},
|
|
202
948
|
});
|
|
203
949
|
|
|
204
|
-
|
|
950
|
+
registerTool({
|
|
205
951
|
name: "get_shareholder_structure",
|
|
206
952
|
description: "查询A股股东户数、十大流通股东变化及沪深交易所季度北向合计持股;官方总量优先,十大HKSCC名义持股仅兜底且标明口径。HK返回港交所南向记录。缺失不当零,期末不等于已公布。",
|
|
207
953
|
parameters: {
|
|
@@ -226,7 +972,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
226
972
|
},
|
|
227
973
|
});
|
|
228
974
|
|
|
229
|
-
|
|
975
|
+
registerTool({
|
|
230
976
|
name: "get_etf_details",
|
|
231
977
|
description: "查询A股ETF净值折溢价、规模、披露持仓及沪深完整PCF申赎篮子;篮子不是实际持仓。include_full_holdings=true另取最近可得半年度/年度披露股票表,含数量/市值/报告期,非实时全资产组合;benchmark用于跟踪误差。",
|
|
232
978
|
parameters: {
|
|
@@ -256,7 +1002,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
256
1002
|
},
|
|
257
1003
|
});
|
|
258
1004
|
|
|
259
|
-
|
|
1005
|
+
registerTool({
|
|
260
1006
|
name: "get_dividends",
|
|
261
1007
|
description: "查询A/HK分红历史、除息日历、已实施TTM股息与连续年数。mode=ranking省略symbol,market=A查报告期排行,market=HK查HKEX/LSEG年度股息率排行(report_date须年末);排行均非当前TTM收益率。缺失不按零。",
|
|
262
1008
|
parameters: {
|
|
@@ -297,10 +1043,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
297
1043
|
},
|
|
298
1044
|
});
|
|
299
1045
|
|
|
300
|
-
|
|
1046
|
+
registerTool({
|
|
301
1047
|
name: "get_kline",
|
|
302
1048
|
description:
|
|
303
|
-
"获取股票K线数据(OHLCV)。支持A股(如600519)、港股(如00700.HK)、美股(如AAPL)、日股(如7203.T)、韩股(如005930.KS)、台股(如2330.TW)及A股ETF。A股股票/ETF返回前复权价格,每条记录 adjusted=qfq;sh000xxx/sz399xxx 指数返回原始点位,adjusted=none。需要历史价格自行计算或画图时用;只问指标用 get_technical_analysis,只问现价用 get_quote",
|
|
1049
|
+
"获取股票K线数据(OHLCV)。支持A股(如600519)、港股(如00700.HK)、美股(如AAPL)、日股(如7203.T)、韩股(如005930.KS)、台股(如2330.TW)及A股ETF。A股股票/ETF返回前复权价格,每条记录 adjusted=qfq;sh000xxx/sz399xxx 指数返回原始点位,adjusted=none。需要历史价格自行计算或画图时用;只问指标用 get_technical_analysis,只问现价用 get_quote。每条记录附 source、UTC fetched_at、data_as_of 和 adjusted;非A股复权口径可能为total_return/qfq/unknown,未知不能假定已复权。部分来源附 adjustment_factor(复权价格/原始价格);缺失不能猜测换算系数。",
|
|
304
1050
|
parameters: {
|
|
305
1051
|
type: "object",
|
|
306
1052
|
properties: {
|
|
@@ -333,10 +1079,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
333
1079
|
},
|
|
334
1080
|
});
|
|
335
1081
|
|
|
336
|
-
|
|
1082
|
+
registerTool({
|
|
337
1083
|
name: "get_quote",
|
|
338
1084
|
description:
|
|
339
|
-
"获取股票实时行情报价(现价、涨跌幅、量比等)。支持A股、港股、美股、日股、韩股、台股;非交易时段返回最近交易日收盘价并以 as_of/stale 标注;ETF 的 premium_discount_rate
|
|
1085
|
+
"获取股票实时行情报价(现价、涨跌幅、量比等)。支持A股、港股、美股、日股、韩股、台股;非交易时段返回最近交易日收盘价并以 as_of/stale 标注;ETF 的 premium_discount_rate 为正=溢价、负=折价。返回 source、UTC fetched_at 和提供方 data_as_of(未知为null);as_of_basis区分提供方时间与交易日历推断,采集时间不等于行情时间。",
|
|
340
1086
|
parameters: {
|
|
341
1087
|
type: "object",
|
|
342
1088
|
properties: {
|
|
@@ -353,7 +1099,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
353
1099
|
},
|
|
354
1100
|
});
|
|
355
1101
|
|
|
356
|
-
|
|
1102
|
+
registerTool({
|
|
357
1103
|
name: "get_capital_flow",
|
|
358
1104
|
description:
|
|
359
1105
|
"获取A股资金流向(主力/超大单/大单/中单/小单净流入)。detail=个股每日明细,summary=多日汇总+趋势,sector_flow=板块资金流排行。可配合 get_chip_distribution 验证主力行为",
|
|
@@ -382,7 +1128,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
382
1128
|
},
|
|
383
1129
|
});
|
|
384
1130
|
|
|
385
|
-
|
|
1131
|
+
registerTool({
|
|
386
1132
|
name: "get_news",
|
|
387
1133
|
description: "获取个股最近N天财经新闻快讯(轻量、无需配置)。需要深度全网情报用 search_comprehensive_intel,按主题搜索用 search_stock_news,读文章全文用 extract_article",
|
|
388
1134
|
parameters: {
|
|
@@ -405,7 +1151,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
405
1151
|
},
|
|
406
1152
|
});
|
|
407
1153
|
|
|
408
|
-
|
|
1154
|
+
registerTool({
|
|
409
1155
|
name: "get_financials",
|
|
410
1156
|
description:
|
|
411
1157
|
"获取股票财务摘要及历史趋势,按天缓存。A股annual=true与periods=10取十年年报;港股可配置LIXINGER_TOKEN取非金融公司财务序列,保留币种/披露日/实际财年,历史比率单位percent。有效Yahoo顶层快照按整组保留,currency为财报币种、market_cap_currency为市值币种、snapshot_source标明来源;缺失值及report_date不混入历史数值/日期。缺token或无权限降级原有来源并标注不足,不补造缺失。估值历史用get_valuation_history,披露排期用get_earnings_calendar",
|
|
@@ -437,7 +1183,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
437
1183
|
|
|
438
1184
|
// --- Analysis Tools ---
|
|
439
1185
|
|
|
440
|
-
|
|
1186
|
+
registerTool({
|
|
441
1187
|
name: "get_technical_analysis",
|
|
442
1188
|
description:
|
|
443
1189
|
"获取股票技术面分析(MA/MACD/RSI/BOLL/KDJ/成交量等指标 + 100分综合评分 + 6级买卖信号 + 趋势/偏离度/支撑压力位;多周期共振时 resonance.direction ∈ aligned_bullish/aligned_bearish/divergent)。个股技术面综合判断与买卖时机分析的首选;只要均线数值或自定义周期用 calculate_ma,专问量价用 get_volume_analysis,扫当日异动用 detect_anomaly",
|
|
@@ -478,7 +1224,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
478
1224
|
},
|
|
479
1225
|
});
|
|
480
1226
|
|
|
481
|
-
|
|
1227
|
+
registerTool({
|
|
482
1228
|
name: "analyze_pattern",
|
|
483
1229
|
description:
|
|
484
1230
|
"K线形态识别 — 检测十字星、锤子线、吞没、启明星、黄昏星、双底、20日突破等12+种经典形态。综合技术面判断用 get_technical_analysis",
|
|
@@ -516,7 +1262,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
516
1262
|
|
|
517
1263
|
// --- Market Tools ---
|
|
518
1264
|
|
|
519
|
-
|
|
1265
|
+
registerTool({
|
|
520
1266
|
name: "get_market_indices",
|
|
521
1267
|
description:
|
|
522
1268
|
"获取主要市场指数行情。CN: 上证/深证/创业板/科创50/沪深300;HK: 恒生/国企/科技;US: 道琼斯/纳斯达克/标普500;JP: 日经225/东证;KR: KOSPI/KOSDAQ;TW: 台湾加权。大盘复盘用 get_market_review 一站式获取",
|
|
@@ -540,7 +1286,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
540
1286
|
},
|
|
541
1287
|
});
|
|
542
1288
|
|
|
543
|
-
|
|
1289
|
+
registerTool({
|
|
544
1290
|
name: "get_sector_rankings",
|
|
545
1291
|
description: "获取A股板块涨跌幅排行(含领涨股、涨跌家数等)。board_type=industry(默认)为行业板块,board_type=concept 时为概念板块排行。支持查看涨幅榜/跌幅榜/双向",
|
|
546
1292
|
parameters: {
|
|
@@ -576,7 +1322,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
576
1322
|
},
|
|
577
1323
|
});
|
|
578
1324
|
|
|
579
|
-
|
|
1325
|
+
registerTool({
|
|
580
1326
|
name: "get_sector_constituents",
|
|
581
1327
|
description:
|
|
582
1328
|
"查询A股板块成分股(正向映射:板块→股票列表)。板块名支持模糊匹配(如「创新药」自动解析到精确板块名),东财行业/概念 + 新浪多源 failover,结果按用户目录缓存7天。仅支持A股;反向查个股所属板块用 resolve_stock_sectors",
|
|
@@ -606,7 +1352,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
606
1352
|
},
|
|
607
1353
|
});
|
|
608
1354
|
|
|
609
|
-
|
|
1355
|
+
registerTool({
|
|
610
1356
|
name: "resolve_stock_sectors",
|
|
611
1357
|
description:
|
|
612
1358
|
"查询个股所属板块(反向映射:个股→板块)。A股返回东财行业 + efinance 概念/板块(雪球行业兜底,需 XUEQIU_TOKEN),港股返回 yfinance GICS 英文 sector/industry 口径。板块级情报(如「创新药回调」)映射到池内个股时调本工具;正向查板块成分股用 get_sector_constituents",
|
|
@@ -626,7 +1372,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
626
1372
|
},
|
|
627
1373
|
});
|
|
628
1374
|
|
|
629
|
-
|
|
1375
|
+
registerTool({
|
|
630
1376
|
name: "get_stock_info",
|
|
631
1377
|
description:
|
|
632
1378
|
"获取股票基本信息(行业、板块、上市日期、总股本等)。A股返回板块/行业,其他市场返回行业/公司简介",
|
|
@@ -646,7 +1392,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
646
1392
|
},
|
|
647
1393
|
});
|
|
648
1394
|
|
|
649
|
-
|
|
1395
|
+
registerTool({
|
|
650
1396
|
name: "get_chip_distribution",
|
|
651
1397
|
description:
|
|
652
1398
|
"获取A股筹码分布数据(获利比例、平均成本、90%/70%成本集中度)。仅支持A股。与 get_capital_flow 配合验证主力行为",
|
|
@@ -666,7 +1412,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
666
1412
|
},
|
|
667
1413
|
});
|
|
668
1414
|
|
|
669
|
-
|
|
1415
|
+
registerTool({
|
|
670
1416
|
name: "get_market_stats",
|
|
671
1417
|
description:
|
|
672
1418
|
"获取A股市场整体统计(涨跌家数、涨停跌停数、平均涨幅、涨跌Top5、总成交额)。用于衡量市场整体情绪与温度",
|
|
@@ -680,7 +1426,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
680
1426
|
},
|
|
681
1427
|
});
|
|
682
1428
|
|
|
683
|
-
|
|
1429
|
+
registerTool({
|
|
684
1430
|
name: "get_limit_up_pool",
|
|
685
1431
|
description:
|
|
686
1432
|
"获取A股涨停池/涨停板复盘——当日涨停个股,含连板数、封板资金、炸板次数、首末次封板时间、所属行业。短线情绪与龙头战法核心数据",
|
|
@@ -702,7 +1448,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
702
1448
|
},
|
|
703
1449
|
});
|
|
704
1450
|
|
|
705
|
-
|
|
1451
|
+
registerTool({
|
|
706
1452
|
name: "get_dragon_tiger",
|
|
707
1453
|
description:
|
|
708
1454
|
"获取A股龙虎榜——上榜个股净买额/买入额/卖出额/上榜原因/解读,可按个股过滤",
|
|
@@ -735,7 +1481,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
735
1481
|
},
|
|
736
1482
|
});
|
|
737
1483
|
|
|
738
|
-
|
|
1484
|
+
registerTool({
|
|
739
1485
|
name: "get_hot_stocks",
|
|
740
1486
|
description: "获取A股全市场人气热搜榜(东方财富人气榜)",
|
|
741
1487
|
parameters: {
|
|
@@ -753,7 +1499,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
753
1499
|
},
|
|
754
1500
|
});
|
|
755
1501
|
|
|
756
|
-
|
|
1502
|
+
registerTool({
|
|
757
1503
|
name: "get_margin_trading",
|
|
758
1504
|
description:
|
|
759
1505
|
"获取A股个股融资融券明细(融资余额/融资买入额/融券余量等,上交所/深交所官方数据按交易所分流),返回最近N个交易日序列(最新在前)。金额单位为元,short_*_shares 单位为股。include_ratio=true追加同日融资买入/成交额百分比(margin_buy_ratio_pct),缺少同日元口径成交额则为null。仅两融标的有数据,非两融标的返回错误",
|
|
@@ -778,7 +1524,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
778
1524
|
},
|
|
779
1525
|
});
|
|
780
1526
|
|
|
781
|
-
|
|
1527
|
+
registerTool({
|
|
782
1528
|
name: "get_northbound_flow",
|
|
783
1529
|
description:
|
|
784
1530
|
"获取北向资金市场级净买入序列(最新在前,单位亿元)。数据口径:东方财富沪深港通历史数据;2024-08-16 起交易所停止披露日度净买额,仅 2024-08 之前历史数据可查(近期小 days 窗口会返回停披错误,加大 days 可取历史)",
|
|
@@ -797,7 +1543,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
797
1543
|
},
|
|
798
1544
|
});
|
|
799
1545
|
|
|
800
|
-
|
|
1546
|
+
registerTool({
|
|
801
1547
|
name: "get_fundamental_context",
|
|
802
1548
|
description:
|
|
803
1549
|
"获取A股基本面上下文(估值 PE/PB/市值 + 营收/净利增速 + ROE/毛利率/净利率 + 分红历史)。用于评估公司质地与长期持有价值",
|
|
@@ -819,10 +1565,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
819
1565
|
|
|
820
1566
|
// --- Screener & Backtest ---
|
|
821
1567
|
|
|
822
|
-
|
|
1568
|
+
registerTool({
|
|
823
1569
|
name: "screen_stocks",
|
|
824
1570
|
description:
|
|
825
|
-
"全市场股票筛选(AlphaSift L1 多因子硬筛 + 市场情绪调节)。按PE/PB/市值/换手率/涨跌幅/量比等因子过滤和评分,可用 l2 开启质量/成长/动量/波动率/资金流增强。显式筛选条件缺少数据时报error,filters_applied
|
|
1571
|
+
"全市场股票筛选(AlphaSift L1 多因子硬筛 + 市场情绪调节)。按PE/PB/市值/换手率/涨跌幅/量比等因子过滤和评分,可用 l2 开启质量/成长/动量/波动率/资金流增强。显式筛选条件缺少数据时报error,filters_applied只列实际执行的条件。候选factor_coverage列出可用/缺失因子、加权覆盖率和effective_weights;L1与L2均按可用因子归一化后排序,缺失/非有限值不按零分计;L2另返回effective_scores供结合市场系数复算final,按可用因子重归一化,高分不代表数据完整。选股预算按候选数量及采集批次计算,top须为正整数。",
|
|
826
1572
|
parameters: {
|
|
827
1573
|
type: "object",
|
|
828
1574
|
properties: {
|
|
@@ -859,10 +1605,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
859
1605
|
},
|
|
860
1606
|
});
|
|
861
1607
|
|
|
862
|
-
|
|
1608
|
+
registerTool({
|
|
863
1609
|
name: "run_backtest",
|
|
864
1610
|
description:
|
|
865
|
-
"策略回测(AlphaEvo)。读取YAML策略定义,在历史数据上模拟交易,输出收益率/回撤/胜率等指标。只想知道单个技术信号的历史胜率用更轻量的 evaluate_signal。period为实际数据期间,requested_period保留请求期间,warnings
|
|
1611
|
+
"策略回测(AlphaEvo)。读取YAML策略定义,在历史数据上模拟交易,输出收益率/回撤/胜率等指标。只想知道单个技术信号的历史胜率用更轻量的 evaluate_signal。period为实际数据期间,requested_period保留请求期间,warnings提示覆盖差异;年化按实际期间计算。默认前日收盘信号、次日开盘成交;YAML simulation.execution=same_close可复现旧假设。execution返回模型、阻止成交次数和未模拟约束;零成交量及带历史限价的一字板不成交。",
|
|
866
1612
|
parameters: {
|
|
867
1613
|
type: "object",
|
|
868
1614
|
properties: {
|
|
@@ -903,7 +1649,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
903
1649
|
},
|
|
904
1650
|
});
|
|
905
1651
|
|
|
906
|
-
|
|
1652
|
+
registerTool({
|
|
907
1653
|
name: "evaluate_signal",
|
|
908
1654
|
description:
|
|
909
1655
|
"技术信号历史准确率评估 — 回溯历史数据,统计某个技术信号触发后N日的胜率和平均收益。支持9种信号:macd_golden_cross/macd_death_cross/rsi_oversold/rsi_overbought/breakout_20d/breakdown_20d/volume_surge/ma_golden_cross/ma_death_cross。要完整模拟交易过程用 run_backtest",
|
|
@@ -956,7 +1702,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
956
1702
|
|
|
957
1703
|
// --- Name Resolution ---
|
|
958
1704
|
|
|
959
|
-
|
|
1705
|
+
registerTool({
|
|
960
1706
|
name: "resolve_stock_name",
|
|
961
1707
|
description:
|
|
962
1708
|
"股票名称智能解析 — 输入中文名(贵州茅台)、拼音(guizhou maotai/gzmt)、部分代码,返回匹配的股票代码。仅支持A股。用户给出中文名/拼音/部分代码时先调本工具换成代码再调其他工具",
|
|
@@ -987,7 +1733,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
987
1733
|
|
|
988
1734
|
// --- Trading Calendar ---
|
|
989
1735
|
|
|
990
|
-
|
|
1736
|
+
registerTool({
|
|
991
1737
|
name: "check_trading_day",
|
|
992
1738
|
description:
|
|
993
1739
|
"查询某日是否为交易日。支持CN(A股)、HK(港股)、US(美股)、JP(日股)、KR(韩股)、TW(台股)",
|
|
@@ -1016,7 +1762,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1016
1762
|
},
|
|
1017
1763
|
});
|
|
1018
1764
|
|
|
1019
|
-
|
|
1765
|
+
registerTool({
|
|
1020
1766
|
name: "get_trading_days",
|
|
1021
1767
|
description:
|
|
1022
1768
|
"获取最近/未来N个交易日列表。支持CN/HK/US/JP/KR/TW",
|
|
@@ -1056,7 +1802,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1056
1802
|
},
|
|
1057
1803
|
});
|
|
1058
1804
|
|
|
1059
|
-
|
|
1805
|
+
registerTool({
|
|
1060
1806
|
name: "get_trading_phase",
|
|
1061
1807
|
description:
|
|
1062
1808
|
"查询某市场当前交易时段(盘前/早盘/午间休市/午盘/交易中/盘后/休市),用于正确解读实时行情的盘中语义。支持CN/HK/US/JP/KR/TW",
|
|
@@ -1079,7 +1825,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1079
1825
|
|
|
1080
1826
|
// --- Standalone MA Calculator ---
|
|
1081
1827
|
|
|
1082
|
-
|
|
1828
|
+
registerTool({
|
|
1083
1829
|
name: "calculate_ma",
|
|
1084
1830
|
description:
|
|
1085
1831
|
"独立均线计算器 — 支持任意周期MA(5/10/20/30/60/120/250或自定义)+ 偏离度 + 均线排列 + 金叉死叉检测。只要均线数值或需要30/120/250等非默认周期时用本工具;综合技术面分析用 get_technical_analysis",
|
|
@@ -1119,7 +1865,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1119
1865
|
|
|
1120
1866
|
// --- Volume-Price Analysis ---
|
|
1121
1867
|
|
|
1122
|
-
|
|
1868
|
+
registerTool({
|
|
1123
1869
|
name: "get_volume_analysis",
|
|
1124
1870
|
description:
|
|
1125
1871
|
"独立量价分析 — 量价相关性、上涨/下跌日成交量对比、量能趋势、量价模式解读(放量上涨/缩量回调等)。综合技术面判断用 get_technical_analysis,扫当日异动用 detect_anomaly",
|
|
@@ -1157,7 +1903,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1157
1903
|
|
|
1158
1904
|
// --- Search Intelligence ---
|
|
1159
1905
|
|
|
1160
|
-
|
|
1906
|
+
registerTool({
|
|
1161
1907
|
name: "search_stock_news",
|
|
1162
1908
|
description:
|
|
1163
1909
|
"多引擎股票新闻搜索(Tavily/Brave/SerpAPI/Bocha/SearXNG)。需配置至少一个搜索源的 Key 或 SearXNG URL。get_news 快讯不够或要按主题搜索时用;深度6维情报用 search_comprehensive_intel",
|
|
@@ -1186,7 +1932,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1186
1932
|
},
|
|
1187
1933
|
});
|
|
1188
1934
|
|
|
1189
|
-
|
|
1935
|
+
registerTool({
|
|
1190
1936
|
name: "search_comprehensive_intel",
|
|
1191
1937
|
description:
|
|
1192
1938
|
"股票综合情报搜索 — 从6个维度(新闻/公告/行情分析/风险/业绩/行业)搜索综合信息。用于个股的深入研究/全面调研;快速看新闻用 get_news",
|
|
@@ -1214,7 +1960,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1214
1960
|
},
|
|
1215
1961
|
});
|
|
1216
1962
|
|
|
1217
|
-
|
|
1963
|
+
registerTool({
|
|
1218
1964
|
name: "get_social_sentiment",
|
|
1219
1965
|
description:
|
|
1220
1966
|
"获取股票社交媒体情绪数据。A股:东方财富股吧热度+雪球讨论热度(无需配置);美股/港股:Reddit/X/Polymarket情绪(需 SENTIMENT_API_KEY)。自动按市场选数据源。面向个股维度;全市场热门讨论用 get_trending_sentiment",
|
|
@@ -1234,7 +1980,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1234
1980
|
},
|
|
1235
1981
|
});
|
|
1236
1982
|
|
|
1237
|
-
|
|
1983
|
+
registerTool({
|
|
1238
1984
|
name: "get_trending_sentiment",
|
|
1239
1985
|
description:
|
|
1240
1986
|
"获取社交媒体热门趋势(Reddit/X/Polymarket热门股票讨论)。适用于发现市场热点;查个股情绪用 get_social_sentiment",
|
|
@@ -1248,7 +1994,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1248
1994
|
},
|
|
1249
1995
|
});
|
|
1250
1996
|
|
|
1251
|
-
|
|
1997
|
+
registerTool({
|
|
1252
1998
|
name: "extract_article",
|
|
1253
1999
|
description:
|
|
1254
2000
|
"网页文章全文提取 — 输入URL,提取文章标题、正文(最多3000字)、作者、发布日期等。配合 get_news/search_stock_news 的搜索结果做深度阅读",
|
|
@@ -1268,7 +2014,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1268
2014
|
},
|
|
1269
2015
|
});
|
|
1270
2016
|
|
|
1271
|
-
|
|
2017
|
+
registerTool({
|
|
1272
2018
|
name: "screen_risk",
|
|
1273
2019
|
description:
|
|
1274
2020
|
"A股风险专项筛查 — 检查估值、技术预警、解禁、减持、业绩预警、监管和行业政策,返回风险评级和 veto_buy。新闻搜索命中是待核实线索,不是已证实风险。data_complete和warnings标明覆盖;数据不足时risk_level=unknown,risk_score或veto_buy可为null,不能视为低风险",
|
|
@@ -1296,7 +2042,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1296
2042
|
},
|
|
1297
2043
|
});
|
|
1298
2044
|
|
|
1299
|
-
|
|
2045
|
+
registerTool({
|
|
1300
2046
|
name: "detect_market_regime",
|
|
1301
2047
|
description:
|
|
1302
2048
|
"市场状态检测 — 分析大盘指数判断当前市场阶段(上涨趋势/下跌趋势/横盘震荡/高波动/板块热点),并推荐适合的分析策略",
|
|
@@ -1317,10 +2063,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1317
2063
|
},
|
|
1318
2064
|
});
|
|
1319
2065
|
|
|
1320
|
-
|
|
2066
|
+
registerTool({
|
|
1321
2067
|
name: "get_market_review",
|
|
1322
2068
|
description:
|
|
1323
|
-
"大盘复盘 —
|
|
2069
|
+
"大盘复盘 — 获取市场日度复盘数据,包含指数、涨跌统计、板块排名、新闻、市场温度与策略建议。复盘类需求的首选,无需再分别调指数/统计/板块工具。数据不足时温度score及strategy_stance为null,信号unknown;warnings/data_quality说明限制",
|
|
1324
2070
|
parameters: {
|
|
1325
2071
|
type: "object",
|
|
1326
2072
|
properties: {
|
|
@@ -1338,7 +2084,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1338
2084
|
},
|
|
1339
2085
|
});
|
|
1340
2086
|
|
|
1341
|
-
|
|
2087
|
+
registerTool({
|
|
1342
2088
|
name: "run_watchlist_analysis",
|
|
1343
2089
|
description:
|
|
1344
2090
|
"批量自选股分析 — 对多只股票并行采集行情/技术/资金/风险等数据,返回汇总结果。适用于每日定时分析自选股列表",
|
|
@@ -1367,7 +2113,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1367
2113
|
},
|
|
1368
2114
|
});
|
|
1369
2115
|
|
|
1370
|
-
|
|
2116
|
+
registerTool({
|
|
1371
2117
|
name: "detect_anomaly",
|
|
1372
2118
|
description:
|
|
1373
2119
|
"异常/事件检测 — 一键扫描股票当前所有异动信号(MACD金叉死叉、RSI超买超卖、20日突破、放量异动、涨跌停、布林突破、KDJ极值、资金异动等),返回结构化异常列表。当日异动归因的首选;综合技术面判断用 get_technical_analysis",
|
|
@@ -1389,7 +2135,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1389
2135
|
|
|
1390
2136
|
// --- Diagnostics & Capabilities ---
|
|
1391
2137
|
|
|
1392
|
-
|
|
2138
|
+
registerTool({
|
|
1393
2139
|
name: "diagnose_data_sources",
|
|
1394
2140
|
description:
|
|
1395
2141
|
"数据源诊断 — 检查当前环境各数据 provider 的包与凭据就绪情况(不探测网络可达性),输出每个市场的可用链路、缺失 env、warnings。工具拿不到数据或报错时调用排查",
|
|
@@ -1409,7 +2155,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1409
2155
|
},
|
|
1410
2156
|
});
|
|
1411
2157
|
|
|
1412
|
-
|
|
2158
|
+
registerTool({
|
|
1413
2159
|
name: "get_market_capabilities",
|
|
1414
2160
|
description:
|
|
1415
2161
|
"市场能力边界 — 返回指定市场支持/不支持的工具列表。不确定某市场能否用某工具(如港股的筹码分布、美股的资金流)时先调本工具,避免调用不支持的工具后编造数据",
|
|
@@ -1431,10 +2177,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1431
2177
|
|
|
1432
2178
|
// --- Report Rendering ---
|
|
1433
2179
|
|
|
1434
|
-
|
|
2180
|
+
registerTool({
|
|
1435
2181
|
name: "render_stock_report",
|
|
1436
2182
|
description:
|
|
1437
|
-
"股票分析报告渲染 — 将结构化报告 JSON 通过 j2 模板渲染为 Markdown。report 字段以 skill 提供的 report_schema 为准,不要自造字段。template: brief|full
|
|
2183
|
+
"股票分析报告渲染 — 将结构化报告 JSON 通过 j2 模板渲染为 Markdown。report 字段以 skill 提供的 report_schema 为准,不要自造字段。template: brief|full。全部分析完成后的最后一步调用。仅渲染,不保存不推送。report可包含evidence(path/label/value/source/as_of)与data_quality(flags/limitations),brief/full均展示证据和限制。",
|
|
1438
2184
|
parameters: {
|
|
1439
2185
|
type: "object",
|
|
1440
2186
|
properties: {
|
|
@@ -1463,7 +2209,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1463
2209
|
},
|
|
1464
2210
|
});
|
|
1465
2211
|
|
|
1466
|
-
|
|
2212
|
+
registerTool({
|
|
1467
2213
|
name: "render_market_report",
|
|
1468
2214
|
description:
|
|
1469
2215
|
"大盘复盘报告渲染 — 将结构化报告 JSON 通过 j2 模板渲染为 Markdown。report 字段以 schemas/market_review_schema.json 为准。save=true 时把报告对象追加归档到本地 JSONL(默认不保存不推送),纵向对比用 get_review_history",
|
|
@@ -1487,7 +2233,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1487
2233
|
},
|
|
1488
2234
|
});
|
|
1489
2235
|
|
|
1490
|
-
|
|
2236
|
+
registerTool({
|
|
1491
2237
|
name: "get_review_history",
|
|
1492
2238
|
description:
|
|
1493
2239
|
"复盘归档历史 — 读取本地 JSONL 归档的最近 N 条市场复盘(最新在前),用于纵向对比(温度/姿态/主线变化)。归档由 render_market_report 的 save=true 写入,空存档返回空列表",
|
|
@@ -1505,10 +2251,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1505
2251
|
|
|
1506
2252
|
// --- Watchlist / Position / Alert Context ---
|
|
1507
2253
|
|
|
1508
|
-
|
|
2254
|
+
registerTool({
|
|
1509
2255
|
name: "build_watchlist_context",
|
|
1510
2256
|
description:
|
|
1511
|
-
"自选股上下文包 — 对多只股票输出评分/趋势/异常/风险/建议 next_tools 的 agent 友好摘要。宿主 agent
|
|
2257
|
+
"自选股上下文包 — 对多只股票输出评分/趋势/异常/风险/建议 next_tools 的 agent 友好摘要。宿主 agent 决定如何写日报或深入分析。异动检查失败时anomaly_status=unavailable、anomaly_count=null,保留anomaly_error/warnings;汇总计入partial",
|
|
1512
2258
|
parameters: {
|
|
1513
2259
|
type: "object",
|
|
1514
2260
|
properties: {
|
|
@@ -1533,7 +2279,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1533
2279
|
},
|
|
1534
2280
|
});
|
|
1535
2281
|
|
|
1536
|
-
|
|
2282
|
+
registerTool({
|
|
1537
2283
|
name: "analyze_position_context",
|
|
1538
2284
|
description:
|
|
1539
2285
|
"持仓上下文分析 — 输入成本/仓位/止损止盈,结合现价和技术位输出浮盈亏、离止损距离、风险级别、操作建议。无状态、不存账户",
|
|
@@ -1563,7 +2309,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1563
2309
|
},
|
|
1564
2310
|
});
|
|
1565
2311
|
|
|
1566
|
-
|
|
2312
|
+
registerTool({
|
|
1567
2313
|
name: "check_alert_rules",
|
|
1568
2314
|
description:
|
|
1569
2315
|
"无状态告警规则检查 — 传入规则数组,返回当前是否触发。规则类型:price_below/price_above/change_pct_above/change_pct_below/volume_ratio_above/anomaly/risk_veto/risk_level_at_least。不做调度不存历史。依赖数据不可用时evaluated条目含error,meta.warnings提示缺失,triggered=false不代表检查成功",
|
|
@@ -1592,7 +2338,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1592
2338
|
},
|
|
1593
2339
|
});
|
|
1594
2340
|
|
|
1595
|
-
|
|
2341
|
+
registerTool({
|
|
1596
2342
|
name: "record_signal",
|
|
1597
2343
|
description:
|
|
1598
2344
|
"记录一条 AI 分析建议信号(方向/入场价/目标价/止损价/持有期限),供后续胜率评估。信号持久化在本地 JSONL($STOCK_SIGNAL_STORE 或 ~/.stock-analysis/signals.jsonl),宿主 Agent 自行决定何时 record/evaluate",
|
|
@@ -1632,10 +2378,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1632
2378
|
},
|
|
1633
2379
|
});
|
|
1634
2380
|
|
|
1635
|
-
|
|
2381
|
+
registerTool({
|
|
1636
2382
|
name: "evaluate_signals",
|
|
1637
2383
|
description:
|
|
1638
|
-
"评估到期信号:拉取记录日之后的日K,判定 target_hit/stop_hit/timeout 并计算收益,回写存储。记录建议用 record_signal,胜率复盘用 get_signal_summary。历史K线未覆盖记录日时skipped_no_data
|
|
2384
|
+
"评估到期信号:拉取记录日之后的日K,判定 target_hit/stop_hit/timeout 并计算收益,回写存储。记录建议用 record_signal,胜率复盘用 get_signal_summary。历史K线未覆盖记录日时skipped_no_data并保持未结算,不能用较新行情代替。原始信号价与复权K线须有可核实的adjustment_factor,缺失则skipped_price_basis保持未结算。CLI预算300秒,截止前返回并保存已完成结果;complete/deferred/warnings说明未处理记录,下次可重试",
|
|
1639
2385
|
parameters: {
|
|
1640
2386
|
type: "object",
|
|
1641
2387
|
properties: {
|
|
@@ -1651,10 +2397,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1651
2397
|
},
|
|
1652
2398
|
});
|
|
1653
2399
|
|
|
1654
|
-
|
|
2400
|
+
registerTool({
|
|
1655
2401
|
name: "get_signal_summary",
|
|
1656
2402
|
description:
|
|
1657
|
-
"信号胜率汇总(可按 source/symbol/status
|
|
2403
|
+
"信号胜率汇总(可按 source/symbol/status 过滤):胜率、平均收益、结果分布与明细。by_source附avg_return_pct、return_samples和sample_warning;仅观察性复盘,样本少不能认定策略有效。",
|
|
1658
2404
|
parameters: {
|
|
1659
2405
|
type: "object",
|
|
1660
2406
|
properties: {
|
|
@@ -1679,7 +2425,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1679
2425
|
},
|
|
1680
2426
|
});
|
|
1681
2427
|
|
|
1682
|
-
|
|
2428
|
+
registerTool({
|
|
1683
2429
|
name: "parse_stock_list",
|
|
1684
2430
|
description:
|
|
1685
2431
|
"自选股/文本导入解析 — 从自然语言、CSV、Markdown 表格提取股票,自动识别 A 股 6 位代码、港股 xxxxx.HK、美股 ticker、日股 xxxx.T、韩股 xxxxxx.KS/KQ、台股 xxxx.TW,并调用 name_resolver 处理中文股票名",
|