private void onMessage(quickfix.fix42.NewOrderSingle order, SessionID sessionID) throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue {
try {
validateOrder(order);
OrderQty orderQty = order.getOrderQty();
Price price = getPrice(order);
quickfix.fix42.ExecutionReport accept = new quickfix.fix42.ExecutionReport(genOrderID(), genExecID(),
new ExecTransType(ExecTransType.NEW), new ExecType(ExecType.NEW), new OrdStatus(OrdStatus.NEW), order
.getSymbol(), order.getSide(), new LeavesQty(0), new CumQty(0), new AvgPx(0));
accept.set(order.getClOrdID());
sendMessage(sessionID, accept);
if (isOrderExecutable(order, price)) {
quickfix.fix42.ExecutionReport executionReport = new quickfix.fix42.ExecutionReport(genOrderID(),
genExecID(), new ExecTransType(ExecTransType.NEW), new ExecType(ExecType.FILL),
new OrdStatus(OrdStatus.FILLED), order.getSymbol(), order.getSide(), new LeavesQty(0),
new CumQty(orderQty.getValue()), new AvgPx(price.getValue()));
executionReport.set(order.getClOrdID());
executionReport.set(orderQty);
executionReport.set(new LastShares(orderQty.getValue()));
executionReport.set(new LastPx(price.getValue()));
sendMessage(sessionID, executionReport);
}
} catch (RuntimeException e) {
LogUtil.logThrowable(sessionID, e.getMessage(), e);