def addIndirectHolding(self, product_id, product, amount, type): tmp_holding = Holding() tmp_holding.fund_id = self.backstop_id tmp_holding.fund = self tmp_holding.product_id = product_id tmp_holding.product = product tmp_holding.amount = amount tmp_holding.type = type if tmp_holding.product_id in self.holdings_indirect.keys(): self.holdings_indirect[ tmp_holding.product_id].amount += tmp_holding.amount else: self.holdings_indirect[tmp_holding.product_id] = tmp_holding
def addIndirectHolding(self,product_id,product,amount,type): tmp_holding = Holding() tmp_holding.fund_id = self.backstop_id tmp_holding.fund = self tmp_holding.product_id = product_id tmp_holding.product = product tmp_holding.amount = amount tmp_holding.type = type if tmp_holding.product_id in self.holdings_indirect.keys(): self.holdings_indirect[tmp_holding.product_id].amount += tmp_holding.amount else: self.holdings_indirect[tmp_holding.product_id] = tmp_holding
def loadHoldingsData(self): if not self.loaded[0]: self.loadFundData() if not self.loaded[1]: self.loadProductData() cp = self.cache_path for p in self.products.keys(): fund_path = cp + "products/" + self.products[p].name rep_file = open(fund_path + "/holding_data.cache") holding_data = cPickle.load(rep_file) rep_file.close() for h_id in holding_data.keys(): tmp_holding = Holding() info = holding_data[h_id][0] bal = holding_data[h_id][1] tmp_holding.amount = bal[0][1][1] date_str = bal[0][2][1].split(" ")[0].strip() tmp_holding.date = datetime.strptime(date_str,"%Y-%m-%d") tmp_holding.fund_id = int(info[5][1]) tmp_holding.product_id = p tmp_holding.product = self.products[p] if tmp_holding.fund_id not in self.funds.keys(): if tmp_holding.fund_id in self.products.keys(): self.products[tmp_holding.fund_id].pass_through = True tmp_holding.fund = self.products[tmp_holding.fund_id] tmp_holding.type = "Internal" tmp_holding.percent = tmp_holding.amount/(self.products[tmp_holding.product_id].balance) self.products[tmp_holding.product_id].addHolding(tmp_holding) self.products[tmp_holding.fund_id].addHolding(tmp_holding) elif tmp_holding.fund_id == 374673: tmp_holding.fund.name = "Cash" tmp_holding.type = "Cash" self.products[tmp_holding.product_id].addHolding(tmp_holding) elif tmp_holding.amount > 0: tmp_holding.type = "Garbage" else: tmp_holding.fund = self.funds[tmp_holding.fund_id] tmp_holding.type = "External" self.products[tmp_holding.product_id].addHolding(tmp_holding) self.funds[tmp_holding.fund_id].addHolding(tmp_holding) self.loaded[7] = True