input: Write a python function to calculate the Relative Strength Index (RSI) for given price data and generate buy and sell signals based on RSI values.
  assert rsi_strategy([45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125], 14) == [(None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), ('BUY', 29.41), (None, 30.77), (None, 32.26)]
  assert rsi_strategy([150, 145, 140, 135, 130, 125, 120, 115, 110, 105, 100, 95, 90, 85, 80, 75, 70], 14) == [(None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), (None, None), ('SELL', 70.59), (None, 69.23), (None, 67.74)]
output: def rsi_strategy(prices, period):
      def calculate_rsi(prices, period):
          gains = []
          losses = []
          for i in range(1, len(prices)):
              change = prices[i] - prices[i - 1]
              if change > 0:
                  gains.append(change)
                  losses.append(0)
              else:
                  gains.append(0)
                  losses.append(abs(change))
          
          avg_gain = sum(gains[:period]) / period
          avg_loss = sum(losses[:period]) / period
          rsi = [100 - (100 / (1 + avg_gain / avg_loss)) if avg_loss != 0 else 100 for _ in range(period)]
  
          for i in range(period, len(prices)):
              gain = gains[i]
              loss = losses[i]
              avg_gain = ((avg_gain * (period - 1)) + gain) / period
              avg_loss = ((avg_loss * (period - 1)) + loss) / period
              rs = avg_gain / avg_loss if avg_loss != 0 else 0
              rsi.append(100 - (100 / (1 + rs)) if rs != 0 else 100)
  
          return rsi
  
      rsi_values = calculate_rsi(prices, period)
      signals = []
  
      for i in range(len(prices)):
          if i < period:
              signals.append((None, None))
          else:
              if rsi_values[i] < 30:
                  signals.append(("BUY", round(rsi_values[i], 2)))
              elif rsi_values[i] > 70:
                  signals.append(("SELL", round(rsi_values[i], 2)))
              else:
                  signals.append((None, round(rsi_values[i], 2)))
      
      return signals