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/// Base delay in milliseconds used for proximity-based delays in the rate limiter
12/// This value is used to calculate wait times when approaching rate limits
13pub const BASE_DELAY_MS: u64 = 1000;
14/// Additional safety buffer in milliseconds added to wait times
15/// This provides extra margin to ensure rate limits are not exceeded
16pub const SAFETY_BUFFER_MS: u64 = 1000;
17/// User agent string used in HTTP requests to identify this client to the IG Markets API
18pub const USER_AGENT: &str = "Rust-IG-Client/0.1.9";
19/// A constant representing the default sell level for orders.
20///
21/// This value is set to `0.0` by default and can be used to indicate an initial or
22/// baseline sell level for order-related computations or configurations.
23pub const DEFAULT_ORDER_SELL_LEVEL: f64 = 0.0;
24/// A constant representing the default buy level for orders.
25///
26/// This value is set as a `f64` and determines the default threshold for the buy level in an order system.
27/// Developers can use this constant to ensure uniformity and consistency when working with order buy levels
28/// across the application.
29pub const DEFAULT_ORDER_BUY_LEVEL: f64 = 10000.0;