Bootstapping hazard rates with non-linear interpolators

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

Bootstapping hazard rates with non-linear interpolators

ChrisT
Hi,

I have been using QuantLib 1.6.2 to extract the hazard rates from a CDS curve. The relevant code is similar to the example "CDS.cpp" that comes with the QuantLib distribution, i.e.,

boost::shared_ptr<PiecewiseDefaultCurve<HazardRate, BackwardFlat> > hazardRateStructure(new PiecewiseDefaultCurve<HazardRate, BackwardFlat> (todaysDate, instruments, Actual365Fixed()));


I tried to experiment with different non-linear interpolation methods (instead of "BackwardFlat" used above), i.e.,

        CubicNaturalSpline
        KrugerCubic
        Parabolic
        FritschButlandCubic
        MonotonicParabolic

but I am getting the error "no appropriate default constructor available". What is the proper way of passing one of  these interpolators to the PiecewiseDefaultCurve class?

Thank you,

Chris
Reply | Threaded
Open this post in threaded view
|

Re: Bootstapping hazard rates with non-linear interpolators

Luigi Ballabio
Hello,
    the classes you're listing are the actual interpolation classes, but the curve is expecting a corresponding factory class (for instance, BackwardFlat in the example is the factory for the BackwardFlatInterpolation class).  In the case of cubic interpolations, you'll have to use the Cubic class. By default, it builds Kruger interpolations (I'm not aware of the reason for the choice) so if you write:

PiecewiseDefaultCurve<HazardRate, Cubic>(todaysDate, instruments, Actual365Fixed())

you'll get a curve using the KrugerCubic class.  To get the other interpolations, you can pass a Cubic instance with the corresponding parameters (you can look them up in the constructors of the interpolation classes); for instance, 

PiecewiseDefaultCurve<HazardRate, Cubic>(todaysDate, instruments, Actual365Fixed(),
                                         1e-12, Cubic(CubicInterpolation::Spline, false))

will give you a curve using the CubicNaturalSpline class, and

PiecewiseDefaultCurve<HazardRate, Cubic>(todaysDate, instruments, Actual365Fixed(),
                                         1e-12, Cubic(CubicInterpolation::Parabolic, true))

will use the MonotonicParabolic class.

Luigi


On Tue, Apr 26, 2016 at 5:10 PM ChrisT <[hidden email]> wrote:
Hi,

I have been using QuantLib 1.6.2 to extract the hazard rates from a CDS
curve. The relevant code is similar to the example "CDS.cpp" that comes with
the QuantLib distribution, i.e.,

boost::shared_ptr<PiecewiseDefaultCurve&lt;HazardRate, BackwardFlat> >
hazardRateStructure(new PiecewiseDefaultCurve<HazardRate, BackwardFlat>
(todaysDate, instruments, Actual365Fixed()));


I tried to experiment with different non-linear interpolation methods
(instead of "BackwardFlat" used above), i.e.,

        CubicNaturalSpline
        KrugerCubic
        Parabolic
        FritschButlandCubic
        MonotonicParabolic

but I am getting the error "no appropriate default constructor available".
What is the proper way of passing one of  these interpolators to the
PiecewiseDefaultCurve class?

Thank you,

Chris




--
View this message in context: http://quantlib.10058.n7.nabble.com/Bootstapping-hazard-rates-with-non-linear-interpolators-tp17424.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