feat: phase 1 — data downloader, backtrader runner, SMA strategy
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user