Hi I'm going through the bootcamp 10. Below is the script


        spread = self.pair[1].Price - self.pair[0].Price
       self.spreadMean.Update(algorithm.Time, spread)
       self.spreadStd.Update(algorithm.Time, spread)

       upperthreshold = self.spreadMean.Current.Value + self.spreadStd.Current.Value
       lowerthreshold = self.spreadMean.Current.Value - self.spreadStd.Current.Value


       if spread > upperthreshold:
           return Insight.Group(
               [
                   Insight.Price(self.pair[0].Symbol, self.period, InsightDirection.Up), Insight.Price(self.pair[1].Symbol, self.period, InsightDirection.Down)
               ])
       if spread < lowerthreshold:
           return Insight.Group(
               [
                   Insight.Price(self.pair[0].Symbol, self.period, InsightDirection.Down), Insight.Price(self.pair[1].Symbol, self.period, InsightDirection.Up)
               ])
       
       return []


   def OnSecuritiesChanged(self, algorithm, changes):
       
       self.pair = [x for x in changes.AddedSecurities]

       #1. Call for 500 hours of history data for each symbol in the pair and save to the variable history
       history=algorithm.History([x.Symbol for x in self.pair], 500)
       #2. Unstack the Pandas data frame to reduce it to the history close price
       history=history.close.unstack(level=0)
       #3. Iterate through the history tuple and update the mean and standard deviation with historical data
       for tuple in history.itertuples():
           self.spreadMean.Update(tuple[0], tuple[2]-tuple[1])
           self.spreadStd.Update(tuple[0], tuple[2]-tuple[1])

 


  1. In the PairTradingAlphaModel constructor, SimpleMovingAverage doesn't require any asset symbol. I don't know what quantities are moving-averaged.
  2. In the Update method of the PairTradingAlphaModel class, it returns empty list. Is this OK?