Login  Register

Re: Schedule end of month business day convention

Posted by Luigi Ballabio on Jun 06, 2014; 9:01am
URL: http://quantlib.414.s1.nabble.com/Schedule-end-of-month-business-day-convention-tp15402p15403.html

You want the last business day of the month, so you take the last day
of the month and adjust it backwards. If you adjusted it forward,
you'd get the first business day of the following month instead.

Luigi

On Fri, Jun 6, 2014 at 10:56 AM, Francois Botha <[hidden email]> wrote:

> Hi,
>
> In schedule.cpp, lines 349 - 355:
>
>             if (convention == Unadjusted) {
>                 for (Size i=1; i<dates_.size()-1; ++i)
>                     dates_[i] = Date::endOfMonth(dates_[i]);
>             } else {
>                 for (Size i=1; i<dates_.size()-1; ++i)
>                     dates_[i] = calendar_.endOfMonth(dates_[i]);
>             }
>
> And calendar.hpp: lines 207-209:
>
>     inline Date Calendar::endOfMonth(const Date& d) const {
>         return adjust(Date::endOfMonth(d), Preceding);
>     }
>
> This is applicable when the endOfMonth rule is true. If the business day
> convention is Unadjusted, it works fine, but if the business day convention
> is e.g. Modified Following, the second part of the code is executed. But
> calendar_.endOfMonth is hardcoded to use Preceding. The actual business day
> convention isn't passed through. Is this a bug or maybe I don't understand
> something?
>
> regards
> Francois Botha
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev