Skip to main content


A calendar variable type represents an ODSL Calendar. It is used with timeseries, curves and other time-bound resources. See here for more detailed information on ODSL Calendars


The calendar variable wraps a standard ODSL calendar and allows you to use the calendar in your scripts.


Calendars are usually read from the Calendar Service and referenced using their code, e.g. “business”, but some basic calendars can be constructed as follows:

// Create a daily calendar
daily = DailyCalendar()

// Create a business (Monday to Friday) calendar
business = BusinessCalendar()

// Create an empty holiday calendar
holiday = HolidayCalendar()

// Create a monthly calendar
monthly = MonthlyCalendar()

// Create an hourly calendar
hourly = IntradayCalendar(1h)

Create an hourly calendar using a holiday calendar and
exclude hours 0-6 and 20-23
peak = IntradayCalendar(1h, holiday, [0,1,2,3,4,5,6,20,21,22,23])


A calendar has the following properties:

codeThe code of the underlying ODSL CalendarScalar(String)
nameThe name of the underlying ODSL CalendarScalar(String)


A calendar has the following methods:

NameDescriptionReturn Type
getDates(start, end)Gets a list of dates from this calendar for the supplied date rangeList(Date)
getDates(start, number)Gets number + 1 list of dates from the supplied start dateList(Date)
includes(Date)Tests to see if the supplied date aligns with this calendarScalar(Boolean)
next(Date)Gets the next date after the supplied dateDate
previous(Date)Gets the previous date before the supplied dateDate
addRule(String)Adds a holiday rule (Only applicable for holiday calendars)void

Some example usage

// Create a daily calendar
daily = DailyCalendar()

first = Date("2020-10-01")
last = Date("2020-10-31")


// Create an empty holiday calendar
holiday = HolidayCalendar()

// Add some rules
holiday.addRule("Every Saturday")
holiday.addRule("Every Sunday")
holiday.addRule("First Tuesday in October")

// Get the list of dates for October 2020
dates = holiday.getDates(first, last)

print dates