I figured out that the C++ version of QuantLib offers a function called holidayList in the calendar class.

//! Returns the holidays between two dates
static std::vector<Date> holidayList(const Calendar& calendar,
                                     const Date& from,
                                     const Date& to,
                                     bool includeWeekEnds = false);

I tried to get all holidays between two dates by using this call:

TARGET_calendar = TARGET()
TARGET_calendar.holidayList(TARGET_calendar, Date(1,1,2015), Date(1,1,2016))

AttributeError: 'TARGET' object has no attribute 'holidayList'

Since I am not so familliar with converting C++ to Python, I also tried:

holidayList(TARGET_calendar, Date(1,1,2015), Date(1,1,2016))

NameError: name 'holidayList' is not defined

Can anybody help me out, please?

Thank you very much!


2 Answers 2


The holidayList() function is not exposed in Python: https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/calendars.i

You can submit an issue asking for it to be added, or do it yourself via a pull request or just locally but in this last case you'd have to rebuild the QuantLib Python library, etc.

As a workaround, you can use the isHoliday() function in order to get this list, combined with isWeekend() if you want want to exclude the weekends from the holidays list:

TARGET_calendar = TARGET()
date = Date(1,1,2015)
holiday_list = []
while date < Date(1,1,2016):
    if(TARGET_calendar.isHoliday(date) and not
    date = date + Period(1, Days)
  • $\begingroup$ In case you want to open an issue, the place to do it is github.com/lballabio/QuantLib-SWIG/issues. $\endgroup$ Commented May 14, 2018 at 9:09
  • $\begingroup$ Dear byouness, dear Luigi! Thank you very much for your answers. The workaround warks like a charm. Thanks! Unfortunately I am a beginner in Python and have no idea about C++ so I am not able to integrate the function myself. I have opened an issue here: github.com/lballabio/QuantLib-SWIG/issues/112 $\endgroup$
    – Bernd
    Commented May 14, 2018 at 15:36
  • $\begingroup$ Hello @BerndMeyer! Glad that this helped. If it answers your question, please mark it as accepted so that people who have the same question can find it more quickly. Thanks. $\endgroup$
    – byouness
    Commented Jun 5, 2018 at 16:12

not quantlib, but with dateroll you can do ddh.hols.NY['7/1/93':'7/1/94']

  • $\begingroup$ Thank you @mike, this looks very cool, but 1 it would be even better if for transparency/explainability purposes the function could be asked to return not only a list of dates, but also the reasons, e.g. if the holidays are USGS union London, then 12/25 is Christmas in US and London, while 12/26 is Boxing day in London 2 I'm not sure if one can do this in Python, but it would be good to easily override the holiday calendars / schedulers built into QuantLib / FinenancePy / rateslib to use dateroll instead. $\endgroup$ Commented Apr 10 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.