About US Futures Security Master

The US Futures Security Master dataset by QuantConnect provides mapping reference data for the most liquid contracts of the CME Group exchanges, calculated with popular rolling techniques. The data covers 75 root Future contracts, starts in 2012, and is delivered on a daily frequency with a zip file with all the contract mappings. This dataset is created by daily processing of the US historical Future chains.

This dataset, paired the US Futures dataset, supports the following rolling techniques: ForwardPanamaCanal, BackwardsPanamaCanal, and Backwards Ratio. You can set the specific date of rolling to occur on the LastTradingDay, FirstDayMonth, or on the day where the contract with the greatest OpenInterest changes.


About QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

Add US Futures Security Master

Add Dataset Create Free QuantConnect Account

About QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.


Algorithm Example

from AlgorithmImports import *
from QuantConnect.DataSource import *

class USFuturesSecurityMasterDataClassicAlgorithm (QCAlgorithm):
    
    threshold = 0.01 # 1%
    
    def initialize(self) -> None:
        self.set_cash(1000000)
        self.set_start_date(2019, 2, 1)
        self.set_end_date(2021, 6, 1)

        # Requesting data
        self.continuous_contract = self.add_future(Futures.Energies.CRUDE_OIL_WTI,
                                                  data_normalization_mode = DataNormalizationMode.BACKWARDS_RATIO,
                                                  data_mapping_mode = DataMappingMode.OPEN_INTEREST,
                                                  contract_depth_offset = 0)
        self.continuous_contract_symbol = self.continuous_contract.symbol
                      
        # Historical data
        history = self.history(self.continuous_contract_symbol, 500, Resolution.MINUTE)
        self.debug(f"We got {len(history)} items from our history request")
        
        self.sma = self.SMA(self.continuous_contract_symbol, 10, Resolution.DAILY)
        if not history.empty:
            for time, row in history.droplevel(0).loc[self.continuous_contract_symbol].iterrows():
                self.sma.update(IndicatorDataPoint(time, row.close))
        

    def on_data(self, slice: Slice) -> None:
        # Accessing data
        for symbol, changed_event in slice.symbol_changed_events.items():
            old_symbol = changed_event.old_symbol
            new_symbol = changed_event.new_symbol
            tag = f"Rollover - Symbol changed at {self.time}: {old_symbol} -> {new_symbol}"
            quantity = self.portfolio[old_symbol].quantity

            # Rolling over: to liquidate any position of the old mapped contract and switch to the newly mapped contract
            self.liquidate(old_symbol, tag = tag)
            if quantity != 0: self.market_order(new_symbol, quantity, tag = tag)
            self.log(tag)
                
        mapped_symbol = self.continuous_contract.mapped

        if not (slice.bars.contains_key(self.continuous_contract_symbol) and self.sma.is_ready and mapped_symbol):
            return
        
        if slice.bars[self.continuous_contract_symbol].price > self.sma.current.value * (1+self.threshold) and not self.portfolio[mapped_symbol].is_long:
            self.market_order(mapped_symbol, 1)
        elif slice.bars[self.continuous_contract_symbol].price < self.sma.current.value * (1-self.threshold) and not self.portfolio[mapped_symbol].is_short:
            self.market_order(mapped_symbol, -1)

Example Applications

The US Futures Security Master enables you to design strategies harnessing continuous Futures contracts. Examples include the following strategies: