I need to bootstrap a yieldcurve with 3M futures, using a cubic spline if possible.

Using, for example 3M Euribor, how do I bootstrap the yield curve using python?

I have a vector of dates and a vector of future prices.

I found about the QuantLib library, and more specifically, the ql.PiecewiseCubicZero. However there is a big lack of documentation on how to use it, and even more, with futures.

Any help would be much appreciated!


2 Answers 2


The theory and a worked-out example are in Ametrano and Bianchetti, Everything You Always Wanted to Know About Multiple Interest Rate Curve Bootstrapping but Were Afraid to Ask.

Recently I reproduced their example in Python; you can read my code at https://www.implementingquantlib.com/2023/09/ametrano-bianchetti.html.


If you want a really easy answer, you can do the following:

  1. Convert your futures prices into rates e.g. $100 - price = rate$.

  2. Construct a LineCurve in rateslib:

from rateslib import *
curve = LineCurve(
        dt(2023, 9, 21): 3.92,
        dt(2023, 12, 20): 4.01,
        dt(2024, 3, 20): 3.96,
        dt(2024, 6, 20): 3.83,
        dt(2024, 9, 20): 3.62,
        dt(2024, 12, 20): 3.42,
        dt(2025, 3, 20): 3.25,
        dt(2023, 9, 21), dt(2023, 9, 21), dt(2023, 9, 21), dt(2023, 9, 21),
        dt(2023, 12, 20),
        dt(2024, 3, 20),
        dt(2024, 6, 20),
        dt(2024, 9, 20),
        dt(2024, 12, 20),
        dt(2025, 3, 20), dt(2025, 3, 20), dt(2025, 3, 20), dt(2025, 3, 20),

enter image description here

The t parameter is the knot sequence which is needed to instruct a cubic spline. You can read about this in the rateslib docs

The curve rate on 18th Jan 2024

>>> curve[dt(2024, 1, 18)]

The curve that is produced is a futures curves and it ignores convexity adjustments which are generally created by the presence of a swaps market.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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