pub struct BitgetBuilder { /* private fields */ }Expand description
Builder for creating Bitget exchange instances.
Provides a fluent API for configuring all aspects of the Bitget exchange, including authentication, connection settings, and Bitget-specific options.
§Example
use ccxt_exchanges::bitget::BitgetBuilder;
let bitget = BitgetBuilder::new()
.api_key("your-api-key")
.secret("your-secret")
.passphrase("your-passphrase")
.sandbox(true)
.timeout(30)
.build()
.unwrap();Implementations§
Source§impl BitgetBuilder
impl BitgetBuilder
Sourcepub fn new() -> BitgetBuilder
pub fn new() -> BitgetBuilder
Creates a new builder with default configuration.
§Example
use ccxt_exchanges::bitget::BitgetBuilder;
let builder = BitgetBuilder::new();Sourcepub fn api_key(self, key: impl Into<String>) -> BitgetBuilder
pub fn api_key(self, key: impl Into<String>) -> BitgetBuilder
Sourcepub fn secret(self, secret: impl Into<String>) -> BitgetBuilder
pub fn secret(self, secret: impl Into<String>) -> BitgetBuilder
Sourcepub fn passphrase(self, passphrase: impl Into<String>) -> BitgetBuilder
pub fn passphrase(self, passphrase: impl Into<String>) -> BitgetBuilder
Sets the passphrase for authentication.
Bitget requires a passphrase in addition to API key and secret.
§Arguments
passphrase- The passphrase string.
Sourcepub fn sandbox(self, enabled: bool) -> BitgetBuilder
pub fn sandbox(self, enabled: bool) -> BitgetBuilder
Enables or disables sandbox/demo mode.
When enabled, the exchange will connect to Bitget’s demo environment instead of the production environment.
§Arguments
enabled- Whether to enable sandbox mode.
Sourcepub fn product_type(self, product_type: impl Into<String>) -> BitgetBuilder
pub fn product_type(self, product_type: impl Into<String>) -> BitgetBuilder
Sets the product type for trading.
Valid values: “spot”, “umcbl” (USDT-M futures), “dmcbl” (Coin-M futures).
Note: Consider using default_type() and default_sub_type() instead
for a more type-safe configuration.
§Arguments
product_type- The product type string.
Sourcepub fn default_type(self, default_type: impl Into<DefaultType>) -> BitgetBuilder
pub fn default_type(self, default_type: impl Into<DefaultType>) -> BitgetBuilder
Sets the default market type for trading.
This determines which product type to use for API calls. Bitget uses product_type-based filtering:
Spot-> product_type=spotSwap+ Linear -> product_type=umcbl (USDT-M)Swap+ Inverse -> product_type=dmcbl (Coin-M)Futures+ Linear -> product_type=umcbl (USDT-M futures)Futures+ Inverse -> product_type=dmcbl (Coin-M futures)
§Arguments
default_type- The default market type (spot, swap, futures, margin, option).
§Example
use ccxt_exchanges::bitget::BitgetBuilder;
use ccxt_core::types::default_type::DefaultType;
let bitget = BitgetBuilder::new()
.default_type(DefaultType::Swap)
.build()
.unwrap();Sourcepub fn default_sub_type(self, sub_type: DefaultSubType) -> BitgetBuilder
pub fn default_sub_type(self, sub_type: DefaultSubType) -> BitgetBuilder
Sets the default sub-type for contract settlement.
Linear: USDT-margined contracts (product_type=umcbl)Inverse: Coin-margined contracts (product_type=dmcbl)
Only applicable when default_type is Swap or Futures.
Ignored for Spot and Option types.
§Arguments
sub_type- The contract settlement type (linear or inverse).
§Example
use ccxt_exchanges::bitget::BitgetBuilder;
use ccxt_core::types::default_type::{DefaultType, DefaultSubType};
let bitget = BitgetBuilder::new()
.default_type(DefaultType::Swap)
.default_sub_type(DefaultSubType::Linear)
.build()
.unwrap();Sourcepub fn timeout(self, timeout: Duration) -> BitgetBuilder
pub fn timeout(self, timeout: Duration) -> BitgetBuilder
Sets the request timeout.
Sourcepub fn timeout_secs(self, seconds: u64) -> BitgetBuilder
pub fn timeout_secs(self, seconds: u64) -> BitgetBuilder
Sets the request timeout in seconds (convenience method).
Sourcepub fn connect_timeout(self, timeout: Duration) -> BitgetBuilder
pub fn connect_timeout(self, timeout: Duration) -> BitgetBuilder
Sourcepub fn connect_timeout_secs(self, seconds: u64) -> BitgetBuilder
pub fn connect_timeout_secs(self, seconds: u64) -> BitgetBuilder
Sets the TCP connection timeout in seconds (convenience method).
§Arguments
seconds- Connection timeout duration in seconds.
Sourcepub fn retry_policy(self, policy: RetryPolicy) -> BitgetBuilder
pub fn retry_policy(self, policy: RetryPolicy) -> BitgetBuilder
Sets the retry policy.
Sourcepub fn recv_window(self, millis: u64) -> BitgetBuilder
pub fn recv_window(self, millis: u64) -> BitgetBuilder
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.
Sourcepub fn enable_rate_limit(self, enabled: bool) -> BitgetBuilder
pub fn enable_rate_limit(self, enabled: bool) -> BitgetBuilder
Sourcepub fn proxy(self, proxy: ProxyConfig) -> BitgetBuilder
pub fn proxy(self, proxy: ProxyConfig) -> BitgetBuilder
Sets the HTTP proxy configuration.
Sourcepub fn proxy_url(self, url: impl Into<String>) -> BitgetBuilder
pub fn proxy_url(self, url: impl Into<String>) -> BitgetBuilder
Sets the HTTP proxy URL (convenience method).
Sourcepub fn verbose(self, enabled: bool) -> BitgetBuilder
pub fn verbose(self, enabled: bool) -> BitgetBuilder
Trait Implementations§
Source§impl Clone for BitgetBuilder
impl Clone for BitgetBuilder
Source§fn clone(&self) -> BitgetBuilder
fn clone(&self) -> BitgetBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more