← Akuna Capital Interview Insights

Akuna Capital·Software Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Akuna Capital coding round, one meaty design problem about rate limiting for a trading engine. The problem looked clean on the surface but the sliding window edge cases took more thinking than I expected.

Questions Asked (1)

Q1

Design and implement a class that trading-engine clients can use to check whether they can send order messages without breaching a configurable message rate limit. The class should support a continuous sliding window (not fixed buckets), arbitrary limit configurations like 100 msgs per second or 500 per minute, batch sends, and you need to write test cases covering the main scenarios.

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

The API signature they gave was basically RateLimit(maxMsgCount, windowMs) and a checkRateLimit(suggestOrders, timestamp) that returns how many messages are actually allowed.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a design using a timestamp queue or token bucket with sliding window semantics. Discuss trade-offs between precision, memory, and performance, and outline test cases covering edge conditions and concurrency.

Pro tip: Emphasize thread safety and atomicity for batch sends—many candidates overlook that checking and sending must be atomic to avoid race conditions in a trading engine.

1. Clarify Requirements

Ask about expected throughput, precision needs, whether limits are per-client or global, and if batch sends should be atomic. Confirm that the window is continuous (sliding) and not fixed buckets.

2. Choose Data Structure & Algorithm

Propose a timestamp queue (e.g., deque) storing send times, or a token bucket with sliding window approximation. Discuss trade-offs: exactness vs. memory, and O(1) vs. O(n) operations.

3. Design Class Interface

Define methods like canSend(n), recordSend(n), or trySend(n) that atomically check and update state. Include configuration for limit and window size, and ensure thread safety with locks or atomic operations.

4. Handle Batch Sends

Explain how to check if a batch of size n can be sent: either check if n messages fit within the window, or if partial sends are allowed, return the maximum allowed. Ensure atomicity for the batch.

5. Outline Test Cases

List tests: single send under/over limit, batch sends, sliding window expiry, concurrent sends, and edge cases like zero limit or large batch. Include performance tests if needed.

Key Points to Mention

  • Sliding window vs fixed window: sliding window avoids burstiness at boundaries.
  • Data structure choice: timestamp queue for exactness, token bucket for efficiency.
  • Thread safety: use locks or atomic operations to prevent race conditions in concurrent environments.
  • Batch send atomicity: either all messages in batch are allowed or none, depending on requirements.
  • Time source: use monotonic clock to avoid issues with system time changes.
  • Test coverage: include boundary conditions, concurrency, and performance under load.

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