Hello Community,
I am using the EndOfDay function and compared the dates I see on the tradebars in OnData and the date of QCAlgorithm.
When everything involved as minute-resolution, things are fine and all the dates agree.
As soon as one thing has daily, things change - and the algo-date is ahead of the tradebars by a businessday.
You will see this in the logs, when you either enable the AddDataQuandl-line or change SPY and AAPL to be daily.
Am I taking a wrong turn somewhere or is there a problem with feeding data into the OnData-machinery?
Many thanks - C
User65267
Adding a backtest and the code showing the above.
JayJayD
There is no error here.
Lean is look-ahead bias free, that means that the engine will never receive data with a timestamp later than the algorithm Time.
In case of daily data, the latest available data today is from the day before (even if time is 23:58), because the today isn’t still closed
From the output of your algorithm:
Completed OnEndOfDay for Algo: 2014-01-02 23:58 AAPL|2014-01-02 15:59|74.13 SPY|2014-01-02 15:59|172.07 VX1|2013-12-31 00:00|13.91 Completed OnEndOfDay for Algo: 2014-01-03 23:58 AAPL|2014-01-03 15:59|72.49 SPY|2014-01-03 15:59|171.93 VX1|2014-01-02 00:00|14.17
Note how the last VX1 is from the day before the firing of the OnEndOfDay method.
Saravana kumar
I also same face similar issues. if you have daily resolution or take History with daily resolution Â
AddEquity(ticker, Resolution.Daily); var history = History(stockData.Symbol, 50, Resolution.Daily);
OnData Event is fired on 12 am with previous day data. but critical issue is I think it is considering after hours data. so open close values are not matching with ususal hour data.Â
This pollutes history data too, so when updating indicators, indicator data also polluted with after hours data.Â
Any way to get daily data (market hours only)?Â
Jared Broad
Hourly and daily data are sourced from market hours only ticks.Â
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.
User65267
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!