Ignore symbol-not-found errors

broker_bumpz
Tyler Goodlet 2022-04-08 14:59:53 -04:00
parent 7586e20ab4
commit 8b1c521ae9
1 changed files with 11 additions and 8 deletions

View File

@ -448,14 +448,17 @@ class Client:
symbol=sym, symbol=sym,
exchange=exch, exchange=exch,
) )
possibles = await self.ib.qualifyContractsAsync(con) try:
for i, condict in enumerate(sorted( possibles = await self.ib.qualifyContractsAsync(con)
map(asdict, possibles), for i, condict in enumerate(sorted(
# sort by expiry map(asdict, possibles),
key=lambda con: con['lastTradeDateOrContractMonth'], # sort by expiry
)): key=lambda con: con['lastTradeDateOrContractMonth'],
expiry = condict['lastTradeDateOrContractMonth'] )):
results[f'{sym}.{exch}.{expiry}'] = condict expiry = condict['lastTradeDateOrContractMonth']
results[f'{sym}.{exch}.{expiry}'] = condict
except RequestError as err:
log.warning(err.message)
return results return results