-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using instance evaluationDate when creating holidays in a calendar #2083
Comments
You may create your own calendar class (or instance if Python) by using a customized calendar (e.g. BespokeCalendar) and combine some methods (removeHolidays, addHolidays) to create an old one from the updated one. |
I see—you're saying that if a new holiday is declared in 2024, calculations made with evaluation date in 2023 should not consider it because at that point in time the holiday didn't exist. It makes sense, but it's tricky to implement—we could check the evaluation date in the calendar method, as you say, but we'd have confusing cases like this one. Let's say we have a new holiday
we'll have a bond evaluated one week before
we'll have the same bond also evaluated one week before I'm not sure what the right thing to do would be. Both of the above are sensible, and one would expect them to have the same result. I might be inclined to leave it to the user to add or remove holidays explicitly depending on the evaluation date... |
I didn't think properly about side effects. It is better using the calendars as reference implementation if changing holidays automagically may lead to unpredictable results. The application, not QuantLib, would take care of fine tuning the holidays. |
After upgrading from QuantLib (Python) 1.29 to 1.35 realized that #1879 broke some of my tests due to new holidays added to Brazil calendar.
I made a quick (and dirty) fix by upgrading my tests to a newer date, but I understand that should not be the proper solution for a regression test because the previous calculation are not wrong.
How about using the instance evaluationDate in order to test if a holiday should exist in that date? If a law in, let's say, 2023 creates a calendar em 2024, may calculation as of 2022 should give the plain old values.
I can try adding this rule to Brazil calendar if you understand that makes sense.
The text was updated successfully, but these errors were encountered: