diff --git a/cvxportfolio/simulator.py b/cvxportfolio/simulator.py index 0910fc9ea..ebf2403a9 100644 --- a/cvxportfolio/simulator.py +++ b/cvxportfolio/simulator.py @@ -200,7 +200,7 @@ def simulate(self, t, t_next, h, policy, past_returns, current_returns, u = self._round_trade_vector(u, current_prices) # recompute cash - u.iloc[-1] = sum(u.iloc[:-1]) + u.iloc[-1] = -sum(u.iloc[:-1]) assert sum(u) == 0. # compute post-trade holdings (including cash balance)