def CV(self, days=45):
    """ Coefficient of Variation.
        計算 days 日內之變異數，預設 45 日
    """
    if len(self.raw_data) >= days:
      data_avg = sum(self.raw_data[-days:]) / days
      return self.SD / data_avg
    else:
      return 0
def CV ( self , days = 45 ) : if len ( self . raw_data ) >= days : data_avg = sum ( self . raw_data [ - days : ] ) / days return self . SD / data_avg else : return 0
Coefficient of Variation.
        計算 days 日內之變異數，預設 45 日