Expand description
Rate Limiter Module
This module provides rate limiting functionality to prevent exceeding exchange API limits. It implements token bucket algorithm with configurable capacity and refill rate.
§Features
- Token Bucket Algorithm: Classic rate limiting strategy
- Async-Friendly: Built on tokio for async/await support
- Thread-Safe: Uses Arc<Mutex<>> for concurrent access
- Configurable: Flexible capacity and refill rate settings
§Example
use ccxt_core::rate_limiter::{RateLimiter, RateLimiterConfig};
use std::time::Duration;
// Create a rate limiter: 10 requests per second
let config = RateLimiterConfig::new(10, Duration::from_secs(1));
let limiter = RateLimiter::new(config);
// Wait for permission to make a request
limiter.wait().await;
// Make your API request hereStructs§
- Multi
Tier Rate Limiter - Multi-tier rate limiter for exchanges with multiple rate limit tiers
- Rate
Limiter - Rate limiter using token bucket algorithm
- Rate
Limiter Config - Rate limiter configuration