_BaseFixingsLoader#
- class rateslib.data.loader._BaseFixingsLoader#
Bases:
objectAbstract base class to allow custom implementations of a fixings data loader.
Notes
This class requires an implementation of
__getitem__, which should accept anidentifierand return a 3-tuple. The 3-tuple should include;an integer representing the state id of the loaded data, i.e. its hash or pseudo-hash.
the data itself as a Series indexed by daily datetimes.
a 2-tuple of datetimes indicating the min and max of the timeseries index.
If a valid Series object cannot be loaded for the
identifierthen this method is required to raise a ValeuError.Methods Summary
add(name, series[, state])Add a timeseries to the data loader directly from Python.
get_stub_ibor_fixings(value_start_date, ...)Return the tenors available in the
Fixingsobject for determining an IBOR type stub period.pop(name)Remove a timeseries from the data loader.
Methods Documentation
- abstract add(name, series, state=NoInput.blank)#
Add a timeseries to the data loader directly from Python.
- Parameters:
name (str) – The string identifier for the timeseries.
series (Series[DualTypes]) – The timeseries to add to static data.
- Return type:
None
Examples
In [1]: ts = Series(index=[dt(2000, 1, 1)], data=[666.0]) In [2]: fixings.add("my_timeseries", ts) In [3]: fixings["my_timeseries"] Out[3]: (8299168255252050875, reference_date 2000-01-01 666.0 Name: rate, dtype: float64, (Timestamp('2000-01-01 00:00:00'), Timestamp('2000-01-01 00:00:00'))) In [4]: fixings.pop("my_timeseries") Out[4]: reference_date 2000-01-01 666.0 Name: rate, dtype: float64
- get_stub_ibor_fixings(value_start_date, value_end_date, fixing_date, fixing_calendar, fixing_modifier, fixing_identifier)#
Return the tenors available in the
Fixingsobject for determining an IBOR type stub period.- Parameters:
value_start_date (datetime) – The value start date of the IBOR period.
value_end_date (datetime) – The value end date of the current stub period.
fixing_date (datetime) – The index date to examine from the fixing series.
fixing_calendar (Cal, UnionCal, NamedCal,) – The calendar to derive IBOR value end dates.
fixing_modifier (Adjuster) – The date adjuster to derive IBOR value end dates.
fixing_identifier (str) – The fixing name, prior to the addition of tenor, e.g. “EUR_EURIBOR”
- Return type:
tuple of list[string tenors] and list[evaluated end dates]
- abstract pop(name)#
Remove a timeseries from the data loader.
- Parameters:
name (str) – The string identifier for the timeseries.
- Return type:
Series[DualTypes] or None
Notes
If the
namedoes not exist None will be returned.