#### Previous topic

fynance.features.indicators.signal_line

#### Next topic

fynance.features.metrics.accuracy

# 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¶

 fynance.features.metrics.accuracy(y_true, y_pred) Compute the accuracy of prediction. fynance.features.metrics.annual_return(X[, …]) Compute compouned annual returns of each X’ series. fynance.features.metrics.annual_volatility(X) Compute the annualized volatility of each X’ series. fynance.features.metrics.calmar(X[, period, …]) Compute the Calmar Ratio for each X’ series. fynance.features.metrics.diversified_ratio(X) Compute diversification ratio of a portfolio. fynance.features.metrics.drawdown(X[, raw, …]) Measures the drawdown of each X’ series. fynance.features.metrics.mad(X[, axis, dtype]) Compute the Mean Absolute Deviation of each X’ series. fynance.features.metrics.mdd(X[, raw, axis, …]) Compute the maximum drawdown for each X’ series. fynance.features.metrics.perf_index(X[, …]) Compute performance of prices or index values along time axis. fynance.features.metrics.perf_returns(R[, …]) Compute performance of returns along time axis. fynance.features.metrics.perf_strat(X[, S, …]) Compute the performance of strategies for each X’ series. fynance.features.metrics.sharpe(X[, rf, …]) Compute the Sharpe ratio for each X’ series. fynance.features.metrics.z_score(X[, w, …]) Compute the Z-score of each X’ series.

## Rolling version of metrics¶

 fynance.features.metrics.roll_annual_return(X) Compute rolling compouned annual returns of each X’ series. fynance.features.metrics.roll_annual_volatility(X) Compute the annualized volatility of each X’ series. fynance.features.metrics.roll_calmar(X[, …]) Compute the rolling Calmar ratio of each X’ series. fynance.features.metrics.roll_drawdown(X[, …]) Measures the rolling drawdown of each X’ series. fynance.features.metrics.roll_mad(X[, w, …]) Compute rolling Mean Absolut Deviation for each X’ series. fynance.features.metrics.roll_mdd(X[, w, …]) Compute the rolling maximum drawdown for each X’ series. fynance.features.metrics.roll_sharpe(X[, …]) Compute rolling sharpe ratio of each X’ series. fynance.features.metrics.roll_z_score(X[, …]) Compute vector of rolling/moving Z-score function.