Skip to content

Commit

Permalink
Ignore symbol-not-found errors
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Apr 10, 2022
1 parent 530edd5 commit ba76f82
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions piker/brokers/ib.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,14 +448,17 @@ async def search_symbols(
symbol=sym,
exchange=exch,
)
possibles = await self.ib.qualifyContractsAsync(con)
for i, condict in enumerate(sorted(
map(asdict, possibles),
# sort by expiry
key=lambda con: con['lastTradeDateOrContractMonth'],
)):
expiry = condict['lastTradeDateOrContractMonth']
results[f'{sym}.{exch}.{expiry}'] = condict
try:
possibles = await self.ib.qualifyContractsAsync(con)
for i, condict in enumerate(sorted(
map(asdict, possibles),
# sort by expiry
key=lambda con: con['lastTradeDateOrContractMonth'],
)):
expiry = condict['lastTradeDateOrContractMonth']
results[f'{sym}.{exch}.{expiry}'] = condict
except RequestError as err:
log.warning(err.message)

return results

Expand Down

0 comments on commit ba76f82

Please sign in to comment.