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 |
It doesn't seem bad to me. Any others wanting to weigh in?
Luigi On Tue, Dec 4, 2012 at 11:25 AM, <[hidden email]> wrote: > > 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 ------------------------------------------------------------------------------ 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 |
Hi Pepe,
since there were no objections, I've added the fix to the repository. Later, Luigi On Fri, Dec 14, 2012 at 11:49 AM, Luigi Ballabio <[hidden email]> wrote: > It doesn't seem bad to me. Any others wanting to weigh in? > > Luigi > > > On Tue, Dec 4, 2012 at 11:25 AM, <[hidden email]> wrote: >> >> 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 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Great,
thank you. Pepe ----- Original Message ----- From: "Luigi Ballabio" <[hidden email]> To: [hidden email] Cc: [hidden email] Sent: Monday, 4 March, 2013 3:18:10 PM Subject: Re: [Quantlib-dev] credit on Saturdays Hi Pepe, since there were no objections, I've added the fix to the repository. Later, Luigi On Fri, Dec 14, 2012 at 11:49 AM, Luigi Ballabio <[hidden email]> wrote: > It doesn't seem bad to me. Any others wanting to weigh in? > > Luigi > > > On Tue, Dec 4, 2012 at 11:25 AM, <[hidden email]> wrote: >> >> 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 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |