From 8b1c521ae90af38035fe03271cea589e7855d52c Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 8 Apr 2022 14:59:53 -0400 Subject: [PATCH] Ignore symbol-not-found errors --- piker/brokers/ib.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/piker/brokers/ib.py b/piker/brokers/ib.py index 1a230ec9..1d01907d 100644 --- a/piker/brokers/ib.py +++ b/piker/brokers/ib.py @@ -448,14 +448,17 @@ class Client: 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