@Override
    public StockTransaction<S> executeOrEnqueue(Stock<S> order) {
        if (order.side == side) throw new IllegalArgumentException("same side");

        List<Stock<S>> matchingOrders;
        synchronized (this) {
            matchingOrders = removeMostProfitableFirst(order);
            if (matchingOrders.size() == 0) {
                enqueue(order);
                return null;
            }
        }

        if (matchingOrders.size() > 0) {
            return transact(order, matchingOrders);
        }

        throw new IllegalStateException();
    }