Backtrader中文笔记之Pyfolio Integration(待看)

The integration of a portfolio tool, namely pyfolio, came up with in Ticket #108.

A first look at the tutorial deemed it as difficult, given the tight integration amongst zipline and pyfolio, but the sample test data available with pyfolio for some other uses is actually pretty useful to decode what’s running behind the scenes and hence the wonder of integration.

Most of the pieces were already in-place in backtrader:

  • Analyzer infrastructure

  • Children analyzer

  • A TimeReturn analyzer

Only a main PyFolio analyzer and 3 easy children analyzer are needed. Plus a method that relies on one of the dependencies already needed by pyfolio which is pandas.

The most challenging part … “getting all the dependencies right”.

  • Update of pandas

  • Update of numpy

  • Update of scikit-lean

  • Update of seaborn

Under Unix-like environments with a C compiler it’s all about time. Under Windows and even with the specific Microsoft compiler installed (in this case the chain for Python 2.7) things failed. But a well known site with a collection of up-to-date packages for Windows helped. Visit it if you ever need it:

The integration wouldn’t be complete if it wasn’t tested and that’s why the usual sample is as always present.

posted @ 2020-09-10 16:51  就是想学习  阅读(359)  评论(0编辑  收藏  举报