views:

719

answers:

5

What's the best way to parse a FIX message ? (FIX message as in the 'financial' FIX Protocol)

+2  A: 

There is no one best way, but given the quickfix tag that either you or the SO system attached, a look at QuickFix open source FIX engine would be a good place to start.

There are many commercial vendors as well if you are at a company where that matters, or if you want more support and services.

Good Luck

sdg
+8  A: 

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.

sergej
QuickFix is used as an underlying FIX parser by a number of companies that provide FIX parsers. Its pretty easy to get a QuickFIX parser running, I would suggest you give it a try.
Luhar
+2  A: 

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

George Hawkins
The C++ QuickFIX library is also maintained.
John Zwinck
A: 

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. The only complication is the groups part because you have to figure out that the tag is the first in of a group and then figure out when the group ends.

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.

stefanB
A: 

from the quickfixj source code, it uses treeMap to handle the FIX message.

regarding to XML format, i think FIX is better, though the parsing is harder in JAVA. coz XML is too heavy.