Re: Error when using a Cubic interpolator for PiecewiseYieldCurve
Posted by
MikeD on
Aug 04, 2010; 1:42am
URL: http://quantlib.414.s1.nabble.com/Error-when-using-a-Cubic-interpolator-for-PiecewiseYieldCurve-tp7607p7609.html
you need to pair the interpolation method correctly with the curve output...
if using discount factors:
MonotonicLogCubicNaturalSpline or LogLinear should work
if using zero rates:
try MonotonicCubicNaturalSpline or CubicNaturalSpline
the reason you are getting an error is because the bootstrapping for the entire curve cant be completed with the interpolation method you selected (cubic on discount factors). even if it did work, the swap rates you would have received would have been off-market.
On Thu, Jul 29, 2010 at 12:31 PM, Robert Philipp
<[hidden email]> wrote:
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
------------------------------------------------------------------------------
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