@weaxs/dsh-stock-analysis 0.2.8 → 0.2.10

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 (47) hide show
  1. package/README.md +4 -2
  2. package/deepseek-search.patch.yml +8 -0
  3. package/dist/index.js +437 -27
  4. package/dist/research-role.js +54 -0
  5. package/package.json +10 -4
  6. package/research.patch.yml +90 -0
  7. package/scripts/profile-offline.py +127 -0
  8. package/scripts/profile-workflows.py +87 -0
  9. package/scripts/setup-python.mjs +11 -4
  10. package/scripts/venv-python.mjs +7 -0
  11. package/skills/event-driven/SKILL.md +2 -0
  12. package/skills/growth-quality/SKILL.md +2 -0
  13. package/skills/market-review/SKILL.md +1 -1
  14. package/skills/sector-rotation/SKILL.md +57 -0
  15. package/skills/sector-rotation/references/computation.md +83 -0
  16. package/skills/sector-rotation/references/strategy_rules.md +62 -0
  17. package/skills/sector-rotation/scripts/rotation_metrics.py +11 -0
  18. package/skills/stock-analysis/SKILL.md +15 -4
  19. package/skills/stock-analysis/references/host-workflows.md +45 -0
  20. package/skills/stock-analysis/references/stateless-analysis.md +16 -2
  21. package/skills/stock-screener/SKILL.md +6 -0
  22. package/skills/strategy-backtest/SKILL.md +10 -3
  23. package/tools/_cache.py +93 -21
  24. package/tools/_subproc.py +43 -8
  25. package/tools/anomaly_detect.py +11 -6
  26. package/tools/backtest.py +225 -70
  27. package/tools/capabilities.py +3 -0
  28. package/tools/cli_budgets.json +2 -1
  29. package/tools/gather.py +63 -8
  30. package/tools/market_regime.py +26 -15
  31. package/tools/market_review.py +2 -2
  32. package/tools/position_context.py +5 -2
  33. package/tools/report_renderer.py +4 -0
  34. package/tools/requirements.txt +2 -2
  35. package/tools/risk_screening.py +40 -15
  36. package/tools/screener.py +44 -18
  37. package/tools/search_intel.py +94 -32
  38. package/tools/sec_holders.py +27 -25
  39. package/tools/sector_rotation.py +466 -0
  40. package/tools/signal_tracker.py +100 -49
  41. package/tools/stateless_analysis.py +600 -33
  42. package/tools/stock_data.py +111 -26
  43. package/tools/technical.py +42 -40
  44. package/tools/trading_calendar.py +26 -21
  45. package/tools/value_data.py +6 -2
  46. package/tools/watchlist.py +24 -15
  47. package/tools/watchlist_context.py +63 -49
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Stock Analysis — DeepSeek Harness (dsh) Plugin
2
2
 
3
- A股 / 港股 / 美股 / 日股 / 韩股 / 台股 行情、技术分析、筛选与回测。作为 dsh bundle 安装到 profile 后,对话中可调用 68 个工具,并自动注册 20 个工作流/策略方法论 skill。
3
+ A股 / 港股 / 美股 / 日股 / 韩股 / 台股 行情、技术分析、筛选与回测。作为 dsh bundle 安装到 profile 后,对话中可调用 71 个工具,并自动注册 21 个工作流/策略方法论 skill。
4
4
 
5
5
  ## 按需工具发现
6
6
 
7
- 支持作用域工具接口和请求组装钩子的新版 dsh 默认增加一个宿主控制入口 `stock_tool_search`,原有 68 个分析工具的名称、参数和输出不变。原生函数调用模式下,首次请求只暴露这个发现入口;其他插件的工具照常保留。搜索支持中文描述、英文关键词或确切工具名,例如 `财务`、`get_quote`、`run_backtest`;命中工具在下一次模型请求提供完整 schema,再按原名调用。默认最多加载 5 项,`limit` 可设 1 到 20;无匹配返回空列表。
7
+ 支持作用域工具接口和请求组装钩子的新版 dsh 默认增加一个宿主控制入口 `stock_tool_search`;按需发现只控制工具加载,不改变 71 个分析工具的名称、参数和输出。原生函数调用模式下,首次请求只暴露这个发现入口;其他插件的工具照常保留。搜索支持中文描述、英文关键词或确切工具名,例如 `财务`、`get_quote`、`run_backtest`;命中工具在下一次模型请求提供完整 schema,再按原名调用。默认最多加载 5 项,`limit` 可设 1 到 20;无匹配返回空列表。
8
8
 
9
9
  加载集合按 Agent 隔离,搜索和回退均保留宿主已有的工具权限限制。搜索入口被禁止或移除时,下一次请求保留原先已授权的完整股票工具目录。旧版缺少相关接口时保持全量暴露;PTC / both 模式沿用宿主生成的 SDK,不做发现过滤。加载集合在本次运行中保留,恢复会话或重载插件后需重新搜索。
10
10
 
@@ -61,6 +61,8 @@ allowBuilds:
61
61
  - `analyze_pattern` — 12+ 种 K 线形态识别
62
62
  - `calculate_ma` — 独立均线计算
63
63
  - `get_volume_analysis` — 量价分析
64
+ - `analyze_portfolio_risk` — 组合敞口、相关性、止损与确定性压力测试
65
+ - `plan_portfolio_rebalance` — 目标权重、整手和现金约束下的调仓清单
64
66
 
65
67
  ### 市场全景
66
68
  - `get_market_indices` — 主要指数(CN/HK/US/JP/KR/TW)
@@ -0,0 +1,8 @@
1
+ # Separate opt-in: needs DeepSeek Web API credentials. No change to stock data providers.
2
+ - id: web
3
+ config:
4
+ searchProvider: deepseek-search-api
5
+ fetchProvider: deepseek-fetch-api
6
+ - id: web-deepseek-api
7
+ config:
8
+ apiKeyEnv: DEEPSEEK_API_KEY
package/dist/index.js CHANGED
@@ -50,7 +50,8 @@ var cli_budgets_default = {
50
50
  watchlist_item: 480,
51
51
  "stateless_analysis.py:event_study": 300,
52
52
  "stateless_analysis.py:robustness": 660,
53
- "trend_strategy.py:fetch": 660
53
+ "trend_strategy.py:fetch": 660,
54
+ "sector_rotation.py:backtest": 300
54
55
  };
55
56
 
56
57
  // scripts/cli-timeout.mjs
@@ -112,7 +113,9 @@ function registerToolDiscovery(ctx, names) {
112
113
  output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
113
114
  async execute({ query, limit = 5 }, exec) {
114
115
  const needle = query.trim().toLowerCase();
115
- const terms = [...new Set(needle.match(/[a-z0-9_]+|\p{Script=Han}/gu) ?? [])];
116
+ const tokens = needle.match(/[a-z0-9_]+|\p{Script=Han}/gu) ?? [];
117
+ const bigrams = (needle.match(/\p{Script=Han}+/gu) ?? []).flatMap((text) => [...text].slice(0, -1).map((_, index) => text.slice(index, index + 2)));
118
+ const terms = [.../* @__PURE__ */ new Set([...tokens, ...bigrams])];
116
119
  if (!terms.length || !Number.isInteger(limit) || limit < 1 || limit > 20) {
117
120
  return JSON.stringify({ error: "query must contain searchable text and limit must be an integer from 1 to 20" });
118
121
  }
@@ -123,7 +126,7 @@ function registerToolDiscovery(ctx, names) {
123
126
  const matches = candidates.map(({ tool, text }) => {
124
127
  const score = (tool.name === needle ? 1e3 : 0) + (text.includes(needle) ? 10 : 0) + terms.reduce((sum, term, index) => sum + weights[index] * (tool.name.includes(term) ? 3 : text.includes(term) ? 1 : 0), 0);
125
128
  return { tool, score };
126
- }).filter((match) => match.score > 0).sort((a, b) => b.score - a.score || a.tool.name.localeCompare(b.tool.name)).slice(0, limit);
129
+ }).filter((match) => match.score > 0).sort((a, b) => b.score - a.score || a.tool.name.length - b.tool.name.length || a.tool.name.localeCompare(b.tool.name)).slice(0, limit);
127
130
  for (const { tool } of matches) state.loaded.add(tool.name);
128
131
  return JSON.stringify({ loaded: matches.map(({ tool }) => ({ name: tool.name, description: tool.description })) });
129
132
  }
@@ -176,20 +179,29 @@ function pythonBin() {
176
179
  async function runPy(script, args) {
177
180
  return executor(pythonBin(), [join3(toolsDir, script), ...args]);
178
181
  }
182
+ var textOutput = {
183
+ schema: { type: "string" },
184
+ render: (_args, value) => [{ type: "text", text: value }]
185
+ };
179
186
  function pyTool(opts) {
180
187
  return defineTool2({
181
188
  name: opts.name,
182
189
  description: opts.description,
183
190
  parameters: opts.parameters,
184
- output: {
185
- schema: { type: "string" },
186
- render: (_args, value) => [{ type: "text", text: value }]
187
- },
191
+ output: textOutput,
188
192
  async execute(args) {
189
193
  return runPy(opts.script, opts.argv(args));
190
194
  }
191
195
  });
192
196
  }
197
+ function closedTool(opts) {
198
+ const tool = defineTool2({
199
+ ...opts,
200
+ output: textOutput
201
+ });
202
+ tool.parameters.additionalProperties = false;
203
+ return tool;
204
+ }
193
205
  var skillsDir = join3(here, "..", "skills");
194
206
  function frontmatterValue(raw, key) {
195
207
  const block = raw.match(/^---\r?\n([\s\S]*?)\r?\n---/);
@@ -818,7 +830,192 @@ function apply(ctx, config = {}) {
818
830
  }
819
831
  })
820
832
  );
821
- ctx.tools.register(defineTool2({
833
+ ctx.tools.register(closedTool({
834
+ name: "calculate_rotation_metrics",
835
+ description: "\u884C\u4E1A\u8F6E\u52A8\u6570\u503C\u590D\u6838\uFF1A\u8F93\u5165\u771F\u5B9EMC-dropout\u6837\u672C\u548C/\u6216\u5386\u53F2\u6210\u4EA4\u8BA1\u6570\uFF0C\u8BA1\u7B97\u96C6\u4E2D\u5EA6\u548C\u539F\u59CB\u914D\u6743\uFF1B\u4E0D\u8BAD\u7EC3\u6A21\u578B\u3001\u4E0D\u751F\u6210\u4E70\u5165\u4FE1\u53F7\uFF0C\u96F6\u5386\u53F2\u4E0D\u8865\u9ED8\u8BA4\u503C\u3002",
836
+ parameters: {
837
+ "prediction_samples": {
838
+ "type": "array",
839
+ "description": "1..100\u7EC4\uFF0C\u603B\u6837\u672C<=100000\uFF1B\u548Ctrade_counts\u81F3\u5C11\u63D0\u4F9B\u4E00\u9879",
840
+ "items": {
841
+ "type": "object",
842
+ "additionalProperties": false,
843
+ "properties": {
844
+ "symbol": {
845
+ "type": "string",
846
+ "description": "\u552F\u4E00\u6807\u7684\u6807\u8BC6",
847
+ "required": true
848
+ },
849
+ "samples": {
850
+ "type": "array",
851
+ "description": "2..100000\u4E2A\u771F\u5B9EMC-dropout\u9884\u6D4B\uFF1B\u4E0D\u5F97\u7528\u968F\u673A\u6570\u6216\u52A8\u91CF\u4EE3\u66FF",
852
+ "items": {
853
+ "type": "number",
854
+ "description": "\u540C\u4E00\u6A21\u578B/\u6807\u7684/\u65F6\u95F4\u7684\u6709\u9650\u7EBF\u6027\u8F93\u51FA\uFF0C\u4E0D\u662F\u4EF7\u683C\u6216\u6536\u76CA\u7387"
855
+ },
856
+ "required": true
857
+ }
858
+ }
859
+ }
860
+ },
861
+ "trade_counts": {
862
+ "type": "array",
863
+ "description": "1..100\u6761\u5DF2\u5B8C\u6210\u5386\u53F2\u6210\u4EA4\u8BA1\u6570\uFF1B\u4E0D\u5F97\u4F7F\u7528\u51B3\u7B56\u540E\u7684\u4EA4\u6613",
864
+ "items": {
865
+ "type": "object",
866
+ "additionalProperties": false,
867
+ "properties": {
868
+ "symbol": {
869
+ "type": "string",
870
+ "description": "\u552F\u4E00\u6807\u7684\u6807\u8BC6\uFF1B\u4EE3\u7801\u522B\u540D\u987B\u5148\u7EDF\u4E00",
871
+ "required": true
872
+ },
873
+ "buys": {
874
+ "type": "number",
875
+ "description": "\u6B64\u524D\u5DF2\u5E73\u4ED3\u4E70\u5165\u5468\u6570\uFF0C\u975E\u8D1F\u6574\u6570",
876
+ "required": true
877
+ },
878
+ "wins": {
879
+ "type": "number",
880
+ "description": "\u6B64\u524D\u76C8\u5229\u5E73\u4ED3\u6B21\u6570\uFF0C0..buys",
881
+ "required": true
882
+ },
883
+ "streak": {
884
+ "type": "number",
885
+ "description": "\u6B64\u524D\u8FDE\u7EED\u76C8\u5229\u4EA4\u6613\u6B21\u6570\uFF0C0..wins",
886
+ "required": true
887
+ }
888
+ }
889
+ }
890
+ }
891
+ },
892
+ async execute(params) {
893
+ return withJsonInput(params, (path) => runPy("sector_rotation.py", ["analyze", "--input", path]));
894
+ }
895
+ }));
896
+ ctx.tools.register(closedTool({
897
+ name: "backtest_rotation_allocation",
898
+ description: "\u884C\u4E1A\u8F6E\u52A8\u914D\u6743\u5206\u9879\u56DE\u6D4B\uFF1A\u4EE3\u7801\u81EA\u52A8\u53D6\u884C\u60C5\uFF0C\u6216\u4F20\u660E\u786E\u5E01\u79CD/\u590D\u6743OHLCV\uFF1B\u76F8\u540C\u6BCF\u5468\u5168\u6C60\u4E70\u5356\u4E0B\u6BD4\u8F83\u7B49\u6743\u4E0E\u5386\u53F2\u914D\u6743\u3002\u6309\u5E02\u573A\u548C\u62A5\u4EF7\u5E01\u79CD\u72EC\u7ACB\u8D44\u91D1\uFF0C\u652F\u6301A/HK/US/JP/KR/TW\uFF1B\u4E0D\u662F\u5B8C\u6574\u8BBA\u6587\u6DF1\u5EA6\u6A21\u578B\u6216\u8DE8\u5E01\u79CD\u5171\u4EAB\u8D44\u91D1\u56DE\u6D4B\u3002",
899
+ parameters: {
900
+ "symbols": {
901
+ "type": "array",
902
+ "description": "1..20\u53EA\u81EA\u52A8\u53D6\u6570\uFF0C\u4E0Edatasets\u4E92\u65A5\uFF1B\u4EFB\u4E00\u5931\u8D25\u6574\u6C60\u505C\u6B62",
903
+ "items": {
904
+ "type": "string",
905
+ "description": "\u552F\u4E00\u80A1\u7968/ETF\u4EE3\u7801\uFF0C\u6309\u63D2\u4EF6\u4EE3\u7801\u683C\u5F0F"
906
+ }
907
+ },
908
+ "datasets": {
909
+ "type": "array",
910
+ "description": "1..20\u4E2A\u79BB\u7EBF\u6570\u636E\u96C6\uFF0C\u4E0Esymbols\u4E92\u65A5\uFF1B8MiB JSON\u8F93\u5165\u4E0A\u9650",
911
+ "items": {
912
+ "type": "object",
913
+ "additionalProperties": false,
914
+ "properties": {
915
+ "symbol": {
916
+ "type": "string",
917
+ "description": "A\u516D\u4F4D\u4EE3\u7801/HK\u59822800.HK/US\u5982XLK/JP\u59821306.T/KR\u5982069500.KS/TW\u59820050.TW",
918
+ "required": true
919
+ },
920
+ "currency": {
921
+ "type": "string",
922
+ "description": "\u5DF2\u6838\u5B9E\u62A5\u4EF7\u5E01\u79CD\u4E09\u5B57\u6BCD\u4EE3\u7801\uFF0C\u4E0D\u6309\u4E0A\u5E02\u5730\u731C\u6D4B",
923
+ "required": true
924
+ },
925
+ "price_basis": {
926
+ "type": "string",
927
+ "enum": [
928
+ "qfq",
929
+ "total_return",
930
+ "split_adjusted"
931
+ ],
932
+ "description": "\u5DF2\u6838\u5B9E\u4E14\u4E00\u81F4\u7684\u590D\u6743\u53E3\u5F84",
933
+ "required": true
934
+ },
935
+ "bars": {
936
+ "type": "array",
937
+ "description": "\u9012\u589E\u552F\u4E00daily OHLCV\uFF0C2..20000\u884C\uFF0C\u5305\u542B\u8BC4\u4F30\u524D\u9884\u70ED\uFF1B\u603B\u91CF<=100000",
938
+ "items": {
939
+ "type": "object",
940
+ "additionalProperties": false,
941
+ "properties": {
942
+ "date": {
943
+ "type": "string",
944
+ "description": "YYYY-MM-DD",
945
+ "required": true
946
+ },
947
+ "open": {
948
+ "type": "number",
949
+ "description": "\u6709\u9650\u6B63OHLC\u4EF7\u683C\uFF1Bvolume\u975E\u8D1F",
950
+ "required": true
951
+ },
952
+ "high": {
953
+ "type": "number",
954
+ "description": "\u6709\u9650\u6B63OHLC\u4EF7\u683C\uFF1Bvolume\u975E\u8D1F",
955
+ "required": true
956
+ },
957
+ "low": {
958
+ "type": "number",
959
+ "description": "\u6709\u9650\u6B63OHLC\u4EF7\u683C\uFF1Bvolume\u975E\u8D1F",
960
+ "required": true
961
+ },
962
+ "close": {
963
+ "type": "number",
964
+ "description": "\u6709\u9650\u6B63OHLC\u4EF7\u683C\uFF1Bvolume\u975E\u8D1F",
965
+ "required": true
966
+ },
967
+ "volume": {
968
+ "type": "number",
969
+ "description": "\u6709\u9650\u6B63OHLC\u4EF7\u683C\uFF1Bvolume\u975E\u8D1F",
970
+ "required": true
971
+ },
972
+ "adjusted": {
973
+ "type": "string",
974
+ "description": "\u53EF\u9009\u9010bar\u590D\u6743\u6807\u8BB0\uFF0C\u5B58\u5728\u65F6\u5FC5\u987B\u4E0Eprice_basis\u4E00\u81F4"
975
+ },
976
+ "source": {
977
+ "type": "string",
978
+ "description": "\u53EF\u9009\u884C\u60C5\u6765\u6E90\u6807\u8BC6\uFF0C\u7528\u4E8E\u6570\u636E\u8986\u76D6\u62A5\u544A"
979
+ }
980
+ }
981
+ },
982
+ "required": true
983
+ }
984
+ }
985
+ }
986
+ },
987
+ "start_date": {
988
+ "type": "string",
989
+ "description": "\u8BC4\u4F30\u8D77\u59CBYYYY-MM-DD\uFF1B\u8DE8\u8FB9\u754C\u5468\u4E0D\u4EA4\u6613\uFF0C\u4E0D\u80FD\u7528\u8BC4\u4F30\u671F\u6536\u76CA\u521D\u59CB\u5316\u914D\u6743",
990
+ "required": true
991
+ },
992
+ "end_date": {
993
+ "type": "string",
994
+ "description": "\u5DF2\u6536\u76D8\u622A\u6B62YYYY-MM-DD\uFF1B\u4E0D\u5B8C\u6574\u672B\u5468\u4E0D\u6210\u4EA4",
995
+ "required": true
996
+ },
997
+ "history_start_date": {
998
+ "type": "string",
999
+ "description": "\u4EC5\u4EE3\u7801\u6A21\u5F0F\uFF1B\u9ED8\u8BA4\u8BC4\u4F30\u524D\u4E00\u5E74\uFF0C\u5FC5\u987B\u65E9\u4E8Estart_date"
1000
+ },
1001
+ "warmup_weeks": {
1002
+ "type": "number",
1003
+ "description": "\u8BC4\u4F30\u524D\u5B8C\u6574\u5386\u53F2\u4EA4\u6613\u54681..104\u6574\u6570\uFF0C\u9ED8\u8BA426\uFF1B\u4E0D\u8DB3\u505C\u6B62"
1004
+ },
1005
+ "capital": {
1006
+ "type": "number",
1007
+ "description": "\u6BCF\u5E02\u573A/\u62A5\u4EF7\u5E01\u79CD\u5206\u7EC4\u72EC\u7ACB\u521D\u59CB\u8D44\u91D1\uFF0C\u9ED8\u8BA41000000\uFF0C\u4E0D\u662F\u6DF7\u5408\u6C60\u603B\u989D"
1008
+ },
1009
+ "cost_per_side": {
1010
+ "type": "number",
1011
+ "description": "\u6BCF\u8FB9\u6BD4\u4F8B\u6210\u672C0..0.1\uFF0C\u9ED8\u8BA40.001\uFF1B\u4E70\u5165\u9884\u7B97\u542B\u8D39\u7528"
1012
+ }
1013
+ },
1014
+ async execute(params) {
1015
+ return withJsonInput(params, (path) => runPy("sector_rotation.py", ["backtest", "--input", path]));
1016
+ }
1017
+ }));
1018
+ ctx.tools.register(closedTool({
822
1019
  name: "analyze_trend_strategy",
823
1020
  description: "\u6708\u5EA6\u53F3\u4FA7\u8D8B\u52BF\u7B56\u7565\uFF1A\u76F4\u63A5\u4F20\u540C\u5E02\u573AA/HK/US\u80A1\u7968\u4EE3\u7801\uFF0C\u81EA\u52A8\u83B7\u53D6\u65E5K\uFF0C\u8F93\u51FA\u6708\u5EA6\u65B0\u5165/\u6301\u6709/\u9000\u51FA\u4E0E\u9006\u6CE2\u52A8\u9884\u7B97\u3002as_of\u9ED8\u8BA4\u6700\u8FD1\u5DF2\u6536\u76D8\u4EA4\u6613\u65E5\uFF0C\u6301\u4ED3\u53EF\u9009\u4E14\u4E0D\u4FDD\u5B58\uFF0C\u4E0D\u81EA\u52A8\u4E0B\u5355\uFF1B\u8DE8\u6837\u672C\u4ECDnot_validated\u3002",
824
1021
  parameters: {
@@ -853,7 +1050,6 @@ function apply(ctx, config = {}) {
853
1050
  "description": "\u53EF\u9009\u56FA\u5B9A\u5BB9\u91CFK\uFF0C\u9ED8\u8BA4ceil(N/3)\uFF0C\u4E0D\u5F97\u5C0F\u4E8E\u771F\u5B9E\u6301\u80A1\u6570\u91CF"
854
1051
  }
855
1052
  },
856
- output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
857
1053
  async execute(params) {
858
1054
  return withJsonInput(params, (path) => runPy("trend_strategy.py", ["fetch", "--input", path]));
859
1055
  }
@@ -1229,8 +1425,9 @@ function apply(ctx, config = {}) {
1229
1425
  ctx.tools.register(
1230
1426
  pyTool({
1231
1427
  name: "render_stock_report",
1232
- description: "\u80A1\u7968\u5206\u6790\u62A5\u544A\u6E32\u67D3 \u2014 \u5C06\u7ED3\u6784\u5316\u62A5\u544A JSON \u901A\u8FC7 j2 \u6A21\u677F\u6E32\u67D3\u4E3A Markdown\u3002report \u5B57\u6BB5\u4EE5 skill \u63D0\u4F9B\u7684 report_schema \u4E3A\u51C6\uFF0C\u4E0D\u8981\u81EA\u9020\u5B57\u6BB5\u3002template: brief|full\u3002\u5168\u90E8\u5206\u6790\u5B8C\u6210\u540E\u7684\u6700\u540E\u4E00\u6B65\u8C03\u7528\u3002\u4EC5\u6E32\u67D3\uFF0C\u4E0D\u4FDD\u5B58\u4E0D\u63A8\u9001\u3002report\u53EF\u5305\u542Bevidence\uFF08path/label/value/source/as_of\uFF09\u4E0Edata_quality\uFF08flags/limitations\uFF09\uFF0Cbrief/full\u5747\u5C55\u793A\u8BC1\u636E\u548C\u9650\u5236\u3002",
1428
+ description: "\u80A1\u7968\u5206\u6790\u62A5\u544A\u6E32\u67D3 \u2014 \u5C06\u7ED3\u6784\u5316\u62A5\u544A JSON \u901A\u8FC7 j2 \u6A21\u677F\u6E32\u67D3\u4E3A Markdown\u3002report \u5B57\u6BB5\u4EE5 skill \u63D0\u4F9B\u7684 report_schema \u4E3A\u51C6\uFF0C\u4E0D\u8981\u81EA\u9020\u5B57\u6BB5\u3002template: brief|full\u3002\u5168\u90E8\u5206\u6790\u5B8C\u6210\u540E\u7684\u6700\u540E\u4E00\u6B65\u8C03\u7528\u3002\u9ED8\u8BA4\u4EC5\u6E32\u67D3\uFF1Bfinal=true\u8868\u793A\u6700\u7EC8\u56DE\u590D\uFF0C\u652F\u6301\u76F4\u51FA\u7684\u5BBF\u4E3B\u53EF\u539F\u6837\u4EA4\u4ED8\u5E76\u7ED3\u675F\u672C\u8F6E\u3002report\u53EF\u5305\u542Bevidence\uFF08path/label/value/source/as_of\uFF09\u4E0Edata_quality\uFF08flags/limitations\uFF09\uFF0Cbrief/full\u5747\u5C55\u793A\u8BC1\u636E\u548C\u9650\u5236\u3002",
1233
1429
  parameters: {
1430
+ final: { type: "boolean", description: "\u6700\u7EC8\u56DE\u590D\u6807\u8BB0\uFF0C\u9ED8\u8BA4false\uFF1B\u4FDD\u5B58\u9644\u4EF6\u6216\u7EE7\u7EED\u5206\u6790\u65F6\u4FDD\u6301false" },
1234
1431
  report: {
1235
1432
  type: "object",
1236
1433
  additionalProperties: true,
@@ -1246,15 +1443,16 @@ function apply(ctx, config = {}) {
1246
1443
  script: "report_renderer.py",
1247
1444
  argv: (p) => {
1248
1445
  const b64 = Buffer.from(JSON.stringify(p.report), "utf-8").toString("base64");
1249
- return ["stock", "--template", p.template ?? "full", "--input-b64", b64];
1446
+ return ["stock", "--template", p.template ?? "full", "--input-b64", b64, ...p.final ? ["--final"] : []];
1250
1447
  }
1251
1448
  })
1252
1449
  );
1253
1450
  ctx.tools.register(
1254
1451
  pyTool({
1255
1452
  name: "render_market_report",
1256
- description: "\u5927\u76D8\u590D\u76D8\u62A5\u544A\u6E32\u67D3 \u2014 \u5C06\u7ED3\u6784\u5316\u62A5\u544A JSON \u901A\u8FC7 j2 \u6A21\u677F\u6E32\u67D3\u4E3A Markdown\u3002report \u5B57\u6BB5\u4EE5 schemas/market_review_schema.json \u4E3A\u51C6\u3002save=true \u65F6\u628A\u62A5\u544A\u5BF9\u8C61\u8FFD\u52A0\u5F52\u6863\u5230\u672C\u5730 JSONL\uFF08\u9ED8\u8BA4\u4E0D\u4FDD\u5B58\u4E0D\u63A8\u9001\uFF09\uFF0C\u7EB5\u5411\u5BF9\u6BD4\u7528 get_review_history",
1453
+ description: "\u5927\u76D8\u590D\u76D8\u62A5\u544A\u6E32\u67D3 \u2014 \u5C06\u7ED3\u6784\u5316\u62A5\u544A JSON \u901A\u8FC7 j2 \u6A21\u677F\u6E32\u67D3\u4E3A Markdown\u3002report \u5B57\u6BB5\u4EE5 schemas/market_review_schema.json \u4E3A\u51C6\u3002save=true \u65F6\u628A\u62A5\u544A\u5BF9\u8C61\u8FFD\u52A0\u5F52\u6863\u5230\u672C\u5730 JSONL\uFF08\u9ED8\u8BA4\u4E0D\u4FDD\u5B58\u4E0D\u63A8\u9001\uFF09\uFF0C\u7EB5\u5411\u5BF9\u6BD4\u7528 get_review_history\uFF1Bfinal=true\u4EC5\u7528\u4E8E\u6700\u7EC8\u56DE\u590D\uFF0C\u4FDD\u5B58\u9644\u4EF6\u6216\u7EE7\u7EED\u5206\u6790\u65F6\u4FDD\u6301false",
1257
1454
  parameters: {
1455
+ final: { type: "boolean", description: "\u6700\u7EC8\u56DE\u590D\u6807\u8BB0\uFF0C\u9ED8\u8BA4false\uFF1B\u4FDD\u5B58\u9644\u4EF6\u6216\u7EE7\u7EED\u5206\u6790\u65F6\u4FDD\u6301false" },
1258
1456
  report: {
1259
1457
  type: "object",
1260
1458
  additionalProperties: true,
@@ -1270,6 +1468,7 @@ function apply(ctx, config = {}) {
1270
1468
  argv: (p) => {
1271
1469
  const b64 = Buffer.from(JSON.stringify(p.report), "utf-8").toString("base64");
1272
1470
  const args = ["market", "--input-b64", b64];
1471
+ if (p.final) args.push("--final");
1273
1472
  if (p.save) args.push("--save");
1274
1473
  return args;
1275
1474
  }
@@ -1443,7 +1642,7 @@ function apply(ctx, config = {}) {
1443
1642
  }
1444
1643
  })
1445
1644
  );
1446
- ctx.tools.register(defineTool2({
1645
+ ctx.tools.register(closedTool({
1447
1646
  name: "compare_stocks",
1448
1647
  description: "\u65E0\u72B6\u6001\u540C\u884C\u6307\u6807\u6BD4\u8F83\uFF1A\u5148\u7528\u73B0\u6709\u8D22\u52A1/\u884C\u60C5\u5DE5\u5177\u53D6\u6570\uFF0C\u518D\u4F20companies\uFF1B\u4EC5\u76F8\u540Cunit/basis/period\u53EF\u6392\u5E8F\uFF0C\u7F3A\u5931\u4E0D\u586B\u96F6\uFF0C\u4E0D\u751F\u6210\u4E70\u5356\u7EFC\u5408\u5206\u3002",
1449
1648
  parameters: {
@@ -1511,12 +1710,11 @@ function apply(ctx, config = {}) {
1511
1710
  "required": true
1512
1711
  }
1513
1712
  },
1514
- output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1515
1713
  async execute(params) {
1516
1714
  return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["peers", "--input", path]));
1517
1715
  }
1518
1716
  }));
1519
- ctx.tools.register(defineTool2({
1717
+ ctx.tools.register(closedTool({
1520
1718
  name: "analyze_disclosure_changes",
1521
1719
  description: "\u65E0\u72B6\u6001\u516C\u544A\u8D22\u62A5\u6BD4\u8F83\uFF1A\u4F20\u65B0\u65E7\u6B63\u6587\u53CA\u6307\u6807\uFF0C\u8FD4\u56DE\u53D8\u66F4\u884C\u53F7\u3001\u6765\u6E90\u4E0E\u8D22\u52A1\u53D8\u5316\uFF1B\u8D1F/\u96F6\u57FA\u6570\u589E\u957F\u7387\u4E3Anull\u3002\u4E0D\u4E0B\u8F7DPDF\u3001\u4E0D\u4EE3\u66FF\u7ECF\u6D4E\u89E3\u8BFB\u3002",
1522
1720
  parameters: {
@@ -1653,14 +1851,13 @@ function apply(ctx, config = {}) {
1653
1851
  "description": "\u53D8\u5316\u4E0A\u96501..100\uFF0C\u9ED8\u8BA430"
1654
1852
  }
1655
1853
  },
1656
- output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1657
1854
  async execute(params) {
1658
1855
  return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["disclosure", "--input", path]));
1659
1856
  }
1660
1857
  }));
1661
- ctx.tools.register(defineTool2({
1858
+ ctx.tools.register(closedTool({
1662
1859
  name: "analyze_portfolio_risk",
1663
- description: "\u65E0\u72B6\u6001\u73B0\u8D27\u591A\u5934\u7EC4\u5408\u98CE\u9669\uFF1A\u8F93\u5165\u6301\u4ED3\u3001\u57FA\u51C6\u5E01\u79CD\u73B0\u91D1\u4E0E\u6C47\u7387\uFF0C\u8FD4\u56DE\u96C6\u4E2D\u5EA6\u3001\u5E01\u79CD/\u884C\u4E1A\u655E\u53E3\u3001\u4EF7\u683C\u76C8\u4E8F\u548C\u6B62\u635F\u60C5\u666F\u3002\u7F3A\u6C47\u7387\u62A5\u9519\uFF1B\u4E0D\u4FDD\u5B58\u8D26\u6237\u3002",
1860
+ description: "\u65E0\u72B6\u6001\u73B0\u8D27\u591A\u5934\u7EC4\u5408\u98CE\u9669\u4E0E\u538B\u529B\u6D4B\u8BD5\uFF1A\u8F93\u5165\u6301\u4ED3\u3001\u57FA\u51C6\u5E01\u79CD\u73B0\u91D1\u4E0E\u6C47\u7387\uFF0C\u8FD4\u56DE\u96C6\u4E2D\u5EA6\u3001\u5E01\u79CD/\u884C\u4E1A\u655E\u53E3\u3001\u4EF7\u683C\u76C8\u4E8F\u3001\u6B62\u635F\u60C5\u666F\u53CA\u53EF\u9009\u5E02\u573A/\u884C\u4E1A/\u4E2A\u80A1/\u6C47\u7387\u51B2\u51FB\u635F\u76CA\u3002\u7F3A\u6C47\u7387\u62A5\u9519\uFF1B\u4E0D\u4FDD\u5B58\u8D26\u6237\u3002",
1664
1861
  parameters: {
1665
1862
  "positions": {
1666
1863
  "type": "array",
@@ -1774,14 +1971,231 @@ function apply(ctx, config = {}) {
1774
1971
  "additionalProperties": false
1775
1972
  },
1776
1973
  "description": "\u53EF\u9009\u5386\u53F2\uFF0C\u5171\u540C\u65E5\u671F\u672C\u5E01\u4EF7\u683C\u6536\u76CA\u76F8\u5173\u6027\uFF0C\u4E0D\u8BA1\u6C47\u7387"
1974
+ },
1975
+ "stress_scenarios": {
1976
+ "type": "array",
1977
+ "items": {
1978
+ "type": "object",
1979
+ "properties": {
1980
+ "name": {
1981
+ "type": "string",
1982
+ "description": "\u60C5\u666F\u540D\u79F0",
1983
+ "required": true
1984
+ },
1985
+ "market_shock": {
1986
+ "type": "number",
1987
+ "description": "\u5168\u5E02\u573A\u8D44\u4EA7\u4EF7\u683C\u51B2\u51FB\u6BD4\u4F8B\uFF0C\u5982-0.1"
1988
+ },
1989
+ "sector_shocks": {
1990
+ "type": "array",
1991
+ "items": {
1992
+ "type": "object",
1993
+ "properties": {
1994
+ "sector": {
1995
+ "type": "string",
1996
+ "description": "\u4E0E\u6301\u4ED3\u4E00\u81F4\u7684\u884C\u4E1A\u540D\u79F0",
1997
+ "required": true
1998
+ },
1999
+ "shock": {
2000
+ "type": "number",
2001
+ "description": "\u884C\u4E1A\u4EF7\u683C\u51B2\u51FB\u6BD4\u4F8B",
2002
+ "required": true
2003
+ }
2004
+ },
2005
+ "additionalProperties": false
2006
+ },
2007
+ "description": "\u53EF\u9009\u884C\u4E1A\u51B2\u51FB"
2008
+ },
2009
+ "symbol_shocks": {
2010
+ "type": "array",
2011
+ "items": {
2012
+ "type": "object",
2013
+ "properties": {
2014
+ "symbol": {
2015
+ "type": "string",
2016
+ "description": "\u6301\u4ED3\u6807\u7684\u4EE3\u7801",
2017
+ "required": true
2018
+ },
2019
+ "shock": {
2020
+ "type": "number",
2021
+ "description": "\u6807\u7684\u4EF7\u683C\u51B2\u51FB\u6BD4\u4F8B",
2022
+ "required": true
2023
+ }
2024
+ },
2025
+ "additionalProperties": false
2026
+ },
2027
+ "description": "\u53EF\u9009\u4E2A\u80A1\u51B2\u51FB"
2028
+ },
2029
+ "currency_shocks": {
2030
+ "type": "array",
2031
+ "items": {
2032
+ "type": "object",
2033
+ "properties": {
2034
+ "currency": {
2035
+ "type": "string",
2036
+ "description": "\u6301\u4ED3\u4E2D\u7684\u975E\u57FA\u51C6\u5E01\u79CD\uFF1B\u57FA\u51C6\u5E01\u79CD\u4E0D\u53EF\u76F8\u5BF9\u81EA\u8EAB\u51B2\u51FB",
2037
+ "required": true
2038
+ },
2039
+ "shock": {
2040
+ "type": "number",
2041
+ "description": "\u76F8\u5BF9\u57FA\u51C6\u5E01\u79CD\u7684\u6C47\u7387\u51B2\u51FB\u6BD4\u4F8B",
2042
+ "required": true
2043
+ }
2044
+ },
2045
+ "additionalProperties": false
2046
+ },
2047
+ "description": "\u53EF\u9009\u6C47\u7387\u51B2\u51FB"
2048
+ }
2049
+ },
2050
+ "additionalProperties": false
2051
+ },
2052
+ "description": "\u53EF\u9009\u538B\u529B\u60C5\u666F\uFF1B\u6240\u6709\u51B2\u51FB\u5747\u4E3A\u6BD4\u4F8B\uFF0C\u7531\u5171\u4EAB\u6838\u5FC3\u8BA1\u7B97"
1777
2053
  }
1778
2054
  },
1779
- output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1780
2055
  async execute(params) {
1781
2056
  return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["portfolio", "--input", path]));
1782
2057
  }
1783
2058
  }));
1784
- ctx.tools.register(defineTool2({
2059
+ ctx.tools.register(closedTool({
2060
+ name: "plan_portfolio_rebalance",
2061
+ description: "\u65E0\u72B6\u6001\u7EC4\u5408\u8C03\u4ED3\u8BA1\u5212\uFF1A\u6309\u5F53\u524D\u6301\u4ED3\u3001\u76EE\u6807\u6743\u91CD\u3001\u73B0\u91D1\u3001\u6C47\u7387\u3001\u6574\u624B\u3001\u8D39\u7528\u548C\u6362\u624B\u7EA6\u675F\u751F\u6210\u5148\u5356\u540E\u4E70\u6E05\u5355\uFF1B\u4E0D\u4FDD\u5B58\u8D26\u6237\u6216\u63D0\u4EA4\u8BA2\u5355\u3002",
2062
+ parameters: {
2063
+ "base_currency": {
2064
+ "type": "string",
2065
+ "description": "\u57FA\u51C6\u5E01\u79CD",
2066
+ "required": true
2067
+ },
2068
+ "cash": {
2069
+ "type": "number",
2070
+ "description": "\u57FA\u51C6\u5E01\u79CD\u73B0\u91D1\uFF0C\u975E\u8D1F",
2071
+ "required": true
2072
+ },
2073
+ "positions": {
2074
+ "type": "array",
2075
+ "items": {
2076
+ "type": "object",
2077
+ "properties": {
2078
+ "symbol": {
2079
+ "type": "string",
2080
+ "description": "\u552F\u4E00\u4EE3\u7801\uFF0C\u91CD\u590D\u6301\u4ED3\u5148\u6C47\u603B",
2081
+ "required": true
2082
+ },
2083
+ "quantity": {
2084
+ "type": "number",
2085
+ "description": "\u6B63\u6301\u4ED3\u6570\u91CF",
2086
+ "required": true
2087
+ },
2088
+ "price": {
2089
+ "type": "number",
2090
+ "description": "\u6B63\u73B0\u4EF7",
2091
+ "required": true
2092
+ },
2093
+ "currency": {
2094
+ "type": "string",
2095
+ "description": "\u6301\u4ED3\u5E01\u79CD\uFF0C\u5982CNY/USD/HKD",
2096
+ "required": true
2097
+ },
2098
+ "cost": {
2099
+ "type": "number",
2100
+ "description": "\u540C\u5E01\u79CD\u6B63\u6210\u672C\u4EF7\uFF0C\u53EF\u9009\uFF1B\u8C03\u4ED3\u8BA1\u7B97\u4E0D\u4F7F\u7528"
2101
+ },
2102
+ "stop_price": {
2103
+ "type": "number",
2104
+ "description": "\u540C\u5E01\u79CD\u6B63\u6B62\u635F\u4EF7\uFF0C\u53EF\u9009\uFF1B\u8C03\u4ED3\u8BA1\u7B97\u4E0D\u4F7F\u7528"
2105
+ },
2106
+ "sector": {
2107
+ "type": "string",
2108
+ "description": "\u7EDF\u4E00\u884C\u4E1A\u5206\u7C7B\uFF0C\u53EF\u9009"
2109
+ },
2110
+ "as_of": {
2111
+ "type": "string",
2112
+ "description": "\u5B9E\u9645\u4F30\u503C\u65F6\u70B9\uFF0C\u5EFA\u8BAEISO8601"
2113
+ }
2114
+ },
2115
+ "additionalProperties": false
2116
+ },
2117
+ "description": "0..100\u4E2A\u73B0\u8D27\u591A\u5934\u6301\u4ED3\uFF0C\u7A7A\u6570\u7EC4\u8868\u793A\u7EAF\u73B0\u91D1\u5EFA\u4ED3",
2118
+ "required": true
2119
+ },
2120
+ "targets": {
2121
+ "type": "array",
2122
+ "items": {
2123
+ "type": "object",
2124
+ "properties": {
2125
+ "symbol": {
2126
+ "type": "string",
2127
+ "description": "\u76EE\u6807\u6807\u7684\u4EE3\u7801",
2128
+ "required": true
2129
+ },
2130
+ "weight": {
2131
+ "type": "number",
2132
+ "description": "\u76EE\u6807\u6743\u91CD\uFF1B\u5927\u4E8E0\u65F6lot_size\u5FC5\u586B",
2133
+ "required": true
2134
+ },
2135
+ "price": {
2136
+ "type": "number",
2137
+ "description": "\u6B63\u76EE\u6807\u4EF7\u683C\uFF1B\u5F53\u524D\u672A\u6301\u6709\u7684\u65B0\u6807\u7684\u5FC5\u586B"
2138
+ },
2139
+ "currency": {
2140
+ "type": "string",
2141
+ "description": "\u76EE\u6807\u5E01\u79CD\uFF1B\u5F53\u524D\u672A\u6301\u6709\u7684\u65B0\u6807\u7684\u5FC5\u586B"
2142
+ },
2143
+ "sector": {
2144
+ "type": "string",
2145
+ "description": "\u7EDF\u4E00\u884C\u4E1A\u5206\u7C7B\uFF0C\u53EF\u9009"
2146
+ },
2147
+ "as_of": {
2148
+ "type": "string",
2149
+ "description": "\u5B9E\u9645\u4F30\u503C\u65F6\u70B9\uFF0C\u5EFA\u8BAEISO8601"
2150
+ },
2151
+ "lot_size": {
2152
+ "type": "number",
2153
+ "description": "\u6B63\u6574\u6570\u4EA4\u6613\u5355\u4F4D\uFF1Bweight>0\u65F6\u5FC5\u586B"
2154
+ }
2155
+ },
2156
+ "additionalProperties": false
2157
+ },
2158
+ "description": "1..100\u4E2A\u76EE\u6807\uFF1B\u65B0\u6807\u7684price/currency\u5FC5\u586B",
2159
+ "required": true
2160
+ },
2161
+ "fx_rates": {
2162
+ "type": "array",
2163
+ "items": {
2164
+ "type": "object",
2165
+ "properties": {
2166
+ "currency": {
2167
+ "type": "string",
2168
+ "description": "\u552F\u4E00\u975E\u57FA\u51C6\u5E01\u79CD",
2169
+ "required": true
2170
+ },
2171
+ "rate": {
2172
+ "type": "number",
2173
+ "description": "\u4E00\u5355\u4F4D\u8BE5\u5E01\u79CD\u5BF9\u5E94\u591A\u5C11\u57FA\u51C6\u5E01\u79CD\uFF0C\u6B63\u6570",
2174
+ "required": true
2175
+ }
2176
+ },
2177
+ "additionalProperties": false
2178
+ },
2179
+ "description": "\u663E\u5F0F\u73B0\u4EF7\u6C47\u7387\uFF1B\u57FA\u51C6\u5E01\u79CD\u9690\u542B1\uFF0C\u4E0D\u5F97\u91CD\u590D"
2180
+ },
2181
+ "fee_rate": {
2182
+ "type": "number",
2183
+ "description": "\u6BCF\u8FB9\u6BD4\u4F8B\u8D39\u75280..0.1\uFF0C\u9ED8\u8BA40\uFF1B\u4E0D\u542B\u672A\u63D0\u4F9B\u7A0E\u8D39/\u6700\u4F4E\u6536\u8D39"
2184
+ },
2185
+ "slippage_rate": {
2186
+ "type": "number",
2187
+ "description": "\u6BCF\u8FB9\u6ED1\u70B90..0.1\uFF0C\u9ED8\u8BA40"
2188
+ },
2189
+ "max_turnover_fraction": {
2190
+ "type": "number",
2191
+ "description": "\u975E\u8D1F\u6700\u5927\u603B\u6362\u624B\uFF0C\u6309\u4E70\u5356\u53C2\u8003\u91D1\u989D\u5408\u8BA1/\u521D\u59CB\u6743\u76CA\uFF1B\u9ED8\u8BA4\u4E0D\u9650\u5236\uFF0C\u53EF\u5927\u4E8E1"
2192
+ }
2193
+ },
2194
+ async execute(params) {
2195
+ return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["rebalance", "--input", path]));
2196
+ }
2197
+ }));
2198
+ ctx.tools.register(closedTool({
1785
2199
  name: "calculate_position_size",
1786
2200
  description: "\u65E0\u72B6\u6001\u591A\u5934\u4ED3\u4F4D\u9884\u7B97\uFF1A\u540C\u5E01\u79CD\u91D1\u989D\uFF0C\u6309\u73B0\u91D1/\u98CE\u9669\u9884\u7B97/\u6700\u5927\u4ED3\u4F4D/\u4EA4\u6613\u5355\u4F4D\u53D6\u6700\u5C0F\u6570\u91CF\uFF0C\u53CC\u8FB9\u8D39\u7528\u548C\u6ED1\u70B9\u53C2\u4E0E\u6B62\u635F\u60C5\u666F\uFF1B\u4E0D\u6267\u884C\u4EA4\u6613\u3002",
1787
2201
  parameters: {
@@ -1828,12 +2242,11 @@ function apply(ctx, config = {}) {
1828
2242
  "description": "\u6BCF\u8FB9\u6ED1\u70B90..0.1\uFF0C\u9ED8\u8BA40"
1829
2243
  }
1830
2244
  },
1831
- output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1832
2245
  async execute(params) {
1833
2246
  return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["position_size", "--input", path]));
1834
2247
  }
1835
2248
  }));
1836
- ctx.tools.register(defineTool2({
2249
+ ctx.tools.register(closedTool({
1837
2250
  name: "analyze_event_study",
1838
2251
  description: "\u65E0\u72B6\u6001\u4E8B\u4EF6\u7814\u7A76\uFF1A\u63D0\u4F9B\u540C\u5E02\u573A\u80A1\u7968\u53CA\u57FA\u51C6\u5B8C\u6574\u4EF7\u683C\u3001\u4E8B\u4EF6\u65E5\u671F\uFF1B\u4E8B\u4EF6\u524D\u4E00\u4EA4\u6613\u65E5\u6536\u76D8\u4E3A\u57FA\u70B9\uFF0C\u8BA1\u7B97\u4EA4\u6613\u65E5\u7A97\u53E3\u6536\u76CA\u5DEE\u3002\u7F3A\u7A97\u53E3/\u57FA\u51C6\u4E3Anull\uFF0C\u6807\u6CE8\u91CD\u53E0\uFF0C\u4E0D\u63A8\u65AD\u56E0\u679C\u3002",
1839
2252
  parameters: {
@@ -1915,12 +2328,11 @@ function apply(ctx, config = {}) {
1915
2328
  "description": "\u540C\u5E02\u573A\u57FA\u51C6\u4EE3\u7801\uFF1B\u4E0Esymbol\u4E00\u8D77\u4F7F\u7528"
1916
2329
  }
1917
2330
  },
1918
- output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
1919
2331
  async execute(params) {
1920
2332
  return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["event_study", "--input", path]));
1921
2333
  }
1922
2334
  }));
1923
- ctx.tools.register(defineTool2({
2335
+ ctx.tools.register(closedTool({
1924
2336
  name: "validate_backtest",
1925
2337
  description: "\u65E0\u72B6\u6001\u56DE\u6D4B\u7A33\u5065\u6027\uFF1A\u8F93\u5165\u5386\u53F2OHLCV\u548C\u5B8C\u6574\u5019\u9009DSL\uFF1B\u6EDA\u52A8\u8BAD\u7EC3\u9009\u53C2\u6570\u3001\u540E\u7EED\u4E0D\u91CD\u53E0\u7A97\u53E3\u9A8C\u8BC1\uFF0C\u5217\u51FA\u5168\u90E8\u6837\u672C\u5185\u654F\u611F\u6027\u53CA\u8DE8\u6807\u7684\u7ED3\u679C\u3002\u4EC5next_open\uFF0C\u4E0D\u81EA\u52A8\u4F18\u5316\u6216\u4FDD\u5B58\u3002",
1926
2338
  parameters: {
@@ -2036,12 +2448,11 @@ function apply(ctx, config = {}) {
2036
2448
  "description": "1..5\u4E2A\u552F\u4E00\u80A1\u7968\u4EE3\u7801\uFF0C\u914D\u5408start_date/end_date\u76F4\u63A5\u53D6\u6570\uFF1B\u548Cdatasets\u4E92\u65A5"
2037
2449
  }
2038
2450
  },
2039
- output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
2040
2451
  async execute(params) {
2041
2452
  return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["robustness", "--input", path]));
2042
2453
  }
2043
2454
  }));
2044
- ctx.tools.register(defineTool2({
2455
+ ctx.tools.register(closedTool({
2045
2456
  name: "compare_analysis_snapshots",
2046
2457
  description: "\u65E0\u72B6\u6001\u5FEB\u7167\u6BD4\u8F83\uFF1A\u4F20\u65B0\u65E7JSON\uFF0C\u8FD4\u56DEJSON Pointer\u53CA\u65B0\u589E/\u5220\u9664/\u53D8\u5316/\u5931\u6548/\u6062\u590D\uFF1B\u4E0D\u4FDD\u5B58\u5FEB\u7167\u3002\u6570\u7EC4\u6574\u4F53\u6BD4\u8F83\uFF0C\u8C03\u7528\u524D\u6309symbol\u5BF9\u9F50\u3002",
2047
2458
  parameters: {
@@ -2060,7 +2471,6 @@ function apply(ctx, config = {}) {
2060
2471
  "required": true
2061
2472
  }
2062
2473
  },
2063
- output: { schema: { type: "string" }, render: (_args, value) => [{ type: "text", text: value }] },
2064
2474
  async execute(params) {
2065
2475
  return withJsonInput(params, (path) => runPy("stateless_analysis.py", ["snapshot", "--input", path]));
2066
2476
  }