For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
[Bug?]: `PyFolio. get_pf_items` Only returns 1 dataset and Cash weight
-
Hi, recently I am using
pyfolio
analyzer to make backtrader work with pyfolio. One thing I notice is that, for the most recent version of backtrader, if the backtest contains multiple data feeds,returns, positions, transactions, gross_lev = pyfoliozer.get_pf_items()
The
positions
will only contains two columns, the last added dataset's weight and cash's weight. After digging into the source code, I think the problem is caused byps = [[k] + v[-2:] for k, v in iteritems(pss)]
In the
get_pf_items
function. After changing it tops = [[k] + v[:] for k, v in iteritems(pss)]
Fixed this issue.
Would like to know if only showing the most recent dataset is a designed feature. Thanks. (Let me know if you need a minimum code to replicate it)
-
The
pyfolio
API keeps on changing and it is not even guaranteed to work, like it happens (or used to happen) with the test sample.Neither a feature nor a bug.