def add_spread(self, instIDs, weights, price_unit = 1): key = (tuple(instIDs), tuple(weights)) self.spread_data[key] = instrument.SpreadInst(instIDs, weights, price_unit) self.spread_data[key].update() for inst in instIDs: if inst not in self.inst2spread: self.inst2spread[inst] = [] self.inst2spread[inst].append(key)
def add_spread(self, instIDs, weights, price_unit = 1): key = '_'.join([str(s) for s in instIDs + weights]) self.spread_data[key] = instrument.SpreadInst(instIDs, weights, price_unit) self.spread_data[key].update() for inst in instIDs: if inst not in self.inst2spread: self.inst2spread[inst] = [] self.inst2spread[inst].append(key)
def add_spread(self, instIDs, weights, multiple = None): key = '_'.join([str(s) for s in instIDs + weights]) self.spread_data[key] = instrument.SpreadInst(self.instruments, instIDs, weights, multiple) self.spread_data[key].update() for inst in instIDs: if inst not in self.inst2spread: self.inst2spread[inst] = [] self.inst2spread[inst].append(key) return self.spread_data[key]