def bizDatesList(holidayCenter, fromDate, toDate): cal = Calendar(holidayCenter) fromDate = check_date(fromDate) toDate = check_date(toDate) assert fromDate <= toDate, "from date ({0} must be earlier than to date {1}".format( fromDate, toDate) return [d.toDateTime() for d in cal.bizDatesList(fromDate, toDate)]
def makeSchedule(firstDate, endDate, tenor): cal = Calendar('NullCalendar') firstDate = check_date(firstDate) endDate = check_date(endDate) tenor = Period(tenor) schedule = Schedule(firstDate, endDate, tenor, cal) return [d.toDateTime() for d in schedule]
def datesList(fromDate, toDate): fromDate = check_date(fromDate) toDate = check_date(toDate) assert fromDate <= toDate, "from date ({0} must be earlier than to date {1}".format( fromDate, toDate) return [ Date.fromExcelSerialNumber(serial).toDateTime() for serial in range(fromDate.serialNumber, toDate.serialNumber + 1) ]
def makeSchedule(firstDate, endDate, tenor, calendar='NullCalendar', dateRule=BizDayConventions.Following): cal = Calendar(calendar) firstDate = check_date(firstDate) endDate = check_date(endDate) tenor = Period(tenor) schedule = Schedule(firstDate, endDate, tenor, cal, convention=dateRule) return [d.toDateTime() for d in schedule]
def advanceDateByCalendar(holidayCenter, referenceDate, period, convention=BizDayConventions.Following): cal = Calendar(holidayCenter) refer = check_date(referenceDate) return cal.advanceDate(refer, period, convention).toDateTime()
def advanceDate(referenceDate, period): d = check_date(referenceDate) + period return d.toDateTime()
def holDatesList(holidayCenter, fromDate, toDate, includeWeekend=True): cal = Calendar(holidayCenter) fromDate = check_date(fromDate) toDate = check_date(toDate) assert fromDate <= toDate, "from date ({0} must be earlier than to date {1}".format(fromDate, toDate) return [d.toDateTime() for d in cal.holDatesList(fromDate, toDate, includeWeekend)]
def datesList(fromDate, toDate): fromDate = check_date(fromDate) toDate = check_date(toDate) assert fromDate <= toDate, "from date ({0} must be earlier than to date {1}".format(fromDate, toDate) return [Date.fromExcelSerialNumber(serial).toDateTime() for serial in range(fromDate.serialNumber, toDate.serialNumber + 1)]
def isBizDay(holidayCenter, ref): cal = Calendar(holidayCenter) ref = check_date(ref) return cal.isBizDay(ref)