"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix: Recognize crypto pair forms rather than routing equity names such as ABNB by bare quote suffix.
Rudy Celekli93602c2162aa
diff --git a/README.md b/README.mdindex b359b3ac8..583a1e29d 100644--- a/README.md+++ b/README.md@@ -1379,6 +1379,8 @@ panel = ... # your wide OHLCV panelsignal = engine.compute_signal(panel)```+Correlation market inference recognizes explicit crypto pairs; bare equity tickers such as `ABNB` and `SOL` use the US equity data chain.+### Market Research```bashdiff --git a/agent/backtest/correlation.py b/agent/backtest/correlation.pyindex 8a3e1321a..45b5e04d8 100644--- a/agent/backtest/correlation.py+++ b/agent/backtest/correlation.py@@ -35,7 +35,17 @@ def infer_market(code: str) -> str:"""code_upper = code.strip().upper()crypto_suffixes = ("USDT", "BTC", "ETH", "BNB", "SOL", "ADA", "DOGE")- if any(code_upper.endswith(s) for s in crypto_suffixes) or "/" in code:+ if (+ "/" in code_upper+ or any(+ code_upper.endswith("-" + quote)+ for quote in (*crypto_suffixes, "USD", "USDC")+ )+ or re.fullmatch(+ r"(?:[A-Z0-9]{2,}(?:USDT|USDC|BTC|ETH|BNB|SOL|ADA|DOGE)|(?:BTC|ETH|BNB|SOL|ADA|DOGE)USD)",+ code_upper,+ )+ ):return "crypto"if code_upper.endswith(".HK"):return "hk_equity"diff --git a/agent/tests/test_equity_crypto_suffix_regressions.py b/agent/tests/test_equity_crypto_suffix_regressions.pynew file mode 100644index 000000000..5976d0912--- /dev/null+++ b/agent/tests/test_equity_crypto_suffix_regressions.py@@ -0,0 +1,36 @@+import pandas as pd+import pytest+from backtest.correlation import infer_market, _fetch_price_series++[email protected]("symbol", ["ABNB", "ABNB.US", "SOL", "SOL.US"])+def test_equity_names_are_not_crypto_quote_suffixes(symbol):+ assert infer_market(symbol) == "us_equity"+++ "symbol",+ ["BTC-USDT", "ETH/USD", "ETHUSDT", "ETHBTC", "XRPUSDT", "LTCETH", "AVAXBNB"],+)+def test_explicit_crypto_pairs_stay_crypto(symbol):+ assert infer_market(symbol) == "crypto"+++def test_airbnb_fetch_uses_equity_chain(monkeypatch):+ from backtest.loaders import registry++ seen = []++ class Loader:+ def is_available(self):+ return True++ def fetch(self, codes, **kwargs):+ seen.extend(codes)+ return {codes[0]: pd.DataFrame({"close": [100, 110]})}++ monkeypatch.setattr(registry, "_ensure_registered", lambda: None)+ monkeypatch.setattr(registry, "FALLBACK_CHAINS", {"us_equity": ["equity"]})+ monkeypatch.setattr(registry, "LOADER_REGISTRY", {"equity": Loader})+ assert list(_fetch_price_series(["ABNB"], "2025-01-01", "2025-01-02")) == ["ABNB"]+ assert seen == ["ABNB.US"]