FIX Messages contain ASCII 1’s that tend to made casual analysis of them confusing. This post describes a simple way to create a command line alias to simplify reading FIX.
Argument for Translation
Without any update, FIX Message separators either don’t print (and fields all run together) or are shown with “^A”.
Here’s an example raw FIX Message:
If we translate the separator to a space, here’s the updated FIX Message:
8=FIX.4.2 9=121 35=D 49=buySide 56=broker 34=129 52=20100622-11:31:40 54=1 55=IBM 38=1000 44=20 40=2 11=Order1 21=2 60=20100622-03:10:39 10=064
Creating an Alias
The following commands expect use of the “bash” shell command line, natively available on Linux and Mac OS. However, Windows requires add-on packages to use “bash,” such as babun or cygwin.
Aliases are a command line shorthand to substitute a long command with a shorthand abbreviation. We can use this to translate the unprintable separators with white space or printable that improves readability.
alias fix="sed s/^A/\ /g"
NOTE: DO NOT cut & paste the above command! Cut and paste will not properly enter the ctrl-A (^A) character. It must by typed (ctrl-V, ctrl-A) as described in the previous section.
Type the command by hand and to enter the “^A” part of the above command, you need to enter ctrl-V followed by ctrl-A.
Making Aliases Permanent
You can make aliases available the next time you open a bash command line by adding the alias to shell startup file ~/.bashrc or ~/.bash_profile.
Put the above alias command at the end of the startup file. Next time you open a shell, that alias command will be read and set.
You can check this by opening a new shell and issuing this comment
Which should give the following output (where the “^A” will NOT show up):
alias fix='sed s//\ /g'
You can now use this new alias to translate FIX Messages. For example:
fix abc.log | head -100
Would show you the first 100 lines from a file abc.log
Or you could copy the whole log with the separators translated:
fix abc.log > new_abc.log