Skip to content

Commit ccced4c

Browse files
committed
binance: pre-#520 fixes for open_cached_client() import and struct-field casting
1 parent 8e622d1 commit ccced4c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

piker/brokers/binance.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
MktPair,
4949
digits_to_dec,
5050
)
51-
from .._cacheables import open_cached_client
52-
from ._util import (
51+
from . import (
5352
resproc,
5453
SymbolNotFound,
5554
DataUnavailable,
55+
open_cached_client,
5656
)
5757
from ._util import (
5858
get_logger,
@@ -443,15 +443,14 @@ async def stream_messages(
443443
# decode/encode, see:
444444
# https://jcristharif.com/msgspec/structs.html#type-validation
445445
msg = AggTrade(**msg)
446-
msg.typecast()
447446
yield 'trade', {
448447
'symbol': msg.s,
449448
'last': msg.p,
450449
'brokerd_ts': time.time(),
451450
'ticks': [{
452451
'type': 'trade',
453-
'price': msg.p,
454-
'size': msg.q,
452+
'price': float(msg.p),
453+
'size': float(msg.q),
455454
'broker_ts': msg.T,
456455
}],
457456
}

0 commit comments

Comments
 (0)