← Citadel Interview Insights

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

SeniorPrefer not to say
Apr 2026

Summary

Citadel software engineer interview that went deep into system design for a stock trading simulator. More implementation-heavy than I expected, and the follow-up questions kept coming once you got the basic structure down.

Questions Asked (1)

Q1

Design and implement a stock trading simulator that supports buy/sell orders, order matching with price-time priority, per-user portfolios and balances, and market price tracking. Walk through your class structure, data structures for the order book, and how you'd extend it for order cancellations and partial fills.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

This one ate up most of the session.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then outline the core classes and data structures for the order book, emphasizing price-time priority. Walk through the matching algorithm, portfolio/balance updates, and market price tracking, and finally discuss extensions for cancellations and partial fills with trade-offs.

Pro tip: Demonstrate awareness of real-world trading systems by mentioning the importance of low-latency data structures and concurrency control, and proactively discuss how you would handle edge cases like self-trading or insufficient funds.

1. Clarify Requirements and Scope

Ask clarifying questions about order types (limit/market), matching rules, user management, and performance expectations. Define the core functionalities and constraints to guide your design.

2. Design Core Classes and Data Structures

Outline classes like Order, Trade, User, Portfolio, and OrderBook. Choose data structures for the order book (e.g., two heaps or sorted lists for bids/asks) that support price-time priority efficiently.

3. Implement Matching Engine

Describe the matching algorithm: when a new order arrives, match against the opposite side of the book based on price-time priority, generating trades and updating portfolios and balances.

4. Handle Portfolios, Balances, and Market Data

Explain how to update user portfolios and balances atomically after trades, and how to track market prices (e.g., last traded price, bid-ask spread) for display or further processing.

5. Extend for Cancellations and Partial Fills

Discuss how to support order cancellations (e.g., using a hash map for quick lookup) and partial fills (e.g., updating order quantities and leaving remainder in the book). Mention trade-offs like complexity vs. performance.

Key Points to Mention

  • Price-time priority: orders matched first by best price, then by earliest time.
  • Data structures: balanced BST or skip list for order book to achieve O(log n) insert/delete and O(1) best bid/ask.
  • Order cancellation: maintain a map from order ID to order object for O(1) access, and remove from book efficiently.
  • Partial fills: update remaining quantity and keep order in book if not fully filled; generate multiple trades.
  • Concurrency: use locks or lock-free structures to handle simultaneous orders in a multi-threaded environment.
  • Market price tracking: maintain last traded price, and possibly a time-series database for historical data.

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