_BaseFixing#
- class rateslib.data.fixings._BaseFixing(*, date, value=NoInput.blank, identifier=NoInput.blank)#
Bases:
objectAbstract base class for core financial fixing implementation.
- Parameters:
date (datetime) – The date of relevance for the financial fixing, e.g. the publication date for an IBORFixing or the reference date for an IndexFixing.
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.
identifier (str, optional) – The string name of the timeseries to be loaded by the Fixings object.
Attributes Summary
The date of relevance for the fixing, e.g. the publication date of an IBORFixing.
The string name of the timeseries to be loaded by the Fixings object.
The fixing value.
Methods Summary
reset([state])Sets the
valueattribute toNoInput, 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.
- 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
valueattribute toNoInput, which allows it to be redetermined from a timeseries.Examples
In [11]: fx_fixing1 = FXFixing(publication=dt(2021, 1, 1), fx_index="eurusd", identifier="A") In [12]: fx_fixing2 = FXFixing(publication=dt(2021, 1, 1), fx_index="gbpusd", identifier="B") In [13]: fixings.add("A_eurusd", Series(index=[dt(2021, 1, 1)], data=[1.1]), state=100) In [14]: fixings.add("B_gbpusd", Series(index=[dt(2021, 1, 1)], data=[1.4]), state=200) # data is populated from the available Series In [15]: fx_fixing1.value Out[15]: np.float64(1.1) In [16]: fx_fixing2.value Out[16]: np.float64(1.4) # fixings are reset according to the data state In [17]: fx_fixing1.reset(state=100) In [18]: fx_fixing2.reset(state=100) # only the private data for fixing1 is removed because of its link to the data state In [19]: fx_fixing1._value Out[19]: <NoInput.blank: 0> In [20]: fx_fixing2._value Out[20]: 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