Skip to content

Commit

Permalink
binance: use built-in anext() add note about new ws ep URL
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Feb 28, 2023
1 parent 2614609 commit 83c3dcc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions piker/brokers/binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,17 +531,19 @@ async def subscribe(ws: wsproto.WSConnection):

async with open_autorecon_ws(
'wss://stream.binance.com/ws',
# XXX: see api docs which show diff addr?
# https://developers.binance.com/docs/binance-trading-api/websocket_api#general-api-information
# 'wss://ws-api.binance.com:443/ws-api/v3',
fixture=subscribe,
) as ws:

# pull a first quote and deliver
msg_gen = stream_messages(ws)

typ, quote = await msg_gen.__anext__()
typ, quote = await anext(msg_gen)

while typ != 'trade':
# TODO: use ``anext()`` when it lands in 3.10!
typ, quote = await msg_gen.__anext__()
typ, quote = await anext(msg_gen)

task_status.started((init_msgs, quote))

Expand Down

0 comments on commit 83c3dcc

Please sign in to comment.