def _rebalance_portfolio(self, data, desired_port):
        # rebalance portfolio
        allocations = {}
        desired_amount = np.zeros_like(desired_port)
        current_amount = np.zeros_like(desired_port)
        prices = np.zeros_like(desired_port)

        if not self.initialized:
            positions_value = self.portfolio.starting_cash
            self.initialized = True
        else:
            positions_value = self.portfolio.positions_value + \
                self.portfolio.cash

        for i, stock in enumerate(data):
            current_amount[i] = self.portfolio.positions[stock].amount
            prices[i] = data[stock].price

        desired_amount = np.round(desired_port * prices / positions_value)

        diff_amount = desired_amount - current_amount

        for i, stock in enumerate(data):
            # Remove nan values
            if not np.isnan(diff_amount[i]):
                allocations[stock] = int(diff_amount[i])
        return allocations
dataset/ETHPy150Open intuition-io/insights/insights/managers/_review/olmar.py/OLMAR._rebalance_portfolio/swapped operands of `/`