fix(HEL-356): support Beijing exchange realtime quotes
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -6,7 +6,8 @@ from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from datahub.adapters.base import AdapterError
|
||||
from datahub.adapters.eastmoney import HIS_TRENDS_URL, TRENDS_URL, EastmoneyAdapter
|
||||
from datahub.adapters.eastmoney import HIS_TRENDS_URL, TRENDS_URL, EastmoneyAdapter, _normalize_market_quote
|
||||
from datahub.adapters.tencent import _tencent_symbol
|
||||
from datahub.db import HubDB
|
||||
from datahub.realtime_serve import fetch_intraday
|
||||
from datahub.serving import ApiError, V1API
|
||||
@@ -47,6 +48,15 @@ class EastmoneyIntradayLookbackTests(unittest.TestCase):
|
||||
self.assertEqual([point["time"] for point in payload["points"]], ["09:30", "15:00"])
|
||||
self.assertEqual(payload["points"][0]["close"], 55.9)
|
||||
|
||||
def test_beijing_exchange_920_codes_keep_their_market(self):
|
||||
self.assertEqual(_tencent_symbol("920703.BJ"), "bj920703")
|
||||
self.assertEqual(_tencent_symbol("920703"), "bj920703")
|
||||
quote = _normalize_market_quote({
|
||||
"f12": "920703", "f13": 0, "f2": 18.2, "f18": 18.0,
|
||||
"f3": 1.1, "f5": 0, "f6": 0,
|
||||
})
|
||||
self.assertEqual(quote["ts_code"], "920703.BJ")
|
||||
|
||||
def test_preferred_date_keeps_that_session(self):
|
||||
adapter = FakeEastmoney()
|
||||
payload = adapter.fetch_intraday("601318.SH", "20260907")
|
||||
|
||||
Reference in New Issue
Block a user