I'm trying to learn how to do the most basic python start on quantconnect, but I keep running into what seems to be a very basic error. Could anyone give a newcomer some support?

Thank you.

Code:

class UncoupledParticleEngine(QCAlgorithm):

def Initialize(self):
self.SetStartDate(2015, 1, 1) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
self.AddEquity("SPY", Resolution.Minute) # self.AddEquity("SPY", Resolution.Minute)
self.rsi = self.RSI("SPY", 10, MovingAverageType.Simple, Resolution.Daily)
# set a warm-up period to initialize the indicator
self.SetWarmUp(timedelta(20))
# Warm-up the indicator with bar count
# self.SetWarmUp(10, Resolution.Daily)

def OnData(self, data):
## You can access the TradeBar dictionary in the slice object and then subset by symbol
## to get the TradeBar for SPY
tradeBars = data.Bars
spyTradeBar = tradeBars['SPY']
spyOpen = spyTradeBar.Open ## Open price
spyClose = spyTradeBar.Close ## Close price
# if not self.Portfolio.Invested:
# self.SetHoldings("SPY", 1)

Error:

94 | 18:11:18:
Runtime Error: KeyNotFoundException : 'SPY' wasn't found in the TradeBars object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey("SPY")
at QuantConnect.Data.Market.DataDictionary`1[T].get_Item (QuantConnect.Symbol symbol) [0x00023] in <b4ad34a4a52041c4accaeff6c8d015c6>:0
at QuantConnect.Data.Market.TradeBars.get_Item (QuantConnect.Symbol symbol) [0x00000] in <b4ad34a4a52041c4accaeff6c8d015c6>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at OnData in main.py:line 17
KeyNotFoundException : 'SPY' wasn't found in the TradeBars object, likely because there was no-data at this moment in time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with data.ContainsKey("SPY")
at QuantConnect.Data.Market.DataDictionary`1[T].get_Item (QuantConnect.Symbol symbol) [0x00023] in <b4ad34a4a52041c4accaeff6c8d015c6>:0
at QuantConnect.Data.Market.TradeBars.get_Item (QuantConnect.Symbol symbol) [0x00000] in <b4ad34a4a52041c4accaeff6c8d015c6>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0 (Open Stacktrace)