IbkrApi.RateLimiter (ibkr_api v1.0.3)
View SourceRate limiting implementation for IBKR API requests using Hammer v7.
Enforces both global and per-endpoint rate limits according to IBKR's published limits:
- Global: 50 requests per second
- Gateway: 10 requests per second
- Per-endpoint: Various limits as documented
Rate limits are configurable through options passed to each function.
Summary
Functions
Checks the endpoint-specific rate limit.
Checks the global rate limit for all IBKR API requests.
Checks if a request should be allowed based on the rate limits.
Extracts the endpoint name from a URL path.
Executes a function with rate limiting.
Functions
Checks the endpoint-specific rate limit.
Each endpoint may have its own rate limit as defined in IBKR's documentation.
Checks the global rate limit for all IBKR API requests.
By default, this is 50 requests per second for authenticated users.
Checks if a request should be allowed based on the rate limits.
Options
:rate_limits(keyword/0) - Rate limit configuration as a keyword list. If not provided, uses Config defaults.:bucket_prefix(String.t/0) - Prefix for rate limit buckets (useful for test isolation) The default value is"".
Returns
:okif the request is allowed{:error, reason}if the request exceeds rate limits
Extracts the endpoint name from a URL path.
Examples: "/iserver/marketdata/snapshot" -> "iserver_marketdata_snapshot" "/iserver/scanner/run" -> "iserver_scanner_run"
Executes a function with rate limiting.
Returns the function result if the rate limit allows the request,
or {:error, error_message} if the rate limit is exceeded.