pub struct ExchangeConfigBuilder { /* private fields */ }Expand description
Builder for ExchangeConfig
Provides a fluent API for constructing exchange configurations.
§Example
use ccxt_core::base_exchange::ExchangeConfigBuilder;
use std::time::Duration;
let config = ExchangeConfigBuilder::new()
.id("binance")
.name("Binance")
.api_key("your-api-key")
.secret("your-secret")
.timeout(Duration::from_secs(60))
.build();Implementations§
Source§impl ExchangeConfigBuilder
impl ExchangeConfigBuilder
Sourcepub fn new() -> ExchangeConfigBuilder
pub fn new() -> ExchangeConfigBuilder
Create a new builder with default configuration
Sourcepub fn id(self, id: impl Into<String>) -> ExchangeConfigBuilder
pub fn id(self, id: impl Into<String>) -> ExchangeConfigBuilder
Set the exchange identifier
Sourcepub fn name(self, name: impl Into<String>) -> ExchangeConfigBuilder
pub fn name(self, name: impl Into<String>) -> ExchangeConfigBuilder
Set the exchange display name
Sourcepub fn api_key(self, key: impl Into<String>) -> ExchangeConfigBuilder
pub fn api_key(self, key: impl Into<String>) -> ExchangeConfigBuilder
Set the API key for authentication
Sourcepub fn secret(self, secret: impl Into<String>) -> ExchangeConfigBuilder
pub fn secret(self, secret: impl Into<String>) -> ExchangeConfigBuilder
Set the API secret for authentication
Sourcepub fn password(self, password: impl Into<String>) -> ExchangeConfigBuilder
pub fn password(self, password: impl Into<String>) -> ExchangeConfigBuilder
Set the password (required by some exchanges)
Sourcepub fn uid(self, uid: impl Into<String>) -> ExchangeConfigBuilder
pub fn uid(self, uid: impl Into<String>) -> ExchangeConfigBuilder
Set the user ID (required by some exchanges)
Sourcepub fn account_id(self, account_id: impl Into<String>) -> ExchangeConfigBuilder
pub fn account_id(self, account_id: impl Into<String>) -> ExchangeConfigBuilder
Set the account ID
Sourcepub fn enable_rate_limit(self, enabled: bool) -> ExchangeConfigBuilder
pub fn enable_rate_limit(self, enabled: bool) -> ExchangeConfigBuilder
Enable or disable rate limiting
Sourcepub fn rate_limit(self, rate_limit: u32) -> ExchangeConfigBuilder
pub fn rate_limit(self, rate_limit: u32) -> ExchangeConfigBuilder
Set the rate limit in requests per second
Sourcepub fn timeout(self, timeout: Duration) -> ExchangeConfigBuilder
pub fn timeout(self, timeout: Duration) -> ExchangeConfigBuilder
Set the request timeout
Sourcepub fn connect_timeout(self, timeout: Duration) -> ExchangeConfigBuilder
pub fn connect_timeout(self, timeout: Duration) -> ExchangeConfigBuilder
Set the TCP connection timeout
Sourcepub fn connect_timeout_secs(self, seconds: u64) -> ExchangeConfigBuilder
pub fn connect_timeout_secs(self, seconds: u64) -> ExchangeConfigBuilder
Set the TCP connection timeout in seconds (convenience method)
Sourcepub fn retry_policy(self, policy: RetryPolicy) -> ExchangeConfigBuilder
pub fn retry_policy(self, policy: RetryPolicy) -> ExchangeConfigBuilder
Set the retry policy
Sourcepub fn sandbox(self, enabled: bool) -> ExchangeConfigBuilder
pub fn sandbox(self, enabled: bool) -> ExchangeConfigBuilder
Enable or disable sandbox/testnet mode
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> ExchangeConfigBuilder
pub fn user_agent(self, user_agent: impl Into<String>) -> ExchangeConfigBuilder
Set a custom user agent string
Sourcepub fn proxy(self, proxy: ProxyConfig) -> ExchangeConfigBuilder
pub fn proxy(self, proxy: ProxyConfig) -> ExchangeConfigBuilder
Set the HTTP proxy configuration
Sourcepub fn proxy_url(self, url: impl Into<String>) -> ExchangeConfigBuilder
pub fn proxy_url(self, url: impl Into<String>) -> ExchangeConfigBuilder
Set the HTTP proxy URL (convenience method)
Sourcepub fn verbose(self, enabled: bool) -> ExchangeConfigBuilder
pub fn verbose(self, enabled: bool) -> ExchangeConfigBuilder
Enable or disable verbose logging
Sourcepub fn option(
self,
key: impl Into<String>,
value: Value,
) -> ExchangeConfigBuilder
pub fn option( self, key: impl Into<String>, value: Value, ) -> ExchangeConfigBuilder
Set a custom option
Sourcepub fn options(self, options: HashMap<String, Value>) -> ExchangeConfigBuilder
pub fn options(self, options: HashMap<String, Value>) -> ExchangeConfigBuilder
Set multiple custom options
Sourcepub fn url_override(
self,
key: impl Into<String>,
url: impl Into<String>,
) -> ExchangeConfigBuilder
pub fn url_override( self, key: impl Into<String>, url: impl Into<String>, ) -> ExchangeConfigBuilder
Set a URL override for a specific key (e.g., “public”, “private”)
Sourcepub fn build(self) -> ExchangeConfig
pub fn build(self) -> ExchangeConfig
Build the configuration
Trait Implementations§
Source§impl Clone for ExchangeConfigBuilder
impl Clone for ExchangeConfigBuilder
Source§fn clone(&self) -> ExchangeConfigBuilder
fn clone(&self) -> ExchangeConfigBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more