I am a bit confused with data I am receiving using History function.

I run my rebalancing function every day before market close:

self.Schedule.On(self.DateRules.EveryDay('SPY'), self.TimeRules.BeforeMarketClose('SPY', 1), Action(self.Rebalance))

Then I want to get "today's" closing price. For this moment I just debug:

history = self.History(["SPY"],3, Resolution.Daily) self.Debug("Processing:" + str(self.Time)) self.Debug("SPY price: " + str(history))

And I get:

2014-07-10 00:00:00 Processing:2014-07-09 15:59:00 2014-07-10 00:00:00 SPY : close high low open volume symbol time SPY 2014-07-04 198.05 198.29 197.64 197.79 32643128.0 2014-07-08 197.53 197.98 197.22 197.82 44628828.0 2014-07-09 196.28 197.22 195.76 197.15 69544115.0

But the date in dataframe is shifted by one day to the reality.

In above dataframe the "Close" value 196.28 is stated for 2014-07-09 (it is a raw price). But in reality it is a value for 2014-07-08. If I use the History function in Research I get correct date.

Thus my questions:

Why is the date shifted in the dataframe?

How do I get "todays" close?

Author