executeOrders(buyOrder, sellOrder, buyOrder.getLimitPrice());
marketPrice.change(buyOrder.getLimitPrice());
matchResult = new MatchResult(true, null);
}
else { // sell order is limit order
Money buyPrice = buyOrder.getLimitPrice();
Money sellPrice = sellOrder.getLimitPrice();
if (buyPrice.compareTo(sellPrice) >= 0) {
Money executionPrice =
buyPrice.plus(sellPrice).div(2, Constants.PRICE_SCALE);
executeOrders(buyOrder, sellOrder, executionPrice);
marketPrice.change(executionPrice);
matchResult = new MatchResult(true, null);
}