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
@@ -59,6 +59,7 @@ class LongShortEngine:
from engine.common.config import config as app_config
strategy_config.symbol = self.config.symbol
strategy_config.exchange = self.config.exchange
strategy_config.type = self.config.type
db_cfg = self._db_config or app_config.db
ds = DataService(db_cfg)
await ds.connect()
@@ -67,6 +68,8 @@ class LongShortEngine:
symbol=self.config.symbol, interval=self.config.interval,
start_time=self.config.start_time, end_time=self.config.end_time,
limit=1_000_000,
type=self.config.type,
exchange=self.config.exchange,
)
if len(klines) < self.config.warmup_bars + 2:
raise ValueError(f"数据不足:需 {self.config.warmup_bars+2},实际 {len(klines)}")