Skip to content

TradingAgents: Multi-Agents LLM Financial Trading Framework

feat(config): benchmark B3 tickers against the Ibovespa (#1366)

Yijia-Xiao5c2dded82c47
diff --git a/tests/test_memory_log.py b/tests/test_memory_log.py
index b4d6af6f3..9fef25c99 100644
--- a/tests/test_memory_log.py
+++ b/tests/test_memory_log.py
@@ -629,6 +629,14 @@ class TestDeferredReflection:
# .SH is the exchange's own suffix; Yahoo spells Shanghai .SS (#1260)
assert TradingAgentsGraph._resolve_benchmark(mock_graph, "600519.SH") == "000001.SS"
+ def test_resolve_benchmark_brazil(self):
+ """B3 tickers were measured against SPY."""
+ from tradingagents.default_config import DEFAULT_CONFIG
+ mock_graph = MagicMock(spec=TradingAgentsGraph)
+ mock_graph.config = {"benchmark_ticker": None,
+ "benchmark_map": DEFAULT_CONFIG["benchmark_map"]}
+ assert TradingAgentsGraph._resolve_benchmark(mock_graph, "PETR4.SA") == "^BVSP"
+
def test_resolve_benchmark_us_ticker_defaults_to_spy(self):
"""US tickers (no dotted suffix) take the empty-suffix entry."""
mock_graph = MagicMock(spec=TradingAgentsGraph)
diff --git a/tradingagents/default_config.py b/tradingagents/default_config.py
index 03089d34d..32d7d8c66 100644
--- a/tradingagents/default_config.py
+++ b/tradingagents/default_config.py
@@ -168,6 +168,7 @@ DEFAULT_CONFIG = _apply_env_overrides({
".AX": "^AXJO", # Australia (ASX 200)
".SS": "000001.SS", # Shanghai (SSE Composite)
".SZ": "399001.SZ", # Shenzhen (SZSE Component)
+ ".SA": "^BVSP", # B3 Brazil (Ibovespa)
"": "SPY", # default for US-listed tickers (no suffix)
},
})