From a44bc4aeb313a204919b7bf686071822f22acad3 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 20 Jun 2023 16:46:30 -0400 Subject: [PATCH] binance: pre-#520 fixes for `open_cached_client()` import and struct-field casting --- piker/brokers/binance.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/piker/brokers/binance.py b/piker/brokers/binance.py index 03840568c..a8791ae9f 100644 --- a/piker/brokers/binance.py +++ b/piker/brokers/binance.py @@ -48,11 +48,11 @@ MktPair, digits_to_dec, ) -from .._cacheables import open_cached_client -from ._util import ( +from . import ( resproc, SymbolNotFound, DataUnavailable, + open_cached_client, ) from ._util import ( get_logger, @@ -443,15 +443,14 @@ async def stream_messages( # decode/encode, see: # https://jcristharif.com/msgspec/structs.html#type-validation msg = AggTrade(**msg) - msg.typecast() yield 'trade', { 'symbol': msg.s, 'last': msg.p, 'brokerd_ts': time.time(), 'ticks': [{ 'type': 'trade', - 'price': msg.p, - 'size': msg.q, + 'price': float(msg.p), + 'size': float(msg.q), 'broker_ts': msg.T, }], }