Centralized default configuration values for bourse.
All defaults can be overridden via application config:
config :bourse,
recv_window_ms: 10_000,
request_timeout_ms: 60_000Available Defaults
| Config Key | Default | Description |
|---|---|---|
:recv_window_ms | 5000 | Request timestamp validity window (exchanges reject stale requests) |
:request_timeout_ms | 30000 | HTTP request timeout |
:retry_policy | :safe_transient | HTTP retry strategy (GET/HEAD only) |
:retry_delay | nil | Backoff between retries; nil keeps Req's exponential default |
:rate_limiter_enabled | true | Enable/disable rate limiter |
:rate_limit_max_wait_ms | 10000 | Named upper bound on pre-request limiter sleep |
:rate_limit_cleanup_interval_ms | 60000 | Interval for cleaning up old rate limit timestamps |
:rate_limit_max_age_ms | 60000 | Maximum age for rate limit request timestamps |
Summary
Functions
Returns the interval for cleaning up expired rate limit timestamps.
Returns the maximum age for rate limit request timestamps before removal.
Named upper bound on how long maybe_rate_limit/3 may Process.sleep before a request.
Returns whether the rate limiter is enabled.
Returns the recv_window value in milliseconds.
Returns the HTTP request timeout in milliseconds.
Returns the backoff between HTTP retries.
Returns the HTTP retry policy.
Functions
@spec rate_limit_cleanup_interval_ms() :: pos_integer()
Returns the interval for cleaning up expired rate limit timestamps.
Default: 60000ms
@spec rate_limit_max_age_ms() :: pos_integer()
Returns the maximum age for rate limit request timestamps before removal.
Default: 60000ms
@spec rate_limit_max_wait_ms() :: pos_integer()
Named upper bound on how long maybe_rate_limit/3 may Process.sleep before a request.
A wait that would exceed this value is returned as
{:error, %Bourse.Error{type: :rate_limit_exceeded}} naming the venue and the
wait, never a longer silent sleep. Well below the 30s request timeout and the
60s ExUnit default.
Default: 10000ms
@spec rate_limiter_enabled?() :: boolean()
Returns whether the rate limiter is enabled.
Default: true
@spec recv_window_ms() :: pos_integer()
Returns the recv_window value in milliseconds.
The recv_window defines how long a signed request is valid. Exchanges reject requests with timestamps outside this window.
Default: 5000ms
@spec request_timeout_ms() :: pos_integer()
Returns the HTTP request timeout in milliseconds.
Maximum time to wait for a response from an exchange API.
Default: 30000ms
@spec retry_delay() :: non_neg_integer() | nil
Returns the backoff between HTTP retries.
nil — the default — leaves the decision to Req, which honors a retry-after
header on 429/503 and otherwise backs off exponentially. An integer overrides
both with a fixed millisecond delay.
The test suite sets 0 so stub-driven retry paths exercise the same code
without paying production backoff; real backoff behavior is asserted by
passing :retry_delay per call.
Default: nil
@spec retry_policy() :: :safe_transient | :transient | false
Returns the HTTP retry policy.
Trading Safety (CRITICAL)
Uses :safe_transient by default — only retries GET/HEAD requests.
Never use :transient for trading APIs as it could duplicate orders.
Default: :safe_transient