pub struct BinanceBuilder { /* private fields */ }Expand description
Builder for creating Binance exchange instances.
Provides a fluent API for configuring all aspects of the Binance exchange, including authentication, connection settings, and Binance-specific options.
§Example
use ccxt_exchanges::binance::BinanceBuilder;
let binance = BinanceBuilder::new()
.api_key("your-api-key")
.secret("your-secret")
.sandbox(true)
.timeout(30)
.build()
.unwrap();Implementations§
Source§impl BinanceBuilder
impl BinanceBuilder
Sourcepub fn new() -> BinanceBuilder
pub fn new() -> BinanceBuilder
Creates a new builder with default configuration.
§Example
use ccxt_exchanges::binance::BinanceBuilder;
let builder = BinanceBuilder::new();Sourcepub fn api_key(self, key: impl Into<String>) -> BinanceBuilder
pub fn api_key(self, key: impl Into<String>) -> BinanceBuilder
Sourcepub fn secret(self, secret: impl Into<String>) -> BinanceBuilder
pub fn secret(self, secret: impl Into<String>) -> BinanceBuilder
Sourcepub fn sandbox(self, enabled: bool) -> BinanceBuilder
pub fn sandbox(self, enabled: bool) -> BinanceBuilder
Enables or disables sandbox/testnet mode.
When enabled, the exchange will connect to Binance’s testnet instead of the production environment.
§Arguments
enabled- Whether to enable sandbox mode.
§Example
use ccxt_exchanges::binance::BinanceBuilder;
let builder = BinanceBuilder::new()
.sandbox(true);Sourcepub fn timeout(self, seconds: u64) -> BinanceBuilder
pub fn timeout(self, seconds: u64) -> BinanceBuilder
Sourcepub fn recv_window(self, millis: u64) -> BinanceBuilder
pub fn recv_window(self, millis: u64) -> BinanceBuilder
Sets the receive window for signed requests.
The receive window specifies how long a request is valid after the timestamp. Default is 5000 milliseconds.
§Arguments
millis- Receive window in milliseconds.
§Example
use ccxt_exchanges::binance::BinanceBuilder;
let builder = BinanceBuilder::new()
.recv_window(10000);Sourcepub fn default_type(self, trading_type: impl Into<String>) -> BinanceBuilder
pub fn default_type(self, trading_type: impl Into<String>) -> BinanceBuilder
Sourcepub fn adjust_for_time_difference(self, enabled: bool) -> BinanceBuilder
pub fn adjust_for_time_difference(self, enabled: bool) -> BinanceBuilder
Enables or disables time synchronization adjustment.
When enabled, the exchange will adjust for time differences between the local system and Binance servers.
§Arguments
enabled- Whether to enable time adjustment.
§Example
use ccxt_exchanges::binance::BinanceBuilder;
let builder = BinanceBuilder::new()
.adjust_for_time_difference(true);Sourcepub fn demo(self, enabled: bool) -> BinanceBuilder
pub fn demo(self, enabled: bool) -> BinanceBuilder
Sourcepub fn enable_rate_limit(self, enabled: bool) -> BinanceBuilder
pub fn enable_rate_limit(self, enabled: bool) -> BinanceBuilder
Sourcepub fn proxy(self, proxy: impl Into<String>) -> BinanceBuilder
pub fn proxy(self, proxy: impl Into<String>) -> BinanceBuilder
Sourcepub fn verbose(self, enabled: bool) -> BinanceBuilder
pub fn verbose(self, enabled: bool) -> BinanceBuilder
Sourcepub fn options(self, options: HashMap<String, Value>) -> BinanceBuilder
pub fn options(self, options: HashMap<String, Value>) -> BinanceBuilder
Sets multiple custom options.
§Arguments
options- HashMap of option key-value pairs.
§Example
use ccxt_exchanges::binance::BinanceBuilder;
use serde_json::json;
use std::collections::HashMap;
let mut options = HashMap::new();
options.insert("option1".to_string(), json!("value1"));
options.insert("option2".to_string(), json!(42));
let builder = BinanceBuilder::new()
.options(options);Sourcepub fn build(self) -> Result<Binance, Error>
pub fn build(self) -> Result<Binance, Error>
Builds the Binance exchange instance.
§Returns
Returns a Result containing the configured Binance instance.
§Errors
Returns an error if the exchange cannot be initialized.
§Example
use ccxt_exchanges::binance::BinanceBuilder;
let binance = BinanceBuilder::new()
.api_key("your-api-key")
.secret("your-secret")
.build()
.unwrap();Trait Implementations§
Source§impl Clone for BinanceBuilder
impl Clone for BinanceBuilder
Source§fn clone(&self) -> BinanceBuilder
fn clone(&self) -> BinanceBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more