code: def _get_cci(cls, df, n_days=None):
          
          if n_days is None:
              n_days = 14
              column_name = 'cci'
          else:
              n_days = int(n_days)
              column_name = 'cci_{}'.format(n_days)
  
          tp = df['middle']
          tp_sma = df['middle_{}_sma'.format(n_days)]
          md = df['middle'].rolling(
              min_periods=1, center=False, window=n_days).apply(
              lambda x: np.fabs(x - x.mean()).mean())
  
          df[column_name] = (tp - tp_sma) / (.015 * md)
docs: Commodity Channel Index
  
          CCI = (Typical Price  -  20-period SMA of TP) / (.015 x Mean Deviation)
          Typical Price (TP) = (High + Low + Close)/3
          TP is also implemented as 'middle'.
  
          :param df: data
          :param n_days: N days window
          :return: None