binance: make `stream_quotes()` deliver new `list[FeedInit]` API

rekt_pps
Tyler Goodlet 2023-04-19 14:03:50 -04:00
parent 4131ff1152
commit e317310ed3
1 changed files with 9 additions and 14 deletions

View File

@ -57,6 +57,7 @@ from ._util import (
get_console_log, get_console_log,
) )
from ..data.types import Struct from ..data.types import Struct
from ..data.validate import FeedInit
from ..data._web_bs import ( from ..data._web_bs import (
open_autorecon_ws, open_autorecon_ws,
NoBsWs, NoBsWs,
@ -539,23 +540,17 @@ async def stream_quotes(
async with ( async with (
send_chan as send_chan, send_chan as send_chan,
): ):
mkt_infos: dict[str, MktPair] = {} init_msgs: list[FeedInit] = []
for sym in symbols: for sym in symbols:
mkt, pair = await get_mkt_info(sym) mkt, pair = await get_mkt_info(sym)
mkt_infos[sym] = mkt
symbol = symbols[0] # build out init msgs according to latest spec
init_msgs.append(
init_msgs = { FeedInit(
# pass back token, and bool, signalling if we're the writer mkt_info=mkt,
# and that history has been written shm_write_opts={'sum_tick_vml': False},
symbol: { )
'fqsn': sym, )
'mkt_info': mkt_infos[sym],
'shm_write_opts': {'sum_tick_vml': False},
},
}
@acm @acm
async def subscribe(ws: wsproto.WSConnection): async def subscribe(ws: wsproto.WSConnection):