original_docstring: 
      Method to calculate the moving standard deviation
      :param data: the dataframe
      :param int period: the window of rolling average
      :param str ma_type: type of moving average, either simple, 'sma' or exponensial, 'ema'
      :param field:
      :return:
      
docstring: Method to calculate the moving standard deviation
docstring_tokens: Method to calculate the moving standard deviation
code: def moving_standard_deviation(data, period, ma_type=None, field=None):
      """
      Method to calculate the moving standard deviation
      :param data: the dataframe
      :param int period: the window of rolling average
      :param str ma_type: type of moving average, either simple, 'sma' or exponensial, 'ema'
      :param field:
      :return:
      """
      field = field or 'Price'
      freq = (data.index[1] - data.index[0]).seconds
      if ma_type.lower() == 'sma':
          profile = pd.rolling_std(data[field], period, min_periods=0)
      elif ma_type.lower() == 'ema':
          mean = moving_average(data, period, ma_type=ma_type, field=field)
          mean_sq = mean * mean
          sq_field = data[field] * data[field]
          sq_mean = moving_average(sq_field, period, ma_type=ma_type)
          profile = numpy.sqrt(sq_mean - mean_sq)
          profile = profile.fillna(0)
      else:
          raise ValueError('{0} is not a known moving average type!'.format(ma_type))
      return profile
code_tokens: def moving_standard_deviation ( data , period , ma_type = None , field = None ) : field = field or 'Price' freq = ( data . index [ 1 ] - data . index [ 0 ] ) . seconds if ma_type . lower ( ) == 'sma' : profile = pd . rolling_std ( data [ field ] , period , min_periods = 0 ) elif ma_type . lower ( ) == 'ema' : mean = moving_average ( data , period , ma_type = ma_type , field = field ) mean_sq = mean * mean sq_field = data [ field ] * data [ field ] sq_mean = moving_average ( sq_field , period , ma_type = ma_type ) profile = numpy . sqrt ( sq_mean - mean_sq ) profile = profile . fillna ( 0 ) else : raise ValueError ( '{0} is not a known moving average type!' . format ( ma_type ) ) return profile
short_docstring: Method to calculate the moving standard deviation
short_docstring_tokens: Method to calculate the moving standard deviation
comment: """
      Method to calculate the moving standard deviation
      :param data: the dataframe
      :param int period: the window of rolling average
      :param str ma_type: type of moving average, either simple, 'sma' or exponensial, 'ema'
      :param field:
      :return:
      """