qis.generate_fixed_maturity_rolls

qis.generate_fixed_maturity_rolls(time_period, freq='h', roll_freq='W-FRI', roll_hour=8, min_days_to_next_roll=6, include_end_date=False, future_days_offset=360)[source]

the roll schedule of a fixed-maturity instrument: for each observation time, the expiry held.

A constant-maturity series is a sequence of contracts, and this says which one is held when. The roll happens once the current expiry is closer than min_days_to_next_roll, so the position is never carried into the last days before expiry where liquidity thins.

Parameters:
  • time_period (TimePeriod) – period over which to generate the schedule

  • freq (str) – frequency of the observation times, as a pandas offset alias

  • roll_freq (str) – frequency of the candidate expiries, e.g. 'W-FRI' for weekly Friday expiries

  • roll_hour (int | None) – hour of day of the expiry. None leaves it at midnight

  • min_days_to_next_roll (int) – roll once the held expiry is fewer than this many days away

  • include_end_date (bool) – include the end of time_period in the observation times

  • future_days_offset (int) – how far past the end of the period to generate candidate expiries, so that the observations near the end still have a next contract to roll into

Returns:

the expiry held at each observation time, indexed by observation time

Return type:

Series