fix(backtest): ensure data_source is passed through all validation calls

- Pass data_source to derive_entry_spot in backtests.py
- Remove default 'synthetic' value for data_source in derive_entry_spot and validate_preview_inputs
- Update all tests to explicitly pass data_source parameter
- Improve error message with helpful suggestion for Databento/Yahoo Finance
This commit is contained in:
Bu5hm4nn
2026-03-30 09:21:49 +02:00
parent eaaf78cd12
commit 2d1ecc2fcf
3 changed files with 12 additions and 6 deletions

View File

@@ -230,7 +230,7 @@ class BacktestPageService:
for template in self.template_service.list_active_templates(symbol)
]
def derive_entry_spot(self, symbol: str, start_date: date, end_date: date, data_source: str = "synthetic") -> float:
def derive_entry_spot(self, symbol: str, start_date: date, end_date: date, data_source: str) -> float:
history = self.get_historical_prices(symbol, start_date, end_date, data_source)
if not history:
raise ValueError("No historical prices found for scenario window")
@@ -251,7 +251,7 @@ class BacktestPageService:
loan_amount: float,
margin_call_ltv: float,
entry_spot: float | None = None,
data_source: str = "synthetic",
data_source: str,
) -> float:
normalized_symbol = symbol.strip().upper()
if not normalized_symbol: