Secwall's notes


QuickFix Log Pretty Print

Posted on

Problem

If you are using QuickFix and don't want to remember zillion of FIX tags you are in big trouble. Because messages.log often looks like this:

[2014-05-02 20:22:04.62] 8=FIX.4.4|9=263|35=X|34=10115815|49=CNTP|52=20140502-20:22:04.656|56=secwall|262=20|268=4|279=0|269=0|278=1716|55=CHF/JPY|270=116.398|271=1000000|346=1|279=2|269=0|278=1722|55=CHF/JPY|279=0|269=1|278=1837|55=CHF/JPY|270=116.462|271=1000000|346=1|279=2|269=1|278=1819|55=CHF/JPY|10=026|

(Standard fields separator (001 - octal 1) is replaced here with "|") So what? Do you remember what 268=4 means?

If you just need to read several messages use minifix (Windows application, runs ok under wine). You could just copy-paste part of log in it and click on particular message.

But what should we do if we want to grep log like in example below?

cat messages.log | <mygrep> NoMDEntries=4

Solution

QuickFix has fix dictionary files (xml) with it. And here is simple python script for translating numeric tags into their names.

Simple example:

cat messages.log | fixpp -d /path/to/dictionary.xml | grep NoMDEntries=4

But there are more. At first I don't like to use long paths. So there are "quicklinks". Example usage:

cat ~/.config/fixpp/fixpp.conf
[quicklink]
fix44 = /opt/feed-fix-prod/selected/data/etc/FIX44.xml
...

cat messages.log | fixpp -d fix44

Another example. Using grep and long format (separated line for each tag):

fixpp -d fix44 -i messages.log | grep 'Symbol=CHF/JPY' | fixpp -d fix44 -s \, -l

Code is real garbage but it works (I'll try to fix this is near future).