def initialize(self): self.ptype = ProductType.Option self.product = inst2product(self.name) sep_name = self.name.split('-') if self.product == 'IO_Opt': self.underlying = sep_name[0].replace('IO', 'IF') self.strike = float(sep_name[2]) self.otype = str(sep_name[1]) self.cont_mth = int(self.underlying[-4:]) + 200000 self.expiry = get_opt_expiry(self.underlying, self.cont_mth) self.product = 'IO' elif '_Opt' in self.product: self.underlying = sep_name[0] self.strike = float(sep_name[2]) self.otype = str(sep_name[1]) if inst2exch(self.underlying) == 'CZCE': self.cont_mth = int(self.underlying[-3:]) + 201000 else: self.cont_mth = int(self.underlying[-4:]) + 200000 self.expiry = get_opt_expiry(self.underlying, self.cont_mth) self.product = self.product[:-4] prod_info = mysqlaccess.load_product_info(self.product) self.exchange = prod_info['exch'] self.start_tick_id = prod_info['start_min'] * 1000 if self.product in night_session_markets: self.start_tick_id = 300000 self.last_tick_id = prod_info['end_min'] * 1000 self.multiple = prod_info['lot_size'] self.tick_base = prod_info['tick_size'] self.broker_fee = prod_info['broker_fee'] return
def initialize(self): self.ptype = ProductType.Option self.product = inst2product(self.name) sep_name = self.name.split('-') if self.product == 'IO_Opt': self.underlying = sep_name[0].replace('IO','IF') self.strike = float(sep_name[2]) self.otype = str(sep_name[1]) self.cont_mth = int(self.underlying[-4:]) + 200000 self.expiry = get_opt_expiry(self.underlying, self.cont_mth) self.product = 'IO' elif '_Opt' in self.product: self.underlying = sep_name[0] self.strike = float(sep_name[2]) self.otype = str(sep_name[1]) self.cont_mth = int(self.underlying[-4:]) + 200000 self.expiry = get_opt_expiry(self.underlying, self.cont_mth) self.product = self.product[:-4] prod_info = mysqlaccess.load_product_info(self.product) self.exchange = prod_info['exch'] self.start_tick_id = prod_info['start_min'] * 1000 if self.product in night_session_markets: self.start_tick_id = 300000 self.last_tick_id = prod_info['end_min'] * 1000 self.multiple = prod_info['lot_size'] self.tick_base = prod_info['tick_size'] self.broker_fee = prod_info['broker_fee'] return
def initialize(self): self.ptype = ProductType.Future self.product = inst2product(self.name) prod_info = mysqlaccess.load_product_info(self.product) self.exchange = prod_info['exch'] if self.exchange == 'CZCE': self.cont_mth = int(self.name[-3:]) + 201000 else: self.cont_mth = int(self.name[-4:]) + 200000 self.start_tick_id = prod_info['start_min'] * 1000 if self.product in night_session_markets: self.start_tick_id = 300000 self.last_tick_id = prod_info['end_min'] * 1000 self.multiple = prod_info['lot_size'] self.tick_base = prod_info['tick_size'] self.broker_fee = prod_info['broker_fee'] return