예제 #1
0
def test_Calendar():

    setDateFormatType(DateFormatTypes.US_LONGEST)
    end_date = Date(31, 12, 2030)

    for calendar_type in CalendarTypes:

        testCases.banner("================================")
        testCases.banner("================================")

        testCases.header("CALENDAR", "HOLIDAY")
        testCases.print("STARTING", calendar_type)

        cal = Calendar(calendar_type)
        next_date = Date(31, 12, 2020)

        while next_date < end_date:
            next_date = next_date.addDays(1)

            if next_date._d == 1 and next_date._m == 1:
                testCases.banner("================================")
#                print("=========================")

            isHolidayDay = cal.isHoliday(next_date)
            if isHolidayDay is True:
                testCases.print(cal, next_date)
#                print(cal, next_date)

    setDateFormatType(DateFormatTypes.US_LONG)
예제 #2
0
def test_DateFormat():

    dt = Date(20, 10, 2019)

    for formatType in DateFormatTypes:
        setDateFormatType(formatType)
        print(formatType.name, dt)
예제 #3
0
def test_FinDateFormat():

    dt = Date(20, 10, 2019)
    testCases.header("FORMAT", "DATE")

    for formatType in DateFormatTypes:
        setDateFormatType(formatType) 
        testCases.print(formatType.name, dt)
예제 #4
0
import numpy as np
import time

import sys
sys.path.append("..")

from financepy.utils.date import Date, dateRange
from financepy.utils.date import DateFormatTypes
from financepy.utils.date import setDateFormatType

from FinTestCases import FinTestCases, globalTestCaseMode
testCases = FinTestCases(__file__, globalTestCaseMode)

###############################################################################

setDateFormatType(DateFormatTypes.UK_LONGEST)

def test_FinDate():

    start_date = Date(1, 1, 2018)

    assert Date(1, 1, 2018) == Date.fromString('1-1-2018', '%d-%m-%Y')

    testCases.header("DATE", "MONTHS", "CDS DATE")

    for numMonths in range(0, 120):
        nextCDSDate = start_date.nextCDSDate(numMonths)
        testCases.print(str(start_date), numMonths, str(nextCDSDate))

    start_date = Date(1, 1, 2018)