Logo

Coding preview

Rate Limiter

What this preview is

About this preview

Rate Limiter is a easy quant coding problem on language knowledge in Python, asked at Quant.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

Implementing a rate limiter for trading platforms

This easy Python coding problem tests whether you can build a sliding-window rate limiter — a core infrastructure component at trading venues and brokers. The task requires you to track request timestamps, expire old entries, and enforce a per-client cap in real time.

The key challenge is maintaining an efficient data structure that discards expired requests as time advances, without scanning the entire history on every call. A well-chosen approach will keep both acceptance checks and window queries fast, even under high request volume. Interviewers often probe boundary conditions: requests arriving exactly at the window edge, bursts that fill the quota instantly, and the interaction between expiry and accounting.

  • Sliding-window techniques and time-based expiry
  • Choosing the right data structure (list, deque, or timestamp log)
  • Handling non-decreasing timestamp sequences
  • State consistency across multiple query methods