RollSchedule#
-
class sigtech.framework.schedules.roll_schedules.factory.RollSchedule
Class responsible for calculation of a rolling table.
Available roll tables:
'front'
- Front contract, contract month with an expiration date closest to the current date.'f_0'
- Adjusted front contract (typically 3 months out).'f_1'
- First contract after'f_0'
.'f_2'
- Second contract after'f_0'
.'f_3'
- Third contract after'f_0'
.'f_4'
- Fourth contract after'f_0'
.'f_4_5'
- Blend of fourth and fifth contract after'f_0'
, applicable only to metals.'f_5'
- Fifth contract after'f_0'
.'f_6'
- Sixth contract after'f_0'
.'f_0_cal'
- Adjusted front contract using calendar days to compute monthly_roll_days.'f_1_cal'
- First contract after'f_0'
using calendar days to compute monthly_roll_days.'f_2_cal'
- Second contract after'f_0'
using calendar days to compute monthly_roll_days.'f_3_cal'
- Third contract after'f_0'
using calendar days to compute monthly_roll_days.'f_4_cal'
- Fourth contract after'f_0'
using calendar days to compute monthly_roll_days.'f_4_5_cal'
-'f_4_5_cal'
using calendar days to compute monthly_roll_days.'f_5_cal'
- Fifth contract after'f_0'
using calendar days to compute monthly_roll_days.'f_6_cal'
- Sixth contract after'f_0'
using calendar days to compute monthly_roll_days.'f_near'
- Nearest contract, used for roll yield calculation (unlikely to be tradable).'f_near_cal'
- Nearest contract, using calendar days to compute monthly_roll_days.'bcom'
- Bloomberg Commodity Index roll schedule.'bcom_3m'
- 3 month lead on Bloomberg Commodity Index contract schedule.'dec'
- December contract at least 6 months in the future.'djubs'
- Dow Jones-UBS commodity index roll schedule.'energy'
- Proprietary schedule for energy contracts.'energy_obs'
- Signal observation schedule used to trade the energy contract schedule.'gsci'
- GSCI (Goldman Sachs) Single Commodity Indices contract schedule.'gsci_eom'
'long_carry'
- Proprietary schedule used for commodity long carry strategy.'short_carry'
- Proprietary schedule used for commodity short carry strategy.'mcq_long_carry'
- Macquarie schedule used for commodity long carry strategy.'mcq_short_carry'
- Macquarie schedule used for commodity short carry strategy.'prev_month'
- Roll the front contract the month before the expiration date.'rici'
- Rogers International Commodity Index (RICI) contract schedule.'seasonal'
- Contract schedule based on harvest date (agriculture and grains).'seasonal_obs'
- Signal observation schedule used to trade the seasonal contract schedule.'front_oi'
- Front contract, shifted to start roll when open interest is greater on contract to roll in.'f_0_oi'
- Adjusted front contract, shifted to roll when open interest is greater on contract to roll in.'quarterly'
- Contracts are rolled quarterly.'quarterly_cal'
- Contracts are rolled quarterly using calendar days to compute monthly_roll_days.'tri'
'pre_roll'
-
calculate_rolling_table(allow_adjustments=False)
Calculate the rolling table using the appropriate rolling method.
- Parameters:
allow_adjustments – If set to False, rolling adjustments to accommodate specific contract expirations are not allowed. If adjustments are allowed, warnings explaining the nature of the adjustments will be provided.
- Returns:
pandas DataFrame.
-
static get_first_contract_with_data(roll_table)
Scan the roll table and return the first contract with no subsequent empty or invalid contracts.
- Parameters:
roll_table – Input roll table.
- Returns:
Contract object.
-
static get_first_valid_series_contract(contract_series, schedule=None)
return the first contract of a continuous series of contract
- Parameters:
contract_series – series of contract where index is date.
schedule – schedule used to beginning of maturity months to next business day.
- Returns:
Contract object.