← Citadel Interview Insights

Citadel·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026

Summary

Citadel quant engineer interview that focused entirely on designing an orderbook from scratch. No matching logic needed, but they wanted a real API proposal with justification before touching any code, which tripped me up a bit at first.

Questions Asked (1)

Q1

Design and implement an orderbook for a trading system. Start by proposing the API surface (place order, cancel order, query orders, best bid/ask, etc.) with justification, then implement it in code. Order matching is out of scope; focus on data structures, API design, and keeping the book consistent.

System DesignAPI & IntegrationsAlgorithms & Data Structures
Author's notes

I jumped straight to data structures before they even asked me to, which was a mistake.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints (e.g., asset class, expected throughput, latency, consistency needs). Then propose a clean API surface with clear semantics, and implement using appropriate data structures (e.g., hash maps for order lookup, balanced BST or skip list for price levels). Emphasize consistency, error handling, and extensibility.

Pro tip: Demonstrate awareness of real-world trading system concerns: concurrency, lock-free designs, and the importance of deterministic behavior. Mention that you'd separate the API from the implementation to allow future optimizations.

1. Clarify Requirements

Ask about expected order volume, latency requirements, concurrency model, and whether the book is single-threaded or multi-threaded. Confirm that matching is out of scope.

2. Design API Surface

Define methods: placeOrder, cancelOrder, getOrder, getBestBid, getBestAsk, getDepth. Specify parameters, return types, and error conditions (e.g., duplicate order ID, unknown order).

3. Choose Data Structures

Use a hash map for O(1) order lookup by ID. For price levels, use a balanced BST (e.g., TreeMap in Java) or skip list to maintain sorted bids/asks. Each price level holds a list or queue of orders (FIFO).

4. Implement Core Operations

Implement placeOrder (insert into map and appropriate price level), cancelOrder (remove from map and price level), and query methods. Ensure consistency by updating both structures atomically.

5. Discuss Edge Cases and Extensions

Cover handling of empty book, duplicate IDs, canceling non-existent orders, and concurrency (e.g., using locks or lock-free structures). Mention potential optimizations like intrusive lists or memory pools.

Key Points to Mention

  • Use of hash map for O(1) order lookup and balanced BST for O(log n) price level operations.
  • API should be idempotent where possible and return clear error codes.
  • Consistency between order map and price levels is critical; consider transactional updates.
  • Concurrency: discuss thread-safety, locks, or lock-free approaches if needed.
  • Extensibility: design API to support future features like order modification or market data publishing.
  • Performance: mention that price level operations dominate; choose data structures accordingly.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.