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?


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])

enter image description here

  • $\begingroup$ Many Thanks for your reply. $\endgroup$
    – Devlife
    Nov 18 '20 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.