Wrong Order Time

Back

I am getting 2015-07-06T13:49:00Z for one of the orders in backtest, when the right time should be 9:49. Why it could be happening?

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.


What is your reference 9:49 time zone? 

0

To help you better understand how QC uses times / timezones: (see the end of the page)
 

https://www.quantconnect.com/docs/key-concepts/understanding-timeAlgorithm Time Zone

"Algorithm time is accessed from the self.time property of QCAlgorithm. Algorithm time defaults to New York timezone for UTC-4 in summer, and UTC-5 in winter. This can be configured by passing an accepted time zone name into the SetTimeZone() method. A full list of time zone names can be found on Wikipedia.

The result of setting a timezone is saved to your algorithm.TimeZone property. In addition QCAlgorithm maintains UTC time under the UtcTime property:
 

Both Time and UtcTime are timezone-less objects. Their state is maintained by LEAN to be consistent."

1

Dear Michael, I believe that I did what you have suggested to me but the problem still remain.

On Initialize I wrote:

        self.SetTimeZone("America/New_York")
        self.UtcTime

After backtest I am getting the following Log for one self.MarketOrder("SPY", -50)

2017-07-06 13:07:00 83 orderEvent:: Time: 07/06/2017 17:07:00 OrderID: 1 EventID: 1 Symbol: SPY Status: Submitted Quantity: -50

Right self.Time is 13:07, but the Order have been submitted with the wrong time, 17:07, as you can see.

I'll apprecite you new help.

0

Mario Schmidt 

I am not sure you can "solve" the problem, as it may not really be a problem.

The order Event class is described here:
https://www.quantconnect.com/lean/documentation/topic25240.html

Forcing the time to be UTC Time allows QuantConnect not to mishandle data because of different "times" shown by different datazones / data providers (for instance data on US stock exchanges and data on Forex which are round the clock), as to prevent QC users to use informations that would not have been known in the real-world.

So the data you get are logical:

At the beginning, the TimeZone you use is written:"2017-07-06 13:07:00", which confirms that the order was CORRECTLY sent at 1:07 PM Eastern Time... while the orderEvent using the UTC ("83 orderEvent:: Time: 07/06/2017 17:07:00 OrderID: 1 EventID: 1 Symbol: SPY Status: Submitted Quantity: -50") did confirm the submission was handle at 5:07 PM UTC, which is equal to 1:07 PM EST.


You could use UTC everywhere so that there would not be any "discrepancy" in the log files.

I do not know if it is possible to do the contrary (showing only EST times, also for submitting / filling orders): maybe someone from QC could answer to that. 

 




 

1

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