From: Roland L. <Rol...@we...> - 2006-07-24 22:42:37
|
> 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 |