Metrics

This module contains some tools to compute financial metrics, such as annualized returns (annual_return), annualized volatility (annual_volatility), Calmar ratio (calmar), diversification ratio (diversified_ratio), maximum drawdown (mdd), Sharpe ratio (sharpe), Z-score (z_score), etc.

There is also rolling version of some metrics, annualized returns (roll_annual_return), annualized volatility (roll_annual_volatility), Calmar ratio (roll_calmar), maximum drawdown (roll_mdd), Sharpe ratio (roll_sharpe), Z-score (roll_z_score), etc.

Classical version of metrics

accuracy(y_true, y_pred[, sign, axis])

Compute the accuracy of prediction.

annual_return(X[, period, axis, dtype, ddof])

Compute compouned annual returns of each X' series.

annual_volatility(X[, period, log, axis, ...])

Compute the annualized volatility of each X' series.

calmar(X[, period, axis, dtype, ddof])

Compute the Calmar Ratio for each X' series.

diversified_ratio(X[, W, std_method, axis])

Compute diversification ratio of a portfolio.

drawdown(X[, raw, axis, dtype])

Measures the drawdown of each X' series.

mad(X[, axis, dtype])

Compute the Mean Absolute Deviation of each X' series.

mdd(X[, raw, axis, dtype])

Compute the maximum drawdown for each X' series.

perf_index(X[, base, axis, dtype])

Compute performance of prices or index values along time axis.

perf_returns(R[, kind, base, axis, dtype])

Compute performance of returns along time axis.

perf_strat(X[, S, base, axis, dtype, reinvest])

Compute the performance of strategies for each X' series.

sharpe(X[, rf, period, log, axis, dtype, ddof])

Compute the Sharpe ratio for each X' series.

z_score(X[, w, kind, axis, dtype])

Compute the Z-score of each X' series.

Rolling version of metrics

roll_annual_return(X[, period, w, axis, ...])

Compute rolling compouned annual returns of each X' series.

roll_annual_volatility(X[, period, log, w, ...])

Compute the annualized volatility of each X' series.

roll_calmar(X[, period, w, axis, dtype, ddof])

Compute the rolling Calmar ratio of each X' series.

roll_drawdown(X[, w, raw, axis, dtype])

Measures the rolling drawdown of each X' series.

roll_mad(X[, w, axis, dtype])

Compute rolling Mean Absolut Deviation for each X' series.

roll_mdd(X[, w, raw, axis, dtype])

Compute the rolling maximum drawdown for each X' series.

roll_sharpe(X[, rf, period, w, log, axis, ...])

Compute rolling sharpe ratio of each X' series.

roll_z_score(X[, w, kind, axis, dtype])

Compute vector of rolling/moving Z-score function.