|
From: Luigi B. <lui...@gm...> - 2022-10-18 20:44:48
|
Ciao Daniele,
fixings are for the past, and term structures are for forecasts — it's
a deliberate choice for a number of reasons. However, you can get what you
want by creating a term structure that gives you back the expected
fixings. I don't have sample code right now, but the idea is as follows.
Let's say you have the last actual index fixing I_0 (i.e., not a
forecast). For each of the future fixings at time T_i, you can calculate
the corresponding zero-rate R_i so that I_i = i_0 * (1 + R_i)^T_i. Once
you've done the conversion, you can create
an InterpolatedZeroInflationCurve from the resulting rates and the
corresponding dates (you might have to play with the lag in order to get
the dates right). If you pass the curve to the index instance, it should
return the fixings you started with.
Let me know if that works. If not, post your code and we can try to get
there.
Hope this helps,
Luigi
On Wed, Oct 12, 2022 at 1:51 PM Daniele Marconi <
dan...@gm...> wrote:
> Dear Luigi,
>
>
>
> the question is strictly on the file “inflationindex.cpp”.
>
>
>
> What I lack is the possibility to give use in the index a set of fixings
> in the future. That is, we have forecasted index values (so, future
> fixings) directly from the market data provider and we would like to use
> them in place of the forecasting function done by the
> zeroInflationTermStructure.
>
> Given the current version, I can load into IndexManager future fixings, no
> problem.
>
> The issue comes in the functionZeroInflationIndex::fixing and then
> ZeroInflationIndex::needsForecast.
>
> In the latter, latestNeededDate is basically evaluation date “minus”
> availabilityLag and it is assumed that everything coming after that date
> needs a forecast from term structure.
>
> Is there a way to obtain what I need, i.e. to use fixings from time-series
> also in case of future dates?
>
>
>
> if (latestNeededDate <= historicalFixingKnown) {
>
> // the fixing date is well before the availability lag, so
>
> // we know that fixings were provided.
>
> return false;
>
> } else if (latestNeededDate > today) {
>
> // the fixing can't be available, no matter what's in the
>
> // time series
>
> return true;
>
> }
>
>
>
> Thank you
>
> Daniele marconi
> --
> Daniele Marconi
> _______________________________________________
> QuantLib-dev mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>
|