TickData
International Futures
Introduction
The International Futures dataset by TickData provides Futures data, including price, volume, open interest, and expiry. The data covers the 3 contracts, FESX, HSI, and NKD, starting in July 1998 and is delivered on any frequency from tick to daily. This dataset is created by TickData, which negotiates directly with exchanges for their official archive and partners with real-time data providers with direct exchange connections and multiple redundant ticker plants.
This dataset also depends on the US Futures Security Master because the US Futures Security Master dataset contains information to construct continuous Futures.
For more information about the International Futures dataset, including CLI commands and pricing, see the dataset listing.
About the Provider
TickData was founded by a futures broker and a programmer in 1984 as the first company in the world to offer historical tick-by-tick prices on the futures and index markets. TickData provides access to comprehensive and detailed market data and analytics products in the financial industry covering Equities, Futures, Options, cash FOREX, and Cash Indices.
Getting Started
The following snippet demonstrates how to request data from the International Futures dataset:
hsi = self.add_future(Futures.Indices.HANG_SENG, Resolution.MINUTE).symbol # "HSI" fesx = self.add_future(Futures.Indices.EURO_STOXX_50, Resolution.MINUTE).symbol # "FESX" nkd = self.add_future(Futures.Indices.NIKKEI_225_DOLLAR, Resolution.MINUTE).symbol # "NKD"
var hsi= AddFuture(Futures.Indices.HangSeng, Resolution.Minute).Symbol // "HSI"; var fesx = AddFuture(Futures.Indices.EuroStoxx50, Resolution.Minute).Symbol // "FESX"; var nkd = AddFuture(Futures.Indices.Nikkei225Dollar, Resolution.Minute).Symbol // "NKD";
Data Summary
The following table describes the dataset properties:
Property | Value |
---|---|
Start Date | July 1998, see Supported Assets below for details |
Coverage | 3 Contracts |
Data Density | Dense |
Resolution | Minute, Hour, & Daily |
Timezone | Various, refer to Supported Assets below |
Market Hours | Regular and Extended |
Volume Discrepancies
Requesting Data
To add International Futures data to your algorithm, call the AddFuture
add_future
method. Save a reference to the Future so you can access the data later in your algorithm.
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 # Request Hang Seng Index Futures data future = self.add_future(Futures.Indices.HANG_SENG) # Set filter to obtain the contracts expire within 90 days future.set_filter(0, 90) self.future_symbol = future.symbol
public class InternationalFuturesDataAlgorithm : QCAlgorithm { private Symbol _futureSymbol; public override void Initialize() { SetStartDate(2013, 12, 20); SetEndDate(2014, 2, 20); SetCash(1000000); UniverseSettings.Asynchronous = True; // Request Hang Seng Index Futures data var future = AddFuture(Futures.Indices.HangSeng); // Set filter to obtain the contracts expire within 90 days future.SetFilter(0, 90); _futureSymbol = future.Symbol; } }
For more information about creating Future subscriptions, see Requesting Data or Futures Universes.
Accessing Data
To get the current International Futures data, index the FuturesChains
futures_chains
property of the current Slice
with the canonical Futures Symbol
. Slice objects deliver unique events to your algorithm as they happen, but the Slice
may not contain data for your Future at every time step.
def on_data(self, slice: Slice) -> None: # Get future chain of the canonical symbol chain = slice.futures_chains.get(self.future_symbol) if chain: # Iterate each contract in the future chain for contract in chain: self.log(f"{contract.symbol} price at {slice.time}: {contract.last_price}")
public override void OnData(Slice slice) { // Get future chain of the canonical symbol if (slice.FuturesChains.TryGetValue(_futureSymbol, out var chain)) { // Iterate each contract in the future chain foreach (var contract in chain) { Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}"); } } }
You can also iterate through all of the FuturesChain
objects in the current Slice
.
def on_data(self, slice: Slice) -> None: # Iterate all future chains for canonical_symbol, chain in slice.futures_chains.items(): # Iterate each contract in the future chain for contract in chain: self.log(f"{contract.symbol} price at {slice.time}: {contract.last_price}")
public override void OnData(Slice slice) { // Iterate all future chains foreach (var kvp in slice.FuturesChains) { var canonicalSymbol = kvp.Key; var chain = kvp.Value; // Iterate each contract in the future chain foreach (var contract in chain) { Log($"{contract.Symbol} price at {slice.Time}: {contract.LastPrice}"); } } }
For more information about accessing Futures data, see Handling Data.
Historical Data
You can get historical International Futures data in an algorithm and the Research Environment.
Historical Data In Algorithms
To get historical International Futures data in an algorithm, call the History
history
method with the canonical Futures Symbol
or a Futures contract Symbol
. If there is no data in the period you request, the history result is empty.
# DataFrame objects contract_history_df = self.history(contract.symbol, 100, Resolution.MINUTE) continuous_history_df = self.history(self.future_symbol, start=self.time - timedelta(days=15), end=self.time, resolution=Resolution.MINUTE, fill_forward=False, extended_market_hours=False, data_mapping_mode=DataMappingMode.OPEN_INTEREST, data_normalization_mode=DataNormalizationMode.RAW, contract_depth_offset=0) # TradeBar objects contract_history_trade_bars = self.history[TradeBar](contract.symbol, 100, Resolution.MINUTE) continous_history_trade_bars = self.history[TradeBar](self.future_symbol, 100, Resolution.MINUTE) # QuoteBar objects contract_history_quote_bars = self.history[QuoteBar](contract.symbol, 100, Resolution.MINUTE) continous_history_quote_bars = self.history[QuoteBar](self.future_symbol, 100, Resolution.MINUTE) # Tick objects contract_history_ticks = self.history[Tick](contract.symbol, timedelta(seconds=10), Resolution.TICK) continous_history_ticks = self.history[Tick](self.future_symbol, timedelta(seconds=10), Resolution.TICK)
// TradeBar objects var contractHistoryTradeBars = History(contract.Symbol, 100, Resolution.Minute); var continuousHistoryTradeBars = History( symbols: new[] {_futureSymbol}, start: Time - TimeSpan.FromDays(15), end: Time, resolution: Resolution.Minute, fillForward: False, extendedMarketHours: False, dataMappingMode: DataMappingMode.OpenInterest, dataNormalizationMode: DataNormalizationMode.Raw, contractDepthOffset: 0); // QuoteBar objects var contractHistoryQuoteBars = History<QuoteBar>(contract.Symbol, 100, Resolution.Minute); var continuousHistoryQuoteBars = History<QuoteBar>(_futureSymbol, 100, Resolution.Minute); // Tick objects var contractHistoryTicks = History<Tick>(contract.Symbol, TimeSpan.FromSeconds(10), Resolution.Tick); var continuousHistoryTicks = History<Tick>(_futureSymbol, TimeSpan.FromSeconds(10), Resolution.Tick);
For more information about historical data in algorithms, see History Requests. For more information about the price adjustments for continuous contracts, see Continous Contracts.
Historical Data In Research
To get historical International Futures data in the Research Environment for an entire Futures chain, call the FutureHistory
future_history
method with the canonical Future Symbol
.
qb = QuantBook() future = qb.add_future(Futures.Indices.HANG_SENG) future.set_filter(0, 90) history = qb.future_history(future.symbol, datetime(2020, 6, 1), datetime(2020, 6, 5)) history_df = history.data_frame all_history = history.get_all_data() expiries = history.get_expiry_dates()
var qb = new QuantBook(); var future = qb.AddFuture(Futures.Indices.HangSeng); future.SetFilter(0, 90); var history = qb.FutureHistory(future.Symbol, new DateTime(2020, 6, 1), new DateTime(2020, 6, 5)); var contracts = history.SelectMany(x => x.OptionChains.SelectMany(y => y.Value.Contracts.Keys)).Distinct().ToList(); var expiries = contracts.Select(x => x.ID.Date).Distinct().ToList();
To get historical data for a single International Futures contract or the continuous Futures contract, call the History
history
method like you would in an algorithm but on the QuantBook
object. For more information about historical data in the Research Environment, see Futures.
Example Applications
The International Futures 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 -- HSI Futures
The following example algorithm uses ZigZag to determine the trend of Hang Seng Index. To trade the Indices, we make use of the 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 ) # 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 and not self.portfolio[self.hsi_future.symbol].is_long: self.set_holdings(self.hsi_future.mapped, 0.2) # If the last pivot point is a high point, the current trend is decreasing after this high point. elif pivot == PivotPointType.HIGH and not self.portfolio[self.hsi_future.symbol].is_short: self.set_holdings(self.hsi_future.mapped, -0.2) # Handle rollover in case the current mapped contract changes. for _, changed_event in slice.symbol_changed_events.items(): old_symbol = changed_event.old_symbol new_symbol = self.add_future_contract(changed_event.new_symbol).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) if quantity != 0: self.market_order(new_symbol, quantity)
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 ); // 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; // If the last pivot point is low, the current trend is increasing after this low point. if (pivot == PivotPointType.Low && !Portfolio[_hsiFuture.Symbol].IsLong) { SetHoldings(_hsiFuture.Mapped, 0.2m); } // If the last pivot point is high, the current trend decreases after this high point. else if (pivot == PivotPointType.High && !Portfolio[_hsiFuture.Symbol].IsShort) { SetHoldings(_hsiFuture.Mapped, -0.2m); } } // Handle rollover in case the current mapped contract changes. foreach (var (_, changedEvent) in slice.SymbolChangedEvents) { var oldSymbol = changedEvent.OldSymbol; var newSymbol = AddFutureContract(changedEvent.NewSymbol).Symbol; var quantity = Portfolio[oldSymbol].Quantity; // Rolling over: to liquidate any position of the old mapped contract and switch to the newly mapped contract Liquidate(oldSymbol); if (quantity != 0) { MarketOrder(newSymbol, quantity); } } } }
Classic Algorithm Example -- FESX Futures
The following example algorithm uses MACD to determine the trend of the EuroStoxx50 Index. To trade the Index, we make use of the FESX 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 Berlin to make it more comparable with the exchange. self.set_time_zone(TimeZones.BERLIN) # Set the account currency as EUR to trade FSX Futures. self.set_account_currency("EUR", 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 FESX Futures to trade. # Note that we will trade the contract with the highest open interest for liquidity. self.fesx_future = self.add_future( Futures.Indices.EURO_STOXX_50, extended_market_hours=True, data_mapping_mode=DataMappingMode.LAST_TRADING_DAY, contract_depth_offset=0 ) # Request the corresponding underlying Index for feeding indicator for trade signal generation. fesx_index = self.add_index("SX5E").symbol # Create a MACD indicator to trade EuroStoxx trend changes on the fast-slow term trend convergence. self._macd = self.macd(fesx_index, 12, 26, 9, Resolution.DAILY) # Warm up indicator for immediate readiness to trade. self.warm_up_indicator(fesx_index, self._macd, 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.fesx_future.symbol) and self._macd.is_ready: # To identify a sensitive change in trend, use the change in the histogram value of the MACD. histogram = self._macd.histogram histogram_chg = histogram.current.value - histogram.previous.value # Positive histogram value increasing means the fast trend is rising faster than the slow trend, indicating a strong uptrend. if histogram_chg > 0 and histogram.current.value > 0 and not self.portfolio[self.fesx_future.symbol].is_long: self.set_holdings(self.fesx_future.mapped, 0.2) # Negative histogram value decreasing means the slow trend is dropping faster than the fast trend, indicating a strong downtrend. elif histogram_chg < 0 and histogram.current.value < 0 and not self.portfolio[self.fesx_future.symbol].is_short: self.set_holdings(self.fesx_future.mapped, -0.2) # Handle rollover in case the current mapped contract changes. for _, changed_event in slice.symbol_changed_events.items(): old_symbol = changed_event.old_symbol new_symbol = self.add_future_contract(changed_event.new_symbol).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) if quantity != 0: self.market_order(new_symbol, quantity)
public class InternationalFuturesDataAlgorithm : QCAlgorithm { private Future _fesxFuture; private MovingAverageConvergenceDivergence _macd; public override void Initialize() { SetStartDate(2021, 1, 1); SetEndDate(2021, 7, 1); // Set the time zone to Berlin to make it more comparable with the exchange. SetTimeZone(TimeZones.Berlin); // Set the account currency as EUR to trade FSX Futures. SetAccountCurrency("EUR", 1000000); // Seed the last price of the contracts for filling. SetSecurityInitializer(new BrokerageModelSecurityInitializer(BrokerageModel, new FuncSecuritySeeder(GetLastKnownPrices))); // Request FESX Futures to trade. // Note that we will trade the contract with the highest open interest for liquidity. _fesxFuture = AddFuture( Futures.Indices.EuroStoxx50, extendedMarketHours: True, dataMappingMode: DataMappingMode.LastTradingDay, contractDepthOffset: 0 ); // Request the corresponding underlying Index for feeding indicator for trade signal generation. var fesxIndex = AddIndex("SX5E").Symbol; // Create a MACD indicator to trade EuroStoxx trend changes on the fast-slow term trend convergence. _macd = MACD(fesxIndex, 12, 26, 9, resolution: Resolution.Daily); // Warm up indicator for immediate readiness to trade. WarmUpIndicator(fesxIndex, _macd, 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(_fesxFuture.Symbol) && _macd.IsReady) { // To identify a sensitive change in trend, use the change in the histogram value of the MACD. var histogram = _macd.Histogram; var histogramChg = histogram - histogram.Previous; // Positive histogram value increasing means the fast trend is rising faster than the slow trend, indicating a strong uptrend. if (histogramChg > 0 && histogram > 0 && !Portfolio[_fesxFuture.Symbol].IsLong) { SetHoldings(_fesxFuture.Mapped, 0.2m); } // Negative histogram value decreasing means the slow trend is dropping faster than the fast trend, indicating a strong downtrend. else if (histogramChg < 0 && histogram < 0 && !Portfolio[_fesxFuture.Symbol].IsShort) { SetHoldings(_fesxFuture.Mapped, -0.2m); } } // Handle rollover in case the current mapped contract changes. foreach (var (_, changedEvent) in slice.SymbolChangedEvents) { var oldSymbol = changedEvent.OldSymbol; var newSymbol = AddFutureContract(changedEvent.NewSymbol).Symbol; var quantity = Portfolio[oldSymbol].Quantity; // Rolling over: to liquidate any position of the old mapped contract and switch to the newly mapped contract Liquidate(oldSymbol); if (quantity != 0) { MarketOrder(newSymbol, quantity); } } } }
Data Point Attributes
The International Futures dataset provides Future
, FuturesChain
, and OpenInterest
objects. To configure the continuous Future settings, use the DataNormalizationMode
and DataMappingMode
enumerations.
Future Attributes
Future
objects have the following attributes:
FuturesChain Attributes
FuturesChain
objects have the following attributes:
OpenInterest Attributes
OpenInterest
objects have the following attributes:
DataNormalizationMode Values
The DataNormalizationMode
enumeration has the following values:
DataMappingMode Values
The DataMappingMode
enumeration has the following values: