Skip to content
All library documents

Log-Linear Yield-Curve Bootstrapping Can Fail with Negative Rates

Article Quant Q&A · Author: Lisa Ann

Summary

The document explains a failure encountered when extracting zero or forward rates from a QuantLib piecewise yield curve. The reported error occurs during the first bootstrap iteration at a short-maturity instrument. The answer attributes it to log-linear interpolation: while searching for a rate at the short node, the bootstrap procedure can enter a region with negative rates, where the logarithm is undefined.

The suggested workaround is to choose a different interpolation method. Another possibility mentioned is changing and recompiling the library or add-in to disable negative rates, but this is presented as more involved. The explanation comes from inspecting the implementation, and the post treats the behavior as a software issue worth reporting. It does not provide a tested interpolation alternative, code, or a comparison of curve accuracy. The practical lesson is specific to this interpolation and bootstrap setup; users should verify that any replacement method is appropriate for their curve and market inputs.

Key ideas

  • Log-linear interpolation can fail when bootstrapping explores negative rates because logarithms are undefined there.
  • The failure may appear at a short-maturity node during the initial bootstrap iteration.
  • Trying another interpolation method is offered as the simpler workaround.
  • Changing library behavior to prevent negative rates requires modifying and rebuilding the software.

Tags

Full text
# QuantLib error with qlPiecewiseYieldCurveData() on qlPiecewiseYieldCurve() with ZeroYield and ForwardRate


# QuantLib error with qlPiecewiseYieldCurveData() on qlPiecewiseYieldCurve() with ZeroYield and ForwardRate












I'm using QuantLibXL to build a discount curve, a zero yield curve and a forward curve of the EURIBOR rate (QuantLibXL is downloadable here).

I've built an object of class `PiecewiseYieldCurve` through the `qlPiecewiseYieldCurve()` function and the `TraitsID` argument is set to `ZeroRate`.

When I use the `qlPiecewiseYieldCurveData()` function to get the zero rates, the ObjectHandler returns me the following error message:

```
qlPiecewiseYieldCurveData - 1st iteration: failed at 1st alive instrument, maturity September 10th, 2013, reference date September 3rd, 2013: invalid value (-1) at index 0
```

Similar issue with the forward rates curve.

What should I amend in my `qlPiecewiseYieldCurve()` to make it work properly?

(Maybe this question is more suitable to Stack Overflow than Quantitative Finance Stack Exchange?).

## Answer by Luigi Ballabio (score 6, accepted)

https://quant.stackexchange.com/a/8859

Ok, I've done some digging in the code. It's an issue with the LogLinear interpolation; while trying to find the correct rate for the 1-week node, the bootstrapper wanders unchecked into a region of negative rates and the logarithms blow up. At this time, I'm afraid the workaround is just to use some other interpolation. Or recompile the library and the addin disabling negative rates, but that's a lot more complex...

Would you mind reporting this as a bug on the QuantLib mailing list, or the bug tracker at http://sourceforge.net/p/quantlib/bugs/? (You might need a SourceForge login for the tracker.)

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.