IndexFixing#

class rateslib.data.fixings.IndexFixing(*, index_lag, index_method, date, value=NoInput.blank, identifier=NoInput.blank)#

Bases: _BaseFixing

An index fixing value for settlement of indexed cashflows.

Parameters:
  • index_lag (int) – The number months by which the reference date is lagged to derive an index value.

  • index_method (IndexMethod) – The method used for calculating the index value. See IndexMethod.

  • date (datetime) – The date of relevance for the index fixing, which is its reference value date.

  • value (float, Dual, Dual2, Variable, optional) – The initial value for the fixing to adopt. Most commonly this is not given and it is determined from a timeseries of published FX rates.

  • identifier (str, optional) – The string name of the timeseries to be loaded by the Fixings object.

Examples

In [1]: fixings.add("UK-CPI", Series(index=[dt(2000, 1, 1), dt(2000, 2, 1)], data=[100, 110.0]))

In [2]: index_fix = IndexFixing(date=dt(2000, 4, 15), identifier="UK-CPI", index_lag=3, index_method=IndexMethod.Daily)

In [3]: index_fix.value
Out[3]: np.float64(104.66666666666667)

Attributes Summary

date

The date of relevance for the fixing, e.g. the publication date of an IBORFixing.

identifier

The string name of the timeseries to be loaded by the Fixings object.

index_lag

The number months by which the reference date is lagged to derive an index value.

index_method

The IndexMethod used for calculating the index value.

value

The fixing value.

Methods Summary

reset([state])

Sets the value attribute to NoInput, which allows it to be redetermined from a timeseries.

Attributes Documentation

date#

The date of relevance for the fixing, e.g. the publication date of an IBORFixing.

identifier#

The string name of the timeseries to be loaded by the Fixings object.

index_lag#

The number months by which the reference date is lagged to derive an index value.

index_method#

The IndexMethod used for calculating the index value.

value#

The fixing value.

If this value is rateslib.enums.generics.NoInput, then each request will attempt a lookup from a timeseries to obtain a new fixing value.

Once this value is determined it is restated indefinitely, unless _BaseFixing.reset() is called.

Methods Documentation

reset(state=NoInput.blank)#

Sets the value attribute to NoInput, which allows it to be redetermined from a timeseries.

Examples

In [4]: fx_fixing1 = FXFixing(publication=dt(2021, 1, 1), fx_index="eurusd", identifier="A")

In [5]: fx_fixing2 = FXFixing(publication=dt(2021, 1, 1), fx_index="gbpusd", identifier="B")

In [6]: fixings.add("A_eurusd", Series(index=[dt(2021, 1, 1)], data=[1.1]), state=100)

In [7]: fixings.add("B_gbpusd", Series(index=[dt(2021, 1, 1)], data=[1.4]), state=200)

# data is populated from the available Series
In [8]: fx_fixing1.value
Out[8]: np.float64(1.1)

In [9]: fx_fixing2.value
Out[9]: np.float64(1.4)

# fixings are reset according to the data state
In [10]: fx_fixing1.reset(state=100)

In [11]: fx_fixing2.reset(state=100)

# only the private data for fixing1 is removed because of its link to the data state
In [12]: fx_fixing1._value
Out[12]: <NoInput.blank: 0>

In [13]: fx_fixing2._value
Out[13]: np.float64(1.4)
Parameters:

state (int, optional) – If given only fixings whose state matches this value will be reset. If no state is given then the value will be reset.

Return type:

None