get_imm#

rateslib.scheduling.get_imm(month=NoInput.blank, year=NoInput.blank, code=NoInput.blank, definition=<rl.Imm.Wed3>)#

Return an IMM date for a specified month.

Parameters:
  • month (int) – The month of the year in which the IMM date falls.

  • year (int) – The year in which the IMM date falls.

  • code (str) – Identifier in the form of a one digit month code and 21st century year, e.g. “U29”. If code is given month and year are unused.

  • definition (Imm, str) – The IMM definition to return the date for. This is entered as either an Imm enum, or that enum variant name as sting, e.g. “Wed3”.

Return type:

datetime

Examples

Get the quarterly SOFR or ESTR futures date, defined by CME, EUREX, or ICE:

In [1]: get_imm(3, 2022, definition=Imm.Wed3_HMUZ)
Out[1]: datetime.datetime(2022, 3, 16, 0, 0)

In [2]: get_imm(code="H22", definition="Wed3")
Out[2]: datetime.datetime(2022, 3, 16, 0, 0)

Get a serial futures contract for a NZD bank bill defined by ASX:

In [3]: get_imm(1, 2023, definition="Wed1_Post9")
Out[3]: datetime.datetime(2023, 1, 11, 0, 0)