Parse and Validate a FIX New Order Message
Last updated: November 29, 2026
Quick Overview
Write a parser for a single FIX message string that splits it into tag/value fields, checks header and trailer order, verifies BodyLength (tag 9) and CheckSum (tag 10), and returns the fields.
Akuna Capital
November 29, 20260
0
0 solved
Write a parser for a single FIX message string that splits it into tag/value fields, checks header and trailer order, verifies BodyLength (tag 9) and CheckSum (tag 10), and returns the fields.
Akuna Capital's order gateways talk to exchanges and brokers over FIX and binary protocols, so careful parsing is everyday work. A phone screen uses this to check string handling, exact protocol rules and defensive error reporting rather than clever algorithms.
What the Interviewer Expects
- Split on the SOH delimiter and partition each field on the first '='
- Enforce that 8 and 9 come first, 35 third and 10 last
- Compute BodyLength over the exact byte range
- Compute CheckSum as the byte sum mod 256 before tag 10
- Raise clear errors for malformed fields
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you parse a stream where messages arrive split across TCP reads?
- How do you handle repeating groups such as multiple legs?
- How would you make this allocation-free in C++ on the hot path?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: a raw FIX string like 8=FIX.4.4|9=43|35=D|...|10=142| (with SOH, \x01, as the real delimiter). Output: ordered (tag, value) pairs and a dict. Reject: missing trailing delimiter, fields with...
High-Level Design
Parse fields first, then validate structure, then the two integrity checks. BodyLength counts characters from just after the delimiter that ends the 9= field up to and including the delimiter before...