[erlang-questions] Erlang and FIX protocol

Per Melin <>
Thu May 3 16:31:45 CEST 2012


On May 3, 2012, at 12:44 , 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.

The problem with the syntax is that it is simplistic. It does not even give you enough information to be able to tokenize a message or to find message boundaries. See binary fields below.


> Next problem is how to handle inlined groups and containers for FIX messages.


It has been a few years since I last looked at FIX so I apologize if anything below is incorrect.

When I run test cases that is suppose to fail on your code I mostly get {more, N} back, often {more, 0}. If I remember correctly, one pain of FIX is that when your code finds an error in what it received from the other party you should categorize it (e.g. fields out of order, value out of range) and send a reject message back detailing the error together with some context. I think dealing with that added quite a lot of both lines and complexity to my parser.

You are not verifying the message checksum, which in the end is not as straight forward as it may first seem.

Your code works on the assumption that SOH (ASCII 01) can be used as a field separator in all contexts, right? That is not true, since it can also be part of a binary field. For example:

1> fix:decode(<<"8=FIX.4.4",1,"9=23",1,"35=0",1,"93=10",1,"89=A",1,"89=234",1,"10=999",1>>).     
{ok,{heartbeat,undefined,undefined,undefined,undefined,
               undefined,
               [{signature_length,10},
                {signature,<<"A">>},
                {signature,<<"234">>}]},
    <<>>}

This is incorrect, as far as I can remember. The actual value of the signature is "A|89=234|1" here, not ["A", "234"] (not to mention that your signature length does not match the content). Field tag 89 (signature) is of type data, so you must look at tag 93 (signature_length) to know where the value ends. Because of binary fields I don't see how you can split or tokenize a message first and then parse it in the way you've done.




More information about the erlang-questions mailing list