2019-10-02: The community is currently in read-only mode
[Bug?]: `PyFolio. get_pf_items` Only returns 1 dataset and Cash weight
Scott Lee last edited by Scott Lee
Hi, recently I am using
pyfolioanalyzer 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()
positionswill 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 by
ps = [[k] + v[-2:] for k, v in iteritems(pss)]
get_pf_itemsfunction. After changing it to
ps = [[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)
pyfolioAPI 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.