Skip to content
All library documents

Interpolating Yield Curve Spreads with QuantLib

Article Quant Q&A · Author: Devlife

Summary

The question concerns creating a three-month euro yield curve from a six-month curve by adding a spread series with more maturity points. It asks how to use monotone convex interpolation in QuantLib’s Python interface. The response challenges the need for this construction, noting that three-month instruments may have directly quoted market data and that swap maturities are often aligned across tenors.

As a practical illustration, it shows spread observations at annual maturities and evaluates a natural cubic spline at quarterly intervals. This demonstrates one way to interpolate a spread series, but it does not implement the requested monotone convex method or explain how to combine interpolated spreads with the six-month curve. The example is therefore limited: it gives a different interpolation approach, and it does not discuss curve construction conventions, arbitrage constraints, or validation against market quotes. Users should distinguish the illustrative spline from a complete curve-building procedure.

Key ideas

  • The question proposes adding an interpolated spread series to a six-month euro curve.
  • The response suggests considering directly quoted three-month instruments first.
  • A natural cubic spline is shown as an example for interpolating spread observations.
  • The example does not demonstrate monotone convex interpolation or a complete curve construction.

Tags

Full text
# monotone convex interpolation using QuantLib


# monotone convex interpolation using QuantLib












I have one yield curves for EUR6M and I want to produce EUR3M using a parallel shift to EUR6M curve. I can just add spread in 6M curve. I am facing problem that my EUR3M curve will have many more expiry nodes then 6M because my spread has many more points. I want to interpolate my spread and 3M curve during addition in 6M curve. I want to use monotone convex interpolation in QuantLib python. Can someone advise me how to use this interpolation function in python using quantlib?

## Answer by David Duarte (score 1)

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

Not sure why you would want this because you have quotes for EUR6M and EUR3M directly (Swap vs 3M and 3M Futures).

Also not sure, why you would have more nodes for the 3M since both swaps and basis swaps are quoted with maturities in years.

Anyway, here is an example that might be helpful:

```
import QuantLib as ql
import numpy as np
import matplotlib.pyplot as plt

spreads = {
    '1Y': 11.1,
    '2Y': 9.3,
    '3Y': 8.5,
    '4Y': 7.9
}

X = [ql.Period(tenor).length() for tenor in spreads]
Y = [v for v in spreads.values()]
plt.plot(X, Y, marker='o')

X_3m = np.arange(1, 4.25, 0.25)

i = ql.CubicNaturalSpline(X, Y)
plt.plot(X_3m, [i(x) for x in X_3m])
```

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.