I would like to find the most recent price of multiple stocks at different times throughout a trading day. Is it possible to fetch the most recent price of a security by simply having it's symbol without adding it to self.ActiveSecurities through self.AddEquity or universe selection?
Varad Kabade
Hi Haakon Flaarønning,
We can make a historical data request with a time period of 1 to fetch the last price of security:
Refer to the following doc for more information.
Note that this method is very computationally expensive and may affect the speed of the backtest.
Best,
Varad Kabade
Haakon
Hello Varab,
Is it any less computationally expensive to subscribe to all securities through a universe and at some time during the day check the current price? I can't assume it is, but I may be wrong?
E.g, I want to check the price of all tradable securities at 10:00 AM - is it best to subscribe to all securities through a universe selection, or run a history request on all securities?
Varad Kabade
Hi Haakon Flaarønning,
We believe a Historical data request for all the securities at a specific time would be more computationally expensive.Please note that if we are subscribing to all the securities and having high frequency(ticks, seconds) along with lengthy calculations, this would be more computationally expensive than other approaches.
Best,
Varad Kabade
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!