Historical Data

Common Errors

Introduction

Errors can occur when you request historical data. This page explains some of the most common ones you may encounter.

Indicator Readiness

Indicators can't produce a valid value until they have enough historical data to be ready. If your indicators require more data than what is currently available (for example, data before an asset's IPO), the indicator_historyIndicatorHistory method will return fewer data points than you request and the warm-up techniques for manual and automatic indicators won't be able to make your indicators ready.

Trading During Warm Up

You can't place trades during the warm-up period because the data feed is replaying historical data for setting algorithm state. If you try to place a trade during warm-up, LEAN throws the following error:

Backtest Handled Error: This operation is not allowed in Initializeinitialize or during warm up: OrderRequest.Submit. Please move this code to the OnWarmupFinished()on_warmup_finished() method.

Numerical Precision

Some factor files have INF split values, which indicate that the stock has so many splits that prices can't be calculated with correct numerical precision. To allow history requests with these symbols, we need to move the starting date forward when reading the data or use raw data normalization. If there are numerical precision errors in the factor files for a security in your history request, LEAN throws the following error:

"Warning: when performing history requests, the start date will be adjusted if there are numerical precision errors in the factor files."

Live Intraday Data Source

In live trading, if you make a history request for minute data at noon and the history period covers the start of the previous day to the present moment, the data from the previous day will be backtest data. The data of the current day will be live data that we collected throughout the morning. If you make this history request in a backtest, you might get slightly different data for the current day because of post-processing from the data vendor.

In cloud deployments, QuantConnect is the default data provider. If you remove it and use a different data provider, you won't get any price data from QuantConnect. However, we provide the following datasets:

QC Data Provider Limitations

When you request historical data or run warm-up, the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution:

ResolutionAvailable History
DailyAll historical data
HourAll historical data
Minute1 year
Second2 months
Tick1 month

In live trading, history requests for Index or Options with the QuantConnect data provider only returns data up to the end of the previous day. For example, if you make a history request for these asset classes at 1 PM Eastern Time (ET), you won't get any data for the current day.

For more information about the QuantConnect data provider, see QuantConnect.

Other Data Provider Limitations

LEAN supports other data providers, including IQFeed and Polygon. For more information about the limitations of these other data providers, see their respective documentation in Cloud Platform, Local Platform, or the CLI.

Brokerage Limitations

LEAN supports several brokerages that can provide historical data. However, some of them have limitations on historical data. For example, Interactive Brokers can be slow, so it can timeout if you request historical data for too many assets at once. For more information about these brokerages and the data they provide, see Datasets.

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: