code: def _getRank(self, instrument):
      # If the price is below the SMA, then this instrument doesn't rank at
      # all.
      smas = self.__sma[instrument]
      price = self.getLastPrice(instrument)
      if len(smas) == 0 or smas[-1] is None or price < smas[-1]:
          return None
  
      # Rank based on 20 day returns.
      ret = None
      lookBack = 20
      priceDS = self.getFeed()[instrument].getPriceDataSeries()
      if (
          len(priceDS) >= lookBack
          and smas[-1] is not None
          and smas[-1 * lookBack] is not None
      ):
          ret = (priceDS[-1] - priceDS[-1 * lookBack]) / float(
              priceDS[-1 * lookBack]
          )
      return ret
  
imports: from __future__ import print_function
  from pyalgotrade import strategy
  from pyalgotrade import plotter
  from pyalgotrade.barfeed import yahoofeed
  from pyalgotrade.technical import ma
  from pyalgotrade.technical import cumret
  from pyalgotrade.stratanalyzer import sharpe
  from pyalgotrade.stratanalyzer import returns
label_desc: Use image node_id 3 for calling the MarketTiming obj's underlying member method code with example usage: obj._getRank(instrument) and returns: ret, None