"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(backtest): read Yahoo three-letter =X forex symbols as USD pairs
wavebyrdc52aa320bb49
diff --git a/agent/backtest/engines/_market_hooks.py b/agent/backtest/engines/_market_hooks.pyindex 2b519f4c2..b9b78e07d 100644--- a/agent/backtest/engines/_market_hooks.py+++ b/agent/backtest/engines/_market_hooks.py@@ -620,6 +620,9 @@ def _normalize_symbol(symbol: str) -> str:# suffix the pair misses the spread and swap tables and gets the defaults.if s.upper().endswith("=X"):s = s[:-2]+ # Yahoo's three-letter form (JPY=X) is the pair quoted against USD.+ if len(s) == 3:+ s = "USD" + sif "/" in s:return s.upper()if len(s) == 6:diff --git a/agent/tests/test_forex_engine.py b/agent/tests/test_forex_engine.pyindex 10fc20928..6d895a0df 100644--- a/agent/tests/test_forex_engine.py+++ b/agent/tests/test_forex_engine.py@@ -60,6 +60,7 @@ class TestNormalize:("EURUSD=X", "EUR/USD"),("usdjpy=x", "USD/JPY"),("XAUUSD=X", "XAU/USD"),+ ("JPY=X", "USD/JPY"),(" eurusd.fx ", "EUR/USD"),],)