Japanese holiday rule have a tiny bug.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Japanese holiday rule have a tiny bug.

eisuke tani
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
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
Reply | Threaded
Open this post in threaded view
|

Re: Japanese holiday rule have a tiny bug.

Luigi Ballabio
Hello,
    thanks for the patch. Yes, I'll add it to next release.

Luigi


On Sun, Sep 11, 2016 at 5:29 PM eisuke tani <[hidden email]> wrote:
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
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

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

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