Trying to do a rolling window to make an SMA of BTCUSD.  I've already reviewed the Documentation and this specific line of code thats throwing the error is pulled right out of the documentation for how to add the quotebar in a rolling window in on Data.

I think I need to make the SMA of BTCUSD be on the close bar of the quote data?  maybe thats the issue?  However I keep getting the following error:

 

 

Runtime Error: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the 'QuantConnect.Data.Market.TradeBar'>) method. Please checkout the API documentation.
at OnData
self.window.Add(data["BTCUSD"])
===
at Python.Runtime.PyObject.Invoke (Python.Runtime.PyTuple args in main.py:line 58
TypeError : No method matches given arguments for Add: (<class 'QuantConnect.Data.Market.TradeBar'>) (Open Stacktrace)

 

This is my code:

 

class RollingWindowAlgorithm(QCAlgorithm):

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2021,2,1)  #Set Start Date
        self.SetEndDate(2021,4,21)  #Set End Date
        self.SetCash(25000)           #Set Strategy Cash
      
        self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)
        self.AddCrypto("BTCUSD", Resolution.Minute) # Subscribe to minutely QuoteBars in Initialize(self)

# Creates a Rolling Window indicator to keep the 2 QuoteBar
        self.window = RollingWindow[QuoteBar](2)    # For other security types, use QuoteBar
     
        # Creates an indicator and adds to a rolling window when it is updated
        self.SMA("BTCUSD", 50).Updated += self.SmaUpdated
        self.smaWin = RollingWindow[IndicatorDataPoint](50)
        
        self.SetBenchmark("BTCUSD")
        
        self.SetWarmUp(50)

    def SmaUpdated(self, sender, updated):
        '''Adds updated values to rolling window'''
        self.smaWin.Add(updated)

    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
        
        # Add Quotebar in rollling window
        if data.ContainsKey("BTCUSD"):
        # Add EURUSD QuoteBar in rolling window
            self.window.Add(data["BTCUSD"])
        
        # Wait for windows to be ready.
        if not (self.window.IsReady and self.smaWin.IsReady): return