[erlang-questions] Erlang and FIX protocol

Serge Aleynikov <>
Fri May 4 02:58:56 CEST 2012


Since the time I asked that question on the mailing list, I also played 
with the idea of implementing FIX in Erlang.  Pursued two approaches - 
one, similar to Quickfix, that used XSLT to auto-generate the parser and 
message definitions.  The end result was something nice that was able to 
decode FIX logs quite nicely (similar to what this product does: 
http://www.validfix.com/fix-analyzer.html).  The second approach was to 
implement a simple parser in C and use Erlang just to handle the session 
and application level layer of the protocol stack.  At the end this 
didn't really go beyond those experiments, as I switched to working on a 
forked version of Quickfix in C++.

Very likely you don't need to support a full set of FIX features and if 
so, you can make some shortcuts that simplify the implementation. 
Taking a look at your project, I doubt that defining those large record 
tuples for messages is a good idea performance wise, since every update 
of a tuple will require a copy.  a better approach would be to have a 
small tuple with mandatory fields, and the rest stored in one element 
holding a gb_tree or some other container.  E.g.:

%% Message type: 8
-record(executionReport, {
       orderID                                         %% Tag: 37
     , execID                                          %% Tag: 17
     , execTransType                                   %% Tag: 20
     , execType                                        %% Tag: 150
     , ordStatus                                       %% Tag: 39
     , symbol                                          %% Tag: 55
     , side                                            %% Tag: 54
     , leavesQty                                       %% Tag: 151
     , cumQty                                          %% Tag: 14
     , avgPx                                           %% Tag: 6
     , opt = []
}).


On 5/3/2012 6:44 AM, Max Lapshin wrote:
> I've tried to implement it:  http://github.com/maxlapshin/fix
>
> Problem with FIX protocol is that it is a low-level protocol with very
> simple syntax, but rather cryptic semantic.
>
> Frames are just what we need for it =))
>
> So parser should be so smart, that it must produce high-level messages
> from low-level protocol packets. XML description took from quickxml
> project looks very interesting, because it is a good specification.
>
> I've took this XML, added some erlangy stuff:
> https://github.com/maxlapshin/fix/blob/master/src/fix_template.erl#L213
> to make fields convenient to use and now I have simple protocol
> handler.
>
> Next problem is how to handle inlined groups and containers for FIX messages.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list