Question

I'm trying to subscribe to a price stream, using the following code:

Using l_msg As New QuickFix42.MarketDataRequest(New MDReqID(Date.Now.Ticks.ToString), New SubscriptionRequestType(SubscriptionRequestType.SNAPSHOT_PLUS_UPDATES), New MarketDepth(1))

            l_msg.setField(New MDUpdateType(1))
            l_msg.setField(New AggregatedBook(False))
            l_msg.setField(New NoMDEntryTypes(2))
            l_msg.setField(New MDEntryType("0"c))
            l_msg.setField(New MDEntryType("1"c))
            l_msg.setField(New Symbol("EUR/USD"))
            l_msg.setField(New NoRelatedSym(1))

            Session.sendToTarget(l_msg, SENDER_COMP_ID.Value, TARGET_COMP_ID.Value)
        End Using

The produced FIX message is:

8=FIX.4.2 9=140 35=V 34=2 49=SENDER_COMP_ID 52=20110909-15:44:02.855 56=TARGET_COMP_ID 55=EUR/USD 146=1 262=634511906383686907 263=1 264=1 265=1 266=N 267=2 269=1 10=079

I need to reorder the tags so 55 comes right after tag 146. I tried invoking setField in different order, but it gives the same result every time.

What is the correct way of handling message tag order?

Edit - problem resolved:

I followed DumbCoder suggestion and build the message by using addGroup instead of setField. The following code sample helped me as well: http://forexforums.dailyfx.com/fix-api-support/411090-fix-api-example.html

Note: The sample is written in Java and targets QF44.

Was it helpful?

Solution

AFAIK quickfix uses a map to read tags and then populate their values, so the placement of the tags is language decided and not by the library.

Set ValidateFieldsOutOfOrder as N on your acceptor, so even if the tags are out of order your message isn't rejected. This caused a lot of work for me, because whatever I tried the tags were never in orer and I had to relent on putting tags in order. And an acceptor which rejects messages if tags aren't in order isn't a good option. You cannot rely on every fix library to do your bidding.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top