def renderFund(self, fund_id): fund = Fund.find(fund_id) profile = Profile.find(fund.prof) organization = Organization.find(profile.org) # these stats are inputs and show up in the top part of the page stats_beta = ['Beta'] stats_controlled = ['Alpha', 'RM', 'RF'] stats_curves = ['c_rate', 'd_rate'] # these stats are calculated and show up after calc is clicked stats_calculated = [ 'growth_rate', 'NAV', 'Unfunded', 'Called', 'Distributed' ] stats = {} x = None for stat_name in stats_beta + stats_controlled + stats_curves + stats_calculated: stat = Stat.find_by_name(stat_name, fund_id, 'db') if not stat == None: stats[stat_name] = { 'y': stat.get_values()[1], # 'color_line': stat.color_line, # 'color_fill': stat.color_fill 'color_line': settings.colors[stat_name]['color_line'], 'color_fill': settings.colors[stat_name]['color_fill'] } if x == None: x = stat.get_values()[0] elif stat_name in stats_controlled + stats_beta + stats_curves: stats[stat_name] = { 'y': [1 for x in range(6)], 'color_line': settings.colors[stat_name]['color_line'], 'color_fill': settings.colors[stat_name]['color_fill'] } if x == None: x = [x for x in range(6)] return { 'fund_name': fund.fund_name, 'fund': fund_id, 'prof_name': profile.prof_name, 'org_name': organization.org_name, 'x': x, 'stats': stats, 'stats_beta': stats_beta, 'stats_curves': stats_curves, 'stats_controlled': stats_controlled, 'stats_calculated': stats_calculated }
def renderPortfolio(self, portfolio_id): portfolio = Profile.find(portfolio_id) funds = Fund.list(portfolio_id) return portfolio, list(funds)
def renderProf(self, prof_id): prof = Profile.find(prof_id) funds = Fund.list(prof_id) return prof, list(funds)