feat: 全链路新增 type 字段支持 + exchange.ts 超时退出优化

- TS: exit 函数统一管理进程退出与 DB 连接关闭;10s 超时 + 异常路径 clearTimeout
- Python: PairType(spot/um/cm) 贯穿 Kline 模型、策略配置、数据查询
- 回测脚本升级: 9策略 × 4币种 × 6时间级别 × 2交易类型
- 新增 generate_report.py 回测报告生成工具
This commit is contained in:
Rekey
2026-06-17 10:01:52 +08:00
parent ebaef5042e
commit 626acb20d3
13 changed files with 42394 additions and 5129 deletions
+3
View File
@@ -98,6 +98,7 @@ class BacktestEngine:
# 确保 strategy_config 与回测配置对齐
strategy_config.symbol = self.config.symbol
strategy_config.exchange = self.config.exchange
strategy_config.type = self.config.type
# 1. 连接数据库并加载数据
from ..common.config import config as app_config
@@ -113,6 +114,8 @@ class BacktestEngine:
start_time=self.config.start_time,
end_time=self.config.end_time,
limit=1_000_000, # 足够大的 limit,实际由 start/end 约束
type=self.config.type,
exchange=self.config.exchange,
)
if len(klines) < self.config.warmup_bars + 2: