Implement Hyperliquid weighted rate limiter for REST API #2960
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduce a weighted, minute-bucket rate limiter for Hyperliquid REST and wire it into Info/Exchange calls. Supports base weights per endpoint, post-response extra debits (for item-scaled endpoints), batch-aware Exchange costs, and bounded retries with full-jitter +
Retry-Afterhandling. Surfaces structuredRateLimit { scope, weight, retry_after_ms }errors.Why not reuse NT’s limiter?
Quotais uniform per request; Hyperliquid requires weighted charges and post-response debits.Quota(Exchange:1 + floor(n/40)).Implementation highlights
WeightedLimiter::per_minute(1200): token bucket;acquire(weight),debit_extra(extra),snapshot().info_base_weight,info_extra_weight(largest array, +1/20;candleSnapshot+1/60);exchange_weight.base=125ms,cap=5s), honorRetry-After; tiny re-acquire to defuse minute rollovers.HyperliquidHttpClient; optionalwith_rate_limits()tuning.