Design exchange–trading system message flow
Company: Jane Street
Role: Software Engineer
Category: System Design
Difficulty: easy
Interview Round: Onsite
Design the message contract and flow between a firm's trading system (OMS/EMS) and an external exchange.
Assume:
- The trading system sends orders and receives acknowledgements, rejects, cancels, and fills.
- The exchange is an external system reachable over the network.
- The system must handle retries, partial fills, out-of-order delivery, and disconnect/reconnect.
Deliverables:
1. What **message types** are required in each direction (trading system → exchange, exchange → trading system)?
2. For each message type, what are the **key fields** (IDs, timestamps, quantities, prices, etc.)?
3. How do you guarantee **idempotency**, **ordering**, and **exactly-once or effectively-once processing** at the application level?
4. How do you handle **session management** (heartbeats, sequence numbers, resend/replay) and **failure modes** (timeouts, dupes, reconnect)?
Quick Answer: This question evaluates a candidate's knowledge of distributed messaging protocols, fault-tolerant system design, and financial trading interface competencies, including defining message contracts, session management, and guarantees like idempotency and ordering.