fix(dataflows): map Shanghai .SH tickers to Yahoo's .SS (#1260)

- normalize_symbol maps 600519.SH to 600519.SS
- the alpha benchmark is resolved from the normalized symbol
This commit is contained in:
Yijia-Xiao
2026-09-15 00:04:25 +00:00
parent fadc698e20
commit 2942655f70
4 changed files with 15 additions and 2 deletions

View File

@@ -598,6 +598,8 @@ class TestDeferredReflection:
"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"
# .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_us_ticker_defaults_to_spy(self):
"""US tickers (no dotted suffix) take the empty-suffix entry."""

View File

@@ -69,6 +69,10 @@ class TestNormalizeSymbol(unittest.TestCase):
def test_hk_code_case_insensitive_suffix(self):
self.assertEqual(normalize_symbol("09992.hk"), "9992.HK")
def test_shanghai_sh_suffix_maps_to_yahoo_ss(self):
self.assertEqual(normalize_symbol("600519.sh"), "600519.SS")
self.assertEqual(normalize_symbol("600519.SS"), "600519.SS")
@pytest.mark.unit
class TestNoMarketDataError(unittest.TestCase):