mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 15:44:18 +08:00
refactor: screen() reuses run_combination(), single runner across combo sizes
- screen() now calls run_combination() internally, eliminating duplicated signal extraction/combination logic - _run_combo_screen creates one CombinationRunner before the size loop, so signal cache is reused across 2-factor and 3-factor screens - Add MAJORITY(2)=AND note to screen() docstring
This commit is contained in:
@@ -97,19 +97,20 @@ def _run_combo_screen(
|
||||
|
||||
from math import comb
|
||||
|
||||
# 单个 Runner 跨 size 复用信号缓存,避免重复提取
|
||||
runner = CombinationRunner(
|
||||
strategy_classes=strategy_classes,
|
||||
df=df,
|
||||
cash=cash,
|
||||
commission=commission,
|
||||
)
|
||||
|
||||
for size in combo_sizes:
|
||||
total = comb(len(strategy_classes), size)
|
||||
click.echo("\n" + "=" * 80)
|
||||
click.echo(f"[*] {size}因子组合回测 (共{total}组, 模式={combo_mode})")
|
||||
click.echo("=" * 80)
|
||||
|
||||
runner = CombinationRunner(
|
||||
strategy_classes=strategy_classes,
|
||||
df=df,
|
||||
cash=cash,
|
||||
commission=commission,
|
||||
)
|
||||
|
||||
results = runner.screen(combo_sizes=(size,), mode=combo_mode.upper())
|
||||
|
||||
if not results:
|
||||
|
||||
Reference in New Issue
Block a user