Python
feat(markets): add China A-share benchmarks and document non-US tickers
Yijia-Xiaoc93b92c7a473
diff --git a/README.md b/README.mdindex 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.+<p align="center"><img src="assets/cli/cli_init.png" width="100%" style="display: inline-block; margin: 0 2%;"></p>diff --git a/tests/test_memory_log.py b/tests/test_memory_log.pyindex 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.pyindex 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)},})