"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(data): match local data result names
xkam7arae2e110b4f66
diff --git a/agent/src/market_data.py b/agent/src/market_data.pyindex 9538b25a9..f691d2084 100644--- a/agent/src/market_data.py+++ b/agent/src/market_data.py@@ -89,6 +89,12 @@ def fetch_market_data() -> dict[str, Any]:"""Fetch normalized OHLCV data through the repository loader layer."""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]] = {}@@ -117,7 +123,11 @@ def fetch_market_data(row[key] = _json_safe(value)results[symbol] = cap_rows(records, max_rows)- unresolved = [code for code in codes if code not in results]+ unresolved = [+ code+ for code in codes+ if code not in results and result_aliases[code] not in results+ ]if unresolved:results["_unresolved"] = unresolveddiff --git a/agent/tests/test_market_data.py b/agent/tests/test_market_data.pyindex f22c8a0f3..d3cfc5541 100644--- a/agent/tests/test_market_data.py+++ b/agent/tests/test_market_data.py@@ -155,6 +155,16 @@ class _PartialLoader:return {codes[0]: pd.DataFrame({"close": [1.0]}, index=idx)}+class _LocalAliasLoader:+ """Mirrors the local loader, which returns keys without ``local:``."""++ def fetch(self, codes, start_date, end_date, interval="1D"):+ idx = pd.to_datetime(["2026-01-01"])+ idx.name = "trade_date"+ clean = codes[0].split(":", 1)[-1]+ return {clean: pd.DataFrame({"close": [1.0]}, index=idx)}++def test_fetch_explicit_source_normalizes_rows() -> None:out = fetch_market_data(codes=["AAPL.US"],@@ -211,6 +221,19 @@ def test_fetch_missing_symbol_listed_as_unresolved() -> None:assert out["_unresolved"] == ["B.US"]+def test_fetch_local_result_alias_is_not_unresolved() -> None:+ out = fetch_market_data(+ codes=["local:AAPL.US"],+ start_date="2026-01-01",+ end_date="2026-01-02",+ source="auto",+ loader_resolver=lambda src: _LocalAliasLoader,+ )++ assert "AAPL.US" in out+ assert "_unresolved" not in out++# --------------------------------------------------------------------------# fetch_market_data_json# --------------------------------------------------------------------------