About this question

Sliding Window Rate Limiter

Medium · architecture & logic · Quant Developer interview question · queue, sliding window, design, c++

In high-frequency trading systems, exchange gateways impose strict rate limits to prevent malicious or runaway algorithms from overwhelming the matching engine. A sliding window rate limiter provides a precise mechanism to enforce message limits over a rolling time window, ensuring compliance with exchange rules. Task Implement a RateLimiter class to enforce a sliding window rate limit. The class must include the following methods: - RateLimiter(int window_size_ms, int max_requests): Initialize