add_tenor#

rateslib.calendars.add_tenor(start, tenor, modifier, calendar=NoInput.blank, roll=NoInput.blank)#

Add a tenor to a given date under specific modification rules and holiday calendar.

Warning

Note this function does not validate the roll input, but expects it to be correct. This can be used to correctly replicate a schedule under a given roll day. For example a modified 29th May +3M will default to 29th Aug, but can be made to match 31 Aug with ‘eom’ rolls.

Parameters:
  • start (datetime) – The initial date to which to add the tenor.

  • tenor (str) – The tenor to add, identified by calendar days, “D”, months, “M”, years, “Y” or business days, “B”, for example “10Y” or “5B”.

  • modifier (str, optional in {"NONE", "MF", "F", "MP", "P"}) – The modification rule to apply if the tenor is calendar days, months or years.

  • calendar (CustomBusinessDay or str, optional) – The calendar for use with business day adjustment and modification.

  • roll (str, int, optional) – This is only required if the tenor is given in months or years. Ensures the tenor period associates with a schedule’s roll day.

Return type:

datetime

Examples

In [1]: add_tenor(dt(2022, 2, 28), "3M", "NONE")
Out[1]: datetime.datetime(2022, 5, 28, 0, 0)

In [2]: add_tenor(dt(2022, 12, 28), "4b", "F", get_calendar("ldn"))
Out[2]: datetime.datetime(2023, 1, 4, 0, 0)

In [3]: add_tenor(dt(2022, 12, 28), "4d", "F", get_calendar("ldn"))
Out[3]: datetime.datetime(2023, 1, 3, 0, 0)