Back

Dates off when using daily resolution

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

 

 

Update Backtest








Adding a backtest and the code showing the above.

0


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.

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed