piecewise yield curve with cubic spline interpolation

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

piecewise yield curve with cubic spline interpolation

Roland Lichters
Hello all,

I am experimenting with yield curve building in QuantLib version 0.3.12.
If the list of instruments contains swaps, I cannot make a piecewise yield curve work with cubic spline interpolation ...

  boost::shared_ptr<YieldTermStructure> ts (
    new PiecewiseYieldCurve<ZeroYield, Cubic>(asof,
                                              instruments,
                                              termStructureDayCounter,
                                              tolerance));
 
It does work with deposits and futures. Adding only one swap rate leads already to a "root not bracketed" error:
 
terminate called after throwing an instance of 'QuantLib::Error'
  what():  root not bracketed: f[2.22045e-16,3] -> [3.743160e+00,2.719709e+00]

I have reduced the tolerance from 1e-6 to even 1e-3 without success.

Attached is a simple program that demonstrates this. Did anyone encounter this before, any ideas, counter examples?

It is clear that the interpolation type affects already the zero rates at grid points (instrument maturities) if the bootstrap requires interpolation to an "unknown" rate at a date which is not the maturity of a curve instrument. This happens usually already when the rate for the first future maturity is computed. Bootstrap in the swap segment may be even more sensitive to interpolation because of the quarterly, semiannual, annual cash flows and "rare" quotes.  But so far I do not see why cubic spline interpolation cannot be built into the bootstrap process with swaps.

I am using a front/back office system in business that takes a different approach: It first builds a "raw" curve with local interpolation (linear zeros or loglinear discounts like piecewise flat forward in QuantLib). It then feeds the zero rates into a cubic spline interpolated curve. This curve does not reprice the curve instruments, so that the zero rates at grid points are "modified" somehow until repicing works again.
   
I would be grateful for any hint, idea!
Roland
 

_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000071


main.cpp (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: piecewise yield curve with cubic spline interpolation

Roland Lichters
> I am experimenting with yield curve building in QuantLib version 0.3.12.

> If the list of instruments contains swaps, I cannot make a piecewise yield curve work with cubic spline interpolation ...
>
>   boost::shared_ptr<YieldTermStructure> ts (
>     new PiecewiseYieldCurve<ZeroYield, Cubic>(asof,
>                                               instruments,
>                                               termStructureDayCounter,
>                                               tolerance));
>  
> It does work with deposits and futures. Adding only one swap rate leads already to a "root not bracketed" error:
>  
> terminate called after throwing an instance of 'QuantLib::Error'
>   what():  root not bracketed: f[2.22045e-16,3] -> [3.743160e+00,2.719709e+00]
>
Apologies, I should have checked my example more carefully, dividing swap rates by 100 helps..
The cubic splined piecewise curve does _not_ fail with one swap rate as claimed above, in fact it works for me (see the attached example) for swap data out to 15Y with no problem.
The "root not bracketed" problem starts with longer maturities, e.g. when I add a 20Y and 30Y swap rate, and I did not manage to resolve it  by increasing the tolerance. The attached example tries to demonstrate this behaviour, too. I wonder whether this is a known "feature" of splined yield curves?
If it is due to scarce swap data, what about the following procedure:
- build a raw curve, e.g. piecewise flat forward, from the actual market data
- build a bunch of swaps with maturities increasing in small, e.g. annual steps up to final maturity of the raw term structure
- compute their fair rates
- create a fake instrument list using these swaps
- build a splined yield curve from the extended instrument list
Did anybody try this before?

I would be grateful for any feedback or hints!
Roland

 
   
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193


main.cpp (6K) Download Attachment