Install any skill in seconds. Free to start, no credit card required.
Get Started Free →调用Finance Engine MCP服务器执行量化策略。当用户需要运行因子表达式策略、回测交易策略或执行金融分析时调用此技能。基于MCP Server工具的实际默认值设置。
.claude/skills/finance-engine-mcp/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 446% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 558% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 486% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 402% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 470% | 0% |
场景1:如果你是在使用 非 openclaw Agent,在使用本技能之前,请确保满足以下配置要求:
json"mcpServers": { "engine_mcp_server": { "url": "https://mcp.hzyotoy.com/engine/mcp", "headers": { "Authorization": "Aksk Mu4OfFXJSPyWXGv3", "appid": "mcpclient001" } } }
场景2:如果你是在使用 openclaw Agent,在使用本技能之前,请确保满足以下配置要求:
>=2026.3.24在主配置文件中启用 MCP 功能:
yamlcommands: mcp: true
在主配置文件中添加 MCP Server 配置:
json"mcp": { "servers": { "engine_mcp_server": { "url": "https://mcp.hzyotoy.com/engine/mcp", "headers": { "Authorization": "Aksk Mu4OfFXJSPyWXGv3", "appid": "mcpclient001" } } } }
当用户提供策略条件时,基于MCP Server工具的实际默认值自动组合参数:
python# 自动组合参数示例(基于MCP Server工具实际默认值) mcp_engine_mcp_server_run_expression_selected( input={ "startDate": "2024-01-17", # 开始日期,DateTime类型 "endDate": "2024-04-17", # 结束日期,DateTime类型 "period": "5m", # 基础周期(默认:5m) "codes": "", # 合约代码列表(新增字段,默认:空) "poolId": 10, # 期货加权品种池(默认:10) "openCondition": "用户提供的开仓条件", "closeCondition": "用户提供的平仓条件", "stopCondition": "用户提供的止损条件", "initCash": 10000000, # 初始资金(默认:10000000) "direction": 1, # 多头方向(默认:1) "commssionFee": 0, # 手续费%(默认:0,不需要手续费) "slippage": 0, # 跳数或跳点值(默认:0,按最小变动价格计算) "runId": 123456789 # 运行ID(默认:随机生成一串长整型数字) } )
| 参数 | 类型 | 说明 | 实际默认值 | 示例 | |------|------|------|-----------|------| | input | ExpressionSelectedV2Input | 输入参数对象 | - | {...} |
| 属性 | 类型 | 说明 | 实际默认值 | 示例 | |------|------|------|-----------|------| | startDate | DateTime | 开始日期 | 当前日期-3个月 | "2024-01-17" | | endDate | DateTime | 结束日期 | 当前日期 | "2024-04-17" | | period | string | 基础周期 | "5m"(5分钟) | "1d", "60m" | | codes | string | 合约代码列表(新增) | 空字符串 | "IF2404,IC2404" | | poolId | int | 品种池ID | 10(期货加权) | 4(股票池) | | openCondition | string | 开仓条件 | 用户提供 | "_ma_5m_30_trend == 1" | | closeCondition | string | 平仓条件 | 用户提供 | "_ma_5m_30_trend == -1" | | stopCondition | string | 止损条件 | 用户提供 | "_palp > 10" | | initCash | float | 初始资金 | 10000000 | 500000 | | direction | int | 交易方向 | 1(多头) | 0(空头) | | commssionFee | float | 手续费% | 0(不需要手续费) | -1(按系统设置手续费参与计算) | | slippage | float | 跳数或跳点值 | 0(按最小变动价格计算) | 1(1个跳点) | | runId | long | 运行ID | 随机生成一串长整型数字 | 123456789 |
| 值 | 说明 | 适用场景 | |----|------|----------| | 0 | 不需要手续费 | 默认值,测试策略时使用 | | -1 | 按系统设置手续费参与计算 | 使用系统配置的手续费 | | >0 | 按设置的手续费计算 | 自定义手续费率 |
| 值 | 说明 | 适用场景 | |----|------|----------| | 0 | 无滑点 | 默认值,理想交易环境 | | >0 | 按设置的跳点值计算 | 模拟真实交易环境 |
| 值 | 说明 | 适用场景 | |----|------|----------| | 空字符串 | 使用品种池进行回测 | 默认值,使用poolId指定的品种池 | | 具体合约代码 | 指定具体合约进行回测 | 如"IF2404,IC2404",多个合约以逗号分隔 |
| 情况 | codes值 | poolId值 | 说明 | |------|---------|----------|------| | 使用品种池 | 空 | >0 | 默认情况,使用poolId指定的品种池 | | 使用具体合约 | 非空 | 0 | 系统自动将poolId置为0,使用指定合约 | | 无效配置 | 空 | 0 | 错误:必须提供合约代码或有效品种池 |
| 值 | 说明 | 适用场景 | |----|------|----------| | 随机长整型数字 | 每次运行可随机生成一串长整型数字 | 用于标识每次策略运行的唯一ID |
| 周期 | 说明 | 适用策略 | 默认值 | |------|------|----------|--------| | "1m" | 1分钟 | 高频交易 | - | | "5m" | 5分钟 | 短线交易 | ✅ | | "15m" | 15分钟 | 中短线策略 | - | | "30m" | 30分钟 | 中短线策略 | - | | "60m" | 1小时或60分钟 | 短期趋势 | - | | "1d" | 1日或日线或天 | 中长线策略 | - | | "1w" | 1周或周 | 长期投资 | - | | "1mon" | 1月或月 | 长期投资 | - |
| poolId | 说明 | 适用市场 | 默认值 | |--------|------|----------|--------| | 10 | 期货加权品种池 | 期货市场 | ✅ | | 4 | 股票品种池 | 股票市场 | - | | 6 | ETF品种池 | ETF市场 | - |
python# 重要概念区分: # 1. 基础周期(period):K线数据的周期(5m、30m、1d等) # 2. 均线周期:技术指标的计算周期(30、60、120等) # 规则1:用户明确指定基础周期时,使用用户指定的周期 if "基础周期" in user_input or "K线周期" in user_input or "数据周期" in user_input: if "30分钟" in user_input: period = "30m" elif "60分钟" in user_input or "1小时" in user_input: period = "60m" elif "5分钟" in user_input: period = "5m" elif "15分钟" in user_input: period = "15m" elif "日" in user_input or "天" in user_input: period = "1d" elif "周" in user_input: period = "1w" elif "月" in user_input: period = "1mon" else: # 规则2:用户未明确指定基础周期时,使用默认周期5m # 注意:用户提到"30分钟均线"指的是均线周期,不是基础周期! period = "5m" # 默认值
python# 识别用户提到的均线周期(用于构建FactorLang表达式) if "30分钟均线" in user_input: # 用户提到的是均线周期30,基础周期仍然是5m ma_period = "5m" # 基础周期 ma_length = "30" # 均线长度 elif "60分钟均线" in user_input: ma_period = "5m" # 基础周期 ma_length = "60" # 均线长度 elif "120分钟均线" in user_input: ma_period = "5m" # 基础周期 ma_length = "120" # 均线长度 elif "240分钟均线" in user_input: ma_period = "5m" # 基础周期 ma_length = "240" # 均线长度 else: # 默认均线周期 ma_period = "5m" ma_length = "30"
python# 重要:所有时间范围都基于当前日期动态计算 # 当前日期:2026年3月25日(根据环境信息) # 规则1:用户明确指定时间范围时,使用用户指定的范围 if "近5年" in user_input: startDate = "2021-03-25" # 当前日期-5年 endDate = "2026-03-25" # 当前日期 elif "近3年" in user_input: startDate = "2023-03-25" # 当前日期-3年 endDate = "2026-03-25" # 当前日期 elif "近1年" in user_input: startDate = "2025-03-25" # 当前日期-1年 endDate = "2026-03-25" # 当前日期 else: # 规则2:用户未指定时间范围时,使用默认近3个月 startDate = "2025-12-25" # 当前日期-3个月 endDate = "2026-03-25" # 当前日期
python# 规则1:用户使用中文描述时,自动转换为FactorLang变量 if "盈亏点" in stop_condition or "点数" in stop_condition: stop_condition = stop_condition.replace("盈亏点", "_palp") elif "盈亏%" in stop_condition or "百分比" in stop_condition: stop_condition = stop_condition.replace("盈亏%", "_palr") # 规则2:确保使用正确的变量 if "_profit_loss_percent" in stop_condition: stop_condition = stop_condition.replace("_profit_loss_percent", "_palr")
python# 用户输入:开仓条件,30分钟均线120朝上且日级别是金叉状态 # AI推断:用户提到的是均线周期30,不是基础周期,使用默认5m基础周期 mcp_engine_mcp_server_run_expression_selected( input={ "startDate": "2024-01-17", # 近3个月(默认) "endDate": "2024-04-17", # 当前日期(默认) "period": "5m", # 5分钟基础周期(默认) "poolId": 10, # 期货加权池(默认) "openCondition": "_ma_5m_120_trend == 1 && _dkx_1d_cross_status == 1", "closeCondition": "_ma_5m_120_trend == -1 && _dkx_1d_cross_status == -1", "stopCondition": "_palp > 10", # 盈亏点数大于10 "initCash": 10000000, # 1000万初始资金(默认) "direction": 1, # 多头方向(默认) "commssionFee": -1, # 手续费%(默认:按系统设置) "slippage": 0, # 滑点(默认:无滑点) "runId": 123456789 # 运行ID(默认:随机生成) } )
python# 用户输入:开仓条件,基础周期30分钟,均线120朝上 # AI推断:用户明确指定基础周期30m mcp_engine_mcp_server_run_expression_selected( input={ "startDate": "2024-01-17", "endDate": "2024-04-17", "period": "30m", # 用户指定基础周期30m "poolId": 10, "openCondition": "_ma_30m_120_trend == 1 && _dkx_1d_cross_status == 1", "closeCondition": "_ma_30m_120_trend == -1 && _dkx_1d_cross_status == -1", "stopCondition": "_palp > 10", "initCash": 10000000, "direction": 1, "commssionFee": -1, # 手续费%(默认:按系统设置) "slippage": 0, # 滑点(默认:无滑点) "runId": 123456789 # 运行ID(默认:随机生成) } )
python# 用户输入:开仓条件,均线朝上,手续费0.1%,滑点1个跳点 # AI推断:用户指定手续费和滑点参数 mcp_engine_mcp_server_run_expression_selected( input={ "startDate": "2024-01-17", "endDate": "2024-04-17", "period": "5m", # 5分钟基础周期(默认) "poolId": 10, "openCondition": "_ma_5m_30_trend == 1", "closeCondition": "_ma_5m_30_trend == -1", "stopCondition": "_palp > 10", "initCash": 10000000, "direction": 1, "commssionFee": 0.1, # 用户指定手续费0.1% "slippage": 1, # 用户指定滑点1个跳点 "runId": 123456789 # 运行ID(默认:随机生成) } )
python# 用户输入:开仓条件,均线朝上,指定IF2404和IC2404合约 # AI推断:用户指定具体合约代码,系统自动将poolId置为0 mcp_engine_mcp_server_run_expression_selected( input={ "startDate": "2024-01-17", "endDate": "2024-04-17", "period": "5m", # 5分钟基础周期(默认) "codes": "IF2404,IC2404", # 用户指定具体合约代码 "poolId": 10, # 系统会自动置为0,使用指定合约 "openCondition": "_ma_5m_30_trend == 1", "closeCondition": "_ma_5m_30_trend == -1", "stopCondition": "_palp > 10", "initCash": 10000000, "direction": 1, "commssionFee": 0, # 不需要手续费(默认) "slippage": 0, # 无滑点(默认) "runId": 123456789 # 运行ID(默认:随机生成) } )
"5m""5m""5m""近3个月"input对象包含所有参数DateTime类型codes、commssionFee、slippage和runId参数codes字段poolId字段poolId置为0"5m"input对象结构commssionFee和slippage参数runId用于标识每次运行当调用 MCP 工具时,必须使用以下标准的 JSON-RPC 格式:
json{ "method": "tools/call", "params": { "name": "run_expression_selected", "arguments": { "input": { "startDate": "2023-01-17T00:00", "endDate": "2026-04-17T00:00", "openCondition": "_close_5m > MAX(_box_15m_green_high, REF(_box_15m_green_high, 1)) && _dkx_30m_cross_status == 1", "closeCondition": "_close_5m < MIN(_box_15m_red_low, REF(_box_15m_red_low, 1)) && _dkx_30m_cross_status == -1", "period": "5m", "poolId": 10, "codes": "ag8888,au8888", "initCash": 10000000, "direction": 1, "commssionFee": 0, "slippage": 0, "runId": 1 } }, "_meta": { "progressToken": 82 } } }
| 字段 | 类型 | 说明 | 示例 | |------|------|------|------| | method | string | 调用的方法名 | "tools/call" | | params.name | string | MCP 工具名称 | "run_expression_selected" | | params.arguments | object | 工具参数对象 | { "input": {...} } | | params.arguments.input | object | 策略输入参数 | 见下方详细说明 | | params._meta | object | 元数据(可选) | { "progressToken": 82 } |
| 参数 | 类型 | 说明 | 示例 | |------|------|------|------| | startDate | DateTime | 开始日期 | "2023-01-17T00:00" | | endDate | DateTime | 结束日期 | "2026-04-17T00:00" | | openCondition | string | 开仓条件 | "_close_5m > MAX(_box_15m_green_high, REF(_box_15m_green_high, 1)) && _dkx_30m_cross_status == 1" | | closeCondition | string | 平仓条件 | "_close_5m < MIN(_box_15m_red_low, REF(_box_15m_red_low, 1)) && _dkx_30m_cross_status == -1" | | period | string | 基础周期 | "5m" | | poolId | int | 品种池ID | 10 | | codes | string | 合约代码列表 | "ag8888,au8888" | | initCash | float | 初始资金 | 10000000 | | direction | int | 交易方向 | 1(多头) | | commssionFee | float | 手续费% | 0 | | slippage | float | 跳数或跳点值 | 0 | | runId | long | 运行ID | 1 |
示例1:使用品种池回测
json{ "method": "tools/call", "params": { "name": "run_expression_selected", "arguments": { "input": { "startDate": "2025-12-25T00:00", "endDate": "2026-03-25T00:00", "openCondition": "_ma_5m_30_trend == 1 && _dkx_1d_cross_status == 1", "closeCondition": "_ma_5m_30_trend == -1 && _dkx_1d_cross_status == -1", "period": "5m", "poolId": 10, "codes": "", "initCash": 10000000, "direction": 1, "commssionFee": 0, "slippage": 0, "runId": 1774578250123 } } } }
示例2:使用具体合约代码回测
json{ "method": "tools/call", "params": { "name": "run_expression_selected", "arguments": { "input": { "startDate": "2023-01-17T00:00", "endDate": "2026-04-17T00:00", "openCondition": "_close_5m > MAX(_box_15m_green_high, REF(_box_15m_green_high, 1)) && _dkx_30m_cross_status == 1", "closeCondition": "_close_5m < MIN(_box_15m_red_low, REF(_box_15m_red_low, 1)) && _dkx_30m_cross_status == -1", "period": "5m", "poolId": 10, "codes": "ag8888,au8888", "initCash": 10000000, "direction": 1, "commssionFee": 0, "slippage": 0, "runId": 1 } } } }
"2023-01-17T00:00""ag8888,au8888"poolId 置为 0_meta 字段为可选,用于传递进度令牌等元信息数据来源:基于MCP Server工具类的实际默认值设置 调用时机:当用户需要运行因子表达式策略、回测交易策略或执行金融分析时自动调用此技能。
版本:v3.0(同步MCP工具最新参数结构,新增codes字段,支持具体合约代码回测)
"timeConsuming": 310 表示运行耗时310毫秒(0.31秒)| 耗时范围 | 说明 | 性能评估 | |----------|------|----------| | < 100ms | 极快 | 优秀 | | 100-500ms | 快速 | 良好 | | 500-1000ms | 正常 | 一般 | | > 1000ms | 较慢 | 需要优化 |
策略运行完成后,系统会生成一个唯一的查看链接:
markdownhttps://visual.hzyotoy.com/?data_dir=xzr&data_id=123456789&initCash=10000000
点击链接或复制URL到浏览器中查看完整策略分析报告
| 参数 | 说明 | 示例 | |------|------|------| | data_dir | 数据目录 | xzr | | data_id | 运行ID | 123456789 | | initCash | 初始资金 | 10000000 |
AI执行要求:必须严格遵守本SKILL中的参数结构匹配规则、类型要求和结果查看规范!
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-13 | fail→fail | 10,391 | 8,509 | -18% | 1 | 1 | 0% | 2,066 | 9,038 | +337% | 0 | 0 | — |
case-01 | fail→pass | 8,133 | 8,146 | +0% | 1 | 1 | 0% | 1,662 | 9,074 | +446% | 0 | 0 | — |
case-02 | fail→pass | 6,626 | 10,469 | +58% | 1 | 1 | 0% | 1,457 | 9,593 | +558% | 0 | 0 | — |
case-03 | fail→pass | 7,181 | 8,708 | +21% | 1 | 1 | 0% | 1,561 | 9,151 | +486% | 0 | 0 | — |
case-04 | fail→pass | 8,258 | 6,726 | -19% | 1 | 1 | 0% | 1,746 | 8,758 | +402% | 0 | 0 | — |
case-05 | fail→pass | 8,166 | 6,357 | -22% | 1 | 1 | 0% | 1,510 | 8,611 | +470% | 0 | 0 | — |
case-06 | fail→pass | 10,317 | 7,122 | -31% | 1 | 1 | 0% | 2,337 | 8,793 | +276% | 0 | 0 | — |
case-07 | pass→pass | 14,798 | 9,576 | -35% | 1 | 1 | 0% | 2,716 | 9,367 | +245% | 0 | 0 | — |
case-08 | pass→pass | 8,293 | 6,772 | -18% | 1 | 1 | 0% | 1,843 | 8,878 | +382% | 0 | 0 | — |
case-09 | fail→pass | 6,786 | 6,497 | -4% | 1 | 1 | 0% | 1,467 | 8,742 | +496% | 0 | 0 | — |
case-10 | fail→pass | 9,222 | 8,441 | -8% | 1 | 1 | 0% | 1,948 | 9,111 | +368% | 0 | 0 | — |
case-11 | fail→pass | 6,100 | 7,025 | +15% | 1 | 1 | 0% | 1,238 | 8,817 | +612% | 0 | 0 | — |
case-12 | fail→pass | 7,935 | 5,204 | -34% | 1 | 1 | 0% | 1,511 | 8,377 | +454% | 0 | 0 | — |
case-14 | pass→pass | 8,951 | 34,446 | +285% | 1 | 1 | 0% | 1,876 | 9,216 | +391% | 0 | 0 | — |
case-15 | pass→pass | 10,897 | 3,366 | -69% | 1 | 1 | 0% | 1,851 | 7,861 | +325% | 0 | 0 | — |
case-16 | fail→pass | 12,957 | 4,935 | -62% | 1 | 1 | 0% | 1,183 | 8,146 | +589% | 0 | 0 | — |
case-17 | fail→pass | 6,095 | 1,529 | -75% | 1 | 1 | 0% | 1,097 | 7,411 | +576% | 0 | 0 | — |
case-18 | fail→pass | 5,111 | 2,186 | -57% | 1 | 1 | 0% | 1,007 | 7,644 | +659% | 0 | 0 | — |
case-19 | fail→pass | 6,944 | 7,187 | +3% | 1 | 1 | 0% | 1,395 | 8,802 | +531% | 0 | 0 | — |
case-20 | fail→pass | 10,429 | 6,044 | -42% | 1 | 1 | 0% | 1,837 | 8,622 | +369% | 0 | 0 | — |
case-21 | pass→pass | 12,582 | 15,548 | +24% | 1 | 1 | 0% | 2,904 | 10,817 | +272% | 0 | 0 | — |
case-22 | pass→pass | 9,536 | 12,886 | +35% | 1 | 1 | 0% | 2,234 | 10,302 | +361% | 0 | 0 | — |
case-23 | pass→fail | 16,866 | 17,167 | +2% | 1 | 1 | 0% | 3,618 | 11,000 | +204% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +61 percentage points is the difference between those two pass rates over the 23 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 7/27/2026 | +64% |
Other measured skills in the registry, with their headline benchmark lift.