Ejemplo n.º 1
0
def fixture(request):
  Position.delete_all()
  Quote.delete_all()
  Portfolio.delete_all()
  avanza = Portfolio(name='Avanza', currency='SEK').save()
  Portfolio(name='XO', currency='GBP').save()
  Position(symbol='AAPL', 
        currency='SEK', 
        currency_rate=1.0, 
        enter_date=date.today(),
        enter_price=5000.0, 
        enter_commission=99.0, 
        shares=1000.0, 
        portfolio=avanza).save()
  Quote(symbol='AAPL', 
        close=1234.5,
        high=1234.5,
        low=1234.5,
        open=1234.5,
        date=date.today()).save()

  return HttpResponseRedirect('/')
Ejemplo n.º 2
0
 def test_delete_all(self):
   Portfolio(name='Avanza', currency='SEK').save()
   Portfolio.delete_all()
   self.assertFalse(Portfolio.load('Avanza'))