Only warn on slow quote query

misc_ib_updates
Tyler Goodlet 2021-11-19 10:29:04 -05:00
parent 0bcaeda784
commit 0e4a7e3846
1 changed files with 13 additions and 6 deletions

View File

@ -505,8 +505,14 @@ class Client:
)
# ensure a last price gets filled in before we deliver quote
while isnan(ticker.last):
for _ in range(25):
if isnan(ticker.last):
ticker = await ticker.updateEvent
await asyncio.sleep(0.2)
else:
log.warning(
f'Symbol {symbol} is not returning a quote '
'it may be outside trading hours?')
details = (await details_fute)[0]
return contract, ticker, details
@ -1350,6 +1356,7 @@ async def stream_quotes(
# TODO: support multiple subscriptions
sym = symbols[0]
with trio.fail_after(3):
contract, first_ticker, details = await _trio_run_client_method(
method='get_quote',
symbol=sym,