@weaxs/openclaw-stock-analysis 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 (63) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +178 -44
  3. package/index.ts +189 -42
  4. package/openclaw.plugin.json +7 -0
  5. package/package.json +1 -1
  6. package/skills/bottom-volume/SKILL.md +1 -4
  7. package/skills/bottom-volume/scripts/gather.py +1 -1
  8. package/skills/box-oscillation/SKILL.md +1 -4
  9. package/skills/box-oscillation/scripts/gather.py +1 -1
  10. package/skills/bull-trend/SKILL.md +1 -4
  11. package/skills/bull-trend/scripts/gather.py +1 -1
  12. package/skills/chan-theory/SKILL.md +1 -4
  13. package/skills/chan-theory/scripts/gather.py +1 -1
  14. package/skills/dragon-head/SKILL.md +24 -28
  15. package/skills/dragon-head/scripts/gather.py +1 -1
  16. package/skills/emotion-cycle/SKILL.md +19 -33
  17. package/skills/emotion-cycle/scripts/gather.py +4 -3
  18. package/skills/event-driven/SKILL.md +42 -26
  19. package/skills/event-driven/scripts/gather.py +1 -1
  20. package/skills/expectation-repricing/SKILL.md +11 -6
  21. package/skills/expectation-repricing/scripts/gather.py +1 -1
  22. package/skills/growth-quality/SKILL.md +11 -6
  23. package/skills/growth-quality/scripts/gather.py +1 -1
  24. package/skills/hot-theme/SKILL.md +27 -23
  25. package/skills/hot-theme/scripts/gather.py +1 -1
  26. package/skills/ma-crossover/SKILL.md +1 -4
  27. package/skills/ma-crossover/scripts/gather.py +1 -1
  28. package/skills/market-review/SKILL.md +11 -8
  29. package/skills/market-review/scripts/gather.py +1 -1
  30. package/skills/one-yang-three-yin/SKILL.md +1 -4
  31. package/skills/one-yang-three-yin/scripts/gather.py +1 -1
  32. package/skills/shrink-pullback/SKILL.md +1 -4
  33. package/skills/shrink-pullback/scripts/gather.py +1 -1
  34. package/skills/stock-analysis/SKILL.md +18 -77
  35. package/skills/stock-analysis/references/short-term-trading.md +78 -0
  36. package/skills/stock-analysis/scripts/gather.py +1 -1
  37. package/skills/stock-screener/SKILL.md +7 -6
  38. package/skills/stock-screener/scripts/gather.py +1 -1
  39. package/skills/strategy-backtest/SKILL.md +24 -20
  40. package/skills/strategy-backtest/scripts/gather.py +1 -1
  41. package/skills/volume-breakout/SKILL.md +21 -23
  42. package/skills/volume-breakout/scripts/gather.py +1 -1
  43. package/skills/wave-theory/SKILL.md +1 -4
  44. package/skills/wave-theory/scripts/gather.py +1 -1
  45. package/skills/wisburg-research/SKILL.md +2 -2
  46. package/tools/alert_rules.py +5 -18
  47. package/tools/backtest.py +4 -4
  48. package/tools/capabilities.py +11 -4
  49. package/tools/diagnostics.py +13 -2
  50. package/tools/gather.py +12 -31
  51. package/tools/market_regime.py +4 -1
  52. package/tools/market_review.py +1 -1
  53. package/tools/name_resolver.py +4 -10
  54. package/tools/pattern.py +3 -24
  55. package/tools/report_renderer.py +1 -2
  56. package/tools/screener.py +2 -16
  57. package/tools/search_intel.py +1 -24
  58. package/tools/signal_tracker.py +275 -0
  59. package/tools/stock_data.py +704 -167
  60. package/tools/trading_calendar.py +92 -7
  61. package/tools/volume_analysis.py +3 -23
  62. package/tools/watchlist_context.py +1 -10
  63. package/scripts/sync-version.sh +0 -56
package/index.ts CHANGED
@@ -90,7 +90,7 @@ export default definePluginEntry({
90
90
  name: "get_quote",
91
91
  description: "获取股票实时行情报价(现价、涨跌幅、量比等)。支持A股、港股、美股、日股、韩股、台股",
92
92
  parameters: Type.Object({
93
- symbol: Type.String({ description: "股票代码" }),
93
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
94
94
  }),
95
95
  async execute(_id, params) {
96
96
  const out = await runPy("stock_data.py", ["quote", params.symbol]);
@@ -130,7 +130,7 @@ export default definePluginEntry({
130
130
  name: "get_news",
131
131
  description: "获取个股最近N天财经新闻快讯(轻量、无需配置)。需要深度全网情报用 search_comprehensive_intel,按主题搜索用 search_stock_news,读文章全文用 extract_article",
132
132
  parameters: Type.Object({
133
- symbol: Type.String({ description: "股票代码" }),
133
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
134
134
  days: Type.Optional(
135
135
  Type.Number({ description: "获取最近几天的新闻,默认 3" })
136
136
  ),
@@ -148,9 +148,9 @@ export default definePluginEntry({
148
148
 
149
149
  api.registerTool({
150
150
  name: "get_financials",
151
- description: "获取股票关键财务指标(PE/PB/市值/营收/净利润/ROE等),适合快速估值快查。A股深度基本面(成长性/盈利能力/分红)用 get_fundamental_context",
151
+ description: "获取股票财务摘要。A股返回最新报告期 ROE/毛利率/净利率/负债率/流动比率;其他市场返回 PE/PB/市值/营收/净利润等。A股估值、成长和分红用 get_fundamental_context",
152
152
  parameters: Type.Object({
153
- symbol: Type.String({ description: "股票代码" }),
153
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
154
154
  }),
155
155
  async execute(_id, params) {
156
156
  const out = await runPy("stock_data.py", ["financials", params.symbol]);
@@ -165,7 +165,7 @@ export default definePluginEntry({
165
165
  description:
166
166
  "获取股票技术面分析(MA/MACD/RSI/BOLL/KDJ/成交量等指标 + 100分综合评分 + 6级买卖信号 + 趋势/偏离度/支撑压力位)。个股技术面综合判断与买卖时机分析的首选;只要均线数值或自定义周期用 calculate_ma,专问量价用 get_volume_analysis,扫当日异动用 detect_anomaly",
167
167
  parameters: Type.Object({
168
- symbol: Type.String({ description: "股票代码" }),
168
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
169
169
  period: Type.Optional(
170
170
  Type.Union(
171
171
  [Type.Literal("daily"), Type.Literal("weekly"), Type.Literal("monthly")],
@@ -194,7 +194,7 @@ export default definePluginEntry({
194
194
  description:
195
195
  "K线形态识别 — 检测十字星、锤子线、吞没、启明星、黄昏星、双底、20日突破等12+种经典形态。综合技术面判断用 get_technical_analysis",
196
196
  parameters: Type.Object({
197
- symbol: Type.String({ description: "股票代码" }),
197
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
198
198
  period: Type.Optional(
199
199
  Type.Union(
200
200
  [Type.Literal("daily"), Type.Literal("weekly"), Type.Literal("monthly")],
@@ -245,7 +245,7 @@ export default definePluginEntry({
245
245
  api.registerTool({
246
246
  name: "get_sector_rankings",
247
247
  description:
248
- "获取A股行业板块涨跌幅排行(含领涨股、涨跌家数等)。支持查看涨幅榜/跌幅榜/双向",
248
+ "获取A股板块涨跌幅排行(含领涨股、涨跌家数等)。board_type=industry(默认)为行业板块,board_type=concept 时为概念板块排行。支持查看涨幅榜/跌幅榜/双向",
249
249
  parameters: Type.Object({
250
250
  top: Type.Optional(
251
251
  Type.Number({ description: "返回排名前N的板块,默认 10" })
@@ -256,6 +256,12 @@ export default definePluginEntry({
256
256
  { description: "top=涨幅榜(默认),bottom=跌幅榜,both=双向" }
257
257
  )
258
258
  ),
259
+ board_type: Type.Optional(
260
+ Type.Union(
261
+ [Type.Literal("industry"), Type.Literal("concept")],
262
+ { description: "板块类型:industry=行业(默认),concept=概念" }
263
+ )
264
+ ),
259
265
  }),
260
266
  async execute(_id, params) {
261
267
  const out = await runPy("stock_data.py", [
@@ -264,6 +270,8 @@ export default definePluginEntry({
264
270
  String(params.top ?? 10),
265
271
  "--direction",
266
272
  params.direction ?? "top",
273
+ "--board-type",
274
+ params.board_type ?? "industry",
267
275
  ]);
268
276
  return asText(out);
269
277
  },
@@ -314,7 +322,7 @@ export default definePluginEntry({
314
322
  description:
315
323
  "获取股票基本信息(行业、板块、上市日期、总股本等)。A股返回板块/行业,其他市场返回行业/公司简介",
316
324
  parameters: Type.Object({
317
- symbol: Type.String({ description: "股票代码" }),
325
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
318
326
  }),
319
327
  async execute(_id, params) {
320
328
  const out = await runPy("stock_data.py", ["stock_info", params.symbol]);
@@ -342,16 +350,68 @@ export default definePluginEntry({
342
350
  name: "get_market_stats",
343
351
  description:
344
352
  "获取A股市场整体统计(涨跌家数、涨停跌停数、平均涨幅、涨跌Top5、总成交额)。用于衡量市场整体情绪与温度",
353
+ parameters: Type.Object({}),
354
+ async execute() {
355
+ const out = await runPy("stock_data.py", ["market_stats"]);
356
+ return asText(out);
357
+ },
358
+ });
359
+
360
+ api.registerTool({
361
+ name: "get_limit_up_pool",
362
+ description:
363
+ "获取A股涨停池/涨停板复盘——当日涨停个股,含连板数、封板资金、炸板次数、首末次封板时间、所属行业。短线情绪与龙头战法核心数据",
345
364
  parameters: Type.Object({
346
- market: Type.Optional(
347
- Type.Union([Type.Literal("A")], { description: "市场,目前仅支持 A" })
365
+ date: Type.Optional(
366
+ Type.String({ description: "日期(YYYYMMDD),默认当日" })
367
+ ),
368
+ }),
369
+ async execute(_id, params) {
370
+ const args = ["limit_up_pool"];
371
+ if (params.date) args.push("--date", params.date);
372
+ const out = await runPy("stock_data.py", args);
373
+ return asText(out);
374
+ },
375
+ });
376
+
377
+ api.registerTool({
378
+ name: "get_dragon_tiger",
379
+ description:
380
+ "获取A股龙虎榜——上榜个股净买额/买入额/卖出额/上榜原因/解读,可按个股过滤",
381
+ parameters: Type.Object({
382
+ date: Type.Optional(
383
+ Type.String({ description: "日期(YYYY-MM-DD),默认当日" })
384
+ ),
385
+ symbol: Type.Optional(
386
+ Type.String({ description: "A股股票代码(可选,按个股过滤),如 600519" })
387
+ ),
388
+ top: Type.Optional(
389
+ Type.Number({ description: "返回前N条,默认 20" })
390
+ ),
391
+ }),
392
+ async execute(_id, params) {
393
+ const args = ["dragon_tiger"];
394
+ if (params.date) args.push("--date", params.date);
395
+ if (params.symbol) args.push("--symbol", params.symbol);
396
+ args.push("--top", String(params.top ?? 20));
397
+ const out = await runPy("stock_data.py", args);
398
+ return asText(out);
399
+ },
400
+ });
401
+
402
+ api.registerTool({
403
+ name: "get_hot_stocks",
404
+ description: "获取A股全市场人气热搜榜(东方财富人气榜)",
405
+ parameters: Type.Object({
406
+ top: Type.Optional(
407
+ Type.Number({ description: "返回前N只,默认 20" })
348
408
  ),
349
409
  }),
350
410
  async execute(_id, params) {
351
411
  const out = await runPy("stock_data.py", [
352
- "market_stats",
353
- "--market",
354
- params.market ?? "A",
412
+ "hot_stocks",
413
+ "--top",
414
+ String(params.top ?? 20),
355
415
  ]);
356
416
  return asText(out);
357
417
  },
@@ -360,7 +420,7 @@ export default definePluginEntry({
360
420
  api.registerTool({
361
421
  name: "get_fundamental_context",
362
422
  description:
363
- "获取A股深度基本面(估值PE/PB/PS + 成长性营收/净利增速 + 盈利能力ROE/毛利率 + 分红历史)。用于评估公司质地与长期持有价值;快速查PE/PB用 get_financials",
423
+ "获取A股基本面上下文(估值 PE/PB/市值 + 营收/净利增速 + ROE/毛利率/净利率 + 分红历史)。用于评估公司质地与长期持有价值",
364
424
  parameters: Type.Object({
365
425
  symbol: Type.String({ description: "A股股票代码,如 600519" }),
366
426
  }),
@@ -390,7 +450,7 @@ export default definePluginEntry({
390
450
  Type.Number({ description: "返回排名前N的股票,默认 20" })
391
451
  ),
392
452
  config: Type.Optional(
393
- Type.String({ description: "自定义筛选配置YAML文件路径(可选)" })
453
+ Type.String({ description: "自定义筛选配置YAML文件路径,不填用默认配置" })
394
454
  ),
395
455
  l2: Type.Optional(
396
456
  Type.Boolean({ description: "开启L2量化增强(质量/成长/真实动量/波动率/资金流因子,逐股抓取数据较慢),默认关闭" })
@@ -417,7 +477,7 @@ export default definePluginEntry({
417
477
  "策略回测(AlphaEvo)。读取YAML策略定义,在历史数据上模拟交易,输出收益率/回撤/胜率等指标。只想知道单个技术信号的历史胜率用更轻量的 evaluate_signal",
418
478
  parameters: Type.Object({
419
479
  strategy: Type.String({ description: "策略YAML文件路径" }),
420
- symbol: Type.String({ description: "股票代码" }),
480
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
421
481
  start: Type.Optional(
422
482
  Type.String({ description: "回测起始日期,格式 YYYY-MM-DD" })
423
483
  ),
@@ -443,7 +503,7 @@ export default definePluginEntry({
443
503
  description:
444
504
  "技术信号历史准确率评估 — 回溯历史数据,统计某个技术信号触发后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",
445
505
  parameters: Type.Object({
446
- symbol: Type.String({ description: "股票代码" }),
506
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
447
507
  signal: Type.Union(
448
508
  [
449
509
  Type.Literal("macd_golden_cross"),
@@ -560,6 +620,22 @@ export default definePluginEntry({
560
620
  },
561
621
  });
562
622
 
623
+ api.registerTool({
624
+ name: "get_trading_phase",
625
+ description:
626
+ "查询某市场当前交易时段(盘前/早盘/午间休市/午盘/交易中/盘后/休市),用于正确解读实时行情的盘中语义。支持CN/HK/US/JP/KR/TW",
627
+ parameters: Type.Object({
628
+ market: Type.Union(
629
+ [Type.Literal("CN"), Type.Literal("HK"), Type.Literal("US"), Type.Literal("JP"), Type.Literal("KR"), Type.Literal("TW")],
630
+ { description: "市场" }
631
+ ),
632
+ }),
633
+ async execute(_id, params) {
634
+ const out = await runPy("trading_calendar.py", ["phase", params.market]);
635
+ return asText(out);
636
+ },
637
+ });
638
+
563
639
  // --- Standalone MA Calculator ---
564
640
 
565
641
  api.registerTool({
@@ -567,7 +643,7 @@ export default definePluginEntry({
567
643
  description:
568
644
  "独立均线计算器 — 支持任意周期MA(5/10/20/30/60/120/250或自定义)+ 偏离度 + 均线排列 + 金叉死叉检测。只要均线数值或需要30/120/250等非默认周期时用本工具;综合技术面分析用 get_technical_analysis",
569
645
  parameters: Type.Object({
570
- symbol: Type.String({ description: "股票代码" }),
646
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
571
647
  periods: Type.Optional(
572
648
  Type.String({
573
649
  description: "逗号分隔的MA周期列表,如 5,10,20,60,120,250",
@@ -602,7 +678,7 @@ export default definePluginEntry({
602
678
  description:
603
679
  "独立量价分析 — 量价相关性、上涨/下跌日成交量对比、量能趋势、量价模式解读(放量上涨/缩量回调等)。综合技术面判断用 get_technical_analysis,扫当日异动用 detect_anomaly",
604
680
  parameters: Type.Object({
605
- symbol: Type.String({ description: "股票代码" }),
681
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
606
682
  period: Type.Optional(
607
683
  Type.Union(
608
684
  [Type.Literal("daily"), Type.Literal("weekly"), Type.Literal("monthly")],
@@ -631,7 +707,7 @@ export default definePluginEntry({
631
707
  api.registerTool({
632
708
  name: "search_stock_news",
633
709
  description:
634
- "多引擎股票新闻搜索(支持 Tavily/Brave/SerpAPI)。需配置对应 API Key 环境变量。get_news 快讯不够或要按主题搜索时用本工具;深度6维情报用 search_comprehensive_intel",
710
+ "多引擎股票新闻搜索(Tavily/Brave/SerpAPI/Bocha/SearXNG)。需配置至少一个搜索源的 Key 或 SearXNG URL。get_news 快讯不够或要按主题搜索时用;深度6维情报用 search_comprehensive_intel",
635
711
  parameters: Type.Object({
636
712
  query: Type.String({ description: "搜索关键词" }),
637
713
  count: Type.Optional(
@@ -654,7 +730,7 @@ export default definePluginEntry({
654
730
  description:
655
731
  "股票综合情报搜索 — 从6个维度(新闻/公告/行情分析/风险/业绩/行业)搜索综合信息。用于个股的深入研究/全面调研;快速看新闻用 get_news",
656
732
  parameters: Type.Object({
657
- symbol: Type.String({ description: "股票代码" }),
733
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
658
734
  name: Type.Optional(
659
735
  Type.String({ description: "股票名称(可选,提升搜索准确度)" })
660
736
  ),
@@ -672,7 +748,7 @@ export default definePluginEntry({
672
748
  description:
673
749
  "获取股票社交媒体情绪数据。A股:东方财富股吧热度+雪球讨论热度(无需配置);美股/港股:Reddit/X/Polymarket情绪(需 SENTIMENT_API_KEY)。自动按市场选数据源。面向个股维度;全市场热门讨论用 get_trending_sentiment",
674
750
  parameters: Type.Object({
675
- symbol: Type.String({ description: "股票代码(如 AAPL)" }),
751
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
676
752
  }),
677
753
  async execute(_id, params) {
678
754
  const out = await runPy("search_intel.py", ["sentiment", params.symbol]);
@@ -683,7 +759,7 @@ export default definePluginEntry({
683
759
  api.registerTool({
684
760
  name: "get_trending_sentiment",
685
761
  description:
686
- "获取社交媒体热门趋势(Reddit/X/Polymarket热门股票讨论)。数据缓存10分钟。适用于发现市场热点;查个股情绪用 get_social_sentiment",
762
+ "获取社交媒体热门趋势(Reddit/X/Polymarket热门股票讨论)。适用于发现市场热点;查个股情绪用 get_social_sentiment",
687
763
  parameters: Type.Object({}),
688
764
  async execute() {
689
765
  const out = await runPy("search_intel.py", ["trending"]);
@@ -707,9 +783,9 @@ export default definePluginEntry({
707
783
  api.registerTool({
708
784
  name: "screen_risk",
709
785
  description:
710
- "风险专项筛查 — 7维度风险检测(估值极端/技术预警/解禁到期/内部人减持/业绩预警/监管处罚/行业政策),返回风险评级和一票否决标记。入场决策前的排雷必调本工具",
786
+ "A股风险专项筛查 — 检查估值、技术预警、解禁、减持、业绩预警、监管和行业政策,返回风险评级和 veto_buy。新闻搜索命中是待核实线索,不是已证实风险",
711
787
  parameters: Type.Object({
712
- symbol: Type.String({ description: "股票代码(如 600519)" }),
788
+ symbol: Type.String({ description: "A股股票代码,如 600519" }),
713
789
  name: Type.Optional(
714
790
  Type.String({ description: "股票名称(可选,提升新闻搜索准确度)" })
715
791
  ),
@@ -801,7 +877,7 @@ export default definePluginEntry({
801
877
  "异常/事件检测 — 一键扫描股票当前所有异动信号(MACD金叉死叉、RSI超买超卖、20日突破、放量异动、涨跌停、布林突破、KDJ极值、资金异动等),返回结构化异常列表。当日异动归因的首选;综合技术面判断用 get_technical_analysis",
802
878
  parameters: Type.Object({
803
879
  symbol: Type.String({
804
- description: "股票代码(如 600519、AAPL、00700.HK)",
880
+ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)",
805
881
  }),
806
882
  }),
807
883
  async execute(_id, params) {
@@ -815,7 +891,7 @@ export default definePluginEntry({
815
891
  api.registerTool({
816
892
  name: "diagnose_data_sources",
817
893
  description:
818
- "数据源诊断 — 检查当前环境可用的数据 provider(akshare/tushare/yfinance/finnhub/longbridge/alphavantage),输出每个市场的可用链路、缺失 env、warnings。工具拿不到数据或报错时调用排查",
894
+ "数据源诊断 — 检查当前环境各数据 provider 的包与凭据就绪情况(不探测网络可达性),输出每个市场的可用链路、缺失 env、warnings。工具拿不到数据或报错时调用排查",
819
895
  parameters: Type.Object({
820
896
  market: Type.Optional(
821
897
  Type.Union(
@@ -871,9 +947,9 @@ export default definePluginEntry({
871
947
  api.registerTool({
872
948
  name: "render_stock_report",
873
949
  description:
874
- "股票分析报告渲染 — 将结构化 JSON(符合 schemas/report_schema.json)通过 j2 模板渲染为 Markdown。template: brief|full。全部分析完成后的最后一步调用。仅渲染,不保存不推送",
950
+ "股票分析报告渲染 — 将结构化报告 JSON 通过 j2 模板渲染为 Markdown。report 字段以 skill 提供的 report_schema 为准,不要自造字段。template: brief|full。全部分析完成后的最后一步调用。仅渲染,不保存不推送",
875
951
  parameters: Type.Object({
876
- report: Type.Object({}, { additionalProperties: true, description: "结构化股票报告" }),
952
+ report: Type.Object({}, { additionalProperties: true, description: "结构化股票报告 JSON" }),
877
953
  template: Type.Optional(
878
954
  Type.Union([Type.Literal("brief"), Type.Literal("full")], {
879
955
  description: "模板类型,默认 full",
@@ -896,22 +972,13 @@ export default definePluginEntry({
896
972
  api.registerTool({
897
973
  name: "render_market_report",
898
974
  description:
899
- "大盘复盘报告渲染 — 将结构化 JSON(符合 schemas/market_review_schema.json)通过 j2 模板渲染为 Markdown",
975
+ "大盘复盘报告渲染 — 将结构化报告 JSON 通过 j2 模板渲染为 Markdown。report 字段以 schemas/market_review_schema.json 为准。仅渲染,不保存不推送",
900
976
  parameters: Type.Object({
901
977
  report: Type.Object({}, { additionalProperties: true, description: "结构化市场复盘" }),
902
- template: Type.Optional(
903
- Type.Union([Type.Literal("full")], { description: "模板类型,默认 full" })
904
- ),
905
978
  }),
906
979
  async execute(_id, params) {
907
980
  const b64 = Buffer.from(JSON.stringify(params.report), "utf-8").toString("base64");
908
- const out = await runPy("report_renderer.py", [
909
- "market",
910
- "--template",
911
- params.template ?? "full",
912
- "--input-b64",
913
- b64,
914
- ]);
981
+ const out = await runPy("report_renderer.py", ["market", "--input-b64", b64]);
915
982
  return asText(out);
916
983
  },
917
984
  });
@@ -947,7 +1014,7 @@ export default definePluginEntry({
947
1014
  description:
948
1015
  "持仓上下文分析 — 输入成本/仓位/止损止盈,结合现价和技术位输出浮盈亏、离止损距离、风险级别、操作建议。无状态、不存账户",
949
1016
  parameters: Type.Object({
950
- symbol: Type.String({ description: "股票代码" }),
1017
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
951
1018
  cost: Type.Number({ description: "成本价" }),
952
1019
  quantity: Type.Number({ description: "持仓数量" }),
953
1020
  stop_loss: Type.Optional(Type.Number({ description: "止损价" })),
@@ -978,7 +1045,7 @@ export default definePluginEntry({
978
1045
  description:
979
1046
  "无状态告警规则检查 — 传入规则数组,返回当前是否触发。规则类型:price_below/price_above/change_pct_above/change_pct_below/volume_ratio_above/anomaly/risk_veto/risk_level_at_least。不做调度不存历史",
980
1047
  parameters: Type.Object({
981
- symbol: Type.String({ description: "股票代码" }),
1048
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
982
1049
  rules: Type.Array(
983
1050
  Type.Object({}, { additionalProperties: true }),
984
1051
  { description: "规则列表,每项 { type, value }" }
@@ -996,6 +1063,86 @@ export default definePluginEntry({
996
1063
  },
997
1064
  });
998
1065
 
1066
+ api.registerTool({
1067
+ name: "record_signal",
1068
+ description:
1069
+ "记录一条 AI 分析建议信号(方向/入场价/目标价/止损价/持有期限),供后续胜率评估。信号持久化在本地 JSONL($STOCK_SIGNAL_STORE 或 ~/.stock-analysis/signals.jsonl),宿主 Agent 自行决定何时 record/evaluate",
1070
+ parameters: Type.Object({
1071
+ symbol: Type.String({ description: "股票代码(A股如600519,美股如AAPL,港股如00700.HK)" }),
1072
+ direction: Type.Union([Type.Literal("buy"), Type.Literal("sell")], {
1073
+ description: "建议方向",
1074
+ }),
1075
+ entry_price: Type.Optional(Type.Number({ description: "入场价(可选)" })),
1076
+ target_price: Type.Optional(Type.Number({ description: "目标价(可选)" })),
1077
+ stop_price: Type.Optional(Type.Number({ description: "止损价(可选)" })),
1078
+ horizon_days: Type.Optional(
1079
+ Type.Number({ description: "持有期限(交易日),默认 10" })
1080
+ ),
1081
+ source: Type.Optional(
1082
+ Type.String({ description: "信号来源(如触发该建议的 skill 名)" })
1083
+ ),
1084
+ note: Type.Optional(Type.String({ description: "备注(可选)" })),
1085
+ }),
1086
+ async execute(_id, params) {
1087
+ const args = [
1088
+ "record",
1089
+ params.symbol,
1090
+ "--direction",
1091
+ params.direction,
1092
+ "--horizon-days",
1093
+ String(params.horizon_days ?? 10),
1094
+ ];
1095
+ if (params.entry_price !== undefined) args.push("--entry-price", String(params.entry_price));
1096
+ if (params.target_price !== undefined) args.push("--target-price", String(params.target_price));
1097
+ if (params.stop_price !== undefined) args.push("--stop-price", String(params.stop_price));
1098
+ if (params.source) args.push("--source", params.source);
1099
+ if (params.note) args.push("--note", params.note);
1100
+ const out = await runPy("signal_tracker.py", args);
1101
+ return asText(out);
1102
+ },
1103
+ });
1104
+
1105
+ api.registerTool({
1106
+ name: "evaluate_signals",
1107
+ description:
1108
+ "评估到期信号:拉取记录日之后的日K,判定 target_hit/stop_hit/timeout 并计算收益,回写存储。记录建议用 record_signal,胜率复盘用 get_signal_summary",
1109
+ parameters: Type.Object({
1110
+ symbol: Type.Optional(
1111
+ Type.String({ description: "股票代码(可选,只评估该股的信号)" })
1112
+ ),
1113
+ }),
1114
+ async execute(_id, params) {
1115
+ const args = ["evaluate"];
1116
+ if (params.symbol) args.push("--symbol", params.symbol);
1117
+ const out = await runPy("signal_tracker.py", args);
1118
+ return asText(out);
1119
+ },
1120
+ });
1121
+
1122
+ api.registerTool({
1123
+ name: "get_signal_summary",
1124
+ description:
1125
+ "信号胜率汇总(可按 source/symbol/status 过滤):胜率、平均收益、结果分布与明细",
1126
+ parameters: Type.Object({
1127
+ source: Type.Optional(Type.String({ description: "按信号来源过滤(可选)" })),
1128
+ symbol: Type.Optional(Type.String({ description: "按股票代码过滤(可选)" })),
1129
+ status: Type.Optional(
1130
+ Type.Union(
1131
+ [Type.Literal("open"), Type.Literal("closed"), Type.Literal("all")],
1132
+ { description: "open=未结算,closed=已结算,all=全部(默认)" }
1133
+ )
1134
+ ),
1135
+ }),
1136
+ async execute(_id, params) {
1137
+ const args = ["summary"];
1138
+ if (params.source) args.push("--source", params.source);
1139
+ if (params.symbol) args.push("--symbol", params.symbol);
1140
+ args.push("--status", params.status ?? "all");
1141
+ const out = await runPy("signal_tracker.py", args);
1142
+ return asText(out);
1143
+ },
1144
+ });
1145
+
999
1146
  api.registerTool({
1000
1147
  name: "parse_stock_list",
1001
1148
  description:
@@ -18,6 +18,9 @@
18
18
  "get_stock_info",
19
19
  "get_chip_distribution",
20
20
  "get_market_stats",
21
+ "get_limit_up_pool",
22
+ "get_dragon_tiger",
23
+ "get_hot_stocks",
21
24
  "get_fundamental_context",
22
25
  "screen_stocks",
23
26
  "run_backtest",
@@ -25,6 +28,7 @@
25
28
  "resolve_stock_name",
26
29
  "check_trading_day",
27
30
  "get_trading_days",
31
+ "get_trading_phase",
28
32
  "calculate_ma",
29
33
  "get_volume_analysis",
30
34
  "search_stock_news",
@@ -44,6 +48,9 @@
44
48
  "build_watchlist_context",
45
49
  "analyze_position_context",
46
50
  "check_alert_rules",
51
+ "record_signal",
52
+ "evaluate_signals",
53
+ "get_signal_summary",
47
54
  "parse_stock_list"
48
55
  ]
49
56
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weaxs/openclaw-stock-analysis",
3
- "version": "0.1.14",
3
+ "version": "0.2.0",
4
4
  "description": "OpenClaw plugin for stock analysis, screening, and strategy backtesting across A/HK/US/JP/KR/TW markets",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -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,