Back

Sys Time Wrong?

Hi

I'm trying to use DateTime ,but the system is showing me wrong dates (today is the 24th). it shows me the sys date is yesterday , and History shows me other dates.

 

today = datetime.today()
yesterday = today - timedelta(1)

self.History(["AAPL"], 2, Resolution.Daily)

I get:

symbol time
AAPL 2018-07-20 189.69 192.55 189.69 191.97 10759095.0
2018-07-21 191.76 192.50 190.17 191.67 12492459.0
Update Backtest







Hi, it is easier to provide support when there is an algorithm attached. When testing datetime.today() and today = today-timedelta(1), the correct values were outputted. With regards to the historical data request, the daily resolution data contains the trade bar of the full previous day. So in the algorithm below the last two days of daily data was received, as expected.

0


Hi ,as you can see in the output I got:

The 21st was Saturday ,which is no a trading day.

0

Yes; this is because the full trading day of Friday ends on Saturday. The daily data received will reference the day before because that is the last complete trading day. 

0

Thanks Gurumeher 

0

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