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 |
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, ------------------------------------------------------------------------------ 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 |
Free forum by Nabble | Edit this page |