From 6f3b7999608b4cbeb972f1152bc8d64dd12c3c4b Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 18 May 2021 11:58:46 -0400 Subject: [PATCH] Skip ib exchanges we haven't tested yet --- piker/brokers/ib.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/piker/brokers/ib.py b/piker/brokers/ib.py index c56a70a8..d6ed1ba7 100644 --- a/piker/brokers/ib.py +++ b/piker/brokers/ib.py @@ -164,6 +164,14 @@ _adhoc_futes_set = { 'mes.globex', } +# exchanges we don't support at the moment due to not knowing +# how to do symbol-contract lookup correctly likely due +# to not having the data feeds subscribed. +_exch_skip_list = { + 'ASX', # aussie stocks + 'MEXI', # mexican stocks +} + # https://misc.interactivebrokers.com/cstools/contract_info/v3.10/index.php?action=Conid%20Info&wlId=IB&conid=69067924 _enters = 0 @@ -266,10 +274,12 @@ class Client: descriptions = await self.ib.reqMatchingSymbolsAsync(pattern) if descriptions is not None: + futs = [] for d in descriptions: con = d.contract - futs.append(self.ib.reqContractDetailsAsync(con)) + if con.primaryExchange not in _exch_skip_list: + futs.append(self.ib.reqContractDetailsAsync(con)) # batch request all details results = await asyncio.gather(*futs) @@ -1273,7 +1283,7 @@ async def open_symbol_search( pass if not pattern: - log.warning(f'empty pattern received, skipping..') + log.warning('empty pattern received, skipping..') continue log.debug(f'searching for {pattern}')