From c93b92c7a47348198c45353e1f2c046b9066f3fb Mon Sep 17 00:00:00 2001 From: Yijia-Xiao Date: Sun, 31 May 2026 07:29:19 +0000 Subject: [PATCH] feat(markets): add China A-share benchmarks and document non-US tickers A-shares already resolve through the Yahoo Finance vendor (Shanghai .SS, Shenzhen .SZ) with correct identity and indicators; add the SSE/SZSE composite benchmarks so their alpha isn't measured against SPY, and document the exchange-suffix tickers we support (incl. A-shares, crypto). --- README.md | 12 ++++++++++++ tests/test_memory_log.py | 10 ++++++++++ tradingagents/default_config.py | 18 ++++++++++-------- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index be14eaa93..8c59fbf83 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,18 @@ python -m cli.main # alternative: run directly from source ``` You will see a screen where you can select your desired tickers, analysis date, LLM provider, research depth, and more. +### Markets and tickers + +TradingAgents works with any market Yahoo Finance covers, using the exchange-suffixed ticker. Company identity and the alpha benchmark resolve automatically per market. + +- US: `AAPL`, `SPY` +- Hong Kong: `0700.HK` · Tokyo: `7203.T` · London: `AZN.L` +- India: `RELIANCE.NS`, `.BO` · Canada: `.TO` · Australia: `.AX` +- China A-shares: Shanghai `.SS`, Shenzhen `.SZ` (e.g. `600519.SS` for Kweichow Moutai) +- Crypto: `BTC-USD`, `ETH-USD` + +Yahoo Finance may be rate-limited or blocked from some mainland-China networks. For China-native data sources, community forks such as [tradingagent_a](https://github.com/michaelyuancb/tradingagent_a) (AKShare-based) target that environment specifically. +

diff --git a/tests/test_memory_log.py b/tests/test_memory_log.py index c468f9998..2d0261fac 100644 --- a/tests/test_memory_log.py +++ b/tests/test_memory_log.py @@ -563,6 +563,16 @@ class TestDeferredReflection: assert TradingAgentsGraph._resolve_benchmark(mock_graph, "RELIANCE.NS") == "^NSEI" assert TradingAgentsGraph._resolve_benchmark(mock_graph, "AZN.L") == "^FTSE" + def test_resolve_benchmark_china_a_shares(self): + """A-share tickers route to their exchange composite (uses the real + default benchmark_map, since A-share support relies on it).""" + 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, "600519.SS") == "000001.SS" + assert TradingAgentsGraph._resolve_benchmark(mock_graph, "000001.SZ") == "399001.SZ" + 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 113021929..9162e2ea7 100644 --- a/tradingagents/default_config.py +++ b/tradingagents/default_config.py @@ -116,13 +116,15 @@ DEFAULT_CONFIG = _apply_env_overrides({ # while non-US tickers get their regional index automatically. "benchmark_ticker": None, "benchmark_map": { - ".NS": "^NSEI", # NSE India (Nifty 50) - ".BO": "^BSESN", # BSE India (Sensex) - ".T": "^N225", # Tokyo (Nikkei 225) - ".HK": "^HSI", # Hong Kong (Hang Seng) - ".L": "^FTSE", # London (FTSE 100) - ".TO": "^GSPTSE", # Toronto (TSX Composite) - ".AX": "^AXJO", # Australia (ASX 200) - "": "SPY", # default for US-listed tickers (no suffix) + ".NS": "^NSEI", # NSE India (Nifty 50) + ".BO": "^BSESN", # BSE India (Sensex) + ".T": "^N225", # Tokyo (Nikkei 225) + ".HK": "^HSI", # Hong Kong (Hang Seng) + ".L": "^FTSE", # London (FTSE 100) + ".TO": "^GSPTSE", # Toronto (TSX Composite) + ".AX": "^AXJO", # Australia (ASX 200) + ".SS": "000001.SS", # Shanghai (SSE Composite) + ".SZ": "399001.SZ", # Shenzhen (SZSE Component) + "": "SPY", # default for US-listed tickers (no suffix) }, })