Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The best way to parse a FIX message? [closed]

How do you parse a FIX message using python ? (FIX message as in the 'financial' FIX Protocol)

like image 291
Chez Avatar asked Feb 22 '10 13:02

Chez


3 Answers

do you mean by using QuickFIX ? (I can see QuickFIX in your tags)

if that is the case, I don't know. Generally it's not difficult to write a simple parser for a FIX message. I found that the web tools on valid fix do the job.

like image 171
sergej Avatar answered Oct 14 '22 16:10

sergej


Apart from using the actual quickfixengine it's easy to parse fix message when you know it contains specific tags.

It contains 0x1 separated pairs of 'key=value' strings. One complication are groups because you have to figure out that the tag is the first in a group (group header) and then figure out when the group ends (when it hits another tag not in the group).

Another problematic field is the RawData which can contain anything including the field separator 0x1, but it is preceded by RawDataLength so you have to read that first and then read RawDataLength number of bytes after the RawData tag to get to the next field.

I believe quickfixengine uses the dictionary of tags where it can figure out that the tag is first of a group then keep adding until hitting tag that is not in a group.

When I need to do custom parsing of FIX messages I mostly know exactly what messages and what data we expect so I can tweak it for those messages.

like image 8
stefanB Avatar answered Oct 14 '22 17:10

stefanB


The FIX format is surprisingly annoying to parse (as the non-XML format, i.e. the one still used by pretty much everyone, has no subgroup start and end markers, instead you have to work it out based on tag ordering rules, and tags that are not in a subgroup, the header or the tail can be in any order).

So rather than parse it yourself I'd recommend you use an existing library to do so.

The only well maintained open source option is the Java QuickFIX/J library.

There are many commercial solutions, e.g. CameronFIX

like image 5
George Hawkins Avatar answered Oct 14 '22 18:10

George Hawkins