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

class USFuturesSecurityMasterDataClassicAlgorithm (QCAlgorithm):
    
    threshold = 0.01 # 1%
    
    def Initialize(self) -> None:
        self.SetCash(1000000)
        self.SetStartDate(2019, 2, 1)
        self.SetEndDate(2021, 6, 1)

        # Requesting data
        self.continuous_contract = self.AddFuture(Futures.Energies.CrudeOilWTI,
                                                  dataNormalizationMode = DataNormalizationMode.BackwardsRatio,
                                                  dataMappingMode = DataMappingMode.OpenInterest,
                                                  contractDepthOffset = 0)
        self.symbol = self.continuous_contract.Symbol
                      
        # Historical data
        history = self.History(self.symbol, 500, Resolution.Minute)
        self.Debug(f"We got {len(history)} items from our history request")
        
        self.sma = self.SMA(self.symbol, 10, Resolution.Daily)
        if not history.empty:
            for time, row in history.droplevel(0).loc[self.symbol].iterrows():
                self.sma.Update(IndicatorDataPoint(time, row.close))
        

    def OnData(self, slice: Slice) -> None:
        # Accessing data
        for changed_event in slice.SymbolChangedEvents.Values:
            if changed_event.Symbol == self.symbol:
                self.Log(f"SymbolChanged event at {self.Time}: {changed_event}")
                
        mapped_symbol = self.continuous_contract.Mapped

        if not (slice.Bars.ContainsKey(self.symbol) and self.sma.IsReady and mapped_symbol):
            return
        
        if slice.Bars[self.symbol].Price > self.sma.Current.Value * (1+self.threshold) and not self.Portfolio[mapped_symbol].IsLong:
            self.MarketOrder(mapped_symbol, 1)
        elif slice.Bars[self.symbol].Price < self.sma.Current.Value * (1-self.threshold) and not self.Portfolio[mapped_symbol].IsShort:
            self.MarketOrder(mapped_symbol, -1)

Example Applications

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