def test_first_example_isma(self): day_counter = ActualActual(ISMA) self.assertAlmostEqual( 0.5, day_counter.year_fraction(self.from_date, self.to_date, self.ref_start, self.ref_end))
def test_first_example_afb(self): day_counter = ActualActual(AFB) self.assertAlmostEqual( 0.497267759563, day_counter.year_fraction(self.from_date, self.to_date) )
def test_first_example_isda(self): day_counter = ActualActual(ISDA) self.assertAlmostEqual( 0.497724380567, day_counter.year_fraction(self.from_date, self.to_date))
def test_first_example_isma(self): day_counter = ActualActual(ISMA) self.assertAlmostEqual( 0.5, day_counter.year_fraction(self.from_date, self.to_date, self.ref_start, self.ref_end) )
def test_first_example_isda(self): day_counter = ActualActual(ISDA) self.assertAlmostEqual( 0.497724380567, day_counter.year_fraction(self.from_date, self.to_date) )
def test_short_calculation_second_period_isda(self): day_counter = ActualActual(ISDA) from_date = Date(1, July, 1999) to_date = Date(1, July, 2000) expected_result = 1.001377348600 self.assertAlmostEquals(expected_result, day_counter.year_fraction(from_date, to_date))
def test_short_calculation_first_period_afb(self): day_counter = ActualActual(AFB) from_date = Date(1, February, 1999) to_date = Date(1, July, 1999) expected_result = 0.410958904110 self.assertAlmostEquals(expected_result, day_counter.year_fraction(from_date, to_date))
def test_short_calculation_first_period_isma(self): day_counter = ActualActual(ISMA) from_date = Date(1, February, 1999) to_date = Date(1, July, 1999) ref_start = Date(1, July, 1998) ref_end = Date(1, July, 1999) expected_result = 0.410958904110 self.assertAlmostEquals( expected_result, day_counter.year_fraction(from_date, to_date, ref_start, ref_end))
def test_short_calculation_first_period_afb(self): day_counter = ActualActual(AFB) from_date = Date(1, February, 1999) to_date = Date(1, July, 1999) expected_result = 0.410958904110 self.assertAlmostEquals( expected_result, day_counter.year_fraction(from_date, to_date) )
def test_short_calculation_second_period_afb(self): day_counter = ActualActual(AFB) from_date = Date(1, July, 1999) to_date = Date(1, July, 2000) expected_result = 1.000000000000 self.assertAlmostEquals( expected_result, day_counter.year_fraction(from_date, to_date) )
def test_short_calculation_second_period_isma(self): day_counter = ActualActual(ISMA) from_date = Date(1, July, 1999) to_date = Date(1, July, 2000) ref_start = Date(1, July, 1999) ref_end = Date(1, July, 2000) expected_result = 1.000000000000 self.assertAlmostEquals( expected_result, day_counter.year_fraction(from_date, to_date, ref_start, ref_end))
def test_short_calculation_first_period_isma(self): day_counter = ActualActual(ISMA) from_date = Date(1, February, 1999) to_date = Date(1, July, 1999) ref_start = Date(1,July,1998) ref_end = Date(1,July,1999) expected_result = 0.410958904110 self.assertAlmostEquals( expected_result, day_counter.year_fraction(from_date, to_date, ref_start, ref_end) )
def test_short_calculation_second_period_isma(self): day_counter = ActualActual(ISMA) from_date = Date(1, July, 1999) to_date = Date(1, July, 2000) ref_start = Date(1, July, 1999) ref_end = Date(1, July, 2000) expected_result = 1.000000000000 self.assertAlmostEquals( expected_result, day_counter.year_fraction(from_date, to_date, ref_start, ref_end) )
def test_first_example_afb(self): day_counter = ActualActual(AFB) self.assertAlmostEqual( 0.497267759563, day_counter.year_fraction(self.from_date, self.to_date))