fd86190e9a
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
22 lines
645 B
Python
22 lines
645 B
Python
import pytest
|
|
from backtest.config import BacktestConfig
|
|
from backtest.runner import BacktestRunner
|
|
from strategies.base import SmaCross
|
|
|
|
|
|
def test_backtest_smoke():
|
|
"""Smoke test: run a minimal backtest and check results exist."""
|
|
config = BacktestConfig(
|
|
symbols=["sh600000"],
|
|
start_date="2024-01-01",
|
|
end_date="2024-03-31",
|
|
initial_cash=100_000,
|
|
)
|
|
runner = BacktestRunner(config)
|
|
results = runner.run(SmaCross)
|
|
assert results is not None
|
|
assert len(results) == 1
|
|
# Check analyzers exist
|
|
sharpe = results[0].analyzers.sharpe.get_analysis()
|
|
assert "sharperatio" in sharpe
|