stock-analysis-plugin 0.1.14 → 0.2.0

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.
Files changed (61) hide show
  1. package/README.md +53 -19
  2. package/package.json +3 -2
  3. package/pi/index.ts +219 -44
  4. package/skills/bottom-volume/SKILL.md +1 -4
  5. package/skills/bottom-volume/scripts/gather.py +1 -1
  6. package/skills/box-oscillation/SKILL.md +1 -4
  7. package/skills/box-oscillation/scripts/gather.py +1 -1
  8. package/skills/bull-trend/SKILL.md +1 -4
  9. package/skills/bull-trend/scripts/gather.py +1 -1
  10. package/skills/chan-theory/SKILL.md +1 -4
  11. package/skills/chan-theory/scripts/gather.py +1 -1
  12. package/skills/dragon-head/SKILL.md +24 -28
  13. package/skills/dragon-head/scripts/gather.py +1 -1
  14. package/skills/emotion-cycle/SKILL.md +19 -33
  15. package/skills/emotion-cycle/scripts/gather.py +4 -3
  16. package/skills/event-driven/SKILL.md +42 -26
  17. package/skills/event-driven/scripts/gather.py +1 -1
  18. package/skills/expectation-repricing/SKILL.md +11 -6
  19. package/skills/expectation-repricing/scripts/gather.py +1 -1
  20. package/skills/growth-quality/SKILL.md +11 -6
  21. package/skills/growth-quality/scripts/gather.py +1 -1
  22. package/skills/hot-theme/SKILL.md +27 -23
  23. package/skills/hot-theme/scripts/gather.py +1 -1
  24. package/skills/ma-crossover/SKILL.md +1 -4
  25. package/skills/ma-crossover/scripts/gather.py +1 -1
  26. package/skills/market-review/SKILL.md +11 -8
  27. package/skills/market-review/scripts/gather.py +1 -1
  28. package/skills/one-yang-three-yin/SKILL.md +1 -4
  29. package/skills/one-yang-three-yin/scripts/gather.py +1 -1
  30. package/skills/shrink-pullback/SKILL.md +1 -4
  31. package/skills/shrink-pullback/scripts/gather.py +1 -1
  32. package/skills/stock-analysis/SKILL.md +18 -77
  33. package/skills/stock-analysis/references/short-term-trading.md +78 -0
  34. package/skills/stock-analysis/scripts/gather.py +1 -1
  35. package/skills/stock-screener/SKILL.md +7 -6
  36. package/skills/stock-screener/scripts/gather.py +1 -1
  37. package/skills/strategy-backtest/SKILL.md +24 -20
  38. package/skills/strategy-backtest/scripts/gather.py +1 -1
  39. package/skills/volume-breakout/SKILL.md +21 -23
  40. package/skills/volume-breakout/scripts/gather.py +1 -1
  41. package/skills/wave-theory/SKILL.md +1 -4
  42. package/skills/wave-theory/scripts/gather.py +1 -1
  43. package/skills/wisburg-research/SKILL.md +2 -2
  44. package/tools/alert_rules.py +5 -18
  45. package/tools/backtest.py +4 -4
  46. package/tools/capabilities.py +11 -4
  47. package/tools/diagnostics.py +13 -2
  48. package/tools/gather.py +12 -31
  49. package/tools/market_regime.py +4 -1
  50. package/tools/market_review.py +1 -1
  51. package/tools/name_resolver.py +4 -10
  52. package/tools/pattern.py +3 -24
  53. package/tools/report_renderer.py +1 -2
  54. package/tools/screener.py +2 -16
  55. package/tools/search_intel.py +1 -24
  56. package/tools/signal_tracker.py +275 -0
  57. package/tools/stock_data.py +704 -167
  58. package/tools/trading_calendar.py +92 -7
  59. package/tools/volume_analysis.py +3 -23
  60. package/tools/watchlist_context.py +1 -10
  61. package/scripts/sync-version.sh +0 -56
package/pi/index.ts CHANGED
@@ -69,7 +69,7 @@ export default (pi: ExtensionAPI) => {
69
69
  properties: {
70
70
  symbol: {
71
71
  type: "string",
72
- description: "股票代码",
72
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
73
73
  },
74
74
  },
75
75
  required: ["symbol"],
@@ -117,7 +117,7 @@ export default (pi: ExtensionAPI) => {
117
117
  properties: {
118
118
  symbol: {
119
119
  type: "string",
120
- description: "股票代码",
120
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
121
121
  },
122
122
  days: {
123
123
  type: "number",
@@ -135,13 +135,13 @@ export default (pi: ExtensionAPI) => {
135
135
  pi.registerTool({
136
136
  name: "get_financials",
137
137
  description:
138
- "获取股票关键财务指标(PE/PB/市值/营收/净利润/ROE等),适合快速估值快查。A股深度基本面(成长性/盈利能力/分红)用 get_fundamental_context",
138
+ "获取股票财务摘要。A股返回最新报告期 ROE/毛利率/净利率/负债率/流动比率;其他市场返回 PE/PB/市值/营收/净利润等。A股估值、成长和分红用 get_fundamental_context",
139
139
  parameters: {
140
140
  type: "object",
141
141
  properties: {
142
142
  symbol: {
143
143
  type: "string",
144
- description: "股票代码",
144
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
145
145
  },
146
146
  },
147
147
  required: ["symbol"],
@@ -163,7 +163,7 @@ export default (pi: ExtensionAPI) => {
163
163
  properties: {
164
164
  symbol: {
165
165
  type: "string",
166
- description: "股票代码",
166
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
167
167
  },
168
168
  period: {
169
169
  type: "string",
@@ -199,7 +199,7 @@ export default (pi: ExtensionAPI) => {
199
199
  properties: {
200
200
  symbol: {
201
201
  type: "string",
202
- description: "股票代码",
202
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
203
203
  },
204
204
  period: {
205
205
  type: "string",
@@ -254,7 +254,7 @@ export default (pi: ExtensionAPI) => {
254
254
 
255
255
  pi.registerTool({
256
256
  name: "get_sector_rankings",
257
- description: "获取A股行业板块涨跌幅排行(含领涨股、涨跌家数等)。支持查看涨幅榜/跌幅榜/双向",
257
+ description: "获取A股板块涨跌幅排行(含领涨股、涨跌家数等)。board_type=industry(默认)为行业板块,board_type=concept 时为概念板块排行。支持查看涨幅榜/跌幅榜/双向",
258
258
  parameters: {
259
259
  type: "object",
260
260
  properties: {
@@ -267,15 +267,22 @@ export default (pi: ExtensionAPI) => {
267
267
  enum: ["top", "bottom", "both"],
268
268
  description: "top=涨幅榜(默认),bottom=跌幅榜,both=双向",
269
269
  },
270
+ board_type: {
271
+ type: "string",
272
+ enum: ["industry", "concept"],
273
+ description: "板块类型:industry=行业(默认),concept=概念",
274
+ },
270
275
  },
271
276
  },
272
- async execute(_id, { top = 10, direction = "top" }) {
277
+ async execute(_id, { top = 10, direction = "top", board_type = "industry" }) {
273
278
  const result = await py("stock_data.py", [
274
279
  "sector_rankings",
275
280
  "--top",
276
281
  String(top),
277
282
  "--direction",
278
283
  direction,
284
+ "--board-type",
285
+ board_type,
279
286
  ]);
280
287
  return asText(result.stdout);
281
288
  },
@@ -340,7 +347,7 @@ export default (pi: ExtensionAPI) => {
340
347
  properties: {
341
348
  symbol: {
342
349
  type: "string",
343
- description: "股票代码",
350
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
344
351
  },
345
352
  },
346
353
  required: ["symbol"],
@@ -375,18 +382,85 @@ export default (pi: ExtensionAPI) => {
375
382
  name: "get_market_stats",
376
383
  description:
377
384
  "获取A股市场整体统计(涨跌家数、涨停跌停数、平均涨幅、涨跌Top5、总成交额)。用于衡量市场整体情绪与温度",
385
+ parameters: {
386
+ type: "object",
387
+ properties: {},
388
+ },
389
+ async execute() {
390
+ const result = await py("stock_data.py", ["market_stats"]);
391
+ return asText(result.stdout);
392
+ },
393
+ });
394
+
395
+ pi.registerTool({
396
+ name: "get_limit_up_pool",
397
+ description:
398
+ "获取A股涨停池/涨停板复盘——当日涨停个股,含连板数、封板资金、炸板次数、首末次封板时间、所属行业。短线情绪与龙头战法核心数据",
378
399
  parameters: {
379
400
  type: "object",
380
401
  properties: {
381
- market: {
402
+ date: {
382
403
  type: "string",
383
- enum: ["A"],
384
- description: "市场,目前仅支持 A",
404
+ description: "日期(YYYYMMDD),默认当日",
385
405
  },
386
406
  },
387
407
  },
388
- async execute(_id, { market = "A" }) {
389
- const result = await py("stock_data.py", ["market_stats", "--market", market]);
408
+ async execute(_id, { date }) {
409
+ const result = await py("stock_data.py", [
410
+ "limit_up_pool",
411
+ ...(date ? ["--date", date] : []),
412
+ ]);
413
+ return asText(result.stdout);
414
+ },
415
+ });
416
+
417
+ pi.registerTool({
418
+ name: "get_dragon_tiger",
419
+ description:
420
+ "获取A股龙虎榜——上榜个股净买额/买入额/卖出额/上榜原因/解读,可按个股过滤",
421
+ parameters: {
422
+ type: "object",
423
+ properties: {
424
+ date: {
425
+ type: "string",
426
+ description: "日期(YYYY-MM-DD),默认当日",
427
+ },
428
+ symbol: {
429
+ type: "string",
430
+ description: "A股股票代码(可选,按个股过滤),如 600519",
431
+ },
432
+ top: {
433
+ type: "number",
434
+ description: "返回前N条,默认 20",
435
+ },
436
+ },
437
+ },
438
+ async execute(_id, { date, symbol, top = 20 }) {
439
+ const result = await py("stock_data.py", [
440
+ "dragon_tiger",
441
+ ...(date ? ["--date", date] : []),
442
+ ...(symbol ? ["--symbol", symbol] : []),
443
+ "--top",
444
+ String(top),
445
+ ]);
446
+ return asText(result.stdout);
447
+ },
448
+ });
449
+
450
+ pi.registerTool({
451
+ name: "get_hot_stocks",
452
+ description: "获取A股全市场人气热搜榜(东方财富人气榜)",
453
+ parameters: {
454
+ type: "object",
455
+ properties: {
456
+ top: {
457
+ type: "number",
458
+ description: "返回前N只,默认 20",
459
+ },
460
+ },
461
+ },
462
+ async execute(_id, { top = 20 }) {
463
+ const result = await py("stock_data.py", ["hot_stocks", "--top", String(top)]);
390
464
  return asText(result.stdout);
391
465
  },
392
466
  });
@@ -394,7 +468,7 @@ export default (pi: ExtensionAPI) => {
394
468
  pi.registerTool({
395
469
  name: "get_fundamental_context",
396
470
  description:
397
- "获取A股深度基本面(估值PE/PB/PS + 成长性营收/净利增速 + 盈利能力ROE/毛利率 + 分红历史)。用于评估公司质地与长期持有价值;快速查PE/PB用 get_financials",
471
+ "获取A股基本面上下文(估值 PE/PB/市值 + 营收/净利增速 + ROE/毛利率/净利率 + 分红历史)。用于评估公司质地与长期持有价值",
398
472
  parameters: {
399
473
  type: "object",
400
474
  properties: {
@@ -431,7 +505,7 @@ export default (pi: ExtensionAPI) => {
431
505
  },
432
506
  config: {
433
507
  type: "string",
434
- description: "自定义筛选配置YAML文件路径(可选)",
508
+ description: "自定义筛选配置YAML文件路径,不填用默认配置",
435
509
  },
436
510
  l2: {
437
511
  type: "boolean",
@@ -466,7 +540,7 @@ export default (pi: ExtensionAPI) => {
466
540
  },
467
541
  symbol: {
468
542
  type: "string",
469
- description: "股票代码",
543
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
470
544
  },
471
545
  start: {
472
546
  type: "string",
@@ -506,7 +580,7 @@ export default (pi: ExtensionAPI) => {
506
580
  properties: {
507
581
  symbol: {
508
582
  type: "string",
509
- description: "股票代码",
583
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
510
584
  },
511
585
  signal: {
512
586
  type: "string",
@@ -650,6 +724,27 @@ export default (pi: ExtensionAPI) => {
650
724
  },
651
725
  });
652
726
 
727
+ pi.registerTool({
728
+ name: "get_trading_phase",
729
+ description:
730
+ "查询某市场当前交易时段(盘前/早盘/午间休市/午盘/交易中/盘后/休市),用于正确解读实时行情的盘中语义。支持CN/HK/US/JP/KR/TW",
731
+ parameters: {
732
+ type: "object",
733
+ properties: {
734
+ market: {
735
+ type: "string",
736
+ enum: ["CN", "HK", "US", "JP", "KR", "TW"],
737
+ description: "市场",
738
+ },
739
+ },
740
+ required: ["market"],
741
+ },
742
+ async execute(_id, { market }) {
743
+ const result = await py("trading_calendar.py", ["phase", market]);
744
+ return asText(result.stdout);
745
+ },
746
+ });
747
+
653
748
  // --- Standalone MA Calculator ---
654
749
 
655
750
  pi.registerTool({
@@ -661,7 +756,7 @@ export default (pi: ExtensionAPI) => {
661
756
  properties: {
662
757
  symbol: {
663
758
  type: "string",
664
- description: "股票代码",
759
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
665
760
  },
666
761
  periods: {
667
762
  type: "string",
@@ -701,7 +796,7 @@ export default (pi: ExtensionAPI) => {
701
796
  properties: {
702
797
  symbol: {
703
798
  type: "string",
704
- description: "股票代码",
799
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
705
800
  },
706
801
  period: {
707
802
  type: "string",
@@ -733,7 +828,7 @@ export default (pi: ExtensionAPI) => {
733
828
  pi.registerTool({
734
829
  name: "search_stock_news",
735
830
  description:
736
- "多引擎股票新闻搜索(支持 Tavily/Brave/SerpAPI)。需配置对应 API Key 环境变量。get_news 快讯不够或要按主题搜索时用本工具;深度6维情报用 search_comprehensive_intel",
831
+ "多引擎股票新闻搜索(Tavily/Brave/SerpAPI/Bocha/SearXNG)。需配置至少一个搜索源的 Key 或 SearXNG URL。get_news 快讯不够或要按主题搜索时用;深度6维情报用 search_comprehensive_intel",
737
832
  parameters: {
738
833
  type: "object",
739
834
  properties: {
@@ -768,7 +863,7 @@ export default (pi: ExtensionAPI) => {
768
863
  properties: {
769
864
  symbol: {
770
865
  type: "string",
771
- description: "股票代码",
866
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
772
867
  },
773
868
  name: {
774
869
  type: "string",
@@ -796,7 +891,7 @@ export default (pi: ExtensionAPI) => {
796
891
  properties: {
797
892
  symbol: {
798
893
  type: "string",
799
- description: "股票代码(如 AAPL)",
894
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
800
895
  },
801
896
  },
802
897
  required: ["symbol"],
@@ -810,7 +905,7 @@ export default (pi: ExtensionAPI) => {
810
905
  pi.registerTool({
811
906
  name: "get_trending_sentiment",
812
907
  description:
813
- "获取社交媒体热门趋势(Reddit/X/Polymarket热门股票讨论)。数据缓存10分钟。适用于发现市场热点;查个股情绪用 get_social_sentiment",
908
+ "获取社交媒体热门趋势(Reddit/X/Polymarket热门股票讨论)。适用于发现市场热点;查个股情绪用 get_social_sentiment",
814
909
  parameters: {
815
910
  type: "object",
816
911
  properties: {},
@@ -844,13 +939,13 @@ export default (pi: ExtensionAPI) => {
844
939
  pi.registerTool({
845
940
  name: "screen_risk",
846
941
  description:
847
- "风险专项筛查 — 7维度风险检测(估值极端/技术预警/解禁到期/内部人减持/业绩预警/监管处罚/行业政策),返回风险评级和一票否决标记。入场决策前的排雷必调本工具",
942
+ "A股风险专项筛查 — 检查估值、技术预警、解禁、减持、业绩预警、监管和行业政策,返回风险评级和 veto_buy。新闻搜索命中是待核实线索,不是已证实风险",
848
943
  parameters: {
849
944
  type: "object",
850
945
  properties: {
851
946
  symbol: {
852
947
  type: "string",
853
- description: "股票代码(如 600519)",
948
+ description: "A股股票代码,如 600519",
854
949
  },
855
950
  name: {
856
951
  type: "string",
@@ -949,7 +1044,7 @@ export default (pi: ExtensionAPI) => {
949
1044
  properties: {
950
1045
  symbol: {
951
1046
  type: "string",
952
- description: "股票代码(如 600519、AAPL、00700.HK)",
1047
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
953
1048
  },
954
1049
  },
955
1050
  required: ["symbol"],
@@ -965,7 +1060,7 @@ export default (pi: ExtensionAPI) => {
965
1060
  pi.registerTool({
966
1061
  name: "diagnose_data_sources",
967
1062
  description:
968
- "数据源诊断 — 检查当前环境可用的数据 provider(akshare/tushare/yfinance/finnhub/longbridge/alphavantage),输出每个市场的可用链路、缺失 env、warnings。工具拿不到数据或报错时调用排查",
1063
+ "数据源诊断 — 检查当前环境各数据 provider 的包与凭据就绪情况(不探测网络可达性),输出每个市场的可用链路、缺失 env、warnings。工具拿不到数据或报错时调用排查",
969
1064
  parameters: {
970
1065
  type: "object",
971
1066
  properties: {
@@ -1007,13 +1102,13 @@ export default (pi: ExtensionAPI) => {
1007
1102
  pi.registerTool({
1008
1103
  name: "render_stock_report",
1009
1104
  description:
1010
- "股票分析报告渲染 — 将结构化 JSON(符合 schemas/report_schema.json)通过 j2 模板渲染为 Markdown。template: brief|full。全部分析完成后的最后一步调用。仅渲染,不保存不推送",
1105
+ "股票分析报告渲染 — 将结构化报告 JSON 通过 j2 模板渲染为 Markdown。report 字段以 skill 提供的 report_schema 为准,不要自造字段。template: brief|full。全部分析完成后的最后一步调用。仅渲染,不保存不推送",
1011
1106
  parameters: {
1012
1107
  type: "object",
1013
1108
  properties: {
1014
1109
  report: {
1015
1110
  type: "object",
1016
- description: "结构化股票报告,字段参考 schemas/report_schema.json",
1111
+ description: "结构化股票报告 JSON",
1017
1112
  },
1018
1113
  template: {
1019
1114
  type: "string",
@@ -1039,24 +1134,17 @@ export default (pi: ExtensionAPI) => {
1039
1134
  pi.registerTool({
1040
1135
  name: "render_market_report",
1041
1136
  description:
1042
- "大盘复盘报告渲染 — 将结构化 JSON(符合 schemas/market_review_schema.json)通过 j2 模板渲染为 Markdown",
1137
+ "大盘复盘报告渲染 — 将结构化报告 JSON 通过 j2 模板渲染为 Markdown。report 字段以 schemas/market_review_schema.json 为准。仅渲染,不保存不推送",
1043
1138
  parameters: {
1044
1139
  type: "object",
1045
1140
  properties: {
1046
1141
  report: { type: "object", description: "结构化市场复盘" },
1047
- template: { type: "string", enum: ["full"], description: "模板类型,默认 full" },
1048
1142
  },
1049
1143
  required: ["report"],
1050
1144
  },
1051
- async execute(_id, { report, template = "full" }) {
1145
+ async execute(_id, { report }) {
1052
1146
  const b64 = Buffer.from(JSON.stringify(report), "utf-8").toString("base64");
1053
- const result = await py("report_renderer.py", [
1054
- "market",
1055
- "--template",
1056
- template,
1057
- "--input-b64",
1058
- b64,
1059
- ]);
1147
+ const result = await py("report_renderer.py", ["market", "--input-b64", b64]);
1060
1148
  return asText(result.stdout);
1061
1149
  },
1062
1150
  });
@@ -1098,11 +1186,11 @@ export default (pi: ExtensionAPI) => {
1098
1186
  parameters: {
1099
1187
  type: "object",
1100
1188
  properties: {
1101
- symbol: { type: "string", description: "股票代码" },
1189
+ symbol: { type: "string", description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" },
1102
1190
  cost: { type: "number", description: "成本价" },
1103
1191
  quantity: { type: "number", description: "持仓数量" },
1104
- stop_loss: { type: "number", description: "止损价(可选)" },
1105
- take_profit: { type: "number", description: "止盈价(可选)" },
1192
+ stop_loss: { type: "number", description: "止损价" },
1193
+ take_profit: { type: "number", description: "止盈价" },
1106
1194
  },
1107
1195
  required: ["symbol", "cost", "quantity"],
1108
1196
  },
@@ -1128,7 +1216,7 @@ export default (pi: ExtensionAPI) => {
1128
1216
  parameters: {
1129
1217
  type: "object",
1130
1218
  properties: {
1131
- symbol: { type: "string", description: "股票代码" },
1219
+ symbol: { type: "string", description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" },
1132
1220
  rules: {
1133
1221
  type: "array",
1134
1222
  description: "规则列表,每项 { type, value }",
@@ -1150,6 +1238,93 @@ export default (pi: ExtensionAPI) => {
1150
1238
  },
1151
1239
  });
1152
1240
 
1241
+ pi.registerTool({
1242
+ name: "record_signal",
1243
+ description:
1244
+ "记录一条 AI 分析建议信号(方向/入场价/目标价/止损价/持有期限),供后续胜率评估。信号持久化在本地 JSONL($STOCK_SIGNAL_STORE 或 ~/.stock-analysis/signals.jsonl),宿主 Agent 自行决定何时 record/evaluate",
1245
+ parameters: {
1246
+ type: "object",
1247
+ properties: {
1248
+ symbol: { type: "string", description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" },
1249
+ direction: {
1250
+ type: "string",
1251
+ enum: ["buy", "sell"],
1252
+ description: "建议方向",
1253
+ },
1254
+ entry_price: { type: "number", description: "入场价(可选)" },
1255
+ target_price: { type: "number", description: "目标价(可选)" },
1256
+ stop_price: { type: "number", description: "止损价(可选)" },
1257
+ horizon_days: { type: "number", description: "持有期限(交易日),默认 10" },
1258
+ source: { type: "string", description: "信号来源(如触发该建议的 skill 名)" },
1259
+ note: { type: "string", description: "备注(可选)" },
1260
+ },
1261
+ required: ["symbol", "direction"],
1262
+ },
1263
+ async execute(_id, { symbol, direction, entry_price, target_price, stop_price, horizon_days = 10, source, note }) {
1264
+ const result = await py("signal_tracker.py", [
1265
+ "record",
1266
+ symbol,
1267
+ "--direction",
1268
+ direction,
1269
+ ...(entry_price !== undefined ? ["--entry-price", String(entry_price)] : []),
1270
+ ...(target_price !== undefined ? ["--target-price", String(target_price)] : []),
1271
+ ...(stop_price !== undefined ? ["--stop-price", String(stop_price)] : []),
1272
+ "--horizon-days",
1273
+ String(horizon_days),
1274
+ ...(source ? ["--source", source] : []),
1275
+ ...(note ? ["--note", note] : []),
1276
+ ]);
1277
+ return asText(result.stdout);
1278
+ },
1279
+ });
1280
+
1281
+ pi.registerTool({
1282
+ name: "evaluate_signals",
1283
+ description:
1284
+ "评估到期信号:拉取记录日之后的日K,判定 target_hit/stop_hit/timeout 并计算收益,回写存储。记录建议用 record_signal,胜率复盘用 get_signal_summary",
1285
+ parameters: {
1286
+ type: "object",
1287
+ properties: {
1288
+ symbol: { type: "string", description: "股票代码(可选,只评估该股的信号)" },
1289
+ },
1290
+ },
1291
+ async execute(_id, { symbol }) {
1292
+ const result = await py("signal_tracker.py", [
1293
+ "evaluate",
1294
+ ...(symbol ? ["--symbol", symbol] : []),
1295
+ ]);
1296
+ return asText(result.stdout);
1297
+ },
1298
+ });
1299
+
1300
+ pi.registerTool({
1301
+ name: "get_signal_summary",
1302
+ description:
1303
+ "信号胜率汇总(可按 source/symbol/status 过滤):胜率、平均收益、结果分布与明细",
1304
+ parameters: {
1305
+ type: "object",
1306
+ properties: {
1307
+ source: { type: "string", description: "按信号来源过滤(可选)" },
1308
+ symbol: { type: "string", description: "按股票代码过滤(可选)" },
1309
+ status: {
1310
+ type: "string",
1311
+ enum: ["open", "closed", "all"],
1312
+ description: "open=未结算,closed=已结算,all=全部(默认)",
1313
+ },
1314
+ },
1315
+ },
1316
+ async execute(_id, { source, symbol, status = "all" }) {
1317
+ const result = await py("signal_tracker.py", [
1318
+ "summary",
1319
+ ...(source ? ["--source", source] : []),
1320
+ ...(symbol ? ["--symbol", symbol] : []),
1321
+ "--status",
1322
+ status,
1323
+ ]);
1324
+ return asText(result.stdout);
1325
+ },
1326
+ });
1327
+
1153
1328
  pi.registerTool({
1154
1329
  name: "parse_stock_list",
1155
1330
  description:
@@ -1,13 +1,10 @@
1
1
  ---
2
2
  name: bottom-volume
3
- description: 底部放量策略 — 识别底部区域的异动放量信号。当用户要求分析底部放量时使用。
4
- allowed-tools: Bash(python3:*) Read
3
+ description: 底部放量分析:判断长期下跌后的异常放量是否构成反转信号。用于低位放量;普通阻力突破用 volume-breakout。
5
4
  ---
6
5
 
7
6
  # 底部放量分析
8
7
 
9
- 你是一位专注底部形态的交易专家。
10
-
11
8
  ## 核心理念
12
9
 
13
10
  长期下跌后的底部区域出现异常放量,可能意味着主力资金开始建仓。底部放量是趋势反转的先兆信号,但需要结合其他指标确认。
@@ -11,7 +11,7 @@ for _s in (sys.stdout, sys.stderr):
11
11
  if hasattr(_s, "reconfigure"):
12
12
  _s.reconfigure(encoding="utf-8")
13
13
 
14
- tools = Path(__file__).resolve().parents[2] / "tools"
14
+ tools = Path(__file__).resolve().parents[3] / "tools"
15
15
  result = subprocess.run(
16
16
  [sys.executable, str(tools / "gather.py"), "technical", sys.argv[1], "--kline-count", "120"],
17
17
  capture_output=True,
@@ -1,13 +1,10 @@
1
1
  ---
2
2
  name: box-oscillation
3
- description: 箱体震荡策略 — 识别箱体区间并在支撑压力间做波段。当用户要求箱体分析时使用。
4
- allowed-tools: Bash(python3:*) Read
3
+ description: 箱体震荡分析:识别横盘区间、支撑压力和突破失效条件。用于区间波段或高抛低吸问题。
5
4
  ---
6
5
 
7
6
  # 箱体震荡分析
8
7
 
9
- 你是一位专注箱体交易的专家。
10
-
11
8
  ## 核心理念
12
9
 
13
10
  当股价在一个相对固定的区间内反复震荡时,形成"箱体"。在箱体内低买高卖做波段,直到箱体被突破。
@@ -11,7 +11,7 @@ for _s in (sys.stdout, sys.stderr):
11
11
  if hasattr(_s, "reconfigure"):
12
12
  _s.reconfigure(encoding="utf-8")
13
13
 
14
- tools = Path(__file__).resolve().parents[2] / "tools"
14
+ tools = Path(__file__).resolve().parents[3] / "tools"
15
15
  result = subprocess.run(
16
16
  [sys.executable, str(tools / "gather.py"), "technical", sys.argv[1], "--kline-count", "90"],
17
17
  capture_output=True,
@@ -1,13 +1,10 @@
1
1
  ---
2
2
  name: bull-trend
3
- description: 趋势追踪策略 — 识别并跟随中长期上升趋势。当用户要求趋势分析时使用。
4
- allowed-tools: Bash(python3:*) Read
3
+ description: 趋势追踪分析:识别中长期趋势、所处阶段和离场条件。用于多头排列、上升通道或持有趋势股。
5
4
  ---
6
5
 
7
6
  # 趋势追踪分析
8
7
 
9
- 你是一位趋势交易专家。运用趋势追踪方法论分析股票。
10
-
11
8
  ## 核心理念
12
9
 
13
10
  趋势追踪的核心是"顺势而为"——在确认趋势形成后入场,在趋势转弱时离场。不预测顶底,只跟随趋势。
@@ -11,7 +11,7 @@ for _s in (sys.stdout, sys.stderr):
11
11
  if hasattr(_s, "reconfigure"):
12
12
  _s.reconfigure(encoding="utf-8")
13
13
 
14
- tools = Path(__file__).resolve().parents[2] / "tools"
14
+ tools = Path(__file__).resolve().parents[3] / "tools"
15
15
  result = subprocess.run(
16
16
  [sys.executable, str(tools / "gather.py"), "technical", sys.argv[1], "--kline-count", "120"],
17
17
  capture_output=True,
@@ -1,13 +1,10 @@
1
1
  ---
2
2
  name: chan-theory
3
- description: 缠论分析 — 基于缠中说禅理论的笔、段、中枢分析。当用户要求缠论分析时使用。
4
- allowed-tools: Bash(python3:*) Read
3
+ description: 缠论分析:按笔、段、中枢和背驰识别缠论买卖点。仅在用户明确要求缠论口径时使用。
5
4
  ---
6
5
 
7
6
  # 缠论分析
8
7
 
9
- 你是一位精通缠论的交易专家。运用缠中说禅理论体系分析股票走势。
10
-
11
8
  ## 核心理念
12
9
 
13
10
  缠论是一套完备的技术分析理论,通过对走势的几何结构分析(笔→段→中枢→趋势),实现精确的买卖点定位。
@@ -11,7 +11,7 @@ for _s in (sys.stdout, sys.stderr):
11
11
  if hasattr(_s, "reconfigure"):
12
12
  _s.reconfigure(encoding="utf-8")
13
13
 
14
- tools = Path(__file__).resolve().parents[2] / "tools"
14
+ tools = Path(__file__).resolve().parents[3] / "tools"
15
15
  result = subprocess.run(
16
16
  [sys.executable, str(tools / "gather.py"), "technical", sys.argv[1], "--kline-count", "120"],
17
17
  capture_output=True,