simple and dirty FIX 4.2 parser and decoder

Since I spend some of my time dealing with FIX messages, I wrote this little FIX decoder yesterday night.
It is simple (very simple) but does a pretty good job at decoding a fix message. You can find the code here.

I kept it simple and easy to modify/extend for my own needs: I open some messages snippets in vim and I want to get a decoded version of the message right away, selecting the line I was on and calling a program to dump the decoded buffer. Very useful when I am dealing with rare tags or when I was not doing some FIX for a while.

Well, this little code does just that. I added also a section where I can add the local dictionary used by my employer (very helpful).

the code is provided with a BSD licence i.e. yes you can put/use it in commercial code.

compiled/edited on a linux box, but it should be pretty easy to port to whatever platform you want run it.

it is simple to compile:

c++ fixdecode.cpp -g -o a.out

it is simple to run:

./a.out < ExampleFixMessages.txt
——————————————————————————-
83 bytes have been retrieved ‘8=FIX.4.19=6135=A49=BRKR56=INVMGR98=034=152=20000426-12:05:08108=3010=143’
[   8]               BeginString ‘FIX.4.1’
[   9]                BodyLength ’61’
[  35]                   MsgType ‘A’
[  49]              SenderCompID ‘BRKR’
[  56]              TargetCompID ‘INVMGR’
[  98]             EncryptMethod ‘0’
[  34]                 MsgSeqNum ‘1’
[  52]               SendingTime ‘20000426-12:05:08’
[ 108]                HeartBtInt ’30’
[  10]                  CheckSum ‘143’
-> OK 83 B

Under vi I just select line and apply a.out to it, and it dumps this helpful message.

Enjoy and share


About this entry