mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 16:54:20 +08:00
feat(backtest): 成交价精简 + 一键寻优全策略 + 预设网格
- 成交价精简为 next_open/next_close,删除 this_close/worst/best 三种 非真实模式(this_close 有未来函数偏差,worst/best 为压力测试边界) - 初始资金默认统一为 1,000,000(原 10万/20万) - 新增 presets.py:18 策略各配 1-2 参数的预设寻优网格(笛卡尔积≤200) - registry.to_schema() 返回 preset_grid 字段供前端自动填充 - 新增 POST /backtest/optimize-all/run/async:逐策略预设网格寻优 + 全局排名(OptimizeAllResult:ranking/best/per_strategy/total_grid_points) - 新增 optimize-all 端到端单测 2 例(838 单测全绿)
This commit is contained in:
@@ -185,17 +185,6 @@ def test_chanlun_injection():
|
||||
assert len(result.trades) >= 1
|
||||
|
||||
|
||||
def test_this_close_warning_in_config():
|
||||
"""Test future_leak_warning in config when using this_close."""
|
||||
df = _make_df(n=50)
|
||||
engine = BacktestEngine(MACrossStrategy, execution="this_close")
|
||||
result = engine.run(df)
|
||||
|
||||
# Config should have future_leak_warning
|
||||
# Note: MACrossStrategy may not generate signals, so warning might be False
|
||||
assert "future_leak_warning" in result.config
|
||||
|
||||
|
||||
def test_config_snapshot():
|
||||
"""Test config contains correct cash and commission."""
|
||||
df = _make_df(n=50)
|
||||
|
||||
Reference in New Issue
Block a user