Advancing a Calendar by calendar (not business) days

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

Advancing a Calendar by calendar (not business) days

ChrisT
Hi,

I try to find a way to advance a Calendar object by a number of calendar (instead of business) days. For example, having as starting date "Dec. 31, 2012" I want to add 182 days to it.

I tried to do it with:

                Calendar calendar = UnitedStates();
                Date evaluationDate(31, December, 2012);
                int tenor = 182;
                Period p(tenor, Days);
                Date maturityDate = calendar.advance(evaluationDate, p, Unadjusted);

but the result is a maturity date in September (September 19th, 2013). How can I tell Calendar that these are calendar (and not business) days?

Notice that if I convert the 182 days to months, e.g.,

    Period p(6, Months);

I get "June 30th, 2013".

However, this is not an option as all tenors are coming as days (e.g., 34 days, 35 days etc.) and converting them to months will result in truncation.

Thanks,
Chris

Reply | Threaded
Open this post in threaded view
|

Re: Advancing a Calendar by calendar (not business) days

Luigi Ballabio
In this case, you don't use a calendar at all. You can write:

Date evaluationDate(31, December, 2012);
int tenor = 182;
Period p(tenor, Days);
Date maturityDate = evaluationDate + p;

or simply:

Date maturityDate = evaluationDate + 182;

Luigi


On Wed, May 4, 2016 at 11:38 AM ChrisT <[hidden email]> wrote:
Hi,

I try to find a way to advance a Calendar object by a number of calendar
(instead of business) days. For example, having as starting date "Dec. 31,
2012" I want to add 182 days to it.

I tried to do it with:

                Calendar calendar = UnitedStates();
                Date evaluationDate(31, December, 2012);
                int tenor = 182;
                Period p(tenor, Days);
                Date maturityDate = calendar.advance(evaluationDate, p, Unadjusted);

but the result is a maturity date in September (September 19th, 2013). How
can I tell Calendar that these are calendar (and not business) days?

Notice that if I convert the 182 days to months, e.g.,

    Period p(6, Months);

I get "June 30th, 2013".

However, this is not an option as all tenors are coming as days (e.g., 34
days, 35 days etc.) and converting them to months will result in truncation.

Thanks,
Chris





--
View this message in context: http://quantlib.10058.n7.nabble.com/Advancing-a-Calendar-by-calendar-not-business-days-tp17436.html
Sent from the quantlib-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users