qis.compute_ewm_sharpe

qis.compute_ewm_sharpe(returns, span=260, norm_type=1, initial_sharpes=None)[source]

Annualised EWM Sharpe-ratio paths of return columns.

Missing returns are set to zero and the annualisation factor af is inferred from the index. The EWM mean m_t and the EWM second moment run from zero seeds (or from the initial_sharpes prior) as the state before row 0, so the first return enters with weight 1 - lambda. The ratio is NaN where its denominator is zero.

Parameters:
  • returns (DataFrame) – periodic returns, one column per strategy, with a frequency-bearing index

  • span (float | ndarray) – EWM span of both moments

  • norm_type (int) – 0 the annualised EWM mean af m_t, not a ratio; 1 (default) sqrt(af) m_t / sqrt(EWM(r^2)_t), the mean over the root mean square, which is the second moment about zero and compresses the Sharpe ratio by 1 / sqrt(1 + SR^2 / af); 2 sqrt(af) m_t / sqrt(EWM((r - m)^2)_t), the mean over the EWM deviation from the running mean

  • initial_sharpes (ndarray) – optional annualised Sharpe prior per column; seeds the mean with 0.1 SR / af and the second moment with 0.01 / af, a 10% annual volatility

Returns:

the EWM Sharpe (or mean, for norm_type=0) paths with the index and columns of returns

Raises:

ValueError – if norm_type is not 0, 1 or 2

Return type:

DataFrame