Handle defunct QT tickers and delays
parent
823bd2ea29
commit
164d636c67
|
@ -304,7 +304,24 @@ async def quoter(client: Client, tickers: [str]):
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
return {quote['symbol']: quote for quote in quotes_resp['quotes']}
|
# dict packing and post-processing
|
||||||
|
quotes = {}
|
||||||
|
for quote in quotes_resp['quotes']:
|
||||||
|
quotes[quote['symbol']] = quote
|
||||||
|
|
||||||
|
if quote.get('delay', 0) > 0:
|
||||||
|
log.warning(f"Delayed quote:\n{quote}")
|
||||||
|
|
||||||
|
return quotes
|
||||||
|
|
||||||
|
first_quotes_dict = await get_quote(tickers)
|
||||||
|
for symbol, quote in first_quotes_dict.items():
|
||||||
|
if quote['low52w'] is None:
|
||||||
|
log.warn(f"{symbol} seems to be defunct discarding from tickers")
|
||||||
|
t2ids.pop(symbol)
|
||||||
|
|
||||||
|
# re-save symbol ids cache
|
||||||
|
ids = ','.join(map(str, t2ids.values()))
|
||||||
|
|
||||||
yield get_quote
|
yield get_quote
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue