Skip to content

metrics

Every function here is a pure, stateless function: pass a plain pandas.Series/DataFrame and get back a float, Series, DataFrame, or (with as_result=True, where applicable) a self-explaining MetricResult. Portfolio.metrics.() is a thin wrapper around these same functions, see The Portfolio object for what it auto-fills.

Submodule Covers
returns Return transformations, total/annualized/average return, CAGR.
risk Variance, volatility, downside risk, VaR/CVaR, tail ratio, skew/kurtosis, beta, tracking error.
performance Sharpe, Sortino, Calmar, Omega, information/Treynor ratios, and more.
drawdowns Drawdown series, max drawdown, duration, recovery, top-N episodes.
rolling Generic rolling/expanding-window engine, plus rolling Sharpe/volatility/beta/correlation.
distributions Descriptive stats, normality test, win rate, monthly returns table, histogram data.
benchmarks Alpha, correlation, R², up/down capture ratios, batting average.
covariance Covariance/correlation matrices, portfolio variance/volatility, risk decomposition.
summary One-call tearsheet_summary() and compare_to_benchmark().
costs Turnover from a weight history, net-of-costs returns.