Skip to content

"Vibe-Trading: Your Personal Trading Agent"

Merge PR #643

Haozhe Wu4275b85fe650
diff --cc agent/src/market_data.py
index f691d2084,39c6c3458..8899fa6ed
--- a/agent/src/market_data.py
+++ b/agent/src/market_data.py
@@@ -86,15 -86,21 +86,27 @@@ def fetch_market_data
interval: str = "1D",
max_rows: int = DEFAULT_MAX_ROWS,
loader_resolver: Callable[[str], type] = get_loader,
+ fallback_chain_provider: Callable[[str], list[str]] | None = None,
+ max_fallback_attempts: int = 3,
) -> dict[str, Any]:
- """Fetch normalized OHLCV data through the repository loader layer."""
+ """Fetch normalized OHLCV data through the repository loader layer.
+
+ When ``source="auto"`` (or any resolved source), if the chosen loader
+ raises during :meth:`fetch` the call falls through to the next source in
+ the market's :data:`backtest.loaders.registry.FALLBACK_CHAINS` (e.g. crypto
+ OKX → Binance → CCXT → Yahoo). At most ``max_fallback_attempts`` retries
+ are attempted before the symbol is recorded as ``_unresolved``.
+ """
+ from backtest.loaders.base import NoAvailableSourceError
+ from backtest.loaders.registry import FALLBACK_CHAINS
+
results: dict[str, Any] = {}
+ result_aliases = {
+ code: code.split(":", 1)[1]
+ if code.lower().startswith("local:")
+ else code
+ for code in codes
+ }
if source == "auto":
groups: dict[str, list[str]] = {}