Skip to main content

CurveDate

A CurveDate is used as the valuation date of a curve. It is a date with an expiry calendar

Construction

A CurveDate is constructed using a date and an expiry calendar as follows:

ondate = CurveDate(Date, ExpiryCalendar)

Here is an example of constructing a curve date:

eombus = ExpiryCalendar(BusinessCalendar())
eombus.addRule("go to the end of the previous month")
ondate = CurveDate(Date("2020-10-13"), eombus)

In the above example:

  1. We create a new ExpiryCalendar using a business calendar
  2. Add an expiry rule to go to the end of the previous month
  3. Create a CurveDate for a specific date and using the expiry calendar we used above

Properties

A CurveDate has the following properties:

NameDescriptionType
dowThe name of the day of the week, e.g. MondayScalar(String)
dayThe day of the monthScalar(Integer)
monthThe month of the year (1-12)Scalar(Integer)
monthNameThe name of the month, e.g. JanuaryScalar(String)
yearThe yearScalar(Integer)
hourThe hour of the day (0-23)Scalar(Integer)
minuteThe minute of the hour (0-59)Scalar(Integer)
secondThe second of the minute (0-59)Scalar(Integer)
calendarThe expiry calendar associated with this curve date (readonly)ExpiryCalendar

Example usage of properties:

// Creates a new curve date variable
eombus = ExpiryCalendar(BusinessCalendar())
eombus.addRule("go to the end of the previous month")
ondate = CurveDate(Date("2020-10-13"), eombus)

print datetime.hour
print datetime.minute
print datetime.second

Methods

The date variable has the following methods:

NameDescriptionReturns
next()Returns the next calendar day after this oneDate
next(Calendar)Returns the next day after this one using the supplied calendarDate
previous()Returns the previous calendar day before this oneDate
previous(Calendar)Returns the previous day before this one using the calendarDate
isHoliday(Calendar)Returns true is this date is a holiday in the supplied calendarScalar(Boolean)
getExpiry(Period)Gets the expiry date for the supplied period codeDate

Example using methods:

// Create a curve date for the 13th October 2020
eombus = ExpiryCalendar(BusinessCalendar())
eombus.addRule("go to the end of the previous month")
ondate = CurveDate(Date("2020-10-13"), eombus)

// Get the expiry date for the December 2020
print ondate.getExpiry("2020M12")