fix(data): normalize symbols on the identity and reflection paths

resolve_instrument_identity and the reflection return lookup queried Yahoo with
the raw ticker, so broker/forex/commodity symbols (XAUUSD, BTCUSD, EURUSD)
failed identity or could mismatch the priced instrument even though the price
path already normalized them. Route both through normalize_symbol (#983, #984).
This commit is contained in:
Yijia-Xiao committed 2026-06-13 20:39:52 +00:00
1 parent 2a58c2208f
commit 7c8fe2fe9f
3 files changed
+66 -2

No files matched your search

+6 -1
View File
@@ -70,9 +70,14 @@ def resolve_instrument_identity(ticker: str) -> dict:
recognise the ticker, we return ``{}`` and the caller falls back to
ticker-only context rather than failing before analysis starts. Cached so
the lookup happens at most once per ticker per process.
The symbol is normalized first (e.g. ``XAUUSD`` -> ``GC=F``) so identity
resolves for the same instrument the price path actually fetches (#983).
"""
from tradingagents.dataflows.symbol_utils import normalize_symbol
try:
info = yf.Ticker(ticker.upper()).info or {}
info = yf.Ticker(normalize_symbol(ticker)).info or {}
except Exception as exc: # noqa: BLE001 — fail open, never block the run
logger.debug("Could not resolve instrument identity for %s: %s", ticker, exc)
return {}