Hello All
Regarding back test, I understand the data ends at midnight each day
what does the last few minutes of volume refer to
we access the final few second's volume and it displays a large number for such volume and yet of course stocks are not trading with much volume at midnight
So for the final few minutes of backtest, what does the volume figure actually refer to?
Please help
Mia Alissi
In backtesting, the data is timestamped to the nearest second and the volume you see at the end of the day is the cumulative volume of trades that happened during the last second of the trading day, not at midnight. The volume figure refers to the number of shares or contracts traded during a specific time period.
However, if you're seeing a large volume at midnight, it might be due to the way the data is handled in the backtest. For example, if you're using daily data, the volume you see at midnight is the total volume for the entire day. If you're using minute or second data, the volume you see at midnight could be the volume for the last minute or second of the trading day.
If you're seeing unusually high volumes at midnight, it could be due to an error in your code or a data issue. It's recommended to check if the data exists before accessing it. Here's an example in Python:
This code checks if the data for the "VXX" symbol exists before trying to access its volume. If the data doesn't exist, it avoids a potential error.
Sources:
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.
John Hookway
Many thanks for your swift help!
John Hookway
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!