Skip to main content

Module constants

Module constants 

Source
Expand description

Module containing global constants used throughout the library

Constants§

BASE_DELAY_MS
Base delay in milliseconds used for proximity-based delays in the rate limiter This value is used to calculate wait times when approaching rate limits
DAYS_TO_BACK_LOOK
Default number of days to look back when fetching historical data
DEFAULT_ACCOUNT_ID
Sentinel value used for account_id when IG_ACCOUNT_ID is not configured.
DEFAULT_API_VERSION
Default IG API version used for authentication when IG_API_VERSION is not set: v3 (OAuth).
DEFAULT_CONFIG_RATE_LIMIT_BURST_SIZE
Default burst size of the configured rate limiter (crate::application::config::RateLimiterConfig::burst_size).
DEFAULT_CONFIG_RATE_LIMIT_MAX_REQUESTS
Default request budget of the configured rate limiter (crate::application::config::RateLimiterConfig::max_requests).
DEFAULT_CONFIG_RATE_LIMIT_PERIOD_SECONDS
Default period of the configured rate limiter, in seconds (crate::application::config::RateLimiterConfig::period_seconds).
DEFAULT_DATABASE_MAX_CONNECTIONS
Default size of the Postgres connection pool (crate::application::config::DatabaseConfig::max_connections).
DEFAULT_DATABASE_URL
Credential-less placeholder used for DATABASE_URL when it is not configured.
DEFAULT_MAX_RETRIES
Default maximum number of retries for transient HTTP failures when the MAX_RETRY_COUNT environment variable is unset.
DEFAULT_ORDER_BUY_LEVEL
A constant representing the default buy level for orders.
DEFAULT_ORDER_SELL_LEVEL
A constant representing the default sell level for orders.
DEFAULT_PAGE_SIZE
Default page size for API requests
DEFAULT_RATE_LIMIT_BURST_SIZE
Fallback burst capacity used when crate::application::config::RateLimiterConfig::burst_size is configured as zero. Preserves the historical default of allowing a small burst.
DEFAULT_REST_BASE_URL
Default IG REST gateway: the demo environment.
DEFAULT_REST_TIMEOUT_SECS
Default REST request timeout in seconds (crate::application::config::RestApiConfig::timeout).
DEFAULT_RETRY_DELAY_SECS
Default base delay in seconds between retries when the RETRY_DELAY_SECS environment variable is unset. Used as the base for exponential backoff.
DEFAULT_SLEEP_TIME
Default sleep time in hours if not specified in environment (24 hours)
DEFAULT_WS_RECONNECT_INTERVAL_SECS
Default delay between Lightstreamer reconnection attempts, in seconds (crate::application::config::WebSocketConfig::reconnect_interval).
DEFAULT_WS_URL
Default Lightstreamer endpoint: the demo environment. Production requires an explicit opt-in via IG_WS_URL or a crate::application::config::WebSocketConfig supplied by the caller.
DEPRECATED_INFINITE_RETRY_CAP
Compatibility retry cap for the deprecated “infinite” retry constructors (crate::model::retry::RetryConfig::infinite and crate::model::retry::RetryConfig::with_delay). Unbounded retry is banned (PR #26); these constructors now clamp to this large-but-finite value so existing callers keep compiling while never looping forever.
ERROR_COOLDOWN_SECONDS
Cooldown time in seconds when hitting max errors (5 minutes)
FALLBACK_RATE_LIMIT_MAX_REQUESTS
Fallback replenishment budget (requests per period) used when crate::application::config::RateLimiterConfig::max_requests is configured as zero, which is structurally invalid.
HISTORICAL_RATE_LIMIT_PER_SECOND
Conservative per-app historical-price request budget, in requests per second, enforced by the rate limiter for endpoints under prices/.
MAX_CONSECUTIVE_ERRORS
Maximum number of consecutive errors before forcing a cooldown
MAX_RETRY_DELAY_SECS
Maximum backoff delay in seconds. Exponential backoff (base * 2^attempt) saturates at this cap — the cap is the policy, so rounding down to it is intentional and documented.
PROACTIVE_REFRESH_MARGIN_V2_SECS
Proactive-refresh safety margin for API v2 (CST / X-SECURITY-TOKEN) sessions, in seconds (5 minutes).
PROACTIVE_REFRESH_MARGIN_V3_SECS
Proactive-refresh safety margin for API v3 (OAuth) sessions, in seconds.
SAFETY_BUFFER_MS
Additional safety buffer in milliseconds added to wait times This provides extra margin to ensure rate limits are not exceeded
TRADING_HISTORICAL_BURST_SIZE
Burst capacity for the derived trading and historical rate-limit buckets.
TRADING_RATE_LIMIT_PER_SECOND
Conservative per-app trading request budget, in requests per second, enforced by the rate limiter for order / position mutations (positions/otc, workingorders/otc).
USER_AGENT
User agent string used in HTTP requests to identify this client to the IG Markets API.
V2_SESSION_LIFETIME_SECS
Lifetime of an IG API v2 (CST / X-SECURITY-TOKEN) session, in seconds (21600 = 6 hours).