sigmaquant.performance.returns.annual_return#
- sigmaquant.performance.returns.annual_return(returns, frequency, kind='simple')#
Compute the annualized performance of a return or PnL series.
For simple and log returns, the function computes the CAGR (Compounded Annual Growth Rate). For PnL values, it computes the annualized arithmetic mean.
- Parameters:
returns (array-like) –
Input sequence of returns or PnL values. The interpretation depends on the
kindparameter.Typically a one-dimensional array-like object such as a
numpy.ndarrayorpandas.Series.frequency (str) –
String describing the sampling frequency of the input series. It is used to infer the number of years in the sample.
For example, for weekly data the number of years is computed as
n_obs / 52.kind ({"simple", "log", "pnl"}, optional) –
"simple": simple (decimal) returns, compounded"log": log-returns, aggregated additively"pnl": additive profit-and-loss values
Notes
NaN values are treated as zeros.
For Simple returns the formula is:
\[\text{CAGR} = \left[ \prod_{k=1}^{N} (1 + R_k) \right]^{1 / \text{years}} - 1\]For Log returns the formula is:
\[\text{CAGR} = \exp \left( \frac{1}{\text{years}} \sum_{k=1}^{N} r_k \right) - 1\]For PnL the formula is:
\[\frac{1}{\text{years}} \sum_{k=1}^{N} \text{PnL}_k\]