Throttle and Coalesce Quote Updates Under an Exchange Message Limit

Last updated: November 29, 2026

Quick Overview

Exchanges cap how many messages a market maker may send per second. Design and implement a throttler that uses a token bucket, coalesces pending quote updates per instrument so only the latest is sent, always sends cancels first, and otherwise prioritizes the instruments whose resting quote is furthest from the new price.

Chicago Trading Company
Coding & Algorithms
Software Engineer
Chicago Trading Company
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Exchanges cap how many messages a market maker may send per second. Design and implement a throttler that uses a token bucket, coalesces pending quote updates per instrument so only the latest is sent, always sends cancels first, and otherwise prioritizes the instruments whose resting quote is furthest from the new price.

When the underlying moves, an options market maker wants to requote thousands of series at once, but each exchange enforces message rate limits. CTC's execution engineers care about which quotes go out first, because the stalest quote is the one most likely to be picked off. This question tests data structure design under a real constraint, plus judgment about risk.

What the Interviewer Expects
  • Implements a correct token bucket with refill on each call
  • Coalesces pending updates so a superseded quote is never sent
  • Uses a priority queue with lazy invalidation via version numbers
  • Puts cancels ahead of everything since they reduce risk
  • Skips sending when the new quote equals what is resting
  • Discusses fairness and starvation of small moves
Key Topics to Cover
token bucket
priority queue
lazy deletion
coalescing
rate limiting
quote risk
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • A small-move instrument can starve forever. How would you bound its wait?
  • Exchange limits are often per session and per second window, not a token bucket. How does the code change?
  • How would you decide to cancel an instrument rather than requote it when you are far behind?
  • This runs on the hot path in C++. What would you change about the data structures?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

submit(now, inst, price, cancel=False) registers a desired state for an instrument and returns messages sent immediately. drain(now) sends whatever tokens allow. Constraints: at most rate messag...

High-Level Design

Three pieces. A token bucket refilled lazily from elapsed time. A pending dict holding the latest (priority, version, msg) per instrument, which gives coalescing for free. A max-heap of `(-priorit...


Submit Your Answer
Markdown supported

Related Questions