Hello, some of the data I request using `self.AddEquity` never comes in the OnData function. In the following example I request 4 tickers, but only retrieve 2 (AAPL and SPY). Data for TSLA and MSFT are never enters OnData. Here is a snippet from the debug:
20220410 14:20:27.465 TRACE:: Debug: TIME: 2021-04-23 00:00:00, SECURITIES ['MSFT', 'AAPL', 'TSLA', 'SPY'], DATA: ['AAPL', 'SPY']
20220410 14:20:27.466 TRACE:: Debug: TIME: 2021-04-24 00:00:00, SECURITIES ['MSFT', 'AAPL', 'TSLA', 'SPY'], DATA: ['AAPL', 'SPY']
20220410 14:20:27.467 TRACE:: Debug: TIME: 2021-04-27 00:00:00, SECURITIES ['MSFT', 'AAPL', 'TSLA', 'SPY'], DATA: ['AAPL', 'SPY']
20220410 14:20:27.468 TRACE:: Debug: TIME: 2021-04-28 00:00:00, SECURITIES ['MSFT', 'AAPL', 'TSLA', 'SPY'], DATA: ['AAPL', 'SPY']
Vladimir
Haakon Flaarønning,,
Try this way.
If you are satisfied with my answer, please accept it.
Fred Painchaud
Hi Haakon,
Or you can also use the slice object passed to OnData.
Fred
Haakon
@Vladimir : You seem to completely neglect the data object that enters OnData. I would like to go through the daily bar that is supposed to be input to OnData, for all the symbols I have selected. I need to analyze the Open, High, Low, Close, and Volume levels.
@Fred Painchaud : Using your start and end dates I get no stocks in my OnData function. I am on the free plan, but I should still be able to retrieve data for all equities? By putting the start date to an earlier time I still only get SPY and AAPL data.
I must be missing something fundamental because this is very basic functionality…
Haakon
It seems to only be a problem when I backtest locally using the LeanCLI. When backtesting in the algorithm lab I get data for all the selected symbols. Do you know how to fix that though? I do need to code and backtest locally.
Haakon
I see now that data for only a few stocks are downloaded to the target folder when using “lean init”, hence why I only get data for selected tickers. Is it supposed to be like that or is that a bug? Do I have to purchase data to access all tickers?
Fred Painchaud
Hi Haakon,
When using the web, the data is included so you have access to it. Over 40TB of data overall, give or take.
When going local, you don't get that data. You need to purchase data from QC or find/purchase your data elsewhere.
That's why my code works well on the web but does not produce anything locally, if you don't have the data for the referred instruments.
Fred
Haakon
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!