Questions
Practice prompts and answer frameworks
Use these as preparation prompts. The goal is to explain your reasoning, trade-offs and failure cases clearly.
Design a limit order book
Design an in-memory limit order book that supports add, cancel, modify and trade events while exposing best bid/ask efficiently.
Answer framework
- Clarify price levels, order IDs, side, quantity and event semantics.
- Use maps/vectors for price levels depending on price domain and performance constraints.
- Keep order-id lookup separate from price-level ordering.
- Discuss determinism, replay, gaps, tests and latency measurement.
How do you handle missing market-data packets?
A UDP multicast feed has sequence numbers. Your process detects a gap. What should happen next?
Answer framework
- Detect sequence gaps deterministically and stop using corrupted state for decisions.
- Request recovery or snapshot depending on feed design.
- Replay missed messages in order before marking the book valid again.
- Expose metrics, alerts and fail-safe behavior.
Explain a tick-to-trade latency budget
Break down the path from market-data packet arrival to order send. Where do you measure, and what can go wrong?
Answer framework
- Break into receive, decode, book update, strategy, risk, encode and send.
- Measure with consistent timestamps and percentiles, not averages.
- Discuss CPU affinity, allocation, locks, logging, branch misses and NIC/kernel path.
- Use observability that does not itself destroy latency.