stock-analysis-plugin 0.2.5 → 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 +126 -15
- package/package.json +2 -1
- package/pi/index.ts +918 -72
- package/schemas/market_review_schema.json +12 -5
- package/schemas/report_schema.json +68 -4
- package/scripts/cli-timeout.mjs +27 -0
- package/scripts/json-input.mjs +26 -0
- package/scripts/setup-python.mjs +6 -6
- package/skills/bull-trend/SKILL.md +34 -10
- package/skills/bull-trend/references/fat-tails.md +91 -0
- package/skills/bull-trend/scripts/tail_analysis.py +132 -0
- package/skills/event-driven/SKILL.md +6 -0
- package/skills/growth-quality/SKILL.md +6 -0
- package/skills/market-review/SKILL.md +2 -0
- package/skills/stock-analysis/SKILL.md +25 -5
- package/skills/stock-analysis/references/stateless-analysis.md +66 -0
- package/skills/stock-screener/SKILL.md +7 -1
- package/skills/strategy-backtest/SKILL.md +13 -0
- package/skills/wisburg-research/SKILL.md +2 -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 +6 -1
- package/templates/stock_analysis/full.md.j2 +8 -3
- package/tools/_subproc.py +66 -11
- package/tools/alert_rules.py +32 -4
- package/tools/backtest.py +95 -18
- package/tools/capabilities.py +11 -0
- package/tools/cli_budgets.json +26 -0
- package/tools/gather.py +24 -16
- package/tools/lixinger.py +100 -0
- package/tools/market_regime.py +7 -3
- package/tools/market_review.py +37 -15
- package/tools/position_context.py +20 -2
- package/tools/report_renderer.py +2 -0
- package/tools/risk_screening.py +45 -17
- package/tools/screener.py +74 -24
- package/tools/sec_edgar.py +346 -0
- package/tools/sec_holders.py +263 -0
- package/tools/signal_tracker.py +218 -24
- package/tools/stateless_analysis.py +630 -0
- package/tools/stock_data.py +170 -32
- package/tools/technical.py +16 -2
- package/tools/value_data.py +159 -0
- package/tools/watchlist.py +24 -1
- package/tools/watchlist_context.py +25 -10
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,18 +58,821 @@ 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
|
|
|
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({
|
|
772
|
+
name: "get_announcements",
|
|
773
|
+
description: "查询A股巨潮公告标题、日期、类型和原文PDF链接;按日期范围/类别筛选,默认近90天,top=1..500。第一版不提取正文,truncated提示截断。",
|
|
774
|
+
parameters: {
|
|
775
|
+
"type": "object",
|
|
776
|
+
"properties": {
|
|
777
|
+
"symbol": {
|
|
778
|
+
"type": "string",
|
|
779
|
+
"description": "A股代码"
|
|
780
|
+
},
|
|
781
|
+
"category": {
|
|
782
|
+
"type": "string",
|
|
783
|
+
"enum": [
|
|
784
|
+
"all",
|
|
785
|
+
"forecast",
|
|
786
|
+
"express",
|
|
787
|
+
"annual",
|
|
788
|
+
"interim",
|
|
789
|
+
"quarterly",
|
|
790
|
+
"reduction",
|
|
791
|
+
"issuance",
|
|
792
|
+
"inquiry",
|
|
793
|
+
"dividend"
|
|
794
|
+
],
|
|
795
|
+
"description": "公告类别,默认all"
|
|
796
|
+
},
|
|
797
|
+
"start_date": {
|
|
798
|
+
"type": "string",
|
|
799
|
+
"description": "开始日期YYYY-MM-DD,默认结束日期前90天"
|
|
800
|
+
},
|
|
801
|
+
"end_date": {
|
|
802
|
+
"type": "string",
|
|
803
|
+
"description": "结束日期YYYY-MM-DD,默认今天"
|
|
804
|
+
},
|
|
805
|
+
"top": {
|
|
806
|
+
"type": "number",
|
|
807
|
+
"description": "最多条数1..500,默认50"
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
"required": [
|
|
811
|
+
"symbol"
|
|
812
|
+
]
|
|
813
|
+
},
|
|
814
|
+
async execute(_id, p) {
|
|
815
|
+
const result = await py("value_data.py", ["announcements", p.symbol, "--category", p.category ?? "all", "--start-date", p.start_date ?? "", "--end-date", p.end_date ?? "", "--top", String(p.top ?? 50)]);
|
|
816
|
+
return asText(result.stdout);
|
|
817
|
+
},
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
registerTool({
|
|
821
|
+
name: "get_us_holdings",
|
|
822
|
+
description: "查询SEC 13F:mode=auto默认有13F申报时查机构,否则按发行人CIK反查持仓机构;manager/issuer可显式指定。发行人通过官方13D/G精确映射CUSIP,扫描最新已发布13F窗口,处理重述/补充修订,返回实际报告期、截止日及映射覆盖。首次约100MB下载,后续缓存;无映射明确报错,不做名称猜测。需SEC_USER_AGENT含真实联系邮箱,不是实时或全部证券持仓。",
|
|
823
|
+
parameters: {
|
|
824
|
+
"type": "object",
|
|
825
|
+
"properties": {
|
|
826
|
+
"cik": {
|
|
827
|
+
"type": "string",
|
|
828
|
+
"description": "机构或发行人CIK,1..10位数字,如0001067983/0000320193"
|
|
829
|
+
},
|
|
830
|
+
"mode": {"type": "string", "enum": ["auto", "manager", "issuer"], "description": "默认auto;manager查机构组合,issuer反查发行人持仓机构"}
|
|
831
|
+
},
|
|
832
|
+
"required": [
|
|
833
|
+
"cik"
|
|
834
|
+
]
|
|
835
|
+
},
|
|
836
|
+
async execute(_id, p) {
|
|
837
|
+
const result = await py("sec_edgar.py", ["holdings", p.cik, ...(p.mode ? ["--mode", p.mode] : [])]);
|
|
838
|
+
return asText(result.stdout);
|
|
839
|
+
},
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
registerTool({
|
|
843
|
+
name: "get_insider_trades",
|
|
844
|
+
description: "查询美股发行人近期Form 4/4-A内部人交易(SEC官方XML),保留人员职务、交易代码、买卖方向、数量、价格、脚注和衍生品标志。需SEC_USER_AGENT含真实联系邮箱;days按申报日期筛选,top限制文件数,修订勿重复计数。",
|
|
845
|
+
parameters: {
|
|
846
|
+
"type": "object",
|
|
847
|
+
"properties": {
|
|
848
|
+
"symbol": {
|
|
849
|
+
"type": "string",
|
|
850
|
+
"description": "美股ticker或发行人CIK"
|
|
851
|
+
},
|
|
852
|
+
"days": {
|
|
853
|
+
"type": "number",
|
|
854
|
+
"description": "申报日期窗口1..365天,默认90"
|
|
855
|
+
},
|
|
856
|
+
"top": {
|
|
857
|
+
"type": "number",
|
|
858
|
+
"description": "最多解析Form 4文件数1..20,默认10"
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
"required": [
|
|
862
|
+
"symbol"
|
|
863
|
+
]
|
|
864
|
+
},
|
|
865
|
+
async execute(_id, p) {
|
|
866
|
+
const result = await py("sec_edgar.py", ["insider_trades", p.symbol, "--days", String(p.days ?? 90), "--top", String(p.top ?? 10)]);
|
|
867
|
+
return asText(result.stdout);
|
|
868
|
+
},
|
|
869
|
+
});
|
|
870
|
+
|
|
25
871
|
// --- Data Tools ---
|
|
26
872
|
|
|
27
|
-
|
|
873
|
+
registerTool({
|
|
28
874
|
name: "get_valuation_history",
|
|
29
|
-
description: "查询A/HK股票历史
|
|
875
|
+
description: "查询A/HK股票历史PE-TTM/PB、当前正值分位和10/25/50/75/90分位Band,返回实际采样区间;亏损估值分位为null。years=1..10,按天缓存。HK配置LIXINGER_TOKEN时优先理杏仁非金融公司日历史,失败降级百度,不混接来源。",
|
|
30
876
|
parameters: {
|
|
31
877
|
"type": "object",
|
|
32
878
|
"properties": {
|
|
@@ -49,7 +895,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
49
895
|
},
|
|
50
896
|
});
|
|
51
897
|
|
|
52
|
-
|
|
898
|
+
registerTool({
|
|
53
899
|
name: "get_index_valuation",
|
|
54
900
|
description: "查询中国指数估值历史分位与Band;乐咕乐股PE/PB优先,中证官方历史补充滚动PE并保留近期PE1口径。缺PB时可用LIXINGER_TOKEN补充理杏仁mcw历史,来源与算法分别标明,不混接同一指标。",
|
|
55
901
|
parameters: {
|
|
@@ -74,7 +920,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
74
920
|
},
|
|
75
921
|
});
|
|
76
922
|
|
|
77
|
-
|
|
923
|
+
registerTool({
|
|
78
924
|
name: "get_earnings_calendar",
|
|
79
925
|
description: "查询财报日历:A股report_date必填季度期末,返回预约/修订/实际披露与业绩预告;HK需symbol,优先HKEX已公告业绩审批董事会排期(不是实际披露日),缺失时返回供应商日期。HK可按已知财政期末过滤,未知期次另列。",
|
|
80
926
|
parameters: {
|
|
@@ -101,7 +947,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
101
947
|
},
|
|
102
948
|
});
|
|
103
949
|
|
|
104
|
-
|
|
950
|
+
registerTool({
|
|
105
951
|
name: "get_shareholder_structure",
|
|
106
952
|
description: "查询A股股东户数、十大流通股东变化及沪深交易所季度北向合计持股;官方总量优先,十大HKSCC名义持股仅兜底且标明口径。HK返回港交所南向记录。缺失不当零,期末不等于已公布。",
|
|
107
953
|
parameters: {
|
|
@@ -126,7 +972,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
126
972
|
},
|
|
127
973
|
});
|
|
128
974
|
|
|
129
|
-
|
|
975
|
+
registerTool({
|
|
130
976
|
name: "get_etf_details",
|
|
131
977
|
description: "查询A股ETF净值折溢价、规模、披露持仓及沪深完整PCF申赎篮子;篮子不是实际持仓。include_full_holdings=true另取最近可得半年度/年度披露股票表,含数量/市值/报告期,非实时全资产组合;benchmark用于跟踪误差。",
|
|
132
978
|
parameters: {
|
|
@@ -156,7 +1002,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
156
1002
|
},
|
|
157
1003
|
});
|
|
158
1004
|
|
|
159
|
-
|
|
1005
|
+
registerTool({
|
|
160
1006
|
name: "get_dividends",
|
|
161
1007
|
description: "查询A/HK分红历史、除息日历、已实施TTM股息与连续年数。mode=ranking省略symbol,market=A查报告期排行,market=HK查HKEX/LSEG年度股息率排行(report_date须年末);排行均非当前TTM收益率。缺失不按零。",
|
|
162
1008
|
parameters: {
|
|
@@ -197,10 +1043,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
197
1043
|
},
|
|
198
1044
|
});
|
|
199
1045
|
|
|
200
|
-
|
|
1046
|
+
registerTool({
|
|
201
1047
|
name: "get_kline",
|
|
202
1048
|
description:
|
|
203
|
-
"获取股票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(复权价格/原始价格);缺失不能猜测换算系数。",
|
|
204
1050
|
parameters: {
|
|
205
1051
|
type: "object",
|
|
206
1052
|
properties: {
|
|
@@ -233,10 +1079,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
233
1079
|
},
|
|
234
1080
|
});
|
|
235
1081
|
|
|
236
|
-
|
|
1082
|
+
registerTool({
|
|
237
1083
|
name: "get_quote",
|
|
238
1084
|
description:
|
|
239
|
-
"获取股票实时行情报价(现价、涨跌幅、量比等)。支持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区分提供方时间与交易日历推断,采集时间不等于行情时间。",
|
|
240
1086
|
parameters: {
|
|
241
1087
|
type: "object",
|
|
242
1088
|
properties: {
|
|
@@ -253,7 +1099,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
253
1099
|
},
|
|
254
1100
|
});
|
|
255
1101
|
|
|
256
|
-
|
|
1102
|
+
registerTool({
|
|
257
1103
|
name: "get_capital_flow",
|
|
258
1104
|
description:
|
|
259
1105
|
"获取A股资金流向(主力/超大单/大单/中单/小单净流入)。detail=个股每日明细,summary=多日汇总+趋势,sector_flow=板块资金流排行。可配合 get_chip_distribution 验证主力行为",
|
|
@@ -282,7 +1128,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
282
1128
|
},
|
|
283
1129
|
});
|
|
284
1130
|
|
|
285
|
-
|
|
1131
|
+
registerTool({
|
|
286
1132
|
name: "get_news",
|
|
287
1133
|
description: "获取个股最近N天财经新闻快讯(轻量、无需配置)。需要深度全网情报用 search_comprehensive_intel,按主题搜索用 search_stock_news,读文章全文用 extract_article",
|
|
288
1134
|
parameters: {
|
|
@@ -305,10 +1151,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
305
1151
|
},
|
|
306
1152
|
});
|
|
307
1153
|
|
|
308
|
-
|
|
1154
|
+
registerTool({
|
|
309
1155
|
name: "get_financials",
|
|
310
1156
|
description:
|
|
311
|
-
"获取股票财务摘要及历史趋势,按天缓存。A
|
|
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",
|
|
312
1158
|
parameters: {
|
|
313
1159
|
type: "object",
|
|
314
1160
|
properties: {
|
|
@@ -337,7 +1183,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
337
1183
|
|
|
338
1184
|
// --- Analysis Tools ---
|
|
339
1185
|
|
|
340
|
-
|
|
1186
|
+
registerTool({
|
|
341
1187
|
name: "get_technical_analysis",
|
|
342
1188
|
description:
|
|
343
1189
|
"获取股票技术面分析(MA/MACD/RSI/BOLL/KDJ/成交量等指标 + 100分综合评分 + 6级买卖信号 + 趋势/偏离度/支撑压力位;多周期共振时 resonance.direction ∈ aligned_bullish/aligned_bearish/divergent)。个股技术面综合判断与买卖时机分析的首选;只要均线数值或自定义周期用 calculate_ma,专问量价用 get_volume_analysis,扫当日异动用 detect_anomaly",
|
|
@@ -378,7 +1224,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
378
1224
|
},
|
|
379
1225
|
});
|
|
380
1226
|
|
|
381
|
-
|
|
1227
|
+
registerTool({
|
|
382
1228
|
name: "analyze_pattern",
|
|
383
1229
|
description:
|
|
384
1230
|
"K线形态识别 — 检测十字星、锤子线、吞没、启明星、黄昏星、双底、20日突破等12+种经典形态。综合技术面判断用 get_technical_analysis",
|
|
@@ -416,7 +1262,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
416
1262
|
|
|
417
1263
|
// --- Market Tools ---
|
|
418
1264
|
|
|
419
|
-
|
|
1265
|
+
registerTool({
|
|
420
1266
|
name: "get_market_indices",
|
|
421
1267
|
description:
|
|
422
1268
|
"获取主要市场指数行情。CN: 上证/深证/创业板/科创50/沪深300;HK: 恒生/国企/科技;US: 道琼斯/纳斯达克/标普500;JP: 日经225/东证;KR: KOSPI/KOSDAQ;TW: 台湾加权。大盘复盘用 get_market_review 一站式获取",
|
|
@@ -440,7 +1286,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
440
1286
|
},
|
|
441
1287
|
});
|
|
442
1288
|
|
|
443
|
-
|
|
1289
|
+
registerTool({
|
|
444
1290
|
name: "get_sector_rankings",
|
|
445
1291
|
description: "获取A股板块涨跌幅排行(含领涨股、涨跌家数等)。board_type=industry(默认)为行业板块,board_type=concept 时为概念板块排行。支持查看涨幅榜/跌幅榜/双向",
|
|
446
1292
|
parameters: {
|
|
@@ -476,7 +1322,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
476
1322
|
},
|
|
477
1323
|
});
|
|
478
1324
|
|
|
479
|
-
|
|
1325
|
+
registerTool({
|
|
480
1326
|
name: "get_sector_constituents",
|
|
481
1327
|
description:
|
|
482
1328
|
"查询A股板块成分股(正向映射:板块→股票列表)。板块名支持模糊匹配(如「创新药」自动解析到精确板块名),东财行业/概念 + 新浪多源 failover,结果按用户目录缓存7天。仅支持A股;反向查个股所属板块用 resolve_stock_sectors",
|
|
@@ -506,7 +1352,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
506
1352
|
},
|
|
507
1353
|
});
|
|
508
1354
|
|
|
509
|
-
|
|
1355
|
+
registerTool({
|
|
510
1356
|
name: "resolve_stock_sectors",
|
|
511
1357
|
description:
|
|
512
1358
|
"查询个股所属板块(反向映射:个股→板块)。A股返回东财行业 + efinance 概念/板块(雪球行业兜底,需 XUEQIU_TOKEN),港股返回 yfinance GICS 英文 sector/industry 口径。板块级情报(如「创新药回调」)映射到池内个股时调本工具;正向查板块成分股用 get_sector_constituents",
|
|
@@ -526,7 +1372,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
526
1372
|
},
|
|
527
1373
|
});
|
|
528
1374
|
|
|
529
|
-
|
|
1375
|
+
registerTool({
|
|
530
1376
|
name: "get_stock_info",
|
|
531
1377
|
description:
|
|
532
1378
|
"获取股票基本信息(行业、板块、上市日期、总股本等)。A股返回板块/行业,其他市场返回行业/公司简介",
|
|
@@ -546,7 +1392,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
546
1392
|
},
|
|
547
1393
|
});
|
|
548
1394
|
|
|
549
|
-
|
|
1395
|
+
registerTool({
|
|
550
1396
|
name: "get_chip_distribution",
|
|
551
1397
|
description:
|
|
552
1398
|
"获取A股筹码分布数据(获利比例、平均成本、90%/70%成本集中度)。仅支持A股。与 get_capital_flow 配合验证主力行为",
|
|
@@ -566,7 +1412,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
566
1412
|
},
|
|
567
1413
|
});
|
|
568
1414
|
|
|
569
|
-
|
|
1415
|
+
registerTool({
|
|
570
1416
|
name: "get_market_stats",
|
|
571
1417
|
description:
|
|
572
1418
|
"获取A股市场整体统计(涨跌家数、涨停跌停数、平均涨幅、涨跌Top5、总成交额)。用于衡量市场整体情绪与温度",
|
|
@@ -580,7 +1426,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
580
1426
|
},
|
|
581
1427
|
});
|
|
582
1428
|
|
|
583
|
-
|
|
1429
|
+
registerTool({
|
|
584
1430
|
name: "get_limit_up_pool",
|
|
585
1431
|
description:
|
|
586
1432
|
"获取A股涨停池/涨停板复盘——当日涨停个股,含连板数、封板资金、炸板次数、首末次封板时间、所属行业。短线情绪与龙头战法核心数据",
|
|
@@ -602,7 +1448,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
602
1448
|
},
|
|
603
1449
|
});
|
|
604
1450
|
|
|
605
|
-
|
|
1451
|
+
registerTool({
|
|
606
1452
|
name: "get_dragon_tiger",
|
|
607
1453
|
description:
|
|
608
1454
|
"获取A股龙虎榜——上榜个股净买额/买入额/卖出额/上榜原因/解读,可按个股过滤",
|
|
@@ -635,7 +1481,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
635
1481
|
},
|
|
636
1482
|
});
|
|
637
1483
|
|
|
638
|
-
|
|
1484
|
+
registerTool({
|
|
639
1485
|
name: "get_hot_stocks",
|
|
640
1486
|
description: "获取A股全市场人气热搜榜(东方财富人气榜)",
|
|
641
1487
|
parameters: {
|
|
@@ -653,7 +1499,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
653
1499
|
},
|
|
654
1500
|
});
|
|
655
1501
|
|
|
656
|
-
|
|
1502
|
+
registerTool({
|
|
657
1503
|
name: "get_margin_trading",
|
|
658
1504
|
description:
|
|
659
1505
|
"获取A股个股融资融券明细(融资余额/融资买入额/融券余量等,上交所/深交所官方数据按交易所分流),返回最近N个交易日序列(最新在前)。金额单位为元,short_*_shares 单位为股。include_ratio=true追加同日融资买入/成交额百分比(margin_buy_ratio_pct),缺少同日元口径成交额则为null。仅两融标的有数据,非两融标的返回错误",
|
|
@@ -678,7 +1524,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
678
1524
|
},
|
|
679
1525
|
});
|
|
680
1526
|
|
|
681
|
-
|
|
1527
|
+
registerTool({
|
|
682
1528
|
name: "get_northbound_flow",
|
|
683
1529
|
description:
|
|
684
1530
|
"获取北向资金市场级净买入序列(最新在前,单位亿元)。数据口径:东方财富沪深港通历史数据;2024-08-16 起交易所停止披露日度净买额,仅 2024-08 之前历史数据可查(近期小 days 窗口会返回停披错误,加大 days 可取历史)",
|
|
@@ -697,7 +1543,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
697
1543
|
},
|
|
698
1544
|
});
|
|
699
1545
|
|
|
700
|
-
|
|
1546
|
+
registerTool({
|
|
701
1547
|
name: "get_fundamental_context",
|
|
702
1548
|
description:
|
|
703
1549
|
"获取A股基本面上下文(估值 PE/PB/市值 + 营收/净利增速 + ROE/毛利率/净利率 + 分红历史)。用于评估公司质地与长期持有价值",
|
|
@@ -719,10 +1565,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
719
1565
|
|
|
720
1566
|
// --- Screener & Backtest ---
|
|
721
1567
|
|
|
722
|
-
|
|
1568
|
+
registerTool({
|
|
723
1569
|
name: "screen_stocks",
|
|
724
1570
|
description:
|
|
725
|
-
"全市场股票筛选(AlphaSift L1 多因子硬筛 + 市场情绪调节)。按PE/PB/市值/换手率/涨跌幅/量比等因子过滤和评分,可用 l2
|
|
1571
|
+
"全市场股票筛选(AlphaSift L1 多因子硬筛 + 市场情绪调节)。按PE/PB/市值/换手率/涨跌幅/量比等因子过滤和评分,可用 l2 开启质量/成长/动量/波动率/资金流增强。显式筛选条件缺少数据时报error,filters_applied只列实际执行的条件。候选factor_coverage列出可用/缺失因子、加权覆盖率和effective_weights;L1与L2均按可用因子归一化后排序,缺失/非有限值不按零分计;L2另返回effective_scores供结合市场系数复算final,按可用因子重归一化,高分不代表数据完整。选股预算按候选数量及采集批次计算,top须为正整数。",
|
|
726
1572
|
parameters: {
|
|
727
1573
|
type: "object",
|
|
728
1574
|
properties: {
|
|
@@ -759,10 +1605,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
759
1605
|
},
|
|
760
1606
|
});
|
|
761
1607
|
|
|
762
|
-
|
|
1608
|
+
registerTool({
|
|
763
1609
|
name: "run_backtest",
|
|
764
1610
|
description:
|
|
765
|
-
"策略回测(AlphaEvo)。读取YAML策略定义,在历史数据上模拟交易,输出收益率/回撤/胜率等指标。只想知道单个技术信号的历史胜率用更轻量的 evaluate_signal",
|
|
1611
|
+
"策略回测(AlphaEvo)。读取YAML策略定义,在历史数据上模拟交易,输出收益率/回撤/胜率等指标。只想知道单个技术信号的历史胜率用更轻量的 evaluate_signal。period为实际数据期间,requested_period保留请求期间,warnings提示覆盖差异;年化按实际期间计算。默认前日收盘信号、次日开盘成交;YAML simulation.execution=same_close可复现旧假设。execution返回模型、阻止成交次数和未模拟约束;零成交量及带历史限价的一字板不成交。",
|
|
766
1612
|
parameters: {
|
|
767
1613
|
type: "object",
|
|
768
1614
|
properties: {
|
|
@@ -803,7 +1649,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
803
1649
|
},
|
|
804
1650
|
});
|
|
805
1651
|
|
|
806
|
-
|
|
1652
|
+
registerTool({
|
|
807
1653
|
name: "evaluate_signal",
|
|
808
1654
|
description:
|
|
809
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",
|
|
@@ -856,7 +1702,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
856
1702
|
|
|
857
1703
|
// --- Name Resolution ---
|
|
858
1704
|
|
|
859
|
-
|
|
1705
|
+
registerTool({
|
|
860
1706
|
name: "resolve_stock_name",
|
|
861
1707
|
description:
|
|
862
1708
|
"股票名称智能解析 — 输入中文名(贵州茅台)、拼音(guizhou maotai/gzmt)、部分代码,返回匹配的股票代码。仅支持A股。用户给出中文名/拼音/部分代码时先调本工具换成代码再调其他工具",
|
|
@@ -887,7 +1733,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
887
1733
|
|
|
888
1734
|
// --- Trading Calendar ---
|
|
889
1735
|
|
|
890
|
-
|
|
1736
|
+
registerTool({
|
|
891
1737
|
name: "check_trading_day",
|
|
892
1738
|
description:
|
|
893
1739
|
"查询某日是否为交易日。支持CN(A股)、HK(港股)、US(美股)、JP(日股)、KR(韩股)、TW(台股)",
|
|
@@ -916,7 +1762,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
916
1762
|
},
|
|
917
1763
|
});
|
|
918
1764
|
|
|
919
|
-
|
|
1765
|
+
registerTool({
|
|
920
1766
|
name: "get_trading_days",
|
|
921
1767
|
description:
|
|
922
1768
|
"获取最近/未来N个交易日列表。支持CN/HK/US/JP/KR/TW",
|
|
@@ -956,7 +1802,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
956
1802
|
},
|
|
957
1803
|
});
|
|
958
1804
|
|
|
959
|
-
|
|
1805
|
+
registerTool({
|
|
960
1806
|
name: "get_trading_phase",
|
|
961
1807
|
description:
|
|
962
1808
|
"查询某市场当前交易时段(盘前/早盘/午间休市/午盘/交易中/盘后/休市),用于正确解读实时行情的盘中语义。支持CN/HK/US/JP/KR/TW",
|
|
@@ -979,7 +1825,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
979
1825
|
|
|
980
1826
|
// --- Standalone MA Calculator ---
|
|
981
1827
|
|
|
982
|
-
|
|
1828
|
+
registerTool({
|
|
983
1829
|
name: "calculate_ma",
|
|
984
1830
|
description:
|
|
985
1831
|
"独立均线计算器 — 支持任意周期MA(5/10/20/30/60/120/250或自定义)+ 偏离度 + 均线排列 + 金叉死叉检测。只要均线数值或需要30/120/250等非默认周期时用本工具;综合技术面分析用 get_technical_analysis",
|
|
@@ -1019,7 +1865,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1019
1865
|
|
|
1020
1866
|
// --- Volume-Price Analysis ---
|
|
1021
1867
|
|
|
1022
|
-
|
|
1868
|
+
registerTool({
|
|
1023
1869
|
name: "get_volume_analysis",
|
|
1024
1870
|
description:
|
|
1025
1871
|
"独立量价分析 — 量价相关性、上涨/下跌日成交量对比、量能趋势、量价模式解读(放量上涨/缩量回调等)。综合技术面判断用 get_technical_analysis,扫当日异动用 detect_anomaly",
|
|
@@ -1057,7 +1903,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1057
1903
|
|
|
1058
1904
|
// --- Search Intelligence ---
|
|
1059
1905
|
|
|
1060
|
-
|
|
1906
|
+
registerTool({
|
|
1061
1907
|
name: "search_stock_news",
|
|
1062
1908
|
description:
|
|
1063
1909
|
"多引擎股票新闻搜索(Tavily/Brave/SerpAPI/Bocha/SearXNG)。需配置至少一个搜索源的 Key 或 SearXNG URL。get_news 快讯不够或要按主题搜索时用;深度6维情报用 search_comprehensive_intel",
|
|
@@ -1086,7 +1932,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1086
1932
|
},
|
|
1087
1933
|
});
|
|
1088
1934
|
|
|
1089
|
-
|
|
1935
|
+
registerTool({
|
|
1090
1936
|
name: "search_comprehensive_intel",
|
|
1091
1937
|
description:
|
|
1092
1938
|
"股票综合情报搜索 — 从6个维度(新闻/公告/行情分析/风险/业绩/行业)搜索综合信息。用于个股的深入研究/全面调研;快速看新闻用 get_news",
|
|
@@ -1114,7 +1960,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1114
1960
|
},
|
|
1115
1961
|
});
|
|
1116
1962
|
|
|
1117
|
-
|
|
1963
|
+
registerTool({
|
|
1118
1964
|
name: "get_social_sentiment",
|
|
1119
1965
|
description:
|
|
1120
1966
|
"获取股票社交媒体情绪数据。A股:东方财富股吧热度+雪球讨论热度(无需配置);美股/港股:Reddit/X/Polymarket情绪(需 SENTIMENT_API_KEY)。自动按市场选数据源。面向个股维度;全市场热门讨论用 get_trending_sentiment",
|
|
@@ -1134,7 +1980,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1134
1980
|
},
|
|
1135
1981
|
});
|
|
1136
1982
|
|
|
1137
|
-
|
|
1983
|
+
registerTool({
|
|
1138
1984
|
name: "get_trending_sentiment",
|
|
1139
1985
|
description:
|
|
1140
1986
|
"获取社交媒体热门趋势(Reddit/X/Polymarket热门股票讨论)。适用于发现市场热点;查个股情绪用 get_social_sentiment",
|
|
@@ -1148,7 +1994,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1148
1994
|
},
|
|
1149
1995
|
});
|
|
1150
1996
|
|
|
1151
|
-
|
|
1997
|
+
registerTool({
|
|
1152
1998
|
name: "extract_article",
|
|
1153
1999
|
description:
|
|
1154
2000
|
"网页文章全文提取 — 输入URL,提取文章标题、正文(最多3000字)、作者、发布日期等。配合 get_news/search_stock_news 的搜索结果做深度阅读",
|
|
@@ -1168,10 +2014,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1168
2014
|
},
|
|
1169
2015
|
});
|
|
1170
2016
|
|
|
1171
|
-
|
|
2017
|
+
registerTool({
|
|
1172
2018
|
name: "screen_risk",
|
|
1173
2019
|
description:
|
|
1174
|
-
"A股风险专项筛查 — 检查估值、技术预警、解禁、减持、业绩预警、监管和行业政策,返回风险评级和 veto_buy
|
|
2020
|
+
"A股风险专项筛查 — 检查估值、技术预警、解禁、减持、业绩预警、监管和行业政策,返回风险评级和 veto_buy。新闻搜索命中是待核实线索,不是已证实风险。data_complete和warnings标明覆盖;数据不足时risk_level=unknown,risk_score或veto_buy可为null,不能视为低风险",
|
|
1175
2021
|
parameters: {
|
|
1176
2022
|
type: "object",
|
|
1177
2023
|
properties: {
|
|
@@ -1196,7 +2042,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1196
2042
|
},
|
|
1197
2043
|
});
|
|
1198
2044
|
|
|
1199
|
-
|
|
2045
|
+
registerTool({
|
|
1200
2046
|
name: "detect_market_regime",
|
|
1201
2047
|
description:
|
|
1202
2048
|
"市场状态检测 — 分析大盘指数判断当前市场阶段(上涨趋势/下跌趋势/横盘震荡/高波动/板块热点),并推荐适合的分析策略",
|
|
@@ -1217,10 +2063,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1217
2063
|
},
|
|
1218
2064
|
});
|
|
1219
2065
|
|
|
1220
|
-
|
|
2066
|
+
registerTool({
|
|
1221
2067
|
name: "get_market_review",
|
|
1222
2068
|
description:
|
|
1223
|
-
"大盘复盘 —
|
|
2069
|
+
"大盘复盘 — 获取市场日度复盘数据,包含指数、涨跌统计、板块排名、新闻、市场温度与策略建议。复盘类需求的首选,无需再分别调指数/统计/板块工具。数据不足时温度score及strategy_stance为null,信号unknown;warnings/data_quality说明限制",
|
|
1224
2070
|
parameters: {
|
|
1225
2071
|
type: "object",
|
|
1226
2072
|
properties: {
|
|
@@ -1238,7 +2084,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1238
2084
|
},
|
|
1239
2085
|
});
|
|
1240
2086
|
|
|
1241
|
-
|
|
2087
|
+
registerTool({
|
|
1242
2088
|
name: "run_watchlist_analysis",
|
|
1243
2089
|
description:
|
|
1244
2090
|
"批量自选股分析 — 对多只股票并行采集行情/技术/资金/风险等数据,返回汇总结果。适用于每日定时分析自选股列表",
|
|
@@ -1267,7 +2113,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1267
2113
|
},
|
|
1268
2114
|
});
|
|
1269
2115
|
|
|
1270
|
-
|
|
2116
|
+
registerTool({
|
|
1271
2117
|
name: "detect_anomaly",
|
|
1272
2118
|
description:
|
|
1273
2119
|
"异常/事件检测 — 一键扫描股票当前所有异动信号(MACD金叉死叉、RSI超买超卖、20日突破、放量异动、涨跌停、布林突破、KDJ极值、资金异动等),返回结构化异常列表。当日异动归因的首选;综合技术面判断用 get_technical_analysis",
|
|
@@ -1289,7 +2135,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1289
2135
|
|
|
1290
2136
|
// --- Diagnostics & Capabilities ---
|
|
1291
2137
|
|
|
1292
|
-
|
|
2138
|
+
registerTool({
|
|
1293
2139
|
name: "diagnose_data_sources",
|
|
1294
2140
|
description:
|
|
1295
2141
|
"数据源诊断 — 检查当前环境各数据 provider 的包与凭据就绪情况(不探测网络可达性),输出每个市场的可用链路、缺失 env、warnings。工具拿不到数据或报错时调用排查",
|
|
@@ -1309,7 +2155,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1309
2155
|
},
|
|
1310
2156
|
});
|
|
1311
2157
|
|
|
1312
|
-
|
|
2158
|
+
registerTool({
|
|
1313
2159
|
name: "get_market_capabilities",
|
|
1314
2160
|
description:
|
|
1315
2161
|
"市场能力边界 — 返回指定市场支持/不支持的工具列表。不确定某市场能否用某工具(如港股的筹码分布、美股的资金流)时先调本工具,避免调用不支持的工具后编造数据",
|
|
@@ -1331,10 +2177,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1331
2177
|
|
|
1332
2178
|
// --- Report Rendering ---
|
|
1333
2179
|
|
|
1334
|
-
|
|
2180
|
+
registerTool({
|
|
1335
2181
|
name: "render_stock_report",
|
|
1336
2182
|
description:
|
|
1337
|
-
"股票分析报告渲染 — 将结构化报告 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均展示证据和限制。",
|
|
1338
2184
|
parameters: {
|
|
1339
2185
|
type: "object",
|
|
1340
2186
|
properties: {
|
|
@@ -1363,7 +2209,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1363
2209
|
},
|
|
1364
2210
|
});
|
|
1365
2211
|
|
|
1366
|
-
|
|
2212
|
+
registerTool({
|
|
1367
2213
|
name: "render_market_report",
|
|
1368
2214
|
description:
|
|
1369
2215
|
"大盘复盘报告渲染 — 将结构化报告 JSON 通过 j2 模板渲染为 Markdown。report 字段以 schemas/market_review_schema.json 为准。save=true 时把报告对象追加归档到本地 JSONL(默认不保存不推送),纵向对比用 get_review_history",
|
|
@@ -1387,7 +2233,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1387
2233
|
},
|
|
1388
2234
|
});
|
|
1389
2235
|
|
|
1390
|
-
|
|
2236
|
+
registerTool({
|
|
1391
2237
|
name: "get_review_history",
|
|
1392
2238
|
description:
|
|
1393
2239
|
"复盘归档历史 — 读取本地 JSONL 归档的最近 N 条市场复盘(最新在前),用于纵向对比(温度/姿态/主线变化)。归档由 render_market_report 的 save=true 写入,空存档返回空列表",
|
|
@@ -1405,10 +2251,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1405
2251
|
|
|
1406
2252
|
// --- Watchlist / Position / Alert Context ---
|
|
1407
2253
|
|
|
1408
|
-
|
|
2254
|
+
registerTool({
|
|
1409
2255
|
name: "build_watchlist_context",
|
|
1410
2256
|
description:
|
|
1411
|
-
"自选股上下文包 — 对多只股票输出评分/趋势/异常/风险/建议 next_tools 的 agent 友好摘要。宿主 agent
|
|
2257
|
+
"自选股上下文包 — 对多只股票输出评分/趋势/异常/风险/建议 next_tools 的 agent 友好摘要。宿主 agent 决定如何写日报或深入分析。异动检查失败时anomaly_status=unavailable、anomaly_count=null,保留anomaly_error/warnings;汇总计入partial",
|
|
1412
2258
|
parameters: {
|
|
1413
2259
|
type: "object",
|
|
1414
2260
|
properties: {
|
|
@@ -1433,7 +2279,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1433
2279
|
},
|
|
1434
2280
|
});
|
|
1435
2281
|
|
|
1436
|
-
|
|
2282
|
+
registerTool({
|
|
1437
2283
|
name: "analyze_position_context",
|
|
1438
2284
|
description:
|
|
1439
2285
|
"持仓上下文分析 — 输入成本/仓位/止损止盈,结合现价和技术位输出浮盈亏、离止损距离、风险级别、操作建议。无状态、不存账户",
|
|
@@ -1463,10 +2309,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1463
2309
|
},
|
|
1464
2310
|
});
|
|
1465
2311
|
|
|
1466
|
-
|
|
2312
|
+
registerTool({
|
|
1467
2313
|
name: "check_alert_rules",
|
|
1468
2314
|
description:
|
|
1469
|
-
"无状态告警规则检查 — 传入规则数组,返回当前是否触发。规则类型:price_below/price_above/change_pct_above/change_pct_below/volume_ratio_above/anomaly/risk_veto/risk_level_at_least
|
|
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不代表检查成功",
|
|
1470
2316
|
parameters: {
|
|
1471
2317
|
type: "object",
|
|
1472
2318
|
properties: {
|
|
@@ -1492,7 +2338,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1492
2338
|
},
|
|
1493
2339
|
});
|
|
1494
2340
|
|
|
1495
|
-
|
|
2341
|
+
registerTool({
|
|
1496
2342
|
name: "record_signal",
|
|
1497
2343
|
description:
|
|
1498
2344
|
"记录一条 AI 分析建议信号(方向/入场价/目标价/止损价/持有期限),供后续胜率评估。信号持久化在本地 JSONL($STOCK_SIGNAL_STORE 或 ~/.stock-analysis/signals.jsonl),宿主 Agent 自行决定何时 record/evaluate",
|
|
@@ -1532,10 +2378,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1532
2378
|
},
|
|
1533
2379
|
});
|
|
1534
2380
|
|
|
1535
|
-
|
|
2381
|
+
registerTool({
|
|
1536
2382
|
name: "evaluate_signals",
|
|
1537
2383
|
description:
|
|
1538
|
-
"评估到期信号:拉取记录日之后的日K,判定 target_hit/stop_hit/timeout 并计算收益,回写存储。记录建议用 record_signal,胜率复盘用 get_signal_summary",
|
|
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说明未处理记录,下次可重试",
|
|
1539
2385
|
parameters: {
|
|
1540
2386
|
type: "object",
|
|
1541
2387
|
properties: {
|
|
@@ -1551,10 +2397,10 @@ export default (pi: ExtensionAPI) => {
|
|
|
1551
2397
|
},
|
|
1552
2398
|
});
|
|
1553
2399
|
|
|
1554
|
-
|
|
2400
|
+
registerTool({
|
|
1555
2401
|
name: "get_signal_summary",
|
|
1556
2402
|
description:
|
|
1557
|
-
"信号胜率汇总(可按 source/symbol/status
|
|
2403
|
+
"信号胜率汇总(可按 source/symbol/status 过滤):胜率、平均收益、结果分布与明细。by_source附avg_return_pct、return_samples和sample_warning;仅观察性复盘,样本少不能认定策略有效。",
|
|
1558
2404
|
parameters: {
|
|
1559
2405
|
type: "object",
|
|
1560
2406
|
properties: {
|
|
@@ -1579,7 +2425,7 @@ export default (pi: ExtensionAPI) => {
|
|
|
1579
2425
|
},
|
|
1580
2426
|
});
|
|
1581
2427
|
|
|
1582
|
-
|
|
2428
|
+
registerTool({
|
|
1583
2429
|
name: "parse_stock_list",
|
|
1584
2430
|
description:
|
|
1585
2431
|
"自选股/文本导入解析 — 从自然语言、CSV、Markdown 表格提取股票,自动识别 A 股 6 位代码、港股 xxxxx.HK、美股 ticker、日股 xxxx.T、韩股 xxxxxx.KS/KQ、台股 xxxx.TW,并调用 name_resolver 处理中文股票名",
|