FIX protocol, explained
FIX (Financial Information eXchange) is the messaging protocol the financial industry uses to trade electronically. When a firm sends an order to an exchange or a liquidity provider, it almost always speaks FIX. It looks simple, plain tag=value text, but the session underneath is where correctness lives. Here is how it works, with pictures.
Every message is a list of numbered fields separated by a control character (SOH, shown
here as |): a header saying who and what and in what order, a body, and a
checksum. Numbers are compact and fast to parse.
Both sides open a long-lived connection and log on. They exchange heartbeats to prove the link is alive, and they number every message so neither side ever silently misses one. Orders and execution reports flow over that ordered session.
Encoding tag=value is a weekend. The session is the hard part. Suppose message 4 never arrives, but 5 does. Watch what a correct engine does:
Hands you message 5 and moves on. Message 4 is silently lost, and now your positions and order state are wrong, discovered later, at the worst time.
Notices the sequence gap, sends a ResendRequest, recovers message 4, and keeps your order flow consistent, automatically.
That is the whole reason a real FIX engine exists. Beyond resend, it handles reconnects, duplicate detection, sequence resets, heartbeats, and strict validation, the dozen quiet edge cases that separate a demo from something you trust with real money.
npm run bench).fixwire is a modern, fully-typed FIX engine for TypeScript, initiator and acceptor, free under MIT.