Possible Bug in Calendar::adjust

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

Possible Bug in Calendar::adjust

Chris Audley-3
I'm just starting to get familiar with QuantLib.  While looking at
Calendar, I've noticed what I believe is an error but I may be wrong.

In adjust with bday convention MonthEndReference, the function
Date::endOfMonth is called with the previous result of moving forward to
the next business day (d1).  I believe this should be called with the
original source date (d).

With the current code, if the original date (d) had been 7/31/2005, d1
would be 8/1/2005.  Following this logic, the result date (d1) would be
pushed forward to 8/31/2005.  Without knowing the rules for
MonthEndReference, I'd guess that the desired month end is July
(7/31/2005) giving a final result of 7/29/2005.

If nobody disputes my assertion, I'll submit a bug report.

Cheers
Chris


Reply | Threaded
Open this post in threaded view
|

RE: Possible Bug in Calendar::adjust

Chris Audley-3
My previous email was an error.  If the result date d1 has moved into
the next month, then the prior if statement (lines 57:59) will adjust
the original date to the previous business date.