Module period
Expand description
Tenor periods — a signed multiplier paired with a time unit.
Period is the duration value type used to express tenors ("3M", "1Y")
and to advance dates. It is pure data; advancing a calendar date by a period
lives in statics::calendars / statics::schedules.
§Algebra
Periods support Add/Sub within a unit family — Month/Year, or
Week/Day — returning a normalized result; combining across families (or with
Term) is an error. Period::normalize coarsens to the largest exact unit
(12M → 1Y, 7D → 1W). Equality and hashing are semantic: 12M == 1Y and
7D == 1W, and equal tenors hash equally. Ordering (PartialOrd) uses day
bounds and is None when undecidable (e.g. 1M vs 30D).
Structs§
- Forward
Tenor - A tenor with an optional forward start:
"5Y"is a five-year term from spot, and"2Y2Y"is a two-year term starting two years after spot — the<forward-start><tenor>spelling a forward swap or a swaption is quoted in. - Period
- A tenor: an integer multiplier and a
PeriodEnumunit.
Enums§
- Period
Enum - Time unit of a
Period(FpMLPeriodEnum). - Period
Error - Error combining or ordering two
Periods.
Constants§
- FORWARD_
TENOR_ 🔒FORM - The shape a forward-tenor spelling must have, named on rejection.
- PERIOD_
FORM 🔒 - The shape a tenor code must have, named on rejection.
Functions§
- single_
period 🔒 - One segment,
"3M"or"-1Y": a signed count and a unit letter, bounded to two centuries.