Beispiel #1
0
 def test_moving_average(self):
     cashflows = [
         Cashflow(
             date=date(2011, 8, 1),
             amount=200,
             description='',
         ),
         Cashflow(
             date=date(2011, 7, 1),
             amount=100,
             description='',
         )
     ]
     self.assertEqual([300, 300],
                      moving_average(to_date=date(2014, 9, 1),
                                     sorted_cashflows=cashflows,
                                     size=2))
     self.assertEqual([0, 0],
                      moving_average(to_date=date(2000, 9, 1),
                                     sorted_cashflows=cashflows,
                                     size=2))
     self.assertEqual([100, 300],
                      moving_average(to_date=date(2011, 9, 1),
                                     sorted_cashflows=cashflows,
                                     size=2))
Beispiel #2
0
 def test_moving_average(self):
     cashflows = [
         Cashflow(
             date=date(2011, 8, 1),
             amount=200,
             description='',),
         Cashflow(
             date=date(2011, 7, 1),
             amount=100,
             description='',)]
     self.assertEqual([300, 300], moving_average(
         to_date=date(2014, 9, 1),
         sorted_cashflows=cashflows,
         size=2))
     self.assertEqual([0, 0], moving_average(
         to_date=date(2000, 9, 1),
         sorted_cashflows=cashflows,
         size=2))
     self.assertEqual([100, 300], moving_average(
         to_date=date(2011, 9, 1),
         sorted_cashflows=cashflows,
         size=2))
Beispiel #3
0
 def test_moving_average_empty(self):
     self.assertEqual([0, 0], moving_average(
         to_date=date(2013, 1, 1),
         sorted_cashflows=[],
         size=2))
Beispiel #4
0
 def test_moving_average_empty(self):
     self.assertEqual([0, 0],
                      moving_average(to_date=date(2013, 1, 1),
                                     sorted_cashflows=[],
                                     size=2))