Skip to main content

Module imm

Module imm 

Expand description

IMM and CDS-IMM date generation — pure Gregorian date arithmetic.

Two distinct conventions live here:

  • IBOR-IMM dates (imm_code_to_dates): the third Wednesday of the cycle month. An IMM code such as "JUN27" resolves to the unadjusted (start, end) reference window of the IMM-cycled future it names, which starts on the coded date.
  • CDS-IMM dates (next_cds_imm_date / cds_standard_maturity): the 20th of March / June / September / December (calendar dates, never business-day-adjusted), per the ISDA 2014 CDS Standard Maturity convention.

These are pure functions — no calendar, no holiday math. Callers apply their own business-day adjustment downstream.

Structs§

ImmCodeError
Error resolving an IMM code.

Enums§

ImmCycle
The IMM reference-period cycle for imm_code_to_dates.
ImmDay
Which day of a cycle month an IMM date is: the third Wednesday, or the first Wednesday on or after the 9th, the New Zealand bank bill roll (a Wednesday 9th is the date itself). The NZ bank bill exchange’s own wording for the second rule was not checked against a primary source.

Constants§

FUTURES_MONTH_LETTERS 🔒
The exchanges’ futures month letters, January first: "H22" is March 2022.
MONTH_CODES 🔒
The three-letter month codes an IMM code is written in, indexed by month - 1.

Functions§

cds_imm_date_on_or_after 🔒
The first CDS-IMM date on or after today — today itself when it is one. The inclusive rule, for an anchor that may be a CDS-IMM date.
cds_imm_date_on_or_before 🔒
The most recent CDS-IMM date on or before today — today itself when it is one: the anchor a CDS2015 schedule accrues from.
cds_standard_maturity
The CDS2015 standard maturity for a tenor_years-year CDS traded on today.
cds_standard_maturity_months
cds_standard_maturity over a tenor in months, so sub-annual quotes (a 6M point) pin their own pillar.
imm_code_of
The IMM code ("JUN27") naming date, the inverse of imm_code_to_dates’s reference-period start.
imm_code_to_dates
Resolves an IMM code (three-letter month + two-digit year, e.g. "JUN27") to its unadjusted (start, end) reference-period dates: the period of the futures contract the code names, as a FutureTemplate’s reference period read it.
imm_date
The IBOR-IMM date of month in year — the third Wednesday — or None where month is outside cycle or not a month.
imm_date_on
The IMM date of month in year under cycle, on the day day names; None for a month outside the cycle.
imm_date_on_or_after 🔒
The first IBOR-IMM date on or after date under cycle — date itself when it is one. The inclusive rule, for an anchor that may be an IMM date.
imm_date_on_or_before 🔒
The last IBOR-IMM date on or before date under cycle — date itself when it is one.
is_cycle_month 🔒
Whether month is a cycle month under cycle: any month for the monthly cycle, and only March / June / September / December for the quarterly one.
is_imm_date
Whether date is an IBOR-IMM date under cycle — the third Wednesday of a cycle month.
next_cds_imm_date
The next CDS-IMM date strictly after today — the 20th of the next March / June / September / December (calendar date, not business-day adjusted). A CDS-IMM date rolls to the following one, as next_semi_annual_roll_date does.
next_cycle_month 🔒
Previous-IMM (year, month) under cycle.
next_imm_date
The next IBOR-IMM date strictly after date under cycle: an IMM date rolls to the following one.
next_semi_annual_roll_date
The next semi-annual CDS roll date — the 20th of the next March or September.
preceding_standard_maturity 🔒
The standard CDS maturity — a 20-Jun or 20-Dec — on or before date.
prior_cds_imm_date
The prior CDS-IMM date strictly before today: a CDS-IMM date rolls to the preceding one.
prior_imm_date
The prior IBOR-IMM date strictly before date under cycle: an IMM date rolls to the preceding one.
third_wednesday 🔒
Third Wednesday of (year, month). None only if (year, month) is invalid.