Improve backtest lazy loading and test automation
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
from datetime import date, timedelta
|
||||
from pathlib import Path
|
||||
@@ -306,3 +307,20 @@ class TestDatabentoHistoricalPriceSourceIntegration:
|
||||
assert stats["total_size_bytes"] > 0
|
||||
assert len(stats["entries"]) == 1
|
||||
assert stats["entries"][0]["symbol"] == "GLD"
|
||||
|
||||
|
||||
@pytest.mark.skipif(not os.getenv("DATABENTO_API_KEY"), reason="requires DATABENTO_API_KEY")
|
||||
def test_live_databento_source_loads_recent_gld_daily_bars(temp_cache_dir: Path) -> None:
|
||||
source = DatabentoHistoricalPriceSource(
|
||||
config=DatabentoSourceConfig(
|
||||
api_key=os.getenv("DATABENTO_API_KEY"),
|
||||
cache_dir=temp_cache_dir,
|
||||
schema="ohlcv-1d",
|
||||
)
|
||||
)
|
||||
|
||||
points = source.load_daily_closes("GLD", date(2024, 7, 1), date(2024, 7, 5))
|
||||
|
||||
assert len(points) >= 4
|
||||
assert points[0].date == date(2024, 7, 1)
|
||||
assert points[0].close > 0
|
||||
|
||||
Reference in New Issue
Block a user