From ad08cb7a66320e7e1305ff2666501f49ee117002 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 30 Aug 2020 12:31:32 -0400 Subject: [PATCH] Try to find cad stocks --- piker/brokers/ib.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/piker/brokers/ib.py b/piker/brokers/ib.py index 50119c38..9e306de1 100644 --- a/piker/brokers/ib.py +++ b/piker/brokers/ib.py @@ -225,18 +225,22 @@ class Client: # use heuristics to figure out contract "type" sym, exch = symbol.upper().split('.') - # TODO: metadata system for all these exchange rules.. - if exch in ('PURE',): - currency = 'CAD' - + # futes if exch in ('GLOBEX', 'NYMEX', 'CME', 'CMECRYPTO'): con = await self.get_cont_fute(symbol=sym, exchange=exch) + # commodities elif exch == 'CMDTY': # eg. XAUUSD.CMDTY con_kwargs, bars_kwargs = _adhoc_cmdty_data_map[sym] con = ibis.Commodity(**con_kwargs) con.bars_kwargs = bars_kwargs + + # stonks 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) try: