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

6

32

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

Nunnery answered 22/2, 2010 at 13:46 Comment(4)
13 up votes and closed! Great job!Derange
this question interested me too, what a pity to see it closed.Awl
Although the question is specific to .NET, there are some generally applicable ideas here: #4908348Range
Wish this question wasn't closed. If you just want to parse some FIX text, take a look at this fix parser, view the source to see how a blob of FIX text is parsed. If you want to parse FIX for an actual trading app, take a look at open source projects (two of mine are github.com/falconair/fix.js and github.com/falconair/lowlevelfix)Anjaanjali
C
12

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.

Chrysarobin answered 22/2, 2010 at 13:51 Comment(1)
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.Litigant
E
8

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.

Ernaldus answered 1/3, 2010 at 2:42 Comment(0)
W
5

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

Windbreak answered 22/2, 2010 at 13:57 Comment(2)
The C++ QuickFIX library is also maintained.Theona
and also Chronicle Fix it also has a free online tool, see fixparser.chronicle.softwareAlvertaalves
A
4

try http://fix.nowing.com

it's a web based fix message parser

Amoebocyte answered 4/4, 2012 at 14:51 Comment(0)
P
2

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.

Perforated answered 30/9, 2010 at 13:40 Comment(3)
I agree on FIX over XML, except for the bloody repeating groups.Canzona
I agree with ProfK. The repeating groups for parties etc is a pain.Morville
Also, most people attempt to "parse" a FIX message by splitting on SOH, which completely ignores the problem of RawData (tag 96). BTW, using TreeMap is probably not the best approach because it makes it difficult to recognize and support duplicate tags in your message. I think list is probably a better data structure representation.Sharpen
E
1

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

Episode answered 22/2, 2010 at 13:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.