quantlib

Quantlib: how to add forecast curve to existing index


I'm using python QL, and have a code that is repricing swap hedges.

The hedges have a common hedge index, declared up front (say EURIBOR3M).

Each hedge is repriced at its inception, as well as "now" (whatever now is).

The index will also have some fixings, as the hedges at the "now" date will have the current period fixed already.

Now, I can create a new index instance at each re-pricing, set the fixings, and link it to its index forecast curve.

Or is there an easier way, to create the hedge index just once, and re-link it to the forecast curves as needed? How would that (assuming it's even possible) deal with the fixings? I assume that it would ignore fixings in the future (i.e. if I have a fixing on 1 Nov 2021, but value on 3 Jan 2020, the Nov 2021 fixing will be from the forecast curve) - is that correct?

Cheers, VE


Solution

  • You can create your index as

    forecast_handle = ql.RelinkableYielTermStructureHandle()
    hedge_index = ql.Euribor3M(forecast_handle)
    

    after this, when you want to use a new forecast curve curve you'll run

    forecast_handle.linkTo(curve)
    

    and the index will start to use it for forecasting.

    As you correctly assumed, you can add fixings once and they will only be used if they're in the past with respect to the current evaluation date.