Requesting Data


If you create a data subscription, your algorithm receives data updates for that security or custom data source.


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.


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 MinuteMINUTE. To set the resolution for a security, pass the resolution argument when you create the security subscription.

AddEquity("SPY", Resolution.Daily);
self.add_equity("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.universe_settings.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 fillForwardfill_forward argument to false when you create the security subscription.

AddEquity("SPY", fillForward: false);
self.add_equity("SPY", fill_forward=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 extendedMarketHoursextended_market_hours argument when you create the security subscription.

AddEquity("SPY", extendedMarketHours: true);
self.add_equity("SPY", extended_market_hours=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.

Remove Subscriptions

To remove a security subscription, call the RemoveSecurityremove_security method.


The RemoveSecurityremove_security method cancels your open orders for the security and liquidates your holdings.


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.add_equity("SPY", market=Market.USA)

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: