Indexes¶
Interest-rate and inflation indexes.
indexes
¶
Runtime source shim for the native itofin.indexes submodule.
The real itofin.indexes is a compiled submodule registered into
sys.modules by the extension (see crates/itofin-py/src/lib.rs); it wins
at import time, so nothing here runs. This file exists only so static type
checkers resolve from itofin.indexes import ... from indexes.pyi without
a reportMissingModuleSource warning.
Auto-generated by scripts/gen_submodule_shims.py from indexes.pyi; do not edit or delete by hand.
Currency
¶
An ISO 4217 currency specification.
Only the four named currencies the core provides are exposed; the general constructor is omitted, as the core ports only the currencies its indexes need and the full catalogue is deferred there.
eur
staticmethod
¶
eur() -> Currency
Return the European Euro.
Returns:
| Name | Type | Description |
|---|---|---|
Currency |
Currency
|
The euro, ISO code "EUR". |
usd
staticmethod
¶
usd() -> Currency
Return the U.S. dollar.
Returns:
| Name | Type | Description |
|---|---|---|
Currency |
Currency
|
The U.S. dollar, ISO code "USD". |
gbp
staticmethod
¶
gbp() -> Currency
Return the British pound sterling.
Returns:
| Name | Type | Description |
|---|---|---|
Currency |
Currency
|
The pound sterling, ISO code "GBP". |
code
¶
Return the ISO 4217 three-letter code.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The three-letter code, e.g. "EUR". |
IborIndex
¶
IborIndex(family_name: str, tenor: Period, settlement_days: int, currency: Currency, fixing_calendar: Calendar, convention: BusinessDayConvention, end_of_month: bool, day_counter: DayCounter, forwarding: YieldTermStructure | None, settings: Settings)
A general Inter-Bank-Offered-Rate index, spelling out every convention.
The form for an index outside the named families (the USD-3M IsdaIbor the ISDA CDS curve bootstraps off, say). Pass forwarding=None to build it over an empty handle, the form the bootstrap rate helpers need.
It is the base of Euribor, and every Ibor-index consumer takes this type and accepts either: the deposit, swap, FRA and futures rate helpers, and the swap, swap-index, optionlet-volatility, cap/floor and swaption-helper facades. The OIS helper is not one of them; it takes the overnight Estr, which is not an IborIndex.
Build an index spelling out every convention the core constructor takes.
The index fixes settlement_days before its value date on the fixing calendar, rolls to maturity under convention and end_of_month, accrues on day_counter and forecasts off forwarding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family_name
|
str
|
The index family the fixings are stored under. |
required |
tenor
|
Period
|
The index tenor, normalized at construction. |
required |
settlement_days
|
int
|
The business days between the fixing date and the value date. |
required |
currency
|
Currency
|
The currency the index is quoted in. |
required |
fixing_calendar
|
Calendar
|
The calendar the fixing and value dates roll on. |
required |
convention
|
BusinessDayConvention
|
The convention applied when rolling the value date to maturity. |
required |
end_of_month
|
bool
|
Whether the maturity roll keeps to month ends. |
required |
day_counter
|
DayCounter
|
The day count the index accrues on. |
required |
forwarding
|
YieldTermStructure | None
|
The curve fixings are forecast off; None builds the index over an empty handle, the form the bootstrap rate helpers need. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool) -> float
Return the index fixing for fixing_date.
Forecast off the forwarding curve for a future date, or read from the stored fixings for a past one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the fixing is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fixing rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the fixing date is not a valid one, the evaluation date is unset, a past fixing is missing from the store, or the forwarding handle is empty on a forecast. |
value_date
¶
Return the value date of the loan fixed on fixing_date.
The fixing date moved forward by the index's fixing days on the fixing calendar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The fixing date to advance. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Date |
Date
|
The value date. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If fixing_date is not a business day on the fixing calendar. |
fixing_date
¶
maturity_date
¶
Return the maturity of the loan starting on value_date.
The value date rolled on by the index tenor under the index's own convention and end-of-month flag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value_date
|
Date
|
The date the loan starts on. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Date |
Date
|
The maturity date. |
tenor
¶
tenor() -> Period
Return the index tenor, normalized at construction.
Returns:
| Name | Type | Description |
|---|---|---|
Period |
Period
|
The index tenor. |
day_counter
¶
day_counter() -> DayCounter
Return the day counter the index accrues on.
Returns:
| Name | Type | Description |
|---|---|---|
DayCounter |
DayCounter
|
The index day count. |
fixing_calendar
¶
fixing_calendar() -> Calendar
Return the calendar the fixing and value dates roll on.
Returns:
| Name | Type | Description |
|---|---|---|
Calendar |
Calendar
|
The fixing calendar. |
business_day_convention
¶
business_day_convention() -> BusinessDayConvention
Return the convention applied when rolling the value date to maturity.
Returns:
| Name | Type | Description |
|---|---|---|
BusinessDayConvention |
BusinessDayConvention
|
The stored convention. |
end_of_month
¶
Return whether the maturity roll keeps to month ends.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the roll is end-of-month. |
name
¶
Return the composed index name, e.g. "Euribor6M Actual/360".
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name the fixings are stored under. |
Euribor
¶
Euribor(tenor: Period, curve: YieldTermStructure | None, settings: Settings)
Bases: IborIndex
The Euribor IBOR index family.
A subclass of IborIndex, so a Euribor is accepted wherever the general index is. It retains its own clone of the index the base holds - the same object, not a rebuild - so its own fixing reads exactly what the base reads.
Build a Euribor index of the given tenor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tenor
|
Period
|
The index tenor. |
required |
curve
|
YieldTermStructure | None
|
The forwarding curve; None builds the index over an empty handle, the form the bootstrap rate helpers need. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If tenor is a daily tenor, which needs the dedicated daily-tenor constructor the core keeps separate. |
three_months
staticmethod
¶
three_months(curve: YieldTermStructure, settings: Settings) -> Euribor
Return the 3-month Euribor index forwarding off curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
YieldTermStructure
|
The forwarding curve. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Euribor |
Euribor
|
The Euribor3M index. |
six_months
staticmethod
¶
six_months(curve: YieldTermStructure, settings: Settings) -> Euribor
Return the 6-month Euribor index forwarding off curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
YieldTermStructure
|
The forwarding curve. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Euribor |
Euribor
|
The Euribor6M index. |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool) -> float
Return the index fixing for fixing_date.
Forecast off the forwarding curve for a future date, or read from the stored fixings for a past one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the fixing is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fixing rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the fixing date is not a valid one, the evaluation date is unset, a past fixing is missing from the store, or the forwarding handle is empty on a forecast. |
UsdLibor
¶
UsdLibor(tenor: Period, curve: YieldTermStructure | None, settings: Settings)
Bases: IborIndex
The USD Libor index family.
A subclass of IborIndex, so a USD Libor is accepted wherever the general index is. It retains its own clone of the index the base holds - the same object, not a rebuild - so its own fixing reads exactly what the base reads.
Build a USD Libor index of the given tenor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tenor
|
Period
|
The index tenor. |
required |
curve
|
YieldTermStructure | None
|
The forwarding curve; None builds the index over an empty handle, the form the bootstrap rate helpers need. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If tenor is a daily tenor, which needs a dedicated daily-tenor constructor the core has not ported. |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool) -> float
Return the index fixing for fixing_date.
Forecast off the forwarding curve for a future date, or read from the stored fixings for a past one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the fixing is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fixing rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the fixing date is not a valid one, the evaluation date is unset, a past fixing is missing from the store, or the forwarding handle is empty on a forecast. |
JpyLibor
¶
JpyLibor(tenor: Period, curve: YieldTermStructure | None, settings: Settings)
Bases: IborIndex
The JPY Libor index family.
A subclass of IborIndex, so a JPY Libor is accepted wherever the general index is. It retains its own clone of the index the base holds - the same object, not a rebuild - so its own fixing reads exactly what the base reads.
Build a JPY Libor index of the given tenor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tenor
|
Period
|
The index tenor. |
required |
curve
|
YieldTermStructure | None
|
The forwarding curve; None builds the index over an empty handle, the form the bootstrap rate helpers need. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If tenor is a daily tenor, which needs a dedicated daily-tenor constructor the core has not ported. |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool) -> float
Return the index fixing for fixing_date.
Forecast off the forwarding curve for a future date, or read from the stored fixings for a past one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the fixing is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fixing rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the fixing date is not a valid one, the evaluation date is unset, a past fixing is missing from the store, or the forwarding handle is empty on a forecast. |
GbpLibor
¶
GbpLibor(tenor: Period, curve: YieldTermStructure | None, settings: Settings)
Bases: IborIndex
The GBP Libor index family.
A subclass of IborIndex, so a GBP Libor is accepted wherever the general index is. It retains its own clone of the index the base holds - the same object, not a rebuild - so its own fixing reads exactly what the base reads.
Build a GBP Libor index of the given tenor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tenor
|
Period
|
The index tenor. |
required |
curve
|
YieldTermStructure | None
|
The forwarding curve; None builds the index over an empty handle, the form the bootstrap rate helpers need. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If tenor is a daily tenor, which needs a dedicated daily-tenor constructor the core has not ported. |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool) -> float
Return the index fixing for fixing_date.
Forecast off the forwarding curve for a future date, or read from the stored fixings for a past one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the fixing is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fixing rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the fixing date is not a valid one, the evaluation date is unset, a past fixing is missing from the store, or the forwarding handle is empty on a forecast. |
EurLibor
¶
EurLibor(tenor: Period, curve: YieldTermStructure | None, settings: Settings)
Bases: IborIndex
The EUR Libor index family, the Euro ICE Libor fixed in London.
Three calendars, not one: fixing dates roll on the joint UK-Exchange plus TARGET calendar while value and maturity dates roll on TARGET alone. A subclass of IborIndex, so a EUR Libor is accepted wherever the general index is, and the base half carries the three-calendar roll rather than a single-calendar approximation of it. It retains its own clone of the index the base holds - the same object, not a rebuild - so its own fixing reads exactly what the base reads.
Build a EUR Libor index of the given tenor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tenor
|
Period
|
The index tenor. |
required |
curve
|
YieldTermStructure | None
|
The forwarding curve; None builds the index over an empty handle, the form the bootstrap rate helpers need. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If tenor is a daily tenor, which needs a dedicated daily-tenor constructor the core has not ported. |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool) -> float
Return the index fixing for fixing_date.
Forecast off the forwarding curve for a future date, or read from the stored fixings for a past one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the fixing is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fixing rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the fixing date is not a valid one, the evaluation date is unset, a past fixing is missing from the store, or the forwarding handle is empty on a forecast. |
CustomIborIndex
¶
CustomIborIndex(family_name: str, tenor: Period, settlement_days: int, currency: Currency, fixing_calendar: Calendar, value_calendar: Calendar, maturity_calendar: Calendar, convention: BusinessDayConvention, end_of_month: bool, day_counter: DayCounter, forwarding: YieldTermStructure | None, settings: Settings)
Bases: IborIndex
An Ibor index with three separate calendars.
The general form of what EurLibor configures: fixing dates roll back on the value calendar and adjust Preceding on the fixing calendar, value dates advance on the value calendar, and maturity dates advance on the maturity calendar. Passing the same calendar three times reproduces a plain IborIndex, so this is the escape hatch for a Libor-like index outside the named families. A subclass of IborIndex, so it is accepted wherever the general index is, and the base half carries the three-calendar roll.
Build a three-calendar Ibor index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family_name
|
str
|
The family name the composed index name is built from. |
required |
tenor
|
Period
|
The index tenor. |
required |
settlement_days
|
int
|
The business days between a fixing and its value date. |
required |
currency
|
Currency
|
The currency the index is quoted in. |
required |
fixing_calendar
|
Calendar
|
The calendar fixing dates are adjusted Preceding on. |
required |
value_calendar
|
Calendar
|
The calendar value dates are advanced on. |
required |
maturity_calendar
|
Calendar
|
The calendar maturity dates are advanced on. |
required |
convention
|
BusinessDayConvention
|
The convention the roll to maturity applies. |
required |
end_of_month
|
bool
|
Whether the maturity roll keeps to month ends. |
required |
day_counter
|
DayCounter
|
The day counter the index accrues on. |
required |
forwarding
|
YieldTermStructure | None
|
The forwarding curve; None builds the index over an empty handle, the form the bootstrap rate helpers need. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool) -> float
Return the index fixing for fixing_date.
Forecast off the forwarding curve for a future date, or read from the stored fixings for a past one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the fixing is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fixing rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the fixing date is not a valid one, the evaluation date is unset, a past fixing is missing from the store, or the forwarding handle is empty on a forecast. |
OvernightIndex
¶
The base of the overnight index families.
Abstract: it has no constructor, because the core builds an overnight index only through a family factory such as Estr. It exists so OISRateHelper and MakeOis name one type and accept any family. The fixing accessor stays on the family facade; lifting it here is deferred.
Estr
¶
Estr(curve: YieldTermStructure | None, settings: Settings)
Bases: OvernightIndex
The Euro Short-Term Rate overnight index.
A subclass of OvernightIndex, so an ESTR index is accepted wherever the general overnight index is. It retains its own clone of the index the base holds - the same object, not a rebuild - so a facade typed on either half reads exactly the same core index.
Build an ESTR index forwarding off curve.
Infallible, unlike the Euribor constructor: the overnight tenor is fixed to one day by the base rather than taken from the caller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
YieldTermStructure | None
|
The forwarding curve; None builds the index over an empty forwarding handle, the form the OIS bootstrap needs. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool) -> float
Return the index fixing for fixing_date.
Forecast off the forwarding curve for a future date, or read from the stored fixings for a past one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the fixing is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fixing rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the fixing date is not a valid one, the evaluation date is unset, a past fixing is missing from the store, or the forwarding handle is empty on a forecast. |
SwapIndex
¶
SwapIndex(family_name: str, tenor: Period, settlement_days: int, currency: Currency, calendar: Calendar, fixed_leg_tenor: Period, fixed_leg_convention: BusinessDayConvention, fixed_leg_day_counter: DayCounter, ibor_index: IborIndex, settings: Settings)
The index whose fixing is the fair rate of an on-the-fly vanilla swap, assembled from the index tenor, the forecasting Ibor index and the fixed-leg conventions.
The swap is assembled off the value date the fixing date implies. The swaption volatility cubes take two of these (a long and a short base) and read the at-the-money forward off them, so this is the index the cube facades stack on rather than one priced with directly.
The currency is inert for every ported consumer, so currency() reading it back off the core index is the only place it shows. Deferred (visible): the clone family (re-curving / re-tenoring) is deferred in the core itself.
Build a swap index forecasting and discounting off one curve.
Both legs use the ibor index's forwarding curve. The index registers with that index, so a relinked curve notifies observers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family_name
|
str
|
The index family the fixings are stored under. |
required |
tenor
|
Period
|
The tenor of the underlying swap. |
required |
settlement_days
|
int
|
The business days between the fixing date and the swap's start. |
required |
currency
|
Currency
|
The index currency, inert for every ported consumer and read back only by currency(). |
required |
calendar
|
Calendar
|
The calendar the swap's dates roll on. |
required |
fixed_leg_tenor
|
Period
|
The fixed leg's payment tenor. |
required |
fixed_leg_convention
|
BusinessDayConvention
|
The fixed leg's business-day convention. |
required |
fixed_leg_day_counter
|
DayCounter
|
The fixed leg's day count. |
required |
ibor_index
|
IborIndex
|
The index forecasting the floating leg, whose forwarding curve also discounts. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
with_exogenous_discount
staticmethod
¶
with_exogenous_discount(family_name: str, tenor: Period, settlement_days: int, currency: Currency, calendar: Calendar, fixed_leg_tenor: Period, fixed_leg_convention: BusinessDayConvention, fixed_leg_day_counter: DayCounter, ibor_index: IborIndex, discount: YieldTermStructure, settings: Settings) -> SwapIndex
Build a swap index discounting off a separate curve.
The floating leg is still forecast off the ibor index's forwarding curve, but discounting uses discount. The index registers with both.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family_name
|
str
|
The index family the fixings are stored under. |
required |
tenor
|
Period
|
The tenor of the underlying swap. |
required |
settlement_days
|
int
|
The business days between the fixing date and the swap's start. |
required |
currency
|
Currency
|
The index currency, inert for every ported consumer and read back only by currency(). |
required |
calendar
|
Calendar
|
The calendar the swap's dates roll on. |
required |
fixed_leg_tenor
|
Period
|
The fixed leg's payment tenor. |
required |
fixed_leg_convention
|
BusinessDayConvention
|
The fixed leg's business-day convention. |
required |
fixed_leg_day_counter
|
DayCounter
|
The fixed leg's day count. |
required |
ibor_index
|
IborIndex
|
The index forecasting the floating leg. |
required |
discount
|
YieldTermStructure
|
The separate curve both legs are discounted on. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SwapIndex |
SwapIndex
|
The index discounting off the exogenous curve. |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool = False) -> float
Return the underlying swap's fair rate for fixing_date.
This is the at-the-money forward the volatility cubes read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the underlying swap is struck off. |
required |
forecast_todays_fixing
|
bool
|
Whether a fixing dated today is forecast rather than looked up. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The fair rate of the underlying swap. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the forwarding handle is empty, the evaluation date is unset, or the fixing date is invalid. |
currency
¶
currency() -> Currency
Return the index currency, read back off the core index.
Returns:
| Name | Type | Description |
|---|---|---|
Currency |
Currency
|
The currency the index was built with. |
fixed_leg_tenor
¶
fixed_leg_tenor() -> Period
Return the fixed leg's payment tenor.
Returns:
| Name | Type | Description |
|---|---|---|
Period |
Period
|
The fixed-leg tenor. |
exogenous_discount
¶
Return whether the index discounts off a separate curve.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the index was built by with_exogenous_discount. |
CpiInterpolationType
¶
How a CPI observation interpolates between the index fixings bracketing it.
Flat reads the fixing of the lagged period outright; Linear advances from it to the next period's fixing by how far the observation date has run into its own period. The core's deprecated AsIndex variant is not ported and so has no counterpart here.
ZeroInflationIndex
¶
A price index publishing one level per period, reading back either a stored figure or a forecast off its inflation curve.
The curve is reached through a relinkable handle the index owns, so an index can be built before the curve it forecasts off exists. The handle starts empty and a forecast before any link raises ItofinError; link_to fills it.
uk_rpi
staticmethod
¶
uk_rpi(settings: Settings) -> ZeroInflationIndex
Return the UK Retail Price Index: monthly, one-month availability lag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ZeroInflationIndex |
ZeroInflationIndex
|
The "UK RPI" index, over an empty curve handle. |
uk_hicp
staticmethod
¶
uk_hicp(settings: Settings) -> ZeroInflationIndex
Return the UK harmonised index of consumer prices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ZeroInflationIndex |
ZeroInflationIndex
|
The UK HICP index, over an empty curve handle. |
eu_hicp
staticmethod
¶
eu_hicp(settings: Settings) -> ZeroInflationIndex
Return the euro-area harmonised index of consumer prices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ZeroInflationIndex |
ZeroInflationIndex
|
The EU HICP index, over an empty curve handle. |
name
¶
Return the index name, under which fixings are stored.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name, e.g. "UK RPI". |
add_fixing
¶
add_fixing(fixing_date: Date, value: float) -> None
Record a published figure across the whole inflation period.
The figure is stored on every date of the period fixing_date falls in, so a later read on any day inside that period finds it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
Any date inside the inflation period the figure describes. |
required |
value
|
float
|
The published index level. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the index frequency has no expressible inflation period, or a different figure is already stored on a date in that period. |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool = False) -> float
Return the fixing at fixing_date, stored or forecast off the linked curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the level is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Accepted and ignored, as in the core: needs_forecast alone decides between history and forecast. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The index level. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If a date the store should cover has no figure, or a forecast is asked for with no curve linked. |
last_fixing_date
¶
last_fixing_date() -> Date
Return the first day of the period the latest stored figure describes.
Returns:
| Name | Type | Description |
|---|---|---|
Date |
Date
|
The start of that inflation period. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the index has no fixing history. |
link_to
¶
link_to(curve: ZeroInflationTermStructure) -> None
Point the index at curve, so every forecast from here on compounds off it.
Takes the ZeroInflationTermStructure base, so any subclass links. It is the curve behind that facade's handle at call time that is stored, not the handle itself: relinking the facade afterwards leaves this index on the curve it was given, and a later link_to is how it moves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
ZeroInflationTermStructure
|
The curve forecasts compound off. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If curve somehow carries no link. |
needs_forecast
¶
needs_forecast(fixing_date: Date) -> bool
Return whether fixing_date has to be forecast rather than read from history.
Decided against the latest period that could have been published by the settings' evaluation date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date in question. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the date has to be forecast off the curve. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the evaluation date is unset, or the index frequency has no expressible inflation period. |
YoYInflationIndex
¶
YoYInflationIndex(family_name: str, region_name: str, region_code: str, revised: bool, frequency: Frequency, availability_lag: Period, currency_name: str, currency_code: str, currency_numeric_code: int, currency_symbol: str, currency_fraction_symbol: str, currency_fractions_per_unit: int, settings: Settings)
An index publishing one year-on-year inflation rate per period, read back as a stored figure or forecast off its year-on-year curve.
Two forms. A ratio index (from_underlying) derives its rate from two ZeroInflationIndex fixings a year apart and owns no history of its own; a quoted one (the constructor) is published as a rate in its own right and keeps its own history through add_fixing.
Both forms link to a relinkable handle the index owns, so an index can be built before the curve it forecasts off exists. The handle starts empty and a forecast before any link raises ItofinError; link_to fills it.
The quoted constructor spells its region and currency out as their component fields: neither core type has a Python facade, and defaulting the currency metadata would put made-up values on the index.
Build a quoted year-on-year index, keeping its own fixing history.
The rate is published in its own right rather than derived from a price index, so fixings are filed here through add_fixing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
family_name
|
str
|
The index family the fixings are stored under. |
required |
region_name
|
str
|
The name of the region the index measures. |
required |
region_code
|
str
|
The region's code. |
required |
revised
|
bool
|
Whether the published figures are subject to revision. |
required |
frequency
|
Frequency
|
How often the index publishes. |
required |
availability_lag
|
Period
|
How long after a period ends its figure is published. |
required |
currency_name
|
str
|
The currency's name. |
required |
currency_code
|
str
|
The currency's ISO 4217 three-letter code. |
required |
currency_numeric_code
|
int
|
The currency's ISO 4217 numeric code. |
required |
currency_symbol
|
str
|
The currency's symbol. |
required |
currency_fraction_symbol
|
str
|
The symbol of the currency's fractional unit. |
required |
currency_fractions_per_unit
|
int
|
How many fractional units make one currency unit. |
required |
settings
|
Settings
|
The explicit settings supplying the evaluation date and the stored fixings. |
required |
from_underlying
staticmethod
¶
from_underlying(underlying: ZeroInflationIndex) -> YoYInflationIndex
Build a ratio index dividing a price index's figure by its figure a year earlier.
The metadata is inherited bar the family name, which is prefixed YYR_, so a "UK RPI" underlying yields "UK YYR_RPI"; fixings belong on the underlying.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
underlying
|
ZeroInflationIndex
|
The price index whose consecutive figures the rate is derived from. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
YoYInflationIndex |
YoYInflationIndex
|
The ratio index, over an empty curve handle. |
name
¶
Return the index name, under which fixings are stored.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name, e.g. "UK YYR_RPI". |
ratio
¶
Return whether this index is the ratio of two price-index fixings.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True for a ratio index, False for a quoted rate. |
underlying_index
¶
underlying_index() -> ZeroInflationIndex | None
Return the price index a ratio index divides, None on a quoted one.
This is the very object from_underlying was handed, not a fresh facade around the same core index: a rebuilt one would carry a relinkable handle this index never sees, so linking it would silently forecast off nothing.
Returns:
| Type | Description |
|---|---|
ZeroInflationIndex | None
|
ZeroInflationIndex | None: The underlying price index, or None. |
add_fixing
¶
add_fixing(fixing_date: Date, value: float) -> None
Record a published year-on-year rate across the whole inflation period.
A ratio index reads the underlying's history, so filing here records a figure it will never consult.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
Any date inside the inflation period the rate describes. |
required |
value
|
float
|
The published year-on-year rate. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the index frequency has no expressible inflation period, or a different figure is already stored on a date in that period. |
fixing
¶
fixing(fixing_date: Date, forecast_todays_fixing: bool = False) -> float
Return the rate at fixing_date, stored or forecast off the linked curve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date the rate is read or forecast for. |
required |
forecast_todays_fixing
|
bool
|
Accepted and ignored, as in the core: needs_forecast alone decides between history and forecast. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The year-on-year inflation rate. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If a forecast is asked for with no curve linked. |
last_fixing_date
¶
last_fixing_date() -> Date
Return the first day of the period the latest figure on record describes.
Read off the underlying on a ratio index.
Returns:
| Name | Type | Description |
|---|---|---|
Date |
Date
|
The start of that inflation period. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the index has no fixing history. |
link_to
¶
link_to(curve: YoYInflationTermStructure) -> None
Point the index at curve, so every forecast from here on reads it.
Takes the YoYInflationTermStructure base, so any subclass links. It is the curve behind that facade's handle at call time that is stored, not the handle itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
YoYInflationTermStructure
|
The curve forecasts are read off. |
required |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If curve somehow carries no link. |
needs_forecast
¶
needs_forecast(fixing_date: Date) -> bool
Return whether fixing_date has to be forecast rather than read from history.
A ratio index defers the question to its underlying.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fixing_date
|
Date
|
The date in question. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the date has to be forecast off the curve. |
Raises:
| Type | Description |
|---|---|
ItofinError
|
If the evaluation date is unset, or the index frequency has no expressible inflation period. |