Fix PURE contracts lookup...

ib_backend
Tyler Goodlet 2020-09-17 14:14:52 -04:00
parent 5bb11826f3
commit 2f8737af6a
1 changed files with 12 additions and 2 deletions

View File

@ -252,11 +252,21 @@ class Client:
# stonks # stonks
else: else:
# TODO: metadata system for all these exchange rules.. # TODO: metadata system for all these exchange rules..
primaryExchange = ''
if exch in ('PURE', 'TSE'): # non-yankee if exch in ('PURE', 'TSE'): # non-yankee
currency = 'CAD' currency = 'CAD'
if exch in ('PURE',):
# stupid ib...
exch = 'SMART'
primaryExchange = 'PURE'
con = ibis.Stock(symbol=sym, exchange=exch, currency=currency) con = ibis.Stock(
symbol=sym,
exchange=exch,
primaryExchange=primaryExchange,
currency=currency,
)
try: try:
exch = 'SMART' if not exch else exch exch = 'SMART' if not exch else exch
contract = (await self.ib.qualifyContractsAsync(con))[0] contract = (await self.ib.qualifyContractsAsync(con))[0]