pub struct OkxBuilder { /* private fields */ }Expand description
Builder for creating OKX exchange instances.
Provides a fluent API for configuring all aspects of the OKX exchange, including authentication, connection settings, and OKX-specific options.
§Example
use ccxt_exchanges::okx::OkxBuilder;
let okx = OkxBuilder::new()
.api_key("your-api-key")
.secret("your-secret")
.passphrase("your-passphrase")
.sandbox(true)
.timeout(30)
.build()
.unwrap();Implementations§
Source§impl OkxBuilder
impl OkxBuilder
Sourcepub fn new() -> OkxBuilder
pub fn new() -> OkxBuilder
Creates a new builder with default configuration.
§Example
use ccxt_exchanges::okx::OkxBuilder;
let builder = OkxBuilder::new();Sourcepub fn api_key(self, key: impl Into<String>) -> OkxBuilder
pub fn api_key(self, key: impl Into<String>) -> OkxBuilder
Sourcepub fn secret(self, secret: impl Into<String>) -> OkxBuilder
pub fn secret(self, secret: impl Into<String>) -> OkxBuilder
Sourcepub fn passphrase(self, passphrase: impl Into<String>) -> OkxBuilder
pub fn passphrase(self, passphrase: impl Into<String>) -> OkxBuilder
Sets the passphrase for authentication.
OKX requires a passphrase in addition to API key and secret.
§Arguments
passphrase- The passphrase string.
Sourcepub fn sandbox(self, enabled: bool) -> OkxBuilder
pub fn sandbox(self, enabled: bool) -> OkxBuilder
Enables or disables sandbox/demo mode.
When enabled, the exchange will connect to OKX’s demo environment instead of the production environment.
§Arguments
enabled- Whether to enable sandbox mode.
Sourcepub fn account_mode(self, mode: impl Into<String>) -> OkxBuilder
pub fn account_mode(self, mode: impl Into<String>) -> OkxBuilder
Sets the account mode for trading.
Valid values: “cash” (spot), “cross” (cross margin), “isolated” (isolated margin).
§Arguments
mode- The account mode string.
Sourcepub fn timeout(self, seconds: u64) -> OkxBuilder
pub fn timeout(self, seconds: u64) -> OkxBuilder
Sourcepub fn enable_rate_limit(self, enabled: bool) -> OkxBuilder
pub fn enable_rate_limit(self, enabled: bool) -> OkxBuilder
Sourcepub fn proxy(self, proxy: impl Into<String>) -> OkxBuilder
pub fn proxy(self, proxy: impl Into<String>) -> OkxBuilder
Sourcepub fn verbose(self, enabled: bool) -> OkxBuilder
pub fn verbose(self, enabled: bool) -> OkxBuilder
Trait Implementations§
Source§impl Clone for OkxBuilder
impl Clone for OkxBuilder
Source§fn clone(&self) -> OkxBuilder
fn clone(&self) -> OkxBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OkxBuilder
impl Debug for OkxBuilder
Source§impl Default for OkxBuilder
impl Default for OkxBuilder
Source§fn default() -> OkxBuilder
fn default() -> OkxBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OkxBuilder
impl RefUnwindSafe for OkxBuilder
impl Send for OkxBuilder
impl Sync for OkxBuilder
impl Unpin for OkxBuilder
impl UnwindSafe for OkxBuilder
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
Mutably borrows from an owned value. Read more