feat: complete advisory market data refresh pipeline
This commit is contained in:
@@ -7,6 +7,35 @@ import pytest
|
||||
from app.infrastructure.fund_market_adapter import EastmoneyFundAdapter
|
||||
|
||||
|
||||
def test_hq_exchange_history_parser_contract(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
import hq
|
||||
|
||||
class Response:
|
||||
def raise_for_status(self) -> None:
|
||||
return None
|
||||
|
||||
def json(self) -> dict[str, object]:
|
||||
return {"data": {"klines": [
|
||||
"2026-09-09,1.20,1.23,1.24,1.19,100000,1234567.89,4.1,2.5,0.03,1.2",
|
||||
"2026-09-08,1.20,1.21,1.22,1.19,90000,1000000,2.5,1.0,0.01,1.0",
|
||||
"malformed",
|
||||
]}}
|
||||
|
||||
def get(*args: object, **kwargs: object) -> Response:
|
||||
del args, kwargs
|
||||
return Response()
|
||||
|
||||
monkeypatch.setattr(hq.httpx, "get", get)
|
||||
rows = hq.get_southern_fund_exchange_history("159511", "2026-09-09", "2026-09-09")
|
||||
|
||||
assert rows == [{
|
||||
"fund_code": "159511",
|
||||
"trade_date": "2026-09-09",
|
||||
"close_price": "1.23",
|
||||
"turnover_amount": "1234567.89",
|
||||
}]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_adapter_parses_names_quotes_and_history() -> None:
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
|
||||
Reference in New Issue
Block a user