Hi everyone,

I am trying to get the close price of the day, but as you can see I get 266.79 for the close of the 14th December 2017 but it's the close of the 13th December not the 14th.

Any idea ?

2017-12-14 00:00:00 : Time 2017-12-13 16:05:00 2017-12-14 00:00:00 : Close history symbol time SPY 2017-12-09 265.49 2017-12-12 266.34 2017-12-13 266.79 Name: close, dtype: float64 2017-12-14 00:00:00 : Close Today 266.79import numpy as np from datetime import datetime class price_check(QCAlgorithm): '''Basic template algorithm simply initializes the date range and cash''' def Initialize(self): self.SetStartDate(2017,12,11) #Set Start Date self.SetEndDate(2017,12,14) #Set End Date self.SetCash(100000) #Set Strategy Cash # Find more symbols here: http://quantconnect.com/data self.AddEquity("SPY", Resolution.Minute) self.spy = self.AddEquity("SPY", Resolution.Minute).Symbol # at market close self.Schedule.On(self.DateRules.EveryDay(self.spy), \ self.TimeRules.BeforeMarketClose(self.spy, -5), \ Action(self.EveryDayAtMarketClose)) def OnData(self, data): pass def EveryDayAtMarketClose(self): lookback = 3 hist = self.History(self.spy, lookback, Resolution.Daily) lastPrice = self.Securities[self.spy].Price close = hist["close"] self.Log('Time {}'.format(str(self.Time))) self.Log('Close history {}'.format(close)) self.Log('Close Today {}'.format(close[-1]))

Thank you.

Author