Posted by
japari on
Dec 04, 2012; 10:25am
URL: http://quantlib.414.s1.nabble.com/credit-on-Saturdays-tp13782.html
If I define CDS helpers on a Saturday. The curve ref date is then the next monday.
Now use the curve to price a coupon with that Saturday (i.e. today) placed within the coupon period, that date becomes the effective start date for the coupon and the pricing fails because of the negative time requested to the default probability (see below)
I am not saying it is a bug. Something similar happens in FI defining a reference date for an index on a Saturday and calling for a fixing which now falls before the index ref date.
Anyway, all this to ask you what do you think of modifying the code below
(see: ql/termstructures/defaulttermstructure.cpp)
-------------------------------------------------------------------------------
Probability DefaultProbabilityTermStructure::defaultProbability(
const Date& d1,
const Date& d2,
bool extrapolate) const {
QL_REQUIRE(d1 <= d2,
"initial date (" << d1 << ") "
"later than final date (" << d2 << ")");
Probability p1 = (d1<=referenceDate()) ? 0. : defaultProbability(d1,extrapolate);//<<<<<<<<<<
Probability p2 = defaultProbability(d2,extrapolate);
return p2 - p1;
}
-------------------------------------------------------------------------------
and similarly for the Time version.
It bypasses the negative time check by assuming survival before the curve reference date.
What do you think?
Best regards
Pepe
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev