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_idwhenIG_ACCOUNT_IDis not configured. - DEFAULT_
API_ VERSION - Default IG API version used for authentication when
IG_API_VERSIONis 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_URLwhen it is not configured. - DEFAULT_
MAX_ RETRIES - Default maximum number of retries for transient HTTP failures when the
MAX_RETRY_COUNTenvironment 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_sizeis 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_SECSenvironment 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_URLor acrate::application::config::WebSocketConfigsupplied by the caller. - DEPRECATED_
INFINITE_ RETRY_ CAP - Compatibility retry cap for the deprecated “infinite” retry constructors
(
crate::model::retry::RetryConfig::infiniteandcrate::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_requestsis 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).