pyfolio offers several analytic functions and plots. The perf_stats summary displays the annual and cumulative returns, volatility, skew, and kurtosis of returns and the SR. The following additional metrics (which can also be calculated individually) are most important:
- Max drawdown: Highest percentage loss from the previous peak
- Calmar ratio: Annual portfolio return relative to maximal drawdown
- Omega ratio: The probability-weighted ratio of gains versus losses for a return target, zero per default
- Sortino ratio: Excess return relative to downside standard deviation
- Tail ratio: Size of the right tail (gains, the absolute value of the 95th percentile) relative to the size of the left tail (losses, abs. value of the 5th percentile)
- Daily value at risk (VaR): Loss corresponding to a return two standard deviations below the daily mean
- Alpha: Portfolio return unexplained by the benchmark return
- Beta: Exposure to the benchmark
from pyfolio.timeseries import perf_stats
perf_stats(returns=returns,
factor_returns=benchmark_rets,
positions=positions,
transactions=transactions)
For the simulated long-short portfolio derived from the MeanReversion factor, we obtain the following performance statistics:
Metric |
All |
In-sample |
Out-of-sample |
Metric |
All |
In-sample |
Out-of-sample |
Annual return |
1.80% |
0.60% |
4.20% |
Skew |
0.34 |
0.40 |
0.09 |
Cumulative returns |
5.40% |
1.10% |
4.20% |
Kurtosis |
3.70 |
3.37 |
2.59 |
Annual volatility |
5.80% |
6.30% |
4.60% |
Tail ratio |
0.91 |
0.88 |
1.03 |
Sharpe ratio |
0.33 |
0.12 |
0.92 |
Daily value at risk |
-0.7% |
-0.8% |
-0.6% |
Calmar ratio |
0.17 |
0.06 |
1.28 |
Gross leverage |
0.38 |
0.37 |
0.42 |
Stability |
0.49 |
0.04 |
0.75 |
Daily turnover |
4.70% |
4.40% |
5.10% |
Max drawdown |
-10.10% |
-10.10% |
-3.30% |
Alpha |
0.01 |
0.00 |
0.04 |
Omega ratio |
1.06 |
1.02 |
1.18 |
Beta |
0.15 |
0.16 |
0.03 |
Sortino Ratio |
0.48 |
0.18 |
1.37 |
|
See the appendix for details on the calculation and interpretation of portfolio risk and return metrics.