Hi All,
I'm new here so I probably don't understand much of what's going on. I'm attempting to read SPY data from November 2004. I can read the close price from self.Securities[self.spy].Close successfully for every OnData call. However, I can't say the same about getting the price from the data Slice. My understanding is that they should report identically for this case but they do not.
Why would that be?
Thank you and Regards.
Vladimir
You attempting to read SPY data when "market is closed" at 00:00:00
If you do that at 09:31:00 the log will be:
2004-11-12 09:31:00 close: 83.308243581 close1: 83.308243581
2004-11-15 09:31:00 close: 83.9160357 close1: 83.9160357
2004-11-16 09:31:00 close: 83.795649826 close1: 83.795649826
Yuri Lopukhov
Rich Duzenbury OnData handler is called not only on new bar, but also on Splits and Dividends events, in this case data slice will not be a TradeBar and will not have a Close attribute.
Rich Duzenbury
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!