This commit is contained in:
2026-09-07 13:34:26 +08:00
parent ad9245abdd
commit 359f9ae2e4
23 changed files with 2260 additions and 513 deletions

View File

@@ -24,6 +24,7 @@ class BacktestConfig:
initial_cash: float = 1000000.0
fast_mode: bool = False # True: 关 T+1/费用,交互试探
bars_per_year: int = 252 # 日线 252分钟级另算
is_fund: bool = False # 场内基金ETF免印花税/过户费
def run_backtest(bars: list[Bar], strategy, cfg: BacktestConfig | None = None) -> dict:
@@ -45,6 +46,7 @@ def run_backtest(bars: list[Bar], strategy, cfg: BacktestConfig | None = None) -
initial_cash=cfg.initial_cash,
enable_costs=not cfg.fast_mode,
enable_t_plus_1=not cfg.fast_mode,
is_fund=cfg.is_fund,
)
equity_values = []