How do you parse a FIX message using python ? (FIX message as in the 'financial' FIX Protocol)
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With