Skip to content

Performance

finml_core.metrics.performance

sharpe_ratio(returns, risk_free_rate=0.0, periods=252)

Calculates the annualized Sharpe Ratio (Ex-post).

The Sharpe Ratio evaluates the risk-adjusted performance of an investment by subtracting the risk-free rate from the investment's return and dividing the result by the investment's standard deviation (volatility).

Mathematical Formula
\[ S = \frac{R_p - R_f}{\sigma_p} \cdot \sqrt{T} \]
Where
  • \(R_p\): Average period return.
  • \(R_f\): Risk-free rate per period.
  • \(\sigma_p\): Standard deviation of period returns.
  • \(T\): Annualization factor (e.g., 252 for daily data).

Parameters:

Name Type Description Default
returns Series

Time series of asset returns (simple returns recommended).

required
risk_free_rate float

Annualized risk-free rate (e.g., 0.04 for 4%). Defaults to 0.0.

0.0
periods int

Annualization factor. (252 for daily, 12 for monthly). Defaults to 252.

252

Returns:

Type Description
float

The annualized Sharpe Ratio.

Interpretability
  • < 1.0: Suboptimal risk-adjusted return.
  • 1.0 - 1.9: Acceptable / Good.
  • 2.0 - 2.9: Superior / Very Good.
  • > 3.0: Exceptional (often seen in High-Frequency Trading).