Skip to content
All library documents

QuantLib Holiday Calendars Require an Explicit Date Range

Article Quant Q&A · Author: Betabr

Summary

The discussion asks whether QuantLib can return every holiday currently published for an exchange calendar without specifying start and end dates. The answer says this is not available as a range-free listing, so a user seeking the NYSE holidays would need to choose a date interval and use a holiday-listing function or otherwise set the interval in their workflow.

It also explains why a holiday list can need more context than dates alone. When calendars are combined, a date may be non-business for different reasons in different markets, such as a weekend or a locally observed holiday. The answer describes an alternative calendar tool that would report the reason for each date and the calendar or calendars involved. This is a brief software capability discussion rather than a detailed implementation guide; it gives no code or comparison of calendar coverage, and its examples illustrate the concept rather than documenting QuantLib output.

Key ideas

  • QuantLib’s holiday listing requires a specified start and end date.
  • A script that retrieves holidays must supply a date interval for the calendar query.
  • Combined calendars can mark a date as a holiday for different reasons in different markets.
  • Explaining each holiday’s cause and calendar can be as useful as listing the date itself.

Tags

Full text
# Using QuantLib to get all holidays currently published by an exchange in multiyears without specifying a range


# Using QuantLib to get all holidays currently published by an exchange in multiyears without specifying a range












Is there a way to get a list of all the holidays published in an exchange calendar without specifying a date range? For example, NYSE has published their holiday calendar up to 2024 and I want to see if I could get all holidays as published in NYSE calendar without the need to do any updates in the script to arrange the date range. https://www.nyse.com/markets/hours-calendars

If there is no option, I will use the solution provided here: QuantLib-Python: Getting a list of all holidays between D1 & D2 with function "holidayList"

Thank you very much and happy new year! :) Roberta

## Answer by Dimitri Vulis (score 1)

https://quant.stackexchange.com/a/69304

There isn't.

Many years ago I wrote a funcion similar to QL's holidayList in another (proprietery) library. However in addition to listing holidays, mine explained why each date is a holiday. Also a term sheet often references a union of two or more holiday calendars. Something along the lines of:

input:

Holiday calendars: NYB and London

Start date: December 20, 2021

End date: December 30, 2021

Made-up Output:

December 24, 2021 - Christmas Day Observed (NYB)

December 25, 2021 - Saturday (NYB&London), Christmas Day (NYB&London)

December 26, 2021 - Sunday (NYB&London), Boxing Day (London)

December 27, 2021 - Boxing Day Observed (London)

December 28, 2021 - Christmas Day Observed (London)

(Other holiday calendars have St. Stephens Day, Christmas Eve, bridging days, et al in late December. Knowing that a date is a holiday, without the explanation, is just half the story.)

Related question: Quantlib Calendar Advance

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.