firstDate and terminationDate in ql/time/schedule.cpp

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

firstDate and terminationDate in ql/time/schedule.cpp

Pascal Haakmat
Dear list,

A quick question regarding
https://github.com/lballabio/quantlib/blob/master/QuantLib/ql/time/schedule.cpp:

Lines 137-141 contain the following code:

                QL_REQUIRE(firstDate_ > effectiveDate &&
                           firstDate_ < terminationDate,
                           "first date (" << firstDate_ <<
                           ") out of effective-termination date range [" <<
                           effectiveDate << ", " << terminationDate << ")");

However, it seems that the condition should be firstDate_ >
effectiveDate && firstDate_ <= terminationDate. Otherwise it is not
possible to have a first (and only) coupon fall on maturity. The use of
")" and "]" in the error message also seems to suggest that this should
be the case, when compared to lines 165-169, where a similar check is
performed for nextToLastDate_.

Is there a reason why this condition is exclusive rather than inclusive
wrt terminationDate?

Thanks,
Pascal


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: firstDate and terminationDate in ql/time/schedule.cpp

Luigi Ballabio
Hi Pascal,
    for a single coupon on maturity I would use no first date and DateGeneration::Zero as the rule. That combination doesn't perform the check above.
If that doesn't work, do you have a test case and its expected output?

Luigi


On Tue, Jul 14, 2015 at 5:56 PM Pascal Haakmat <[hidden email]> wrote:
Dear list,

A quick question regarding
https://github.com/lballabio/quantlib/blob/master/QuantLib/ql/time/schedule.cpp:

Lines 137-141 contain the following code:

                QL_REQUIRE(firstDate_ > effectiveDate &&
                           firstDate_ < terminationDate,
                           "first date (" << firstDate_ <<
                           ") out of effective-termination date range [" <<
                           effectiveDate << ", " << terminationDate << ")");

However, it seems that the condition should be firstDate_ >
effectiveDate && firstDate_ <= terminationDate. Otherwise it is not
possible to have a first (and only) coupon fall on maturity. The use of
")" and "]" in the error message also seems to suggest that this should
be the case, when compared to lines 165-169, where a similar check is
performed for nextToLastDate_.

Is there a reason why this condition is exclusive rather than inclusive
wrt terminationDate?

Thanks,
Pascal


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
--

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users