Add matching and slippage execution options
This commit is contained in:
@@ -106,6 +106,10 @@ pub fn built_in_strategy_manual() -> StrategyAiManual {
|
||||
title: "filter.stock_expr / risk.stop_loss / risk.take_profit / allocation.buy_scale".to_string(),
|
||||
detail: "表达式型规则,支持多条组合。stop_loss/take_profit 多条按 OR 组合,filter.stock_expr 多条按 AND 组合。".to_string(),
|
||||
},
|
||||
ManualSection {
|
||||
title: "execution.matching_type / execution.slippage".to_string(),
|
||||
detail: "设置撮合模式和滑点。支持 execution.matching_type(\"next_tick_last\" | \"current_bar_close\" | \"next_bar_open\"),以及 execution.slippage(\"none\") / execution.slippage(\"price_ratio\", 0.001) / execution.slippage(\"tick_size\", 1)。".to_string(),
|
||||
},
|
||||
ManualSection {
|
||||
title: "when / unless / else".to_string(),
|
||||
detail: "条件块支持按日期、指数、仓位等动态切换规则。".to_string(),
|
||||
@@ -190,6 +194,10 @@ pub fn built_in_strategy_manual() -> StrategyAiManual {
|
||||
title: "涨停触达后满仓,否则半仓".to_string(),
|
||||
code: "allocation.buy_scale(touched_upper_limit ? 1.0 : 0.5)".to_string(),
|
||||
},
|
||||
ManualExample {
|
||||
title: "next tick 撮合 + tick 滑点".to_string(),
|
||||
code: "execution.matching_type(\"next_tick_last\")\nexecution.slippage(\"tick_size\", 1)".to_string(),
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -259,7 +267,10 @@ pub fn render_manual_markdown(manual: &StrategyAiManual) -> String {
|
||||
}
|
||||
out.push_str("## 示例\n");
|
||||
for example in &manual.examples {
|
||||
out.push_str(&format!("### {}\n```txt\n{}\n```\n\n", example.title, example.code));
|
||||
out.push_str(&format!(
|
||||
"### {}\n```txt\n{}\n```\n\n",
|
||||
example.title, example.code
|
||||
));
|
||||
}
|
||||
out
|
||||
}
|
||||
@@ -313,8 +324,7 @@ pub fn build_optimization_prompt(
|
||||
}
|
||||
prompt.push_str("结果摘要 JSON:\n```json\n");
|
||||
prompt.push_str(
|
||||
&serde_json::to_string_pretty(&request.result_summary)
|
||||
.unwrap_or_else(|_| "{}".to_string()),
|
||||
&serde_json::to_string_pretty(&request.result_summary).unwrap_or_else(|_| "{}".to_string()),
|
||||
);
|
||||
prompt.push_str("\n```\n\n");
|
||||
prompt.push_str("详细手册如下:\n\n");
|
||||
|
||||
Reference in New Issue
Block a user