code: def _pair_exp_cov(X, Y, span=180):
      
      covariation = (X - X.mean()) * (Y - Y.mean())
      # Exponentially weight the covariation and take the mean
      if span < 10:
          warnings.warn("it is recommended to use a higher span, e.g 30 days")
      return covariation.ewm(span=span).mean()[-1]
docs: Calculate the exponential covariance between two timeseries of returns.
  
      :param X: first time series of returns
      :type X: pd.Series
      :param Y: second time series of returns
      :type Y: pd.Series
      :param span: the span of the exponential weighting function, defaults to 180
      :type span: int, optional
      :return: the exponential covariance between X and Y
      :rtype: float