def __init__(self): self.product = Product() self.product_id = 0 self.fund = Fund() self.fund_id = 0 self.type = "" self.date = "" self.amount = 0
def __init__(self): self.product = Product() self.product_id = 0 self.fund = Fund.Fund() self.fund_id = 0 self.date = date.today() self.amount = 0 self.type = "" self.percent = 0
def loadFundData(self, as_of_date, load_from_cache=False): if self.pg != None: self.pg.startSubProcess(self.pg.cur_sub_proc_total, 2.0) cp = self.cache_path if not load_from_cache: f_def = open("def/fund_def.dat") f_res = open("def/fund_res.dat") if self.pg != None: self.pg.addMessage("Downloading Fund Data") self.pg.incSub("running funds report.....") fund_data = self.bsdm.runFundsReport(f_def.read(), f_res.read(), as_of_date) if self.pg != None: self.pg.incSub("finished funds report.....") rep_file = open(cp + "reports/fund_rep.cache", 'w') cPickle.dump(fund_data, rep_file) rep_file.close() else: rep_file = open(cp + "reports/fund_rep.cache") fund_data = cPickle.load(rep_file) rep_file.close() for f in fund_data: tmp_fund = Fund() tmp_fund.backstop_id = int(f[0][1]) tmp_fund.name = f[1][1] tmp_fund.first_investment_date = datetime.strptime( f[6][1], "%m/%d/%Y") tmp_fund.incept_date = datetime.strptime(f[3][1], "%m/%d/%Y") if int(f[30][1]) not in self.firms.keys(): tmp_fund.firm = Firm() tmp_fund.firm.name = f[31][1] tmp_fund.firm.backstop_id = int(f[30][1]) self.firms[int(f[30][1])] = tmp_fund.firm self.funds[tmp_fund.backstop_id] = tmp_fund self.loaded[0] = True