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:
8=FIX.4.29=12135=D49=buySide56=broker34=12952=20100622-11:31:4054=155=IBM38=100044=2040=211=Order121=260=20100622-03:10:3910=064
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
alias fix
Which should give the following output (where the “^A” will NOT show up):
alias fix='sed s//\ /g'
Conclusion
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
0 Comments Leave a comment
Comments are closed.