ib.feed: drop legacy "quote-with-vlm" polling
Since now we explicitly check each mkt's venue hours now we don't need this mega hacky "waiting on a quote with real vlm" stuff to determing whether historical data should be loaded immediately. This approach also had the added complexity that we needed to handle edge cases for tickers (like xauusd.cmdty) which never have vlm.. so it's nice to be rid of it all ;pmultiaddrs
parent
205058de21
commit
ec4e6ec742
|
|
@ -1246,54 +1246,12 @@ async def stream_quotes(
|
||||||
tn.start_soon(reset_on_feed)
|
tn.start_soon(reset_on_feed)
|
||||||
|
|
||||||
async with aclosing(iter_quotes):
|
async with aclosing(iter_quotes):
|
||||||
# if syminfo.get('no_vlm', False):
|
|
||||||
if not init_msg.shm_write_opts['has_vlm']:
|
|
||||||
|
|
||||||
# generally speaking these feeds don't
|
|
||||||
# include vlm data.
|
|
||||||
atype: str = mkt.dst.atype
|
|
||||||
log.info(
|
|
||||||
f'No-vlm {mkt.fqme}@{atype}, skipping quote poll'
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
|
||||||
# wait for real volume on feed (trading might be
|
|
||||||
# closed)
|
|
||||||
while True:
|
|
||||||
ticker = await iter_quotes.receive()
|
|
||||||
|
|
||||||
# for a real volume contract we rait for
|
|
||||||
# the first "real" trade to take place
|
|
||||||
if (
|
|
||||||
# not calc_price
|
|
||||||
# and not ticker.rtTime
|
|
||||||
False
|
|
||||||
# not ticker.rtTime
|
|
||||||
):
|
|
||||||
# spin consuming tickers until we
|
|
||||||
# get a real market datum
|
|
||||||
log.debug(f"New unsent ticker: {ticker}")
|
|
||||||
continue
|
|
||||||
|
|
||||||
else:
|
|
||||||
log.debug("Received first volume tick")
|
|
||||||
# ugh, clear ticks since we've
|
|
||||||
# consumed them (ahem, ib_insync is
|
|
||||||
# truly stateful trash)
|
|
||||||
# ticker.ticks = []
|
|
||||||
|
|
||||||
# XXX: this works because we don't use
|
|
||||||
# ``aclosing()`` above?
|
|
||||||
break
|
|
||||||
|
|
||||||
quote = normalize(ticker)
|
|
||||||
log.debug(f"First ticker received {quote}")
|
|
||||||
|
|
||||||
# tell data-layer spawner-caller that live
|
# tell data-layer spawner-caller that live
|
||||||
# quotes are now active desptie not having
|
# quotes are now active desptie not having
|
||||||
# necessarily received a first vlm/clearing
|
# necessarily received a first vlm/clearing
|
||||||
# tick.
|
# tick.
|
||||||
ticker = await iter_quotes.receive()
|
ticker = await iter_quotes.receive()
|
||||||
|
quote = normalize(ticker)
|
||||||
feed_is_live.set()
|
feed_is_live.set()
|
||||||
fqme: str = quote['fqme']
|
fqme: str = quote['fqme']
|
||||||
await send_chan.send({fqme: quote})
|
await send_chan.send({fqme: quote})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue