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,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
|
||||
Reference in New Issue
Block a user