Skip ib exchanges we haven't tested yet

symbol_search
Tyler Goodlet 2021-05-18 11:58:46 -04:00
parent 42fda2a9e6
commit 6f3b799960
1 changed files with 12 additions and 2 deletions

View File

@ -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}')