Need help in building an E message

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Need help in building an E message

Tirthankarg
QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
QuickFIX/J Support: http://www.quickfixj.org/support/

Hi,

 

I am trying to build and E message using quickfix NewOrderList (in FIX 4.4) . My idea was to create the E message using NewOrderList and then reconverting it to a string and trying to recreate a Message object from the string, for the sake of cross-verification. It seems if I create a NewOrderList with a single order in the group it works while if I try 2 orders, it gives me a body length mismatch error, when I try to create the Message object. Can someone please help me in spotting what is wrong in the way I am using NewOrderList.

 

The code snippet is as under:

 

        NewOrderList newOrderList=new NewOrderList();

        NewOrderList.NoOrders NOLOrders=new NewOrderList.NoOrders();

 

        newOrderList.set(new ListID("Test125"));

        newOrderList.set(new BidType(3));

        newOrderList.set(new TotNoOrders(2));

        StringField sf2 =new StringField(5551);

        sf2.setValue("Test_Portfolio23:30:60:60");

        newOrderList.setField(sf2);

        sf2 =new StringField(5552);

        sf2.setValue("1");

        newOrderList.setField(sf2);

       

 

        //// adding the first order       

        NOLOrders.set(new ClOrdID("321"));

        NOLOrders.set(new ListSeqNo(1));

        NOLOrders.set(new Symbol("MJSFT"));

        NOLOrders.set(new Side(Side.BUY));

        NOLOrders.set(new OrderQty(30));

        newOrderList.addGroup(NOLOrders);

                       

        // adding a second order

        NOLOrders.set(new ClOrdID("221"));

        NOLOrders.set(new ListSeqNo(2));

        NOLOrders.set(new Symbol("IBM"));

        NOLOrders.set(new Side(Side.BUY));

        NOLOrders.set(new OrderQty(30));

       

        newOrderList.addGroup(NOLOrders);

    

        DataDictionary dd = new DataDictionary("FIX44.xml");                 

        Message m = new Message(newOrderList.toString());


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Quickfixj-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfixj-users
Reply | Threaded
Open this post in threaded view
|

Re: Need help in building an E message

Tirthankarg
QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
QuickFIX/J Support: http://www.quickfixj.org/support/

Please ignore my last email. I got the problem in my code. I was not using the correct datadictionary.

 

Thanks and regards

 

-----Original Message-----
From: Tirthankarg [mailto:[hidden email]]
Sent: Monday, May 07, 2007 7:10 AM
To: '[hidden email]'
Subject: Need help in building an E message

 

Hi,

 

I am trying to build and E message using quickfix NewOrderList (in FIX 4.4) . My idea was to create the E message using NewOrderList and then reconverting it to a string and trying to recreate a Message object from the string, for the sake of cross-verification. It seems if I create a NewOrderList with a single order in the group it works while if I try 2 orders, it gives me a body length mismatch error, when I try to create the Message object. Can someone please help me in spotting what is wrong in the way I am using NewOrderList.

 

The code snippet is as under:

 

        NewOrderList newOrderList=new NewOrderList();

        NewOrderList.NoOrders NOLOrders=new NewOrderList.NoOrders();

 

        newOrderList.set(new ListID("Test125"));

        newOrderList.set(new BidType(3));

        newOrderList.set(new TotNoOrders(2));

        StringField sf2 =new StringField(5551);

        sf2.setValue("Test_Portfolio23:30:60:60");

        newOrderList.setField(sf2);

        sf2 =new StringField(5552);

        sf2.setValue("1");

        newOrderList.setField(sf2);

       

 

        //// adding the first order       

        NOLOrders.set(new ClOrdID("321"));

        NOLOrders.set(new ListSeqNo(1));

        NOLOrders.set(new Symbol("MJSFT"));

        NOLOrders.set(new Side(Side.BUY));

        NOLOrders.set(new OrderQty(30));

        newOrderList.addGroup(NOLOrders);

                       

        // adding a second order

        NOLOrders.set(new ClOrdID("221"));

        NOLOrders.set(new ListSeqNo(2));

        NOLOrders.set(new Symbol("IBM"));

        NOLOrders.set(new Side(Side.BUY));

        NOLOrders.set(new OrderQty(30));

       

        newOrderList.addGroup(NOLOrders);

    

        DataDictionary dd = new DataDictionary("FIX44.xml");                 

        Message m = new Message(newOrderList.toString());


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Quickfixj-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfixj-users