Rolling schedule methods#
-
sigtech.framework.schedules.roll_schedules.methods.oi_adjusted_adjustment(original, bd_schedule, calculation_end_date: Optional[date] = None)
Method to shift rolling dates dynamically up to the rolled out contract expiry, based on the date when the contract open interest crosses over.
-
sigtech.framework.schedules.roll_schedules.methods.oi_adjusted_rolling_front(name, start_date, end_date, bd_schedule, contract_group, roll_table, table_format, front_offset=None, **kwargs)
Roll futures into the front-month contract only, on one or more consecutive trading days,
offset
trading days before the expiry.offset
must be continuous. This range of days are shifted dynamically up to the rolled out contract expiry, based on the date when the contract open interest crosses over.
-
sigtech.framework.schedules.roll_schedules.methods.oi_adjusted_rolling_monthly(name, start_date, end_date, bd_schedule, contract_group, roll_table, table_format, monthly_roll_days=None, **kwargs)
Generic monthly roll rule where the roll period is implemented over a range of days, starting a day from
start_roll_day
(including) toend_roll_day
(including). This range of days are shifted dynamically up to the rolled out contract expiry, based on the date when the contract open interest crosses over.
-
sigtech.framework.schedules.roll_schedules.methods.roll_table_lookup(name, roll_table, table_format, contract_group, month, year, **kwargs)
Lookup given month in a roll table and return a contract to roll into.
- Parameters:
name – Rule name.
roll_table – Rolling table.
table_format – Table format.
contract_group – Contract group.
month – Month.
year – Year.
- Returns:
Contract name.
-
sigtech.framework.schedules.roll_schedules.methods.rolling_custom(name, start_date, end_date, bd_schedule, contract_group, roll_table, table_format, monthly_roll_days=None, front_offset=None, **kwargs)
Wrapper roll rule explicitly defined to support a custom roll table with or without front_offset.
- Parameters:
name – Rule name.
start_date – Start date.
end_date – End date.
bd_schedule – Business days schedule.
contract_group – Contract group.
roll_table – Rolling table.
table_format – Table format.
monthly_roll_days – Monthly rolling days.
front_offset – Front offset.
- Returns:
Pre-roll table (Dataframe).
-
sigtech.framework.schedules.roll_schedules.methods.rolling_front(name, start_date, end_date, bd_schedule, contract_group, roll_table, table_format, front_offset=None, **kwargs)
Front rule: roll futures into the front-month contract only, on one or more consecutive trading days,
offset
trading days before the expiry.offset
must be continuous.- Parameters:
name – Rule name.
start_date – Start date.
end_date – End date.
bd_schedule – Business days schedule.
contract_group – Contract group.
roll_table – Rolling table.
table_format – Table format.
front_offset – Front offset.
- Returns:
Pre-roll table (Dataframe).
-
sigtech.framework.schedules.roll_schedules.methods.rolling_monthly(name, start_date, end_date, bd_schedule, contract_group, roll_table, table_format, monthly_roll_days=None, **kwargs)
Generic monthly roll rule where the roll period is implemented over a period ranging from
start_roll_day
(including) toend_roll_day
(including).- Parameters:
name – Rule name.
start_date – Start date.
end_date – End date.
bd_schedule – Business days schedule.
contract_group – Contract group.
roll_table – Rolling table.
table_format – Table format.
monthly_roll_days – Monthly rolling days.
- Returns:
Pre-roll table (Dataframe).
-
sigtech.framework.schedules.roll_schedules.methods.rolling_prev_month(name, start_date, end_date, bd_schedule, contract_group, roll_table, table_format, month_end_offset=None, **kwargs)
Previous month rule: roll a specified number of days before the end of previous month before expiry.
- Parameters:
name – Rule name.
start_date – Start date.
end_date – End date.
bd_schedule – Business days schedule.
contract_group – Contract group.
roll_table – Rolling table.
table_format – Table format.
month_end_offset – Month end offset.
- Returns:
Pre-roll table (Dataframe).
-
sigtech.framework.schedules.roll_schedules.methods.rolling_rici(name, start_date, end_date, bd_schedule, contract_group, roll_table, table_format, **kwargs)
RICI rule: the index rolls usually over 3 days, from the day prior to the last RICI Business Day of the month to the first RICI Business Day of the following month.
In the event that at least one of the last 3 weekdays (excluding weekend) of the month is simultaneously a holiday in the US and a business day in Japan, the roll period will be shifted forward by the number of days meeting the preceding condition (i.e., holiday in the US and business day in Japan).
Each contract is treated according to its own exchange business days only. Because RICI now rolls over the year-end (2 days at the end of year Y plus 1 day at the start of Y+1), we generate rolling timetable that starts from end of January / start of February.
- Parameters:
name – Rule name.
start_date – Start date.
end_date – End date.
bd_schedule – Business days schedule.
contract_group – Contract group.
roll_table – Rolling table.
table_format – Table format.
- Returns:
Pre-roll table (Dataframe).