@Override
public String generateNewOrderSingleMessage(Order order) {
logger.debug("Generating NewOrderSingle: {}", order);
NewOrderSingle fixMessage = new NewOrderSingle(
ClOrdIDConverter.toFix(getBrokerId(), order.getId()),
OrderSideConverter.toFix(order.getSide()),
new TransactTime(order.getCreationTime().toDate()),
OrderTypeConverter.toFix(order.getType()));
fixMessage.set(InstrumentConverter.toFix(order.getSymbol()));
fixMessage.set(OrderQuantityConverter.toFix(order.getQuantity()));
if (order.getLimitPrice() != null) {
fixMessage.set(MoneyConverter.toFixPrice(order.getLimitPrice()));
fixMessage.set(MoneyConverter.toFixCurrency(order.getLimitPrice()));
}
fixMessage.set(OrderTermConverter.toFix(order.getTerm()));
if (order.isAllOrNone()) {
fixMessage.set(new ExecInst(Character.toString(ExecInst.ALL_OR_NONE)));
}
logger.debug("Sending message:\n{}", FixFormatter.format(fixMessage));
return fixMessage.toString();
}