static void setOrderID(Message inMessage, String inOrderID) { inMessage.setField(new ClOrdID(inOrderID)); } static BigDecimal getPrice(Message inMessage) {
protected void addHandlingInst(Message inMessage) { inMessage.setField(new HandlInst(HandlInst.AUTOMATED_EXECUTION_ORDER_PRIVATE)); }
/** Creates a {@link MsgType#ORDER_CANCEL_REJECT} message * @param rejectReasonText Text explanation for why reject is sent */ public Message newOrderCancelReject(OrderID orderID, ClOrdID clOrdID, OrigClOrdID origClOrdID, String rejectReasonText, CxlRejReason cxlRejReason) { Message reject = newOrderCancelReject(); reject.setField(orderID); reject.setField(clOrdID); reject.setField(origClOrdID); reject.setField(new OrdStatus(OrdStatus.REJECTED)); reject.setField(new CxlRejResponseTo(CxlRejResponseTo.ORDER_CANCEL_REQUEST)); reject.setString(Text.FIELD, rejectReasonText.replace(SOH_CHAR, SOH_REPLACE_CHAR)); if(cxlRejReason!=null) { reject.setField(cxlRejReason); } addApplicationVersion(reject); return reject; }
/** Only add the transaction time if it's necessary for this message */ public void addTransactionTimeIfNeeded(Message msg) { if(msgAugmentor.needsTransactTime(msg)) { msg.setField(new TransactTime(new Date())); //non-i18n } } /**
/** Creates a new BusinessMessageReject message based on passed-in parameters */ public Message newBusinessMessageReject(String refMsgType, int rejReason, String textReason) { Message bmReject = createMessage(MsgType.BUSINESS_MESSAGE_REJECT); bmReject.setField(new RefMsgType(refMsgType)); bmReject.setField(new BusinessRejectReason(rejReason)); bmReject.setField(new Text(textReason)); addApplicationVersion(bmReject); return bmReject; }
public Message newCancelReplaceShares(String orderID, String origOrderID, BigDecimal quantity) { Message aMessage = msgFactory.create(beginString, MsgType.ORDER_CANCEL_REPLACE_REQUEST); addApplicationVersion(aMessage); addTransactionTimeIfNeeded(aMessage); aMessage.setField(new ClOrdID(orderID)); aMessage.setField(new OrigClOrdID(origOrderID)); aMessage.setField(new OrderQty(quantity)); addHandlingInst(aMessage); return aMessage; }
/** * Create a new market data request that cancels the market data request based on the given original request. * * @param inOriginalMessage a <code>String</code> value * @return a <code>Message</code> value * @throws FieldNotFound if the message could not be constructed */ public Message newMarketDataRequestCancel(Message inOriginalMessage) throws FieldNotFound { Message cancelRequest = inOriginalMessage; addApplicationVersion(cancelRequest); cancelRequest.setField(new quickfix.field.SubscriptionRequestType(quickfix.field.SubscriptionRequestType.DISABLE_PREVIOUS_SNAPSHOT_PLUS_UPDATE_REQUEST)); return cancelRequest; } /**
/** * Set the AggregatedBook value on the given message based on the inputs. * * @param inMarketDataRequest a <code>Message</code> value * @param inNewAggregatedBookValue a <code>boolean</code> value * @param inCurrentAggregatedBookValue a <code>Boolean</code> value or <code>null</code> if the value has not yet been set * @return a <code>boolean</code> value holding the new AggregatedBook value for the message * @throws IllegalArgumentException if the new aggregated book value conflicts with the old aggregated book value */ private boolean setAggregatedBook(Message inMarketDataRequest, boolean inNewAggregatedBookValue, Boolean inCurrentAggregatedBookValue) { Validate.isTrue(inCurrentAggregatedBookValue == null || inNewAggregatedBookValue == inCurrentAggregatedBookValue, "Request has conflicting implied aggregated book"); inMarketDataRequest.setField(new quickfix.field.AggregatedBook(inNewAggregatedBookValue)); return inNewAggregatedBookValue; } /**
/** * Set the MaxDepth value on the given message based on the inputs. * * @param inMarketDataRequest a <code>Message</code> value * @param inNewDepthValue an <code>int</code> value * @param inCurrentDepthValue an <code>Integer</code> value or <code>null</code> if the value has not yet been set * @return an <code>int</code> value containing the new MaxDepth value for the message * @throws IllegalArgumentException if the new MaxDepth value conflicts with the old MaxDepth value */ private int setMaxDepth(Message inMarketDataRequest, int inNewDepthValue, Integer inCurrentDepthValue) { Validate.isTrue(inCurrentDepthValue == null || inNewDepthValue == inCurrentDepthValue, "Request has conflicting implied market depth"); inMarketDataRequest.setField(new quickfix.field.MarketDepth(inNewDepthValue)); return inNewDepthValue; } /**
public Message newCancelReplacePrice( String orderID, String origOrderID, BigDecimal price ) { Message aMessage = msgFactory.create(beginString, MsgType.ORDER_CANCEL_REPLACE_REQUEST); addApplicationVersion(aMessage); addTransactionTimeIfNeeded(aMessage); aMessage.setField(new ClOrdID(orderID)); aMessage.setField(new OrigClOrdID(origOrderID)); aMessage.setField(new Price(price)); addHandlingInst(aMessage); return aMessage; }
private static Message createQuoteMessage(String reqId, Quote quote) { Message message = new Message(); message.getHeader().setField(QUOTE_MSG_TYPE); message.setField(new QuoteReqID(reqId)); message.setField(new DoubleField(MktBidPx.FIELD, quote.getBid(), 2)); message.setField(new DoubleField(MktOfferPx.FIELD, quote.getBid(), 2)); return message; }
/** * {@inheritDoc} */ @Override public void toAdmin(Message message, SessionID sessionId) { super.toAdmin(message, sessionId); String msgType; try { msgType = message.getHeader().getString(MsgType.FIELD); } catch (FieldNotFound e) { throw new RuntimeException(e.getMessage(), e); } if (MsgType.LOGON.equals(msgType)) { message.setField(new Username(accessKey)); message.setField(new Password(secretKey)); } }
public quickfix.Message populateOrder(Order order, quickfix.Message newOrderSingle) { OrderType type = order.getType(); if (type == OrderType.LIMIT) newOrderSingle.setField(new Price(order.getLimit())); else if (type == OrderType.STOP) { newOrderSingle.setField(new StopPx(order.getStop())); } else if (type == OrderType.STOP_LIMIT) { newOrderSingle.setField(new Price(order.getLimit())); newOrderSingle.setField(new StopPx(order.getStop())); } if (order.getSide() == OrderSide.SHORT_SELL || order.getSide() == OrderSide.SHORT_SELL_EXEMPT) { newOrderSingle.setField(new LocateReqd(false)); } newOrderSingle.setField(tifToFIXTif(order.getTIF())); return newOrderSingle; }
/** * Create a new market data incremental refresh (35=X) message. * * @param inRequestId a <code>String</code> value */ public Message newMarketDataIncrementalRefresh(String inRequestId) { Message request = msgFactory.create(beginString, MsgType.MARKET_DATA_INCREMENTAL_REFRESH); addApplicationVersion(request); request.setField(new quickfix.field.MDReqID(inRequestId)); return request; } /**
Message populateCancelReplace(Order order, Order newOrder, quickfix.Message message) { if (order.getQuantity() != newOrder.getQuantity()) message.setField(new OrderQty(newOrder.getQuantity())); if (!order.getLimit().equals(newOrder.getLimit())) message.setField(new Price(newOrder.getLimit())); return message; }
/** If the {@link CxlType} field is defined then set it */ public Message cancelRequestAugment(Message inMessage) { super.cancelRequestAugment(inMessage); DataDictionary dictionary = CurrentFIXDataDictionary.getCurrentFIXDataDictionary().getDictionary(); if(dictionary.isMsgField(dictionary.getMsgType("OrderCancelRequest"), //$NON-NLS-1$ CxlType.FIELD)) { inMessage.setField(new CxlType(CxlType.FULL_REMAINING_QUANTITY)); } return inMessage; }
public static Message createSessionReject(Message inMessage, int inReason, String inText) throws FieldNotFound, SessionNotFound, ExecutionException { FIXVersion version = FIXVersion.getFIXVersion(inMessage); Message reject = version.getMessageFactory().createSessionReject(inMessage, inReason); FIXMessageUtil.fillFieldsFromExistingMessage(reject, inMessage, getDataDictionary(inMessage), false); if(inText != null) { reject.setField(new Text(inText)); } return reject; } /**
public void resetSequence(int nextSeqNum) throws SessionNotFound { logInvocation("resetSequence to: " + nextSeqNum); Message sequenceReset = new Message(); sequenceReset.getHeader().setField(new MsgType(MsgType.SEQUENCE_RESET)); sequenceReset.setField(new NewSeqNo(nextSeqNum)); doSend(sequenceReset, session.getSessionID()); }
public void resetSequence(int nextSeqNum) throws SessionNotFound { logInvocation("resetSequence to: " + nextSeqNum); Message sequenceReset = new Message(); sequenceReset.getHeader().setField(new MsgType(MsgType.SEQUENCE_RESET)); sequenceReset.setField(new NewSeqNo(nextSeqNum)); doSend(sequenceReset, session.getSessionID()); }
public void resetSequence(int nextSeqNum) throws SessionNotFound { logInvocation("resetSequence to: " + nextSeqNum); Message sequenceReset = new Message(); sequenceReset.getHeader().setField(new MsgType(MsgType.SEQUENCE_RESET)); sequenceReset.setField(new NewSeqNo(nextSeqNum)); doSend(sequenceReset, session.getSessionID()); }