Reputation: 71
I use a QuickFix/n initiator. My broker rejects my logon messages, citing wrong order of fields (tags) in the message header. Instead of 34, 49, 52, 56, the order should be 49, 56, 34, 52.
QuickFix/n seems to automatically sort the various fields within the three regions (header, body, trailer) of messages by tag number upon sending the message to the session.
Is there a way to change the order of the fields in a message sent to an acceptor? Is there a way to prevent the sorting behaviour? (Adding groups to the message or changing the data dictionary don't work.)
Or if that is impossible with QuickFix/n, is there a FIX engine which allows changing the order of fields in messages?
Upvotes: 7
Views: 9483
Reputation: 11
Changing the order of fields in a FIX message I use Vb.net QuickFIXn.FIX5.0SP2.1.10.0
Imports QuickFix
Public Class ApplicationFixFxAll
Inherits QuickFix.MessageCracker
Implements QuickFix.IApplication
Public Sub ToAdmin(message As Message, sessionID As SessionID) Implements IApplication.ToAdmin
message.Header.HEADER_FIELD_ORDER = {8, 9, 35, 56, 34, 49, 52}
Debug.Print($"toAdmin {Now:yyyMMdd HHmm} {message.ToString}")
End Sub
...
End Class
Upvotes: 1
Reputation: 1049
for python: open up the quickfix file in your site-packages folder that contains the message type you want. The messages are all classes that have an "order" array that determines the order of the tags.
Upvotes: 0
Reputation: 106
By default quickFix reorders tags in a group by ascending order. If you want to retain the order you need to rebuild the quick fix jar as suggested here.
Upvotes: 3
Reputation: 1224
This error is normally caused by trying to put a header field into the body of the message. The DataDictionary object provided either by yourself if you are manually adding it to the session or from the session itself (if you are using the config file to tell the session which data dictionary to use) has functions called isHeaderField(int tagNumber) and isTrailerField(int tagNumber) to help you decide if the field should be in the header or the trailer. Different data dictionary files for different counterparties may (I've only seen it once or twice) put header fields into the body part of the message, body fields into the header, or (most commonly) custom tags into the header. This means that it is generally a good idea to use the available functions to check whether a field should be added to the header, body, trailer or a repeating group within the body. Since this question is about logon messages I am guessing that you are adding fields to that message type so I may need to see the code doing that to help further.
Upvotes: 5