Introducing Deephaven's new calendar API

Enhanced calendar functions boost performance

April 5 2024

Elijah PettyElijah PettyTechnical Writer @Deephaven
AI prompt: a line chart sitting on top of a monthly calendar with visible dates

Deephaven 0.32.0 introduced a number of new features, as well as improvements to old ones. Key features of the overhauled calendar API include:

  • An updated Java calendar API that boosts performance in table operations.
  • A streamlined Python API designed to minimize the chances of calling Python from query strings.
  • Simple and intuitive naming conventions for ease of use.
  • Support for user-defined calendars.
  • Conversion between Deephaven and NumPy calendar formats.

New calendar methods

The new Python API is designed to be minimal, and facilitate the use of the Java API in query strings. The new calendar class provides the following methods:

MethodDescription
add_calendarAdds a new business calendar to the set of available options.
calendarRetrieves the calendar with the given name.
calendar_nameReturns the name of the default calendar.
calendar_namesReturns the names of all available calendars.
remove_calendarRemoves the given business calendar from the set of available options.
set_calendarSets the default calendar.

Example calendars

Deephaven provides three example calendars: USBANK_EXAMPLE, USNYSE_EXAMPLE, and UTC.

Note

These example calendars are intended for learning, demonstration, and testing purposes - not production. Deephaven makes no guarantees about the accuracy of these calendars.

User-defined business calendars

Deephaven now allows users to create their own business calendars. First, create an XML file for the calendar.

To view the example calendar's XML format, click here.

Now add it to the list of available calendars:

Convert calendars to numpy business calendars

Deephaven's numpy module has been updated with the to_np_busdaycalendar method, which converts a Deephaven calendar to a numpy business calendar:

Reach out

Our Community documentation has all of the resources you need to become a Deephaven power user. Our Slack community continues to grow, and we'd love to have you join us! If you have any questions, comments, or suggestions, please reach out to us there.