"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(loaders): preserve Yahoo quote currency
Lanre Shittu57f583a7f6d9
diff --git a/agent/backtest/loaders/yahoo_loader.py b/agent/backtest/loaders/yahoo_loader.pyindex d9ccfd4ff..bc642ebc8 100644--- a/agent/backtest/loaders/yahoo_loader.py+++ b/agent/backtest/loaders/yahoo_loader.py@@ -289,4 +289,6 @@ class DataLoader:frame = _rows_to_frame(rows, start_date, end_date, interval)if is_lse_symbol(code):frame = normalize_lse_quote_currency(frame, currency)+ elif currency:+ frame.attrs["quote_currency"] = currencyreturn frame if not frame.empty else Nonediff --git a/agent/tests/test_yahoo_loader.py b/agent/tests/test_yahoo_loader.pyindex 74fa4643c..b3a587ecb 100644--- a/agent/tests/test_yahoo_loader.py+++ b/agent/tests/test_yahoo_loader.py@@ -249,6 +249,24 @@ class TestFetch:assert kwargs["period2"] == _epoch("2024-01-31") + 86400assert kwargs["interval"] == "1d"+ def test_fetch_preserves_provider_quote_currency(self):+ rows = [_row("2024-01-02", 10, 11, 9, 10.5, 1000)]+ with patch(+ "backtest.loaders.yahoo_loader.yahoo_client.get_chart",+ return_value=(rows, "ARS"),+ ):+ out = DataLoader().fetch(["GGAL.BA"], "2024-01-01", "2024-01-31")+ assert out["GGAL.BA"].attrs["quote_currency"] == "ARS"++ def test_fetch_leaves_missing_quote_currency_absent(self):+ rows = [_row("2024-01-02", 10, 11, 9, 10.5, 1000)]+ with patch(+ "backtest.loaders.yahoo_loader.yahoo_client.get_chart",+ return_value=(rows, ""),+ ):+ out = DataLoader().fetch(["AAPL.US"], "2024-01-01", "2024-01-31")+ assert "quote_currency" not in out["AAPL.US"].attrs+def test_fetch_india_symbol(self):rows = [_row("2024-01-02", 10, 11, 9, 10.5, 1000),