feat: phase 1 — data downloader, backtrader runner, SMA strategy

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Yuxuan Yan
2026-06-07 09:21:16 +08:00
parent 338c912029
commit fd86190e9a
19 changed files with 456 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""End-to-end smoke test: download data -> backtest SMA crossover -> print results."""
import logging
from backtest.config import BacktestConfig
from backtest.runner import BacktestRunner
from strategies.base import SmaCross
from analysis.report import print_results
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
def main():
config = BacktestConfig(
symbols=["sh600000"], # 浦发银行
start_date="2023-01-01",
end_date="2024-12-31",
initial_cash=1_000_000,
)
runner = BacktestRunner(config)
results = runner.run(SmaCross)
print_results(results, config.initial_cash)
if __name__ == "__main__":
main()