Weight supplied that adds to 0 will yield error due to
self.pnl = pd.DataFrame(np.average(self.returns, 1, self.weights),
index=self.returns.index,
columns=["Daily PnL"])
A workaround that I have used is to change the above to:
self.pnl = pd.DataFrame((self.returns * self.weights).sum(axis=1),
index=self.returns.index,
columns=["Daily PnL"])
The above change will make the PnL into a long short excess return for the portfolio. However, the backtest() function doesn't yield correct graph though.
Weight supplied that adds to 0 will yield error due to
A workaround that I have used is to change the above to:
The above change will make the PnL into a long short excess return for the portfolio. However, the
backtest()function doesn't yield correct graph though.