Rate limit status information parsed from exchange response headers.
Exchanges report rate limit status with every API response (not just 429s). This struct captures that information in a normalized format.
Sources
Different exchanges use different header patterns:
| Source | Exchange | Headers |
|---|---|---|
:binance_weight | Binance | x-mbx-used-weight-1m, x-sapi-used-ip-weight-1m |
:bybit_bapi | Bybit | x-bapi-limit, x-bapi-limit-status, x-bapi-limit-reset-timestamp |
:standard | KuCoin, others | x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset |
Summary
Functions
Returns true if remaining capacity is below the threshold percentage.
Returns the percentage of rate limit capacity used (0.0 to 100.0).
Returns milliseconds to wait until the rate limit window resets.
Types
@type t() :: %CCXT.RateLimiter.Info{ exchange: String.t() | nil, limit: non_neg_integer() | nil, raw_headers: %{required(String.t()) => String.t()}, remaining: non_neg_integer() | nil, reset_at: integer() | nil, source: atom(), used: non_neg_integer() | nil }
Functions
Returns true if remaining capacity is below the threshold percentage.
Threshold is a float between 0.0 and 1.0 representing the fraction of total capacity. Default is 0.1 (10%).
Returns false if limit or remaining data is not available.
Returns the percentage of rate limit capacity used (0.0 to 100.0).
Returns nil if insufficient data to calculate usage.
@spec wait_time(t()) :: non_neg_integer()
Returns milliseconds to wait until the rate limit window resets.
Returns 0 if no reset time is available or the reset time has already passed.