Esempio n. 1
0
def test_FinDayCount():

    testCases.header("DAY_COUNT_METHOD", "START", "END", "ALPHA")

    finFreq = FrequencyTypes.ANNUAL

    for dayCountMethod in DayCountTypes:

        start_date = Date(1, 1, 2019)
        next_date = start_date
        numDays = 20
        dayCount = DayCount(dayCountMethod)

        for _ in range(0, numDays):
            next_date = next_date.addDays(7)
            dcf = dayCount.year_frac(start_date, next_date, next_date, finFreq)

            testCases.print(str(dayCountMethod), str(start_date),
                            str(next_date), dcf[0])
Esempio n. 2
0
def test_year_frace_ACT_360():
    day_count_type = DayCountTypes.ACT_360
    day_count = DayCount(day_count_type)
    answer = day_count.year_frac(start, end, end, finFreq)

    assert round(answer[0], 4) == 0.3889
Esempio n. 3
0
def test_year_frace_SIMPLE():
    day_count_type = DayCountTypes.SIMPLE
    day_count = DayCount(day_count_type)
    answer = day_count.year_frac(start, end, end, finFreq)

    assert round(answer[0], 4) == 0.3836
Esempio n. 4
0
def test_year_frace_THIRTY_E_360_ISDA():
    day_count_type = DayCountTypes.THIRTY_E_360_ISDA
    day_count = DayCount(day_count_type)
    answer = day_count.year_frac(start, end, end, finFreq)

    assert round(answer[0], 4) == 0.3889