示例#1
0
文件: portfolio.py 项目: OspreyX/flow
 def testDefaultView(self):
     '''Test the default view'''
     self.fill()
     funds = PortfolioHolder.objects.filter(parent = None)
     # pick a random fund
     holder = funds[randint(0,len(funds)-1)]
     funds  = holder.dates.all()
     fund   = funds[randint(0,len(funds)-1)]
     # call the api to obtain the view
     view = api.get_portfolio_object(fund)
     self.assertEqual(view.portfolio,fund)
     self.assertEqual(view.name,'default')
     self.assertEqual(view.ccy,fund.ccy)
     folders = view.folders.all()
     self.assertTrue(folders.count()>0)
     #The total number of positions in folders
     #must be the same as the number of position in porfolio
     N = 0
     for folder in folders:
         N += folder.positions.size()
     self.assertEqual(N,fund.positions.all().count())
示例#2
0
 def testDefaultView(self):
     '''Test the default view'''
     self.fill()
     funds = PortfolioHolder.objects.filter(parent=None)
     # pick a random fund
     holder = funds[randint(0, len(funds) - 1)]
     funds = holder.dates.all()
     fund = funds[randint(0, len(funds) - 1)]
     # call the api to obtain the view
     view = api.get_portfolio_object(fund)
     self.assertEqual(view.portfolio, fund)
     self.assertEqual(view.name, 'default')
     self.assertEqual(view.ccy, fund.ccy)
     folders = view.folders.all()
     self.assertTrue(folders.count() > 0)
     #The total number of positions in folders
     #must be the same as the number of position in porfolio
     N = 0
     for folder in folders:
         N += folder.positions.size()
     self.assertEqual(N, fund.positions.all().count())
示例#3
0
 def get_id(self, name, dt=None):
     fund = Fund.objects.get(code=name)
     instance = api.get_portfolio_object(fund)
     return api.get_object_id(instance, dt)
示例#4
0
文件: finins.py 项目: OspreyX/flow
 def get_id(self, name, dt = None):
     fund = Fund.objects.get(code = name)
     instance = api.get_portfolio_object(fund)
     return api.get_object_id(instance,dt)