Skip to content

"Vibe-Trading: Your Personal Trading Agent"

Merge PR #1862: retain digit-leading bases with separated quote pairs

Haozhe Wu363a4c6f7b9f
diff --cc agent/backtest/engines/_market_hooks.py
index 525099cfe,e3c7e3d5f..2f8e380fd
--- a/agent/backtest/engines/_market_hooks.py
+++ b/agent/backtest/engines/_market_hooks.py
@@@ -129,7 -129,11 +129,11 @@@ _MARKET_PATTERNS =
# through every pattern and got a_share rules (T+1, no shorting) on a
# perpetual. Bare metals/FX (XAUUSD) end in USD, not USDT/USDC/BUSD, so
# they still reach the forex whitelist below.
- (re.compile(r"^[A-Z]{2,}(?:USDT|USDC|BUSD)$", re.I), "crypto"),
+ (re.compile(r"^(?!\d+(?:USDT|USDC|BUSD)$)[A-Z0-9]{2,}(?:USDT|USDC|BUSD)$", re.I), "crypto"),
+ # Separated USDC/BUSD-quoted pairs (BTC-USDC, ETH/USDC). Only the USDT
+ # spellings above were separator-aware, so these fell through to the
+ # a_share default even though the unseparated BTCUSDC is crypto.
+ (re.compile(r"^(?=[A-Z0-9]*[A-Z])[A-Z0-9]+[-/](?:USDC|BUSD)$", re.I), "crypto"),
# China futures: product+delivery.exchange (e.g. IF2406.CFFEX, rb2410.SHFE)
# Tushare suffix spellings (SHF/CZC/CFX/GFE) classify here too.
(