Thursday, February 24, 2011

FIX Protocol and User Defined Fields in Repeating Groups

This post is driven by discussion on fixprotocol.org about message parsing and user defined fields (UDF) in repeating groups.

The main concern is if you really need to correct a dictionary when adding UDF to the repeating group or message can be parsed just based on the standard. Popular (and theoretically correct) answer is yes, you should modify dictionary. But in fact there is something you can do without dictionary and still be able to parse such messages properly.


When you parse repeating group you know several things about it:

  1. From the leading tag you know the number of entries 
  2. From the standard you know the start tag, which is alway required for repeating group
When you parse particular entry of the repeating group and it is not the last entry (you can easily find out that by counting start tags) you can consider all UDFs as part of this repeating group.
When you parse the last entry and you find UDF, which appeared in previous entries you can also consider it as a part of repeating group.
What you CANNOT do:

  1. If you find UDF the first time when parsing the last entry of the repeating group you cannot decide if it belongs to repeating group or body (actually you can check if it is followed by the tag defined for repeating group but this is too much). 
  2. If message is invalid i.e. contains incorrect number of entries you cannot make correct decision.
After all keep in mind that all these "guesses" slow down your parsing so think twice whether you really need it and then think one more time. :)

Some additional links are under cut.


FIX message format
B2BITS FIX Antenna dictionary format

2 comments:

  1. Nice post dude. I have also shared my experience on a similar topic here Repeating group in FIX Protocol

    I think key point is to find out market tag which is used to identify start and end of repeating group.

    Thanks
    Javin
    FIX Protocol tutorial

    ReplyDelete
  2. Start is easy (start tag is always required according to the FIX specification), finishing does not exist. This has been discussed several times within FIX Protocol group but never resulted in something.

    In fact I do not think it is good idea to modify syntax now. It is done and used. New syntax would just add more mess and all vendors will have to support all versions.

    ReplyDelete