index_value#

rateslib.curves.index_value(index_lag, index_method, index_fixings=NoInput.blank, index_date=NoInput.blank, index_curve=NoInput.blank)#

Determine an index value from a reference date using combinations of known fixings and forecast from a Curve.

Parameters:
  • index_lag (int) – The number of months by which the reference index_date should be lagged to derive a value.

  • index_method (str in {"curve", "daily", "monthly"}) – The method used to derive and interpolate index values.

  • index_fixings (float, Dual, Dual2, Variable, Series[DualTypes], optional) – A specific index value which is returned directly, or if given as a Series applies the appropriate index_method to determine a value. May also forecast from Curve if necessary. See notes.

  • index_date (datetime, optional) – The reference index date for which the index value is sought. Not required if index_fixings is returned directly.

  • index_curve (Curve, optional) – The forecast curve from which to derive index values under the appropriate index_method. If using ‘curve’, then curve calculations are used directly.

Return type:

DualTypes or NoInput

Notes

A Series must be given with a unique, monotonic increasing index. This will not be validated.

When using the ‘daily’ or ‘monthly’ type index_methods index values must be assigned to the first of the month to which the publication is relevant.

The below image is a snippet taken from the UK DMO ‘Formulae for Calculating Gilt Prices and Yield’. It outlines the calculation of an index value for a reference date using their 3 month lag and ‘daily’ indexing method.

Index value calculations

This calculation is replicated in rateslib in the following way:

In [1]: from rateslib import index_value

In [2]: from pandas import Series

In [3]: rpi_series = Series(
   ...:     [172.2, 173.1, 174.2, 174.4],
   ...:     index=[dt(2001, 3, 1), dt(2001, 4, 1), dt(2001, 5, 1), dt(2001, 6, 1)]
   ...: )
   ...: 

In [4]: index_value(
   ...:     index_lag=3,
   ...:     index_method="daily",
   ...:     index_fixings=rpi_series,
   ...:     index_date=dt(2001, 7, 20)
   ...: )
   ...: 
Out[4]: np.float64(173.77419354838707)