Question on Calendar advance method

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

Question on Calendar advance method

Shuo Wang-2
Hi,

I have read the code in calendar.cpp

Date Calendar::advance(const Date& d,
                           Integer n, TimeUnit unit,
                           BusinessDayConvention c,
                           bool endOfMonth) const{...}

It seems when the TimeUnit is Days, the method advances n Business
Days, if this is the case, the BusinessDayConvetion is actually not
useful, because, if I advance (1, Days) from 25th Nov, 2011 with
Unadjusted BusinessDayConvention, I will end up at 28th Nov, 2011,
which is the same as ModifiedFollowing and Following.

This seems to be contradicting to the meaning of unadjusted?



--
王硕
邮箱:[hidden email]
Whatever your journey, keep walking.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Question on Calendar advance method

Luigi Ballabio
2011/11/29 Shuo Wang <[hidden email]>:

> I have read the code in calendar.cpp
>
> Date Calendar::advance(const Date& d,
>                           Integer n, TimeUnit unit,
>                           BusinessDayConvention c,
>                           bool endOfMonth) const{...}
>
> It seems when the TimeUnit is Days, the method advances n Business
> Days, if this is the case, the BusinessDayConvetion is actually not
> useful, because, if I advance (1, Days) from 25th Nov, 2011 with
> Unadjusted BusinessDayConvention, I will end up at 28th Nov, 2011,
> which is the same as ModifiedFollowing and Following.
>
> This seems to be contradicting to the meaning of unadjusted?

True, but I don't see any easy way out of this.  The solution would be
to have separate time units for business days and calendar days, but
it's going to be difficult do that without breaking a lot of code.
It's probably something we'll fix in the next big release.

Luigi

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users