ig_client/constants.rs
1/// Default number of days to look back when fetching historical data
2pub const DAYS_TO_BACK_LOOK: i64 = 10;
3/// Maximum number of consecutive errors before forcing a cooldown
4pub const MAX_CONSECUTIVE_ERRORS: u32 = 3;
5/// Cooldown time in seconds when hitting max errors (5 minutes)
6pub const ERROR_COOLDOWN_SECONDS: u64 = 300;
7/// Default sleep time in hours if not specified in environment (24 hours)
8pub const DEFAULT_SLEEP_TIME: u64 = 24;
9/// Default page size for API requests
10pub const DEFAULT_PAGE_SIZE: u32 = 50;
11
12// Constants for rate limiter configuration
13/// Base delay in milliseconds used for proximity-based delays in the rate limiter
14/// This value is used to calculate wait times when approaching rate limits
15pub const BASE_DELAY_MS: u64 = 1000;
16
17/// Additional safety buffer in milliseconds added to wait times
18/// This provides extra margin to ensure rate limits are not exceeded
19pub const SAFETY_BUFFER_MS: u64 = 1000;
20
21/// User agent string used in HTTP requests to identify this client to the IG Markets API
22pub const USER_AGENT: &str = "Rust-IG-Client/0.1.9";