Back

Temporal Coherence

I am really struggling to understand when events happen in this system. I am trying to implement a basic algo that operates as follows

1. 20 min before close (Using scheduled event fired 20min before the close) buy 100 shares.

2. After the close that day calculate the Stop and Target for next day(Using scheduled event)

In the logs there are several time stamps, one driven by the Debug command and one from my printing the Time of the slice I am accessing. These times do not line up in any manner, I see info from the day before printed after the infor triggered by the endofDay scheduled event.

Is there a good example of managing time in the algorithms?

Update Backtest







The data timezone of equity is New York time. The default algorithm timezone is the New York time as well. For equity algorithm, the timestamp in the console and the slice.Time should be consistent. Please see the attached algorithm. 

2018-01-02 10:00:00 :1/2/2018 10:00:00 AM2018-01-02 11:00:00 :1/2/2018 11:00:00 AM2018-01-02 12:00:00 :1/2/2018 12:00:00 PM2018-01-02 13:00:00 :1/2/2018 1:00:00 PM2018-01-02 14:00:00 :1/2/2018 2:00:00 PM

We can not repeat the same issue. Could you please share the algorithm if you still find the inconsistency in the time index?

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.


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