Login  Register

Error when using a Cubic interpolator for PiecewiseYieldCurve

Posted by Robert Philipp on Jul 29, 2010; 5:31pm
URL: http://quantlib.414.s1.nabble.com/Error-when-using-a-Cubic-interpolator-for-PiecewiseYieldCurve-tp7607.html

I'm just starting out with QuantlLib and started going through the examples . In an attempt to get smoother forwards, I would like to use a cubic (or log-cubic, or monotonic) interpolator instead of the log-linear interpolator. So I modified the example code "swapvaluation.cpp" by replacing

        boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
            new PiecewiseYieldCurve< Discount, LogLinear>(
                                       settlementDate, depoFutSwapInstruments,
                                       termStructureDayCounter,
                                       tolerance));

with
        boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
            new PiecewiseYieldCurve< Discount, Cubic >(
                                       settlementDate, depoFutSwapInstruments,
                                       termStructureDayCounter,
                                       tolerance));

I get the following error message:
        1st iteration: failed at 10th instrument, maturity December 20th, 2006, reference date September 22nd, 2004:
        root not bracketed: f[2.22045e-016,0.932437] -> [-3.323214e+018,-3.911669e+000]

The full output is:
        Today: Monday, September 20th, 2004
        Settlement date: Wednesday, September 22nd, 2004
        ====================================================================
        5-year market swap-rate = 4.43 %
        ====================================================================
                5-years swap paying 4.00 %
        term structure | net present value | fair spread | fair fixed rate |
        --------------------------------------------------------------------
             depo-swap |          19065.88 |     -0.42 % |          4.43 % |
        1st iteration: failed at 10th instrument, maturity December 20th, 2006, reference date September 22nd, 2004:
        root not bracketed: f[2.22045e-016,0.932437] -> [-3.323214e+018,-3.911669e+000]


Is there something additional I must do when using an interpolator other than LogLinear?

Thanks,
-- 
Robert Philipp
Synapse Financial Engineering
703.623.4063 (mobile)
703.573.0119 (fax)

[hidden email]
www.synapsefe.com

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users