Noticed cash positions being greater than 1.0 within backtest results from a short only strategy, and thought this might be a bug, but wanted to confirm.
In pyfolio/quantrocket_moonshot.py
the from_moonshot
method returns the following for positions:
I would think cash would be 1 - active positions, which appears to be the intention within from_moonshot
per the following code snippet:
returns = results.loc["Return"].sum(axis=1)
positions = results.loc["NetExposure"]
positions["cash"] = 1 - positions.sum(axis=1)
Should the last line maybe use abs() before sum() instead?
positions["cash"] = 1 - positions.abs().sum(axis=1)