This is what the backtrader analyzer can return and then you can the returns, positions, transactions, gross_lev as arguments for the pyfolio library.
For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/