Menu

#152 mistake in calendar?

closed-fixed
None
5
2012-11-06
2012-09-16
No

I think there is a mistake in your implementation of the holidays of the Japanese calendar. It seems to produce a different answer as to the "golden week" which is a series of holidays in the beginning of May in Japan. The results are inconsistent with other calculators such as Bloomberg. I also compared your code with legal Japanese websites and I believe there is a misunderstanding in your code as to what happens when one or more of the holidays fall in a week-end.

Best Regards,

Sebastien

Discussion

  • Luigi Ballabio

    Luigi Ballabio - 2012-09-17

    May you provide some examples of correct data?

     
  • Sebastien Gurrieri

    On this link we can see that 07/05/2013 is a business day in Japan

    http://portalseven.com/calendar/Holidays_Japan.jsp?year=2013

    and this is consistent with what I see in Bloomberg. As you can see at the bottom of this page, the “Greenery day”, on the 4th, falls on a Saturday while the Children’s Day falls on the Sunday 5th. I checked the QuantLib code, and it seems to consider that any day in the 3rd, 4th, and 5th, that falls on a week-end will be compensated by a holiday on the week after that, and for example, when the 4th is a Saturday and the 5th is a Sunday, 2 days will be compensated in QuantLib, yielding a holiday on the 7th. The QuantLib addin accordingly answers that the 7th is a holiday, which does not seem to be in line with Japanese rules. Indeed, the rule is that only when such a day falls on a Sunday will it be compensated for.

    See the reference

    http://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html

    Sorry for the Japanese, but here is the sentence saying it in the link above

    また、「国民の祝日」が日曜日に当たるときは、その日後においてその日に最も近い「国民の祝日」でない日を休日とすることになりました。

    I’m not a Japanese native so I checked by asking around me to Japanese people, and they confirmed the Sunday-only rule (I work in a Japanese bank).
    This rule is indeed consistent with what is observed in the first link for 2013. Currently the code is (I’m still on the 1.2.0)

    || (d == 3 && m == May)
    // Holiday for a Nation
    || (d == 4 && m == May)
    // Children's Day
    || (d == 5 && m == May)
    // any of the three above observed later if on Saturday or Sunday
    || ((d == 6 || d == 7) && m == May
    && (w == Monday || w == Tuesday || w == Wednesday))

    but I’m thinking that

    || (d == 3 && m == May)
    // Holiday for a Nation
    || (d == 4 && m == May)
    // Children's Day
    || (d == 5 && m == May)
    // any of the three above observed later if on Saturday or Sunday
    || (d == 6 && m == May
    && (w == Monday || w == Tuesday || w == Wednesday))

    would probably be more in line with what the official rule seems to be.

    Best regards,

    Sebastien

     
  • Luigi Ballabio

    Luigi Ballabio - 2012-11-06

    The patch was applied to the Subversion repository.
    Thank you for the report and the fix.

     
  • Luigi Ballabio

    Luigi Ballabio - 2012-11-06
    • assigned_to: nobody --> lballabio
    • status: open --> closed-fixed
     

Log in to post a comment.