Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the order of fields in a FIX message

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?

like image 507
user3723746 Avatar asked Feb 13 '23 18:02

user3723746


2 Answers

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.

like image 100
MD-Tech Avatar answered Feb 15 '23 08:02

MD-Tech


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.

like image 38
halbs Avatar answered Feb 15 '23 07:02

halbs