Skip to content

Commit

Permalink
binance: pre-#520 fixes for open_cached_client() import and struct-…
Browse files Browse the repository at this point in the history
…field casting
  • Loading branch information
goodboy committed Jun 27, 2023
1 parent c4277eb commit a44bc4a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions piker/brokers/binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}],
}
Expand Down

0 comments on commit a44bc4a

Please sign in to comment.