diff --git a/tests/test_memory_log.py b/tests/test_memory_log.py index 807335b4a..090c3af9a 100644 --- a/tests/test_memory_log.py +++ b/tests/test_memory_log.py @@ -628,6 +628,16 @@ class TestDeferredReflection: "benchmark_map": DEFAULT_CONFIG["benchmark_map"]} assert settlement.resolve_benchmark("PETR4.SA", config) == "^BVSP" + @pytest.mark.parametrize(("ticker", "index"), [ + ("2330.TW", "^TWII"), ("6488.TWO", "^TWII"), ("005930.KS", "^KS11"), ("247540.KQ", "^KQ11"), ("D05.SI", "^STI"), ("SAP.DE", "^GDAXI"), + ("MC.PA", "^FCHI"), ("ASML.AS", "^AEX"), ("NESN.SW", "^SSMI"), ("ENI.MI", "FTSEMIB.MI"), + ]) + def test_resolve_benchmark_regional_indexes(self, ticker, index): + """Taiwan, Korea, Singapore and the main European exchanges were measured against SPY.""" + from tradingagents.default_config import DEFAULT_CONFIG + config = {"benchmark_ticker": None, "benchmark_map": DEFAULT_CONFIG["benchmark_map"]} + assert settlement.resolve_benchmark(ticker, config) == index + def test_resolve_benchmark_us_ticker_defaults_to_spy(self): """US tickers (no dotted suffix) take the empty-suffix entry.""" config = { diff --git a/tradingagents/default_config.py b/tradingagents/default_config.py index 3bfaf3db9..8c59c76e3 100644 --- a/tradingagents/default_config.py +++ b/tradingagents/default_config.py @@ -161,8 +161,18 @@ DEFAULT_CONFIG = _apply_env_overrides({ ".NS": "^NSEI", # NSE India (Nifty 50) ".BO": "^BSESN", # BSE India (Sensex) ".T": "^N225", # Tokyo (Nikkei 225) + ".TW": "^TWII", # Taiwan (TAIEX) + ".TWO": "^TWII", # Taipei OTC (TPEx has no Yahoo index; TAIEX) + ".KS": "^KS11", # Korea (KOSPI) + ".KQ": "^KQ11", # Korea (KOSDAQ) ".HK": "^HSI", # Hong Kong (Hang Seng) + ".SI": "^STI", # Singapore (Straits Times) ".L": "^FTSE", # London (FTSE 100) + ".DE": "^GDAXI", # Germany (DAX) + ".PA": "^FCHI", # Paris (CAC 40) + ".AS": "^AEX", # Amsterdam (AEX) + ".SW": "^SSMI", # Switzerland (SMI) + ".MI": "FTSEMIB.MI", # Milan (FTSE MIB) ".TO": "^GSPTSE", # Toronto (TSX Composite) ".AX": "^AXJO", # Australia (ASX 200) ".SS": "000001.SS", # Shanghai (SSE Composite) diff --git a/tradingagents/graph/settlement.py b/tradingagents/graph/settlement.py index 794b987ee..51e658834 100644 --- a/tradingagents/graph/settlement.py +++ b/tradingagents/graph/settlement.py @@ -16,10 +16,9 @@ def resolve_benchmark(ticker: str, config: dict) -> str: ``config["benchmark_ticker"]`` overrides everything when set; otherwise the suffix map matches the ticker's exchange suffix (e.g. ``.T`` for Tokyo). US-listed tickers without a dotted suffix fall through to the - empty-suffix entry (SPY by default). Unrecognised suffixes (including - US tickers with dots like ``BRK.B``) also fall back to the empty-suffix - entry, which is the right default because the alpha calculation works - in USD. + empty-suffix entry (SPY by default). Unrecognised suffixes, including + US tickers with dots like ``BRK.B``, also take the empty-suffix entry. + Returns are compared as percentages, each in its own currency. """ explicit = config.get("benchmark_ticker")