Skip to main content

reserving.CalendarIndex

An index by calendar period: one value per period of one grain, from a

Usage

Source

reserving.CalendarIndex()

first period on, optionally extended past its last period at a constant annual rate (CPI, wages, a claims-inflation index).

Parameters

first: str or int

The first period: "2020" (or the integer 2020), "2020H2", "2020Q3" or "2020-07". Its grain is the index’s grain.

values: list of float

The index in first, then one value per period: finite and positive.

future_rate: float
The annual rate past the last period, compounded by months from the last period’s start: finite and above -1. Without it, a period past the last is an error.

Examples

>>> from prospicio.reserving import CalendarIndex
>>> cpi = CalendarIndex("2020", [100.0, 104.0, 110.0], future_rate=0.05)
>>> cpi.value("2021-06")

104.0

>>> round(cpi.value("2024-01"), 4)

121.275

>>> cpi.periods

[‘2020’, ‘2021’, ‘2022’]

Attributes

Name Description
future_rate The annual rate past the last period, or None.
periods The given periods, one per value.
values The given values.

future_rate

The annual rate past the last period, or None.

future_rate: float | None


periods

The given periods, one per value.

periods: list[str]


values

The given values.

values: list[float]

Methods

Name Description
value() The index of the period that contains a month.

value()

The index of the period that contains a month.

Usage

Source

value(month)
Parameters
month: str or date
"YYYY-MM" or a date.
Returns
float
Raises
ValueError
For a month before the first period, or after the last one when no future rate is set.