Expand description
Rate limiter module for API request throttling Rate limiter module for controlling API request rates
This module provides rate limiting functionality using the governor crate
to ensure compliance with IG Markets API rate limits.
§Enforced budget
RateLimiter holds one governor token bucket per
RateLimitClass, all derived from the single
RateLimiterConfig passed to
RateLimiter::new:
NonTradinghonors the configured budget exactly:max_requestsrequests perperiod_seconds, withburst_sizeburst capacity. The per-cell replenishment interval isperiod_seconds / max_requests.Tradinguses a stricter, fixed budget derived from IG’s published per-app trading limit (~1 request/second), independent of the configured budget so a permissive config cannot loosen it.Historicaluses its own conservative bucket because historical price fetches also draw down a weekly data-point allowance.
The buckets are independent, so bulk non-trading traffic can never queue order placement behind it.
Structs§
- Rate
Limiter - Rate limiter for controlling API request rates
Enums§
- Rate
Limit Class - Rate-limit class for an IG endpoint.