Hello everyone
For some reason, the DateTimes I receive from historical data requests seems to be one day ahead of the real dates. In the included algorithm, I request historical data for the three trading days prior to the start date of the algorithm (4th of August) and receive data for the 31st of July, 1st of August (a Sunday) and 4th of August (current start date of the algorithm), while data for the 3rd of August (a Monday) is missing. According to the algorithm logs, the price of AAPL was in the $93 to $96 range the 31st of July, however, according to other price sources, it should have been above $100 that day. Doing a historical data request in daily resolution by specifying DateTimes yields the same results.
There doesn't seem to be any mistake when looking at the data from Quantconnect Data Explorer (https://www.quantconnect.com/data/file/equity/usa/daily/a*/aapl.zip/aapl.csv#p=56), which correctly lists no price data for the 1st and 2nd of August (weekend).
I'm wondering if this could be a bug caused by the daily bars being formed right after midnight, causing the date for that bar to be the following day rather than the day where the price data was from. Requesting minute data using specified DateTimes gives data with the correct and matching DateTimes. While it is easy to work around this in an algorithm, any help or suggestions for fixing this or finding the cause will be appreciated. Thank you.
Mads
Laurent Crouzet
To my mind, that way of handling the dates by Quantconnect was chosen by purpose, and is not a bug.
See here:
https://www.quantconnect.com/docs/key-concepts/understanding-time
Especially : "The close of a bar is not known until the start of the next bar, which can sometimes be confusing. For example, a price bar for Friday will include all the ticks from Friday 00:00 to Friday 23:59.99999, but it will actually be emitted to your algorithm on Saturday at midnight. Because of this, any orders you create after analyzing the Friday data will be sent to your brokerage on Saturday, when most markets are closed. QuantConnect automatically turns your order into a
MarketOnOpen
order, which will be filled Monday morning."Mads
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!