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
+18
View File
@@ -0,0 +1,18 @@
import pytest
from data.downloader import download_daily
def test_download_single_stock():
"""Smoke test: download data for 浦发银行 for a short window."""
df = download_daily("sh600000", "2024-01-01", "2024-01-31")
assert df is not None
assert len(df) > 0
assert list(df.columns) == ["symbol", "date", "open", "high", "low", "close", "volume", "amount"]
assert df["close"].notna().all()
def test_download_baostock_fallback():
"""Test baostock works as secondary source."""
df = download_daily("sz000001", "2024-06-01", "2024-06-15", source="baostock")
assert df is not None
assert len(df) > 0