from poly_updown.prices import _parse_chainlink_message def test_parse_chainlink_rtds_message() -> None: ticks = _parse_chainlink_message( { "topic": "crypto_prices", "type": "update", "payload": { "symbol": "btc/usd", "data": [ {"timestamp": 1779376675000, "value": 77123.45}, {"timestamp": 1779376676000, "value": 77124.45}, ], }, } ) assert len(ticks) == 2 tick = ticks[-1] assert tick is not None assert tick.source == "polymarket_rtds_chainlink" assert tick.symbol == "btc/usd" assert tick.price == 77124.45 def test_parse_chainlink_rtds_ignores_other_symbols() -> None: assert _parse_chainlink_message( { "topic": "crypto_prices", "type": "update", "payload": {"symbol": "eth/usd", "value": 3000}, } ) == []