Hello,
I'm receiving this log error:
Runtime Error: In Scheduled Event 'SPY: EveryDay: 9', AttributeError : 'NoneType' object has no attribute 'Close' at Rebalance in main.py:line 95 :: if self.CurrentSlice[symbol].Close is not None: AttributeError : 'NoneType' object has no attribute 'Close'.My code is this:
for symbol, previous_d_close in self.previous_d_close.items():
if self.CurrentSlice.ContainsKey(symbol):
if self.CurrentSlice[symbol].Close is not None:
last_price = self.CurrentSlice[symbol].Close
percent_change[symbol] = last_price / previous_d_close
I've looked at multiple forum posts including these:
https://www.quantconnect.com/forum/discussion/8649/attributeerror-039-nonetype-039-object-has-no-attribute-039-assetclassification-039/p1
https://www.quantconnect.com/forum/discussion/8156/039-nonetype-039-object-has-no-attribute-039-open-039-when-plotting-candle-charts/p1
https://www.quantconnect.com/forum/discussion/4918/how-to-generate-the-rolling-window-of-4-tradebars/p1
https://www.quantconnect.com/forum/discussion/8649/attributeerror-039-nonetype-039-object-has-no-attribute-039-assetclassification-039/p0
https://www.quantconnect.com/forum/discussion/4283/using-data-keys-to-check-for-symbols-in-the-slice-object-not-working/p1
However none of these suggestions resolve the issue. Does anyone have a suggestion to fix this?