Exemplo n.º 1
0
 def setUp(self):
     self.today = BusinessDate(20161231)
     self.schedule = BusinessSchedule(self.today, self.today + '5y', '1m')
     self.df = DiscountFactorCurve([self.today], [1.],
                                   interpolation=interpolation_scheme)
     self.df2 = DiscountFactorCurve([self.today], [.2],
                                    interpolation=interpolation_scheme)
     self.curve = CashRateCurve([self.today], [.1])
Exemplo n.º 2
0
    def test_init(self):
        leg1 = RateCashFlowList(self.schedule, 100., fixed_rate=1.)
        curve = CashRateCurve([self.today], [.1])
        leg2 = RateCashFlowList(self.schedule, -1000., forward_curve=curve)

        cf = self.cls((leg1, leg2))
        for d in self.schedule:
            self.assertIn(d, cf.domain)
            self.assertAlmostEqual(0., cf[d])
Exemplo n.º 3
0
 def setUp(self):
     self.today = BusinessDate(20161231)
     self.schedule = BusinessSchedule(self.today, self.today + '5y', '1m')
     self.rate = 0.01
     self.df = DiscountFactorCurve(ZeroRateCurve([self.today], [self.rate]))
     self.curve = CashRateCurve([self.today], [self.rate])
 def test_cash3m_cast(self):
     for p in self.periods:
         curve = self.curve(p)
         cast = self.cast_type(CashRateCurve(curve, forward_tenor='3M'))
         for d in curve.domain[1:]:
             self.assertAlmostEqual(cast(d), curve(d), self.cash_precision)
Exemplo n.º 5
0
 def test_forward_rate(self):
     leg1 = RateCashFlowList(self.schedule, 100., fixed_rate=1.)
     curve = CashRateCurve([self.today], [.1])
     leg2 = RateCashFlowList(self.schedule, 1000., forward_curve=curve)
     for d in self.schedule:
         self.assertAlmostEqual(leg1[d], leg2[d])