pub struct Config {
pub credentials: Credentials,
pub rest_api: RestApiConfig,
pub websocket: WebSocketConfig,
pub database: DatabaseConfig,
pub sleep_hours: u64,
pub page_size: u32,
pub days_to_look_back: i64,
pub rate_limit_type: RateLimitType,
pub rate_limit_safety_margin: f64,
pub api_version: Option<u8>,
}Expand description
Main configuration for the IG Markets API client
Fields§
§credentials: CredentialsAuthentication credentials
rest_api: RestApiConfigREST API configuration
websocket: WebSocketConfigWebSocket API configuration
database: DatabaseConfigDatabase configuration for data persistence
sleep_hours: u64Number of hours between transaction fetching operations
page_size: u32Number of items to retrieve per page in API requests
days_to_look_back: i64Number of days to look back when fetching historical data
rate_limit_type: RateLimitTypeRate limit type to use for API requests
rate_limit_safety_margin: f64Safety margin for rate limiting (0.0-1.0)
api_version: Option<u8>API version to use for authentication (2 or 3). If None, auto-detect based on available tokens
Implementations§
Source§impl Config
impl Config
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new configuration instance from environment variables
Loads configuration from environment variables or .env file. Uses default values if environment variables are not found.
§Returns
A new Config instance
Sourcepub fn with_rate_limit_type(
rate_limit_type: RateLimitType,
safety_margin: f64,
) -> Self
pub fn with_rate_limit_type( rate_limit_type: RateLimitType, safety_margin: f64, ) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.