public void updatePosition(String product, Price price, BookSide side, int volume) throws Exception {
        String thisClass = "client.Position#updatePosition.";
        if (ExceptionHandler.checkString(product, thisClass) && ExceptionHandler.checkObject(price, thisClass)
                && ExceptionHandler.checkObject(side, thisClass)) {
            int adjustedVolume = 0;
            if (side == BookSide.BUY) {
                adjustedVolume = volume;
            } else {
                adjustedVolume = (-volume);
            }
            if (holdings.get(product) == null || holdings.isEmpty()) {
                holdings.put(product, adjustedVolume);
            } else {
                int holdingVolume = holdings.get(product);
                holdingVolume = holdingVolume + adjustedVolume;
                if (holdingVolume == 0) {
                    holdings.remove(product);
                } else {
                    holdings.put(product, holdingVolume);
                }
            }
            Price totalPrice = price.multiply(volume);
            if (side == BookSide.BUY) {
                accountCosts = accountCosts.subtract(totalPrice);
            } else {
                accountCosts = accountCosts.add(totalPrice);
            }
        }
    }