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
afis inferred from the index. The EWM meanm_tand the EWM second moment run from zero seeds (or from theinitial_sharpesprior) as the state before row 0, so the first return enters with weight1 - lambda. The ratio is NaN where its denominator is zero.- Parameters:
returns (DataFrame) – periodic returns, one column per strategy, with a frequency-bearing index
norm_type (int) –
0the annualised EWM meanaf 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 by1 / sqrt(1 + SR^2 / af);2sqrt(af) m_t / sqrt(EWM((r - m)^2)_t), the mean over the EWM deviation from the running meaninitial_sharpes (ndarray) – optional annualised Sharpe prior per column; seeds the mean with
0.1 SR / afand the second moment with0.01 / af, a 10% annual volatility
- Returns:
the EWM Sharpe (or mean, for
norm_type=0) paths with the index and columns ofreturns- Raises:
ValueError – if
norm_typeis not 0, 1 or 2- Return type: