Try to find cad stocks

ib_backend
Tyler Goodlet 2020-08-30 12:31:32 -04:00
parent 103014aa58
commit ad08cb7a66
1 changed files with 8 additions and 4 deletions

View File

@ -225,18 +225,22 @@ class Client:
# use heuristics to figure out contract "type" # use heuristics to figure out contract "type"
sym, exch = symbol.upper().split('.') sym, exch = symbol.upper().split('.')
# TODO: metadata system for all these exchange rules.. # futes
if exch in ('PURE',):
currency = 'CAD'
if exch in ('GLOBEX', 'NYMEX', 'CME', 'CMECRYPTO'): if exch in ('GLOBEX', 'NYMEX', 'CME', 'CMECRYPTO'):
con = await self.get_cont_fute(symbol=sym, exchange=exch) con = await self.get_cont_fute(symbol=sym, exchange=exch)
# commodities
elif exch == 'CMDTY': # eg. XAUUSD.CMDTY elif exch == 'CMDTY': # eg. XAUUSD.CMDTY
con_kwargs, bars_kwargs = _adhoc_cmdty_data_map[sym] con_kwargs, bars_kwargs = _adhoc_cmdty_data_map[sym]
con = ibis.Commodity(**con_kwargs) con = ibis.Commodity(**con_kwargs)
con.bars_kwargs = bars_kwargs con.bars_kwargs = bars_kwargs
# stonks
else: else:
# TODO: metadata system for all these exchange rules..
if exch in ('PURE', 'TSE'): # non-yankee
currency = 'CAD'
con = ibis.Stock(symbol=sym, exchange=exch, currency=currency) con = ibis.Stock(symbol=sym, exchange=exch, currency=currency)
try: try: