1
$\begingroup$

We have a data set up that provides us a list of holidays and weekends which is different from the country or currency calendars.Is there any method exposed in Quantlib calendars which expects a list of holday dates and weekends to form a calendar?

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Something like this?

myCalendar = ql.WeekendsOnly()
dates = ['19-06-2019', '07-05-2020']
for date in dates:
    myCalendar.addHoliday( ql.Date(date, '%d-%m-%Y') )

Or if for some reason the weekends are different, start from ql.NullCalendar()

$\endgroup$
1
  • 3
    $\begingroup$ This will modify all instances of WeekendsOnly and make it something different. Also, it can only be done for one calendar. I suggest using BespokeCalendar instead. $\endgroup$ Commented Jul 13, 2020 at 9:15

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