Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid FIX Message Header #4

Closed
tom-smalls opened this issue Aug 8, 2016 · 2 comments
Closed

Invalid FIX Message Header #4

tom-smalls opened this issue Aug 8, 2016 · 2 comments

Comments

@tom-smalls
Copy link
Contributor

When using the FixMessageBuilder object, if you're building a fix message whose message type is not predefined in the MsgType object then you have to use the append() method the builder provides. If the first call to the builder is not appending the MsgType, then the fix message produced is invalid (MsgType will not be the 3rd fix tag.

Valid Message: 8=FIX.4.2|9=64|35=4|123=Y|36=10|56=tom|49=JUDD|52=20160808-12:02:50.967|34=100|10=237|

new FixMessageBuilder()
                .append(35, "4")
                .msgSeqNum(100)
                .append(123, "Y")
                .append(36, "10")
                .send();

Invalid Message: 8=FIX.4.2|9=64|34=100|123=Y|35=4|36=10|56=tom|49=JUDD|52=20160808-12:02:50.967|10=237|

new FixMessageBuilder()
                .msgSeqNum(100)
                .append(123, "Y")
                .append(35, "4")
                .append(36, "10")
                .send();

The Standard Message Header for FIX defines that MsgType should be the third field in a message (http://btobits.com/fixopaedia/fixdic44/index.html)

juddgaddie added a commit that referenced this issue Aug 21, 2016
juddgaddie added a commit that referenced this issue Aug 21, 2016
@juddgaddie
Copy link
Contributor

This is expected behaviour the FixMessageBuilder doesn't enforce order of fields. Fields are written in the order that they are appended to the builder. JavaDoc and test added.

@tom-smalls
Copy link
Contributor Author

I have to say I disagree Fix version, body length, message type, and checksum are the only fields in fix messages that have to be in a certain position. Fix version, body length, and checksum all have their positions determined internally to the FixMessageBuilder (not by when they are appended), whilst message type is not, which provides an inconsistency with the api. Fields where order matters should all be treated the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants