For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Pyfolio Full Tear Sheet Save Results to Variables

  • Afternoon,

    This is an amazing package, thank you so much for it. I am trying to export the values calculated for the full tear sheet. I have tried to save the result to a variable but it doesn't seem to work. When I had a look at the code it seems to print calculated values, but I couldn't see the code which calculates things like "annual return", "cumulative return" and presents a figure.

    Would somebody be able to point me in the right direction to access those calculated values? Or would it be easier to calculate my own tear sheet from the positions, transactions, etc?

    Kind Regards

  • administrators

    If you are using PyFolio (and it is working for you, because it doesn't work in most cases) all the values are calculated by PyFolio itself and not by backtrader.

    The code is here:

  • pystats_df = pyfolio.timeseries.perf_stats(returns, positions=positions, transactions=transactions)

Log in to reply