Login  Register

Japanese holiday rule have a tiny bug.

Posted by eisuke tani on Sep 11, 2016; 2:08pm
URL: http://quantlib.414.s1.nabble.com/Japanese-holiday-rule-have-a-tiny-bug-tp17715.html

Hi all,

From August 2016,
new public holiday "Mountain Day" was added to Japanese calendar.
This holiday is defined <ql/time/calendars/japan.cpp> in QuantLib.
But this code have a tiny bug.

Japanese holiday rule note that:
when holiday occurs Sunday, that holiday is shifted to Monday.
<ql/time/calendars/japan.cpp> line 89 doesn't take care of this rule.

So, I wrote following code to modify this bug.

Current code:
            || (d == 11  && m == August && y >= 2016)
Modified code:
            || ((d == 11 || (d == 12 && w == Monday)) && m == August
                && y >= 2016)

And, I wrote simple program to test whether it work fine.
(This web site is useful
  https://www.timeanddate.com/calendar/?year=2019&country=26)
Could you take consideration this code for next update?

Regards,
Eisuke Tani ( [hidden email] )

------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

japan.cpp (7K) Download Attachment
main.cpp (1K) Download Attachment