Securities
Requesting Data
Characteristics
We thoroughly vet datasets before we add them to the Data Market. The datasets in the Data Market are well-defined with robust ticker and Symbol
links to ensure tickers are properly tracked through time. The datasets are consistently delivered on time and most of them are ready for live trading. All the datasets have at least one year of historical data and are free of survivorship bias.
Resolutions
Resolution is the duration of time that's used to sample a data source. The Resolution
enumeration has the following members:
The default resolution for market data is Minute
. To set the resolution for a security, pass the resolution
argument when you create the security subscription.
AddEquity("SPY", Resolution.Daily);
self.AddEquity("SPY", Resolution.Daily)
To set the resolution for all securities, set the Resolution
universe setting before you create security subscriptions.
UniverseSettings.Resolution = Resolution.Daily;
self.UniverseSettings.Resolution = Resolution.Daily
To see which resolutions of data are available for a dataset, see the dataset listing in the Data Market. To create custom resolution periods, see Consolidating Data.
Data density describes the frequency of entries in a dataset. Datasets at the tick resolution have dense data density. All other resolutions usually have regular data density. If a non-tick resolution dataset doesn't have an entry at each sampling, it has sparse density.
Fill Forward
Fill forward means if there is no data point for the current slice, LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get stale fills or you may see trade volume as zero.
To disable fill forward for a security, set the fillForward
argument to false when you create the security subscription.
AddEquity("SPY", fillForward: false);
self.AddEquity("SPY", fillForward=False)
Extended Market Hours
By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the extendedMarketHours
argument when you create the security subscription.
AddEquity("SPY", extendedMarketHours: true);
self.AddEquity("SPY", extendedMarketHours=True)
You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.
Warning: Undefined variable $marketHoursLink in /tmp/docs/c3aac5f8ee7065002e92aeecc79c79c6d945b376/Resources/securities/extended-market-hours.php on line 7Markets
The datasets integrated into the Dataset Market cover many markets. The Market
enumeration has the following members:
LEAN can usually determine the correct market based on the ticker you provide when you create the security subscription. To manually set the market for a security, pass a market
argument when you create the security subscription.
AddEquity("SPY", market: Market.USA);
self.AddEquity("SPY", market=Market.USA)
Quotas
There is no limit to the number of security subscriptions you can create, but some live data providers impose data subscription limits. To set a limit, in the Initialize
method, set the DataSubscriptionLimit
algorithm setting.
Settings.DataSubscriptionLimit = 500;
self.Settings.DataSubscriptionLimit = 500
All securities that you add to the algorithm count as one subscription, except Options and Futures. Every Option and Future contract counts as one subscription.