What is Boot Camp?
Boot Camp is a great way to improve your skills and learn the QuantConnect API in easily digestible portions.
Don't have an account? Join QuantConnect Today
We are dedicated to providing investors with a cutting-edge platform for rapidly creating quant investment strategies. Founded in 2012, we've empowered more than 250,000 quants and engineers to create and trade their ideas.
Quickly and easily started with our API to build your strategy. The learning center lessons are interactive, step-by-step guides to make you productive as fast as possible.
Focus your efforts on driving alpha, not parsing CSV files. Our cloud offers hundreds of terabytes of traditional and alternative data preformatted, cleaned, and instantly accessible by our API.
Coordinate teamwork, control access permissions, and your shared cloud resources. Grow your trading organization safely and efficiently on top of our cloud architecture.
A selection of streaming live-trading strategies written by QuantConnect, and top highlights from the community available to follow and clone. Peer into detailed real-time positions to gain insight for your own trading.
What is Boot Camp?
Boot Camp is a great way to improve your skills and learn the QuantConnect API in easily digestible portions.
A collection of courses from independent educators to improve your quant skill base and create better strategies.
Solidify and expand your quant skill base with courses at QuantConnect
Learn algorithmic trading with python for US Equities. Guided strategy development in easily digestible portions.
Author: QuantConnect
Free | 95,986 People Enrolled
Learn algorithmic trading with python for FX. Guided strategy development in easily digestible portions.
Author: QuantConnect
Free | 20,577 People Enrolled
Learn algorithmic trading with python for Futures. Guided strategy development in easily digestible portions.
Author: QuantConnect
Free | 7,421 People Enrolled
In this algorithmic trading tutorial series you will learn everything you need to know to start writing your own trading bots using Python and the QuantConnect quantitative trading platform.
Author: Louis
Free | 28,770 People Enrolled
Master algorithmic trading on QuantConnect; backtest and live trade Stocks, Options, Futures, Forex, and Crypto.
Author: Cheng Li
Paid | Enroll on Udemy
Learn to use Python, Pandas, Matplotlib, and the QuantConnect Lean Engine to perform financial analysis and trading.
Author: Jose Portilla, Pierian Training
Paid | Enroll on Udemy
Learn to write programs that algorithmically trade cryptocurrencies using QuantConnect (C#).
Author: Eric Summers
Paid | Enroll on Udemy
Organization Notes
Get Started with Algorithm Lab
New Research
Optimizing a Gold-SPY Portfolio Using Hidden Markov Models for Market Downtime
Gold-SPY portfolio optimization using Hidden Markov Models for minimizing market downturn risk....
ReadAlgorithm Lab is your playground for developing and refining trading algorithms with QuantConnect. Utilize advanced tools, historical data, and robust backtesting to enhance your trading strategies. Transform your ideas into actionable insights and optimize your trading approach with ease.
Sign Up for FreeAlready have an account Log In.
This account is protected by two-factor authentication.
Request Token Information Reset My TokenCreated | Last Time Used | Agent | |
---|---|---|---|
No entries found |
To continue please enter your email:
(No google account required)
To verify that everything goes well please enter the 6 digit verification code generated by the authenticator application
Algorithm Lab is your playground for developing and refining trading algorithms with QuantConnect. Utilize advanced tools, historical data, and robust backtesting to enhance your trading strategies. Transform your ideas into actionable insights and optimize your trading approach with ease.
Sign Up for FreeAlready have an account Log In.
Please stop one of the following coding sessions, or upgrade your account.
NAME | ORGANIZATION |
---|
QuantConnect Datasets
Explore free and paid datasets available on QuantConnect covering fundamentals, pricing, and alternative options.
Datasets >
Dashboard
A transparent, community reporting system. Report suspected issues with our cloud data to be investigated by the QuantConnect Team.
Issue List
Loading...
Data Explorer Issues are a way to report and track data problems. They give the QuantConnect community a way to discuss potential solutions and be notified when they are resolved. If you think you have found a data problem please check the existing open and closed issues first; often another user may have already reported your problem.
Does your issue match any of the already listed issues?
Thank you for your contribution! Our team is currently working on resolving these issues, please subscribe to them to receive updates.
Datasets >
US Futures
Dataset by AlgoSeek
The US Futures dataset by AlgoSeek provides Futures data, including price, volume, open interest, and expiry. The data covers the 162 most liquid contracts, starts in May 2009, and is delivered on any frequency from tick to daily. This dataset is created by monitoring the trading activity on the CFE, CBOT, CME, COMEX, NYMEX, and ICE*.
This dataset also depends on the US Futures Security Master because the US Futures Security Master dataset contains information to construct continuous Futures.
AlgoSeek is a leading historical intraday US market data provider offering the most comprehensive and detailed market data and analytics products in the financial industry covering equities, futures, options, cash forex, and cryptocurrencies. AlgoSeek data is built for quantitative trading and machine learning. For more information about AlgoSeek, visit algoseek.com.
The following snippet demonstrates how to request data from the US Futures dataset:
future = self.add_future(Futures.Metals.GOLD)
future.set_filter(0, 90)
var future = AddFuture(Futures.Metals.Gold);
future.SetFilter(0, 90);
The following table describes the dataset properties:
Property | Value |
---|---|
Start Date | May 2009 |
Asset Coverage | 162 Futures |
Data Density | Dense |
Resolution | Tick, Second, Minute, Hour, & Daily |
Timezone |
|
Market Hours | Regular and Extended |
This dataset only includes Sugar (SB) from the ICE exchange.
The volume of the daily trade bars from this dataset is different from the daily volume that CME and other platforms like Yahoo Finance report because the CME includes pit trades in their daily volume calculation. In contrast, the volume of the daily trade bars in this dataset (from AlgoSeek) doesn't include pit trades because pit trades are over-the-counter, which algorithms can't trade.
Another discrepancy occurs from the start and end times of the daily bars. Daily bars from the CME and Yahoo Finance span from 5 PM Central Time (CT) to 4 PM CT on the following day. In contrast, QuantConnect consolidates daily bars from from 12 AM Eastern Time (ET) to 12 AM ET the following day. Therefore, to calculate the daily volume in the same way that CME does (excluding the pit trades), sum the volume of intraday bars that span 5 PM CT to 4 PM CT on the following day. For an example implementation, see Examples.
The US Futures dataset enables you to accurately design Futures strategies. Examples include the following strategies:
For more example algorithms, see Examples.
The US Futures dataset provides FuturesChain, Future, and OpenInterest objects. To configure the continuous Future settings, use the DataNormalizationMode and DataMappingMode enumerations.
The DataNormalizationMode enumeration has the following values:
The DataMappingMode enumeration has the following values:
Future objects have the following attributes:
FuturesChain objects have the following attributes:
OpenInterest objects have the following attributes:
The following list shows the available (162) Futures:
To add US Futures data to your algorithm, call the AddFutureadd_future method. Save a reference to the Future so you can access the data later in your algorithm.
class USFuturesDataAlgorithm(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 Gold Future data
future = self.add_future(Futures.Metals.GOLD)
# Set filter to obtain the contracts expire within 90 days
future.set_filter(0, 90)
self.future_symbol = future.symbol
namespace QuantConnect
{
public class USFuturesDataAlgorithm : QCAlgorithm
{
private Symbol _futureSymbol;
public override void Initialize()
{
SetStartDate(2013, 12, 20);
SetEndDate(2014, 2, 20);
SetCash(1000000);
UniverseSettings.Asynchronous = true;
// Request Gold Future data
var future = AddFuture(Futures.Metals.Gold);
// 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.
To get the current US Futures data, index the Barsbars, QuoteBarsquote_bars, or Ticksticks properties of the current Slice with the Future Symbol. Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.
def on_data(self, slice: Slice) -> None:
# Access data: TradeBar data
if self.future_symbol in slice.bars:
trade_bar = slice.bars[self.future_symbol]
self.log(f"{self.future_symbol} close at {slice.time}: {trade_bar.close}")
# Access data: QuoteBar data
if self.future_symbol in slice.quote_bars:
quote_bar = slice.quote_bars[self.future_symbol]
self.log(f"{self.future_symbol} bid at {slice.time}: {quote_bar.bid.close}")
# Access data: Ticks data
if self.future_symbol in slice.ticks:
ticks = slice.ticks[self.future_symbol]
for tick in ticks:
self.log(f"{self.future_symbol} price at {slice.time}: {tick.price}")
public override void OnData(Slice slice)
{
// Access data: TradeBar data
if (slice.Bars.TryGetValue(_futureSymbol, out var tradeBar))
{
Log($"{_futureSymbol} price at {slice.Time}: {tradeBar.Close}");
}
// Access data: QuoteBar data
if (slice.QuoteBars.TryGetValue(_futureSymbol, out var quoteBar))
{
Log($"{_futureSymbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
}
// Access data: Ticks data
if (slice.Ticks.TryGetValue(_futureSymbol, out var ticks))
{
foreach (var tick in ticks)
{
Log($"{_futureSymbol} price at {slice.Time}: {tick.Price}");
}
}
}
You can also iterate through all of the data objects in the current Slice.
def on_data(self, slice: Slice) -> None:
# Iterate all TradeBar received
for symbol, trade_bar in slice.bars.items():
self.log(f"{symbol} close at {slice.time}: {trade_bar.close}")
# Iterate all QuoteBar received
for symbol, quote_bar in slice.quote_bars.items():
self.log(f"{symbol} bid at {slice.time}: {quote_bar.bid.close}")
# Iterate all Ticks received
for symbol, ticks in slice.ticks.items():
for tick in ticks:
self.log(f"{symbol} price at {slice.time}: {tick.price}")
public override void OnData(Slice slice)
{
// Iterate all TradeBar received
foreach (var kvp in slice.Bars)
{
var symbol = kvp.Key;
var tradeBar = kvp.Value;
Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
}
// Iterate all QuoteBar received
foreach (var kvp in slice.QuoteBars)
{
var symbol = kvp.Key;
var quoteBar = kvp.Value;
Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
}
// Iterate all Ticks received
foreach (var kvp in slice.Ticks)
{
var symbol = kvp.Key;
var ticks = kvp.Value;
foreach (var tick in ticks)
{
Log($"{symbol} price at {slice.Time}: {tick.Price}");
}
}
}
For more information about accessing US Futures data, see Handling Data.
You can get historical US Futures data in an algorithm and the Research Environment.
To get historical US Futures data in an algorithm, call the Historyhistory 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.
To get historical US Futures data in the Research Environment for an entire Futures chain, call the FutureHistoryfuture_history method with the canonical Future Symbol.
qb = QuantBook()
future = qb.add_future(Futures.Metals.GOLD)
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.Metals.Gold);
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 US Futures contract or the continuous Futures contract, call the Historyhistory method like you would in an algorithm but on the QuantBook object. For more information about historical data in the Research Environment, see Futures.
The US Futures dataset provides FuturesChain, Future, and OpenInterest objects. To configure the continuous Future settings, use the DataNormalizationMode and DataMappingMode enumerations.
The DataNormalizationMode enumeration has the following values:
The DataMappingMode enumeration has the following values:
Future objects have the following attributes:
FuturesChain objects have the following attributes:
OpenInterest objects have the following attributes:
The following example algorithm buys the Mini Gold Futures contract with the greatest open interest and sells the Micro Gold Futures contract with the greatest open interest. When the open interest of a different contract exceeds the open interest of a contract in the portfolio, the algorithm rebalances the portfolio.
from AlgorithmImports import *
from QuantConnect.DataSource import *
class USFuturesDataAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_cash(1000000)
# Setting the continuous contract mapping criteria for both Gold and Micro Gold contracts, since we want to order the highest liquidity contracts
self.set_security_initializer(lambda security: FuncSecuritySeeder(self.get_last_known_prices).seed_security(security))
self.gold = self.add_future(Futures.Metals.GOLD,
extended_market_hours=True,
data_mapping_mode=DataMappingMode.OPEN_INTEREST,
data_normalization_mode=DataNormalizationMode.BACKWARDS_RATIO,
contract_depth_offset=0)
self.micro_gold = self.add_future(Futures.Metals.MICRO_GOLD,
extended_market_hours=True,
data_mapping_mode=DataMappingMode.OPEN_INTEREST,
data_normalization_mode=DataNormalizationMode.BACKWARDS_RATIO,
contract_depth_offset=0)
# The contract multiplier is cached in the Security symbol_properties property from the symbol properties database
self.gold_multiplier = self.gold.symbol_properties.contract_multiplier
self.micro_gold_multiplier = self.micro_gold.symbol_properties.contract_multiplier
def on_data(self, slice: Slice) -> None:
# Make sure to calculate the order size by the most updated price data of both contracts
if not self.portfolio.invested and self.gold.symbol in slice.bars and self.micro_gold.symbol in slice.bars:
# Calculate the order size for $500k
# Get the quotient after dividing the contract multiplier since the order size must be whole number
gold_quantity = 500000 / slice.bars[self.gold.symbol].close // self.gold_multiplier
micro_gold_quantity = 500000 / slice.bars[self.micro_gold.symbol].close // self.micro_gold_multiplier
self.market_order(self.gold.mapped, gold_quantity)
self.market_order(self.micro_gold.mapped, micro_gold_quantity)
def on_securities_changed(self, changes: SecurityChanges) -> None:
for security in changes.added_securities:
# Historical data
history = self.history(security.symbol, 10, Resolution.MINUTE)
self.debug(f"We got {len(history)} from our history request for {security.symbol}")
using QuantConnect.DataSource;
namespace QuantConnect
{
public class USFuturesDataAlgorithm : QCAlgorithm
{
private Future _gold, _microGold;
private decimal _goldMulitplier, _microGoldMulitplier;
public override void Initialize()
{
SetCash(1000000);
// Setting the continuous contract mapping criteria for both Gold and Micro Gold contracts, since we want to order the highest liquidity contracts
_gold = AddFuture(Futures.Metals.Gold,
extendedMarketHours: true,
dataMappingMode: DataMappingMode.OpenInterest,
dataNormalizationMode: DataNormalizationMode.BackwardsRatio,
contractDepthOffset: 0);
_microGold = AddFuture(Futures.Metals.MicroGold,
extendedMarketHours: true,
dataMappingMode: DataMappingMode.OpenInterest,
dataNormalizationMode: DataNormalizationMode.BackwardsRatio,
contractDepthOffset: 0);
// The contract multiplier is cached in the Security SymbolProperties property from the symbol properties database
_goldMulitplier = _gold.SymbolProperties.ContractMultiplier;
_microGoldMulitplier = _microGold.SymbolProperties.ContractMultiplier;
}
public override void OnData(Slice slice)
{
// Make sure to calculate the order size by the most updated price data of both contracts
if (!Portfolio.Invested && slice.Bars.ContainsKey(_gold.Symbol) && slice.Bars.ContainsKey(_microGold.Symbol))
{
// Calculate the order size for $500k
// Get the quotient after dividing the contract multiplier since the order size must be whole number
var goldQuantity = Math.Floor(500000m / slice.Bars[_gold.Symbol].Close / _goldMulitplier);
var microGoldQuantity = Math.Floor(500000m / slice.Bars[_microGold.Symbol].Close / _microGoldMulitplier);
MarketOrder(_gold.Mapped, goldQuantity);
MarketOrder(_microGold.Mapped, microGoldQuantity);
}
}
public override void OnSecuritiesChanged(SecurityChanges changes)
{
foreach (var security in changes.AddedSecurities)
{
// Historical data
var history = History(security.Symbol, 100, Resolution.Minute);
Debug($"We got {history.Count()} from our history request for {security.Symbol}");
}
}
}
}
The following example algorithm buys the front-month Mini Gold Futures contract and sells the front-month Micro Gold Futures contract. When the front-month contract changes, the algorithm rebalances the portfolio.
from AlgorithmImports import *
from QuantConnect.DataSource import *
from Selection.FutureUniverseSelectionModel import FutureUniverseSelectionModel
class USFuturesDataAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2013, 12, 20)
self.set_end_date(2014, 2, 20)
self.set_cash(100000)
self.universe_settings.asynchronous = True
# Set up an universe selection model that selects the front month contract
self.set_universe_selection(FrontMonthFutureUniverseSelectionModel())
self.add_alpha(ConstantFuturesAlphaModel())
# A portfolio construction model that only order a single share per insight signal
self.set_portfolio_construction(SingleSharePortfolioConstructionModel())
class FrontMonthFutureUniverseSelectionModel(FutureUniverseSelectionModel):
def __init__(self,) -> None:
# Daily updating with select_future_chain_symbols function
super().__init__(timedelta(1), self.select_future_chain_symbols)
def select_future_chain_symbols(self, utcTime: datetime) -> List[Symbol]:
# Select gold and micro gold contracts for the strategy need
future_pairs = [
(Futures.Metals.GOLD, Market.COMEX),
(Futures.Metals.MICRO_GOLD, Market.COMEX)
]
return [Symbol.create(pair[0], SecurityType.FUTURE, pair[1]) for pair in future_pairs]
def filter(self, filter: FutureFilterUniverse) -> FutureFilterUniverse:
# Filter only front month contract for liquidity and most informed information
return filter.front_month().only_apply_filter_at_market_open()
class ConstantFuturesAlphaModel(AlphaModel):
# Long gold and short micro gold in this strategy
long_symbol = Symbol.create(Futures.Metals.GOLD, SecurityType.FUTURE, Market.COMEX)
short_symbol = Symbol.create(Futures.Metals.MICRO_GOLD, SecurityType.FUTURE, Market.COMEX)
def update(self, algorithm: QCAlgorithm, slice: Slice) -> List[Insight]:
if algorithm.portfolio.invested:
return []
insights = []
# For both gold and micro gold, select the front month contract (only contract) in the chain
for kvp in slice.future_chains:
chain = [contract for contract in kvp.Value]
contract = chain[0]
# Long gold and short micro gold as planned
if kvp.Key == self.long_symbol:
insights.append(Insight.price(contract.symbol, contract.expiry + timedelta(days=1), InsightDirection.UP))
elif kvp.Key == self.short_symbol:
insights.append(Insight.price(contract.symbol, contract.expiry + timedelta(days=1), InsightDirection.DOWN))
return insights
def on_securities_changed(self, algorithm: QCAlgorithm, changes: SecurityChanges) -> None:
for security in changes.added_securities:
# Historical data
history = algorithm.history(security.symbol, 10, Resolution.MINUTE)
algorithm.debug(f"We got {len(history)} from our history request for {security.symbol}")
class SingleSharePortfolioConstructionModel(PortfolioConstructionModel):
def create_targets(self, algorithm: QCAlgorithm, insights: List[Insight]) -> List[PortfolioTarget]:
targets = []
for insight in insights:
if algorithm.securities[insight.symbol].is_tradable:
# Single share only using integer portfolio target
targets.append(PortfolioTarget(insight.symbol, insight.direction))
return targets
using QuantConnect.DataSource;
namespace QuantConnect
{
public class USFuturesDataAlgorithm : QCAlgorithm
{
public override void Initialize()
{
SetStartDate(2013, 12, 20);
SetEndDate(2014, 2, 20);
SetCash(1000000);
UniverseSettings.Asynchronous = true;
// Set up an universe selection model that selects the front month contract
SetUniverseSelection(new FrontMonthFutureUniverseSelectionModel());
SetAlpha(new ConstantFuturesAlphaModel());
// A portfolio construction model that only order a single share per insight signal
SetPortfolioConstruction(new SingleSharePortfolioConstructionModel());
}
}
class FrontMonthFutureUniverseSelectionModel : FutureUniverseSelectionModel
{
// Daily updating with select_future_chain_symbols function
public FrontMonthFutureUniverseSelectionModel()
: base(TimeSpan.FromDays(1), SelectFutureChainSymbols) {}
private static IEnumerable<Symbol> SelectFutureChainSymbols(DateTime utcTime)
{
//Select gold and micro gold contracts for the strategy need
return new List<Symbol> {
QuantConnect.Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX),
QuantConnect.Symbol.Create(Futures.Metals.MicroGold, SecurityType.Future, Market.COMEX)
};
}
protected override FutureFilterUniverse Filter(FutureFilterUniverse filter)
{
// Filter only front month contract for liquidity and most informed information
return filter.FrontMonth().OnlyApplyFilterAtMarketOpen();
}
}
class ConstantFuturesAlphaModel : AlphaModel
{
// Long gold and short micro gold in this strategy
private Symbol
_longSymbol = QuantConnect.Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX),
_shortSymbol = QuantConnect.Symbol.Create(Futures.Metals.MicroGold, SecurityType.Future, Market.COMEX);
public override IEnumerable<Insight> Update(QCAlgorithm algorithm, Slice slice)
{
var insights = new List<Insight>();
if (algorithm.Portfolio.Invested)
{
return insights;
}
// For both gold and micro gold, select the front month contract (only contract) in the chain
foreach (var kvp in slice.FutureChains)
{
var symbol = kvp.Key;
var chain = kvp.Value;
var contract = chain.First();
// Long gold and short micro gold as planned
if (symbol == _longSymbol)
{
insights.Add(Insight.Price(contract.Symbol, contract.Expiry + TimeSpan.FromDays(1), InsightDirection.Up));
}
else if (symbol == _shortSymbol)
{
insights.Add(Insight.Price(contract.Symbol, contract.Expiry + TimeSpan.FromDays(1), InsightDirection.Down));
}
}
return insights;
}
public override void OnSecuritiesChanged(QCAlgorithm algorithm, SecurityChanges changes)
{
foreach (var security in changes.AddedSecurities)
{
// Historical data
var history = algorithm.History(security.Symbol, 100, Resolution.Minute);
algorithm.Debug($"We got {history.Count()} from our history request for {security.Symbol}");
}
}
}
class SingleSharePortfolioConstructionModel : PortfolioConstructionModel
{
public override IEnumerable<PortfolioTarget> CreateTargets(QCAlgorithm algorithm, Insight[] insights)
{
var targets = new List<PortfolioTarget>();
foreach (var insight in insights)
{
if (algorithm.Securities[insight.Symbol].IsTradable)
{
// Single share only using integer portfolio target
targets.Add(new PortfolioTarget(insight.Symbol, (int) insight.Direction));
}
}
return targets;
}
}
}
US Futures is allowed to be used in the cloud for personal and commercial projects for free. The data is permissioned for use within the licensed organization only
Free | Documentation
US Futures can be downloaded on premise with the LEAN CLI, for a charge per file downloaded. This download is for the licensed organization's internal LEAN use only and cannot be redistributed or converted in any format.
Starting at 5 QCC/file | Learn More
LEAN CLI is a cross-platform wrapper on the QuantConnect algorithmic trading engine called LEAN. The CLI makes using LEAN incredibly easy, reducing most of the pain points of developing and managing an algorithmic trading strategy to a few lines of bash.
Using the CLI you can download the same data QuantConnect hosts in the cloud for a small fee. These fees are per file downloaded, and are paid for in QuantConnect-Credits (QCC). We recommend purchasing credits to enable downloading.
The CLI command generator is a helpful tool to generate a copy-paste command to download this dataset from the form below.
lean data download \
--dataset "US Futures" \
--data-type "bulk" \
--resolution "second" \
--start "20240401" \
--end "20250401"
lean data download `
--dataset "US Futures" `
--data-type "bulk" `
--resolution "second" `
--start "20240401" `
--end "20250401"
The QuantConnect-AlgoSeek partnership provides free access to US Futures market data in QuantConnect Cloud. This dataset depends on the US Futures Security Master dataset because the US Futures Security Master dataset contains information on symbol changes.
Free access to the most popular US Futures in QuantConnect Cloud for backtest and research.
US Future Tick resolution archives in LEAN format for on premise backtesting and research. One file per ticker/day.
US Futures Second resolution archives in LEAN format for on premise backtesting and research. One file per ticker/day.
US Futures Minute resolution archives in LEAN format for on premise backtesting and research. One file per ticker/day.
US Futures Hourly resolution archives in LEAN format for on premise backtesting and research. One file per ticker.
US Futures Daily resolution archives in LEAN format for on premise backtesting and research. One file per ticker.
Bulk download the latest daily data
Bulk download the latest tick data
Bulk download the latest second data
Bulk download the latest minute data
Bulk download the latest hourly data
Bulk download all the daily data
Bulk download all the hourly data
Bulk download all the tick data
Bulk download all the second data
Bulk download all the minute data
What people are saying about this
This product has not received any reviews yet, be the first to post one!
Rate the Module:
Provider offers 16 licensing options
Explore free and paid datasets available on QuantConnect covering fundamentals, pricing, and alternative options.
Dataset Status from to
No Runs
OK
Degraded
Failure
Explore free and paid datasets available on QuantConnect covering fundamentals, pricing, and alternative options.
Lorem ipsum dolor sit amet conjectura lorem ipsum dolor sit amet conjectura lorem ipsum
Configuration Keys
Environment Variables
Lorem ipsum dolor sit amet conjectura lorem ipsum dolor sit amet conjectura lorem ipsum
File Link
Lorem ipsum dolor sit amet conjectura lorem ipsum dolor sit amet conjectura lorem ipsum
Lorem ipsum dolor sit amet conjectura lorem ipsum dolor sit amet conjectura lorem ipsum
Upload a manually created tar or zip file to all cloud data systems.
Add a link and click the Sync Dataset button to upload the dataset
Upload Destinations
The dataset synchronizer is an internal tool for the QuantConnect team to upload data to the
cloud data storage environments. It supports TAR files which are extracted in the root directory
of the cloud data environments.
Take extreme care to carefully structure your data TAR package with
the same folders as the LEAN data folder. Ensure all folders and file names are lowercase as Linux is case-sensitive.
Support
Algorithm Lab is your playground for developing and refining trading algorithms with QuantConnect. Utilize advanced tools, historical data, and robust backtesting to enhance your trading strategies. Transform your ideas into actionable insights and optimize your trading approach with ease.
Sign Up for FreeAlready have an account Log In.
â‘
â‘
â‘
â‘
â‘
Hover and click over the stars to rate us.
It looks like you are not fully satisfied with your experience on QuantConnect, please take a moment to let us know how we can improve our services for you:
If you have a minute to spare, please leave us a review on Trustpilot.
Stories like yours help others see the full potential of QuantConnect.
Organization Name |
---|
Upgrade to Team plan or higher to enable custom invoicing
Changes will be applied to future invoices.
Users will be able to join by following the link in the invitation email.
You’ve been invited by Jared Broad to join his G-Force Organization.
Would you like to accept the invitation?
Are you sure you want to delete the encryption key "undefined"?
Caution: We will not be able to decrypt encrypted projects without the original key.
Drag & Drop or
Keys are added to the local storage in your web browser and not uploaded to QuantConnect. To use an encrypted project on another computer you will need to bring a copy of the key.
This project is encrypted using the key .
This project will be encrypted using the key .