FIX message delimiter

2019-01-26 08:35发布

问题:

I am relatively new to FIX-Protocol.

The delimiter for a FIX-Protocol message sometimes show ^ and other times |. Wikipedia for FIX-Protocol says [SOH] ( <Start of Header> for hex 0x01 ) being the character.

Please explain the meaning of the same.

For example a FIX-Protocol message can be visually represented as

8=FIX.4.4^9=122^35=D^34=215^49=CLIENT12^52=20100225-19:41:57.316^56=B^1=Marcel^11=13346^21=1^40=2^44=5^54=1^59=0^60=20100225-19:39:52.020^10=072^

or

8=FIX.4.4|9=122|35=D|34=215|49=CLIENT12|52=20100225-19:41:57.316|56=B|1=Marcel|11=13346|21=1|40=2|44=5|54=1|59=0|60=20100225-19:39:52.020|10=072|

So what exactly is the difference in using a ^ over |

Are there other delimiters used as well. Its not clear why [SOH] (0x01) fits for ^ or |

It could have been numberical ONE.

回答1:

The delimiter SOH = ASCII code 01 is a non-printable character. Looking at the binary representation of the message (e.g. in a hex editor view), you'll see the character as 0x01. To display the messages, it seems that some people use | and other use ^ which are rarely used characters and thus a good delimiter.



回答2:

FIX messages always have 0x01 between fields in the message, whether it is on the wire, in an OMS/EMS or in a log file. It is only when the message has to be displayed that the substitution is made (OK, some people may make their log files clean and so transcribe the character). It is never the case that a valid FIX message will have pipes or carets separating fields. It is also the case that a FIX message will never have anywhere than between fields. ( is a character which shouldn't appear in printed text - FIX messages are supposed to be readable - and it won't clash with that terminates a C string, so the whole message can be treated as a string, if you are so inclined.)