Search in sources :

Example 1 with ClOrdID

use of quickfix.field.ClOrdID in project camel by apache.

the class TradeExecutorExample method createNewOrderMessage.

private NewOrderSingle createNewOrderMessage() {
    NewOrderSingle order = new NewOrderSingle(new ClOrdID("CLIENT_ORDER_ID"), new HandlInst('1'), new Symbol("GOOG"), new Side(Side.BUY), new TransactTime(new Date()), new OrdType(OrdType.LIMIT));
    order.set(new OrderQty(10));
    order.set(new Price(300.00));
    return order;
}
Also used : NewOrderSingle(quickfix.fix42.NewOrderSingle) Side(quickfix.field.Side) OrderQty(quickfix.field.OrderQty) Price(quickfix.field.Price) Symbol(quickfix.field.Symbol) OrdType(quickfix.field.OrdType) ClOrdID(quickfix.field.ClOrdID) HandlInst(quickfix.field.HandlInst) TransactTime(quickfix.field.TransactTime) Date(java.util.Date)

Example 2 with ClOrdID

use of quickfix.field.ClOrdID in project wso2-synapse by wso2.

the class FIXTransportSenderTest method testFIXTransportSenderSendMessage.

@Test()
public void testFIXTransportSenderSendMessage() throws Exception {
    String BEGIN_STRING = "FIX.4.1";
    String SENDER_ID = "BANZAI";
    String TARGET_ID = "SYNAPSE";
    int SEQ_NUM = 5;
    String SYMBOL = "APACHE";
    String CLORD_ID = "12345";
    String CHECKSUM = "67890";
    String TX_DATE = new Date().toString();
    String SESSION_ID = "FIX.4.1:BANZAI->SYNAPSE";
    Message message = new NewOrderSingle();
    message.getHeader().setField(new BeginString(BEGIN_STRING));
    message.getHeader().setField(new SenderCompID(SENDER_ID));
    message.getHeader().setField(new TargetCompID(TARGET_ID));
    message.getHeader().setField(new MsgSeqNum(SEQ_NUM));
    message.setField(new Symbol(SYMBOL));
    message.setField(new ClOrdID(CLORD_ID));
    message.setField(new TradeOriginationDate(TX_DATE));
    message.getTrailer().setField(new CheckSum(CHECKSUM));
    MessageContext msgCtx = new MessageContext();
    msgCtx.setProperty(FIXConstants.FIX_SERVICE_NAME, "sampleService");
    Map trpHeaders = new HashMap();
    trpHeaders.put(FIXConstants.FIX_MESSAGE_APPLICATION, "sampleApplication");
    msgCtx.setProperty(MessageContext.TRANSPORT_HEADERS, trpHeaders);
    FIXUtils.getInstance().setSOAPEnvelope(message, SEQ_NUM, SESSION_ID, msgCtx);
    OutTransportInfo info = new FIXOutTransportInfo("fix://dummyEPR");
    FIXTransportSender spy = PowerMockito.spy(new FIXTransportSender());
    PowerMockito.doReturn(true).when(spy, "sendUsingEPR", anyString(), anyString(), any(), anyString(), anyInt(), any());
    spy.sendMessage(msgCtx, "fix://dummyEPR", info);
    PowerMockito.verifyPrivate(spy, times(1)).invoke("sendUsingEPR", anyString(), anyString(), any(), anyString(), anyInt(), any());
}
Also used : NewOrderSingle(quickfix.fix41.NewOrderSingle) BeginString(quickfix.field.BeginString) SenderCompID(quickfix.field.SenderCompID) Message(quickfix.Message) HashMap(java.util.HashMap) Symbol(quickfix.field.Symbol) TargetCompID(quickfix.field.TargetCompID) ClOrdID(quickfix.field.ClOrdID) TradeOriginationDate(quickfix.field.TradeOriginationDate) BeginString(quickfix.field.BeginString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) MsgSeqNum(quickfix.field.MsgSeqNum) Date(java.util.Date) TradeOriginationDate(quickfix.field.TradeOriginationDate) OutTransportInfo(org.apache.axis2.transport.OutTransportInfo) CheckSum(quickfix.field.CheckSum) MessageContext(org.apache.axis2.context.MessageContext) HashMap(java.util.HashMap) Map(java.util.Map) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

Date (java.util.Date)2 ClOrdID (quickfix.field.ClOrdID)2 Symbol (quickfix.field.Symbol)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MessageContext (org.apache.axis2.context.MessageContext)1 OutTransportInfo (org.apache.axis2.transport.OutTransportInfo)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 Message (quickfix.Message)1 BeginString (quickfix.field.BeginString)1 CheckSum (quickfix.field.CheckSum)1 HandlInst (quickfix.field.HandlInst)1 MsgSeqNum (quickfix.field.MsgSeqNum)1 OrdType (quickfix.field.OrdType)1 OrderQty (quickfix.field.OrderQty)1 Price (quickfix.field.Price)1 SenderCompID (quickfix.field.SenderCompID)1 Side (quickfix.field.Side)1