Drop timeout-cancel block

ib_mkt_closed
Tyler Goodlet 2022-02-06 12:20:01 -05:00
parent a9d42b374f
commit 9bfad86c29
1 changed files with 3 additions and 28 deletions

View File

@ -1388,7 +1388,7 @@ async def stream_quotes(
# TODO: support multiple subscriptions # TODO: support multiple subscriptions
sym = symbols[0] sym = symbols[0]
with trio.fail_after(16) as cs: with trio.fail_after(16):
contract, first_ticker, details = await _trio_run_client_method( contract, first_ticker, details = await _trio_run_client_method(
method='get_quote', method='get_quote',
symbol=sym, symbol=sym,
@ -1424,25 +1424,7 @@ async def stream_quotes(
} }
return init_msgs return init_msgs
if cs.cancelled_caught:
contract, first_ticker, details = await _trio_run_client_method(
method='get_sym_details',
symbol=sym,
)
# init_msgs = mk_init_msgs()
# try again but without timeout and then do feed startup once we
# get one.
contract, first_ticker, details = await _trio_run_client_method(
method='get_quote',
symbol=sym,
)
# else:
init_msgs = mk_init_msgs() init_msgs = mk_init_msgs()
con = first_ticker.contract con = first_ticker.contract
# should be real volume for this contract by default # should be real volume for this contract by default
@ -1470,16 +1452,9 @@ async def stream_quotes(
# pass first quote asap # pass first quote asap
first_quote = {topic: quote} first_quote = {topic: quote}
if isnan(first_ticker.last):
# it might be outside regular trading hours so see if we can at # it might be outside regular trading hours so see if we can at
# least grab history. # least grab history.
# quote = normalize(first_ticker, calc_price=calc_price) if isnan(first_ticker.last):
# con = quote['contract']
# topic = '.'.join((con['symbol'], suffix)).lower()
# quote['symbol'] = topic
# # pass first quote asap
# first_quote = {topic: quote}
task_status.started((init_msgs, first_quote)) task_status.started((init_msgs, first_quote))
# it's not really live but this will unblock # it's not really live but this will unblock