There's more...

Previously, we used the pf.create_simple_tear_sheet function, as it already contains a lot of useful metrics. To obtain even more details, we can use the pf.create_returns_tear_sheet function. 

Some of the interesting new features include:

  • A table with the top five drawdown periods: how bad the drawdown was, the peak/valley dates, the recovery date, and the duration. This table complements the analysis of the underwater plot, and is shown in the following image:

  • The top five drawdown periods are also visualized on a separate plot:

  • Plots describing the distribution of the portfolio returns: a summary of what the returns were over certain months/years, how the monthly returns were distributed, and the returns' quantiles, using different frequencies. All that information is presented below:

pyfolio was developed by the Quantopian team and works really well as a standalone library. However, it can also be combined with zipline—a Quantopian-developed backtesting and live-trading framework. Similarly to backtrader, it is a framework facilitating backtesting of trading strategies. When we add extra information (such as transaction/position details obtained from zipline) to the pyfolio function calls, we receive even more information in the tear sheet.

We can create Bayesian tear sheets by running the pf.create_bayesian_tear_sheet function. These are based on PyMC3 and require additional dependencies.

Most of the performance/risk metrics presented in the pyfolio tear sheets are actually calculated using a library called empyrical, also developed by Quantopian. We can use it directly if we are only interested in calculating a specific metric, such as the Omega ratio.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.209.120