QuantConnect
International Future Universe
Introduction
The International Future Universe dataset by QuantConnect lists the available International Future contracts, their daily trading volume, and Open Interest. The data covers 3 contracts (FESX, HSI, and NKD), starts in July 1998, and is delivered on daily frequency. This dataset is created by monitoring the trading activity on the EUREX, HKFE, and CME.
This dataset depends on the US Futures Security Master dataset because the US Futures Security Master dataset contains information on symbol changes of the contracts.
This dataset does not
contain market data. For market data, see International Futures by TickData and US Futures by AlgoSeek for NKD.
For more information about the International Future Universe dataset, including CLI commands and pricing, see the dataset listing.
About the Provider
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.
Getting Started
The International Futures Universe dataset provides data for contract filtering/selection:
hsi = self.add_future(Futures.Indices.HANG_SENG, Resolution.MINUTE) # "HSI" hsi.set_filter(0, 90) fesx = self.add_future(Futures.Indices.EURO_STOXX_50, Resolution.MINUTE) # "FESX" fesx.set_filter(0, 90) nkd = self.add_future(Futures.Indices.NIKKEI_225_DOLLAR, Resolution.MINUTE) # "NKD" nkd.set_filter(0, 90)
var hsi= AddFuture(Futures.Indices.HangSeng, Resolution.Minute) // "HSI"; hsi.SetFilter(0, 90); var fesx = AddFuture(Futures.Indices.EuroStoxx50, Resolution.Minute) // "FESX"; fesx.SetFilter(0, 90); var nkd = AddFuture(Futures.Indices.Nikkei225Dollar, Resolution.Minute) // "NKD"; nkd.SetFilter(0, 90);
Data Summary
The following table describes the dataset properties:
Property | Value |
---|---|
Start Date | July 1998 (for details, see Supported Assets ) |
Coverage | 3 Contracts |
Data Density | Dense |
Resolution | Daily |
Timezone | Various (for details, see Supported Assets ) |
Market Hours | Regular and Extended |
Requesting Data
To add International Future Universe data to your algorithm, call the AddFuture
add_future
method. Save a reference to the Future object so you can access the data later in your algorithm. To define which contracts should be in your universe, specify the filter when requesting the Future data.
The AddFuture
add_future
method provides a daily stream of Future chain data. To get the most recent daily chain, call the FuturesChain
futures_chain
method with the underlying Future Symbol. The FuturesChain
futures_chain
method returns data on all the tradable contracts, not just the contracts that pass your universe filter.
class InternationalFuturesDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2013, 12, 20) self.set_end_date(2014, 2, 20) self.set_cash(1000000) self.universe_settings.asynchronous = True self._future = self.add_future(Futures.Indices.HANG_SENG) # Set our contract filter for this Future chain. self._future.set_filter(lambda universe: universe.standards_only().front_month()) # Get the entire Futures chain for the current day. chain = self.futures_chain(self._future.symbol, flatten=True).data_frame
public class InternationalFuturesDataAlgorithm : QCAlgorithm { private Future _future; public override void Initialize() { SetStartDate(2013, 12, 20); SetEndDate(2014, 2, 20); SetCash(1000000); UniverseSettings.Asynchronous = True; var future = AddFuture(Futures.Indices.HangSeng); // Set our contract filter for this Future chain. _future.SetFilter((universe) => universe.StandardsOnly().FrontMonth()); // Get the entire Futures chain for the current day. var chain = FuturesChain(_future.Symbol); } }
For more information about creating Future Universes, see Futures.
Accessing Data
For information about accessing International Future Universe data, see Futures.
Historical Data
You can get historical International Future Universe data in an algorithm and the Research Environment.
Historical Data In Algorithms
To get historical International Future Universe data in an algorithm, call the History<FutureUniverse>
history
method with continuous Future Symbol
and a lookback period. This method returns the all the available contracts for each trading day, not the subset of contracts that pass your universe filter. If there is no data for the period you requested, the history result is empty.
# Add the Future and save a reference to it. future = self.add_future(Futures.Indices.HANG_SENG) # DataFrame example where the columns are the FutureUniverse attributes: history_df = self.history(FutureUniverse, future.symbol, 5, flatten=True) # Series example where the values are lists of FutureUniverse objects: history_series = self.history(FutureUniverse, future.symbol, 5, flatten=False) # FutureUniverse objects example: history = self.history[FutureUniverse](future.symbol, 5)
// Add the Future and save a reference to it. var future = AddFuture(Futures.Indices.HangSeng); // Get historical data. var history = History<FutureUniverse>(future.Symbol, 5);
For more information about historical International Future Universe data in algorithms, see Contracts.
Historical Data In Research
To get historical International Future Universe data in the Research Environment, call the History<FutureUniverse>
history
method with continuous Future Symbol
and a time period. This method returns the all the available contracts for each trading day, not the subset of contracts that pass your universe filter. If there is no data for the period you requested, the history result is empty.
# Add the Future and save a reference to it. future = qb.add_future(Futures.Indices.HANG_SENG) # DataFrame example where the columns are the FutureUniverse attributes: history_df = qb.history(FutureUniverse, future.symbol, datetime(2025, 1, 1), datetime(2025, 4, 1), flatten=True) # Series example where the values are lists of FutureUniverse objects: history_series = qb.history(FutureUniverse, future.symbol, 5, flatten=False) # FutureUniverse objects example: history = qb.history[FutureUniverse](future.symbol, datetime(2025, 1, 1), datetime(2025, 4, 1))
// Add the Future and save a reference to it. var future = qb.AddFuture(Futures.Indices.HangSeng); // Get historical data. var history = qb.History<FutureUniverse>(future.Symbol, new DateTime(2025, 1, 1), new DateTime(2025, 4, 1));
For more information about historical International Future Universe data in the Research Environment, see Daily Prices History.
Example Applications
The International Futures Universe dataset enables you to design Futures strategies accurately. Examples include the following strategies:
- Buying the Futures contract with the most open interest to reduce slippage and market impact
- Trade speculation on an International Index
- Trading bull calendar spreads to reduce volatility and margin requirements
Classic Algorithm Example
The following example algorithm uses the ZigZag indicator to determine the trend of Hang Seng Index. It then trades the Index with HSI Futures.
class InternationalFuturesDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2021, 1, 1) self.set_end_date(2021, 7, 1) # Set the time zone to HKT to make it more comparable with the exchange. self.set_time_zone(TimeZones.HONG_KONG) # Set the account currency as HKD to trade HSI Futures. self.set_account_currency("HKD", 1000000) # Seed the last price of the contracts for filling. self.set_security_initializer(BrokerageModelSecurityInitializer(self.brokerage_model, FuncSecuritySeeder(self.get_last_known_prices))) # Request HSI Futures to trade. # Note that we will trade the contract with the highest open interest for liquidity. self.hsi_future = self.add_future( Futures.Indices.HANG_SENG, extended_market_hours=True, data_mapping_mode=DataMappingMode.LAST_TRADING_DAY, contract_depth_offset=0 ) # Adds contracts that expiry within 90 days. We will trade the farthest contract self.hsi_future.set_filter(0,90) # Request the corresponding underlying Index for feeding indicator for trade signal generation. hsi_index = self.add_index("HSI").symbol # Create a ZigZag indicator to trade Hang Seng Index price pivot points. self._zz = self.zz(hsi_index, 0.15, 5, Resolution.DAILY) # Warm up indicator for immediate readiness to trade. self.warm_up_indicator(hsi_index, self._zz, Resolution.DAILY) def on_data(self, slice: Slice) -> None: # Only place trade if the Future contracts is in market opening hours to avoid stale fills. if self.is_market_open(self.hsi_future.symbol) and self._zz.is_ready: pivot = self._zz.pivot_type # If the last pivot point is a low point, the current trend is increasing after this low point. if pivot == PivotPointType.LOW: contracts = sorted([x.symbol for x in slice.future_chains.get(self.hsi_future.symbol)], key=lambda x: x.id.date) self.set_holdings(contracts[-1], 0.2) # If the last pivot point is a high point, the current trend is decreasing after this high point. if pivot == PivotPointType.HIGH: contracts = sorted([x.symbol for x in slice.future_chains.get(self.hsi_future.symbol)], key=lambda x: x.id.date) self.set_holdings(contracts[-1], -0.2)
public class InternationalFuturesDataAlgorithm : QCAlgorithm { private Future _hsiFuture; private ZigZag _zz; public override void Initialize() { SetStartDate(2021, 1, 1); SetEndDate(2021, 7, 1); // Set the time zone to HKT to make it more comparable with the exchange. SetTimeZone(TimeZones.HongKong); // Set the account currency as HKD to trade HSI Futures. SetAccountCurrency("HKD", 1000000); // Seed the last price of the contracts for filling. SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices))); // Request HSI Futures to trade. // Note that we will trade the contract with the highest open interest for liquidity. _hsiFuture = AddFuture( Futures.Indices.HangSeng, extendedMarketHours: True, dataMappingMode: DataMappingMode.LastTradingDay, contractDepthOffset: 0 ); // Adds contracts that expiry within 90 days. We will trade the farthest contract _hsiFuture.SetFilter(0,90); // Request the corresponding underlying index for feeding indicators for trade signal generation. var hsiIndex = AddIndex("HSI").Symbol; // Create a ZigZag indicator to trade Hang Seng Index price pivot points. _zz = ZZ(hsiIndex, 0.15m, 5, Resolution.Daily); // Warm up indicator for immediate readiness to trade. WarmUpIndicator(hsiIndex, _zz, Resolution.Daily); } public override void OnData(Slice slice) { // Only place trade if the Future contracts is in market opening hours to avoid stale fills. if (IsMarketOpen(_hsiFuture.Symbol) && _zz.IsReady) { var pivot = _zz.PivotType; FuturesChain chain; // If the last pivot point is low, the current trend is increasing after this low point. if (pivot == PivotPointType.Low && slice.FutureChains.TryGetValue(_hsiFuture.Symbol, out chain)) { var contract = chain.OrderBy(x => x.Expiry).LastOrDefault()?.Symbol; SetHoldings(contract, 0.2m); } // If the last pivot point is high, the current trend decreases after this high point. if (pivot == PivotPointType.High && slice.FutureChains.TryGetValue(_hsiFuture.Symbol, out chain)) { var contract = chain.OrderBy(x => x.Expiry).LastOrDefault()?.Symbol; SetHoldings(contract, -0.2m); } } } }