feat: add 5-day reversal strategy

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Yuxuan Yan
2026-06-07 09:26:35 +08:00
parent fd86190e9a
commit 085e51abf1
3 changed files with 52 additions and 4 deletions
+4 -4
View File
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
"""End-to-end smoke test: download data -> backtest SMA crossover -> print results."""
"""End-to-end smoke test: download data -> backtest 5-day reversal -> print results."""
import logging
from backtest.config import BacktestConfig
from backtest.runner import BacktestRunner
from strategies.base import SmaCross
from strategies.reversal import FiveDayReversal
from analysis.report import print_results
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
@@ -11,14 +11,14 @@ logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(me
def main():
config = BacktestConfig(
symbols=["sh600000"], # 浦发银行
symbols=["sh600000", "sz000001", "sh600519"], # 浦发银行, 平安银行, 贵州茅台
start_date="2023-01-01",
end_date="2024-12-31",
initial_cash=1_000_000,
)
runner = BacktestRunner(config)
results = runner.run(SmaCross)
results = runner.run(FiveDayReversal)
print_results(results, config.initial_cash)