I have defined an Ibor Index with the python version of Quantlib using a Flat Forward Curve of 5%.

When I get an estimate for a date in 3 months from now, I would expect to get 0.0500000, as I defined in the flat curve. However I get 0.050320809398634044 instead. I am perplexed to why this is...

import QuantLib as ql
calendar = ql.UnitedStates(ql.UnitedStates.FederalReserve)
usd_curve = ql.FlatForward(2, calendar,
               0.05, ql.Actual360())

effectiveDate = ql.Settings.instance().evaluationDate
index = ql.IborIndex("LiborUSD", ql.Period("3m"),
             2, ql.USDCurrency(), calendar,
             ql.ModifiedFollowing, False,

for i in [3,6,9,12,15]:
        calendar.advance(effectiveDate, i, ql.Months, ql.ModifiedFollowing)

2 Answers 2


You're creating a flat curve with a rate of 5% continously compounded, whereas the LIBOR fixing is a simply-compounded rate. You're getting the simple rate equivalent to a 5% continuously compounded rate over the relevant period; that is, the LIBOR rate $L$ so that $(1+Lt) = e^{rt}$, with $r$ being your 5% input and $t$ the 3-months period underlying the fixing.

I'm afraid there's no direct way to set the LIBOR fixing; the addFixing method suggested in the other answer works for past fixings, not for forecasting. You can get a result close to what you want by creating a flat, quarterly compounding curve:

usd_curve = ql.FlatForward(2, calendar, 0.05, ql.Actual360(), ql.Compounded, ql.Quarterly)

because the formulas happen to work out (if you want a 6-months fixing, you'll need ql.Semiannual and so on). It's not exact, but you'll be just a small fraction of basis point away from the 5% you want:


When calling index.fixing you are actually calling the c++ method IborIndex::forecastFixing and given the date is in the future QuantLib will do the following calculation: $$(\frac{e^{-r_1 * t_1}}{e^{-r_2*t_2}} - 1)/(\frac{t_2 - t_1}{360}),$$

based on your inputs, where continuous compounding is set by default. Here $t_1$ will be given by

Date fixingDate = fixingCalendar().advance(valueDate,
    -static_cast<Integer>(fixingDays_), Days);

and $t_2$ by

fixingCalendar().advance(fixingDate, fixingDays_, Days);

Thus the curve itself will be constant, i.e., $r_1 = r_2$ but the dates are different causing the effect you see in your calculations. If you'd like to set a fixing I'd suggest having a look at the method setFixing.


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.