@Override public OrderSingle createOrderSingle() { OrderSingleImpl order = new OrderSingleImpl(); assignOrderID(order); return order; }
/** Extracts the FIX message from the incoming ER, pulls the custom fields out of it, and sets it on the specified order */ protected void addCustomFieldsFromReport(ExecutionReport inLatestReport, RelatedOrder order, Set<Integer> inExcludeFields) { if(inLatestReport instanceof HasFIXMessage) { Message msg = ((HasFIXMessage) inLatestReport).getMessage(); try { order.setCustomFields(getFieldMap(msg, inExcludeFields)); } catch (MessageCreationException e) { // ignore: unable to insert custom fields } } }
/** * Assigns a unique order ID to the supplied order. * * @param inMessage the order message that needs to be * assigned a unique order ID. */ private void assignOrderID(Message inMessage) { FIXUtil.setOrderID(inMessage, getNextOrderID()); }
@Override public OrderSingle createOrderSingle(Message inMessage, BrokerID inBrokerID) throws MessageCreationException { checkSystemMessage(inMessage); if(!FIXMessageUtil.isOrderSingle(inMessage)) { throw new MessageCreationException(new I18NBoundMessage1P( Messages.NOT_SINGLE_ORDER, inMessage.toString())); } OrderSingle order = createOrderSingle(); order.setAccount(FIXUtil.getAccount(inMessage)); order.setExecutionDestination(FIXUtil.getExecutionDestination(inMessage)); order.setBrokerID(inBrokerID); order.setCustomFields(getFieldMap(inMessage, SystemFIXMessageFactory.ORDER_SINGLE_FIELDS)); order.setOrderID(FIXUtil.getOrderID(inMessage)); order.setOrderType(FIXUtil.getOrderType(inMessage)); order.setPrice(FIXUtil.getPrice(inMessage)); order.setQuantity(FIXUtil.getOrderQuantity(inMessage)); order.setDisplayQuantity(FIXUtil.getOrderDisplayQuantity(inMessage)); order.setSide(FIXUtil.getSide(inMessage)); order.setInstrument(FIXUtil.getInstrument(inMessage)); order.setTimeInForce(FIXUtil.getTimeInForce(inMessage)); order.setOrderCapacity(FIXUtil.getOrderCapacity(inMessage)); order.setPositionEffect(FIXUtil.getPositionEffect(inMessage)); order.setText(FIXUtil.getText(inMessage)); assignOrderID(order); return order; }
@Override public OrderCancel createOrderCancel(Message inMessage, BrokerID inBrokerID) throws MessageCreationException { checkSystemMessage(inMessage); if(!FIXMessageUtil.isCancelRequest(inMessage)) { throw new MessageCreationException(new I18NBoundMessage1P( Messages.NOT_CANCEL_ORDER, inMessage.toString())); } OrderCancel order = new OrderCancelImpl(); order.setAccount(FIXUtil.getAccount(inMessage)); order.setBrokerID(inBrokerID); order.setBrokerOrderID(FIXUtil.getBrokerOrderID(inMessage)); order.setCustomFields(getFieldMap(inMessage, SystemFIXMessageFactory.ORDER_CANCEL_FIELDS)); order.setOrderID(FIXUtil.getOrderID(inMessage)); order.setOriginalOrderID(FIXUtil.getOriginalOrderID(inMessage)); order.setQuantity(FIXUtil.getOrderQuantity(inMessage)); order.setSide(FIXUtil.getSide(inMessage)); order.setInstrument(FIXUtil.getInstrument(inMessage)); order.setText(FIXUtil.getText(inMessage)); assignOrderID(order); return order; }
@Override public OrderCancel createOrderCancel(ExecutionReport inLatestReport) { OrderCancelImpl order = new OrderCancelImpl(); assignOrderID(order); if (inLatestReport != null) { order.setAccount(inLatestReport.getAccount()); order.setBrokerID(inLatestReport.getBrokerID()); order.setBrokerOrderID(inLatestReport.getBrokerOrderID()); order.setQuantity(inLatestReport.getOrderQuantity()); order.setSide(inLatestReport.getSide()); order.setInstrument(inLatestReport.getInstrument()); order.setText(inLatestReport.getText()); addCustomFieldsFromReport(inLatestReport, order, SystemFIXMessageFactory.EXECUTION_REPORT_FIELDS); Map<String,String> customFields = order.getCustomFields(); if(customFields != null) { customFields.remove(String.valueOf(quickfix.field.MaxFloor.FIELD)); order.setCustomFields(customFields); } // set this manually after the customFields are copied, so that we take the OrigClOrdId from the report itself, // not from the custom field of the report order.setOriginalOrderID(inLatestReport.getOrderID()); } return order; }
BrokerID inBrokerID) throws MessageCreationException { checkSystemMessage(inMessage); if(!FIXMessageUtil.isCancelReplaceRequest(inMessage)) { throw new MessageCreationException(new I18NBoundMessage1P( order.setBrokerID(inBrokerID); order.setBrokerOrderID(FIXUtil.getBrokerOrderID(inMessage)); order.setCustomFields(getFieldMap(inMessage, SystemFIXMessageFactory.ORDER_REPLACE_FIELDS)); order.setOrderID(FIXUtil.getOrderID(inMessage)); order.setOrderType(FIXUtil.getOrderType(inMessage)); order.setPositionEffect(FIXUtil.getPositionEffect(inMessage)); order.setText(FIXUtil.getText(inMessage)); assignOrderID(order); return order;
@Override public OrderReplace createOrderReplace(ExecutionReport inLatestReport) { OrderReplaceImpl order = new OrderReplaceImpl(); assignOrderID(order); if (inLatestReport != null) { order.setAccount(inLatestReport.getAccount()); order.setBrokerID(inLatestReport.getBrokerID()); order.setBrokerOrderID(inLatestReport.getBrokerOrderID()); order.setOrderType(inLatestReport.getOrderType()); order.setPrice(inLatestReport.getPrice()); order.setQuantity(inLatestReport.getOrderQuantity()); order.setDisplayQuantity(inLatestReport.getOrderDisplayQuantity()); order.setSide(inLatestReport.getSide()); order.setInstrument(inLatestReport.getInstrument()); order.setTimeInForce(inLatestReport.getTimeInForce()); order.setOrderCapacity(inLatestReport.getOrderCapacity()); order.setPositionEffect(inLatestReport.getPositionEffect()); order.setText(inLatestReport.getText()); addCustomFieldsFromReport(inLatestReport, order, SystemFIXMessageFactory.CANCEL_REPLACE_EXCLUSION_FIELDS); // set this manually after the customFields are copied, so that we take the OrigClOrdId from the report itself, // not from the custom field of the report order.setOriginalOrderID(inLatestReport.getOrderID()); } return order; }
/** * Assigns a unique order ID to the supplied order. * * @param inOrder the order that needs to be assigned a unique order ID. */ private void assignOrderID(OrderBase inOrder) { inOrder.setOrderID(new OrderID(getNextOrderID())); }
@Override public FIXOrder createOrder(Message inMessage, BrokerID inBrokerID) throws MessageCreationException { assignOrderID(inMessage); return new FIXOrderImpl(inMessage, inBrokerID); }