def get_livepositions(dt, fund = None): ''' Create the list of live positions at date dt ''' from jflow.db.tools.positions import livepositions pos = livepositions(dt,fund=fund) plist = [] for p in pos: ip = p.getposition(dt) plist.append(ip) return plist
def get_livepositions(dt, fund=None): ''' Create the list of live positions at date dt ''' from jflow.db.tools.positions import livepositions pos = livepositions(dt, fund=fund) plist = [] for p in pos: ip = p.getposition(dt) plist.append(ip) return plist
def createportfolio(dt, fund, view): ''' Create the portfolio JSON object for a given fund ''' positions = livepositions(dt, fund = fund) delems = list(PortfolioDisplayElement.objects.all()) root = FinInsPortfolio(dbobj = fund) # Get the subportfolios subs = view.portfolio_set.filter(parent = None) for s in subs: add_to_portfolio(root, s, delems, dt) for pos in positions: if not pos.portfolio_set.filter(view = view).count(): _add_position(root,pos,delems,dt) return jportfolio(data = root, displays = displays())
def createportfolio(dt, fund, view): ''' Create the portfolio JSON object for a given fund ''' positions = livepositions(dt, fund=fund) delems = list(PortfolioDisplayElement.objects.all()) root = FinInsPortfolio(dbobj=fund) # Get the subportfolios subs = view.portfolio_set.filter(parent=None) for s in subs: add_to_portfolio(root, s, delems, dt) for pos in positions: if not pos.portfolio_set.filter(view=view).count(): _add_position(root, pos, delems, dt) return jportfolio(data=root, displays=displays())