add_calendar
The add_calendar
method adds a new business calendar to the set of available options.
Syntax
add_calendar(cal: Union[BusinessCalendar, str]) -> None
Parameters
Parameter | Type | Description |
---|---|---|
cal | Union[BusinessCalendar, str] | A |
Returns
None.
Example
The following code block adds a new business calendar, TestCalendar_2024.calendar
, to the set of available business calendars. This calendar can be found in the examples repository.
from deephaven.calendar import add_calendar, calendar
add_calendar("/data/examples/Calendar/TestCalendar_2024.calendar")
test_2024_cal = calendar("TestCalendar_2024")
Business calendar files should be formatted as:
<calendar>
* <name>CalendarName</name>
* <!-- Optional description -->
* <description>Example calendar</description>
* <timeZone>America/Chicago</timeZone>
* <default>
* <businessTime><open>08:30</open><close>16:30</close></businessTime>
* <weekend>Saturday</weekend>
* <weekend>Sunday</weekend>
* </default>
* <!-- Optional firstValidDate. Defaults to the first holiday. -->
* <firstValidDate>1999-01-01</firstValidDate>
* <!-- Optional lastValidDate. Defaults to the first holiday. -->
* <lastValidDate>2003-12-31</lastValidDate>
* <holiday>
* <date>1999-01-01</date>
* </holiday>
* <holiday>
* <date>2002-07-05</date>
* <businessTime>
* <open>09:30</open>
* <close>13:00</close>
* </businessTime>
* </holiday>
* </calendar>