pub struct HyperLiquidBuilder { /* private fields */ }Expand description
Builder for creating HyperLiquid exchange instances.
§Note on Market Types
HyperLiquid only supports perpetual futures (Swap). Attempting to set
default_type to any other value (Spot, Futures, Margin, Option) will
result in a validation error when calling build().
§Example
use ccxt_exchanges::hyperliquid::HyperLiquidBuilder;
let exchange = HyperLiquidBuilder::new()
.private_key("0x...")
.testnet(true)
.default_leverage(10)
.build()
.unwrap();Implementations§
Source§impl HyperLiquidBuilder
impl HyperLiquidBuilder
Sourcepub fn new() -> HyperLiquidBuilder
pub fn new() -> HyperLiquidBuilder
Creates a new HyperLiquidBuilder with default settings.
Sourcepub fn private_key(self, key: &str) -> HyperLiquidBuilder
pub fn private_key(self, key: &str) -> HyperLiquidBuilder
Sets the Ethereum private key for authentication.
The private key should be a 64-character hex string (32 bytes), optionally prefixed with “0x”.
§Arguments
key- The private key in hex format.
§Example
use ccxt_exchanges::hyperliquid::HyperLiquidBuilder;
let builder = HyperLiquidBuilder::new()
.private_key("0x1234567890abcdef...");Sourcepub fn sandbox(self, enabled: bool) -> HyperLiquidBuilder
pub fn sandbox(self, enabled: bool) -> HyperLiquidBuilder
Enables or disables sandbox/testnet mode.
When enabled, the exchange will connect to HyperLiquid testnet instead of mainnet.
This method is equivalent to testnet() and is provided for
consistency with other exchanges.
§Arguments
enabled- Whether to use sandbox mode.
Sourcepub fn testnet(self, enabled: bool) -> HyperLiquidBuilder
pub fn testnet(self, enabled: bool) -> HyperLiquidBuilder
Enables or disables testnet mode.
When enabled, the exchange will connect to HyperLiquid testnet instead of mainnet.
This method is equivalent to sandbox() and is provided for
backward compatibility.
§Arguments
enabled- Whether to use testnet.
Sourcepub fn vault_address(self, address: &str) -> HyperLiquidBuilder
pub fn vault_address(self, address: &str) -> HyperLiquidBuilder
Sets the vault address for vault trading.
When set, orders will be placed on behalf of the vault.
§Arguments
address- The vault’s Ethereum address.
Sourcepub fn default_leverage(self, leverage: u32) -> HyperLiquidBuilder
pub fn default_leverage(self, leverage: u32) -> HyperLiquidBuilder
Sets the default leverage multiplier.
This leverage will be used when placing orders if not specified.
§Arguments
leverage- The leverage multiplier (1-50).
Sourcepub fn default_type(
self,
default_type: impl Into<DefaultType>,
) -> HyperLiquidBuilder
pub fn default_type( self, default_type: impl Into<DefaultType>, ) -> HyperLiquidBuilder
Sets the default market type for trading.
Important: HyperLiquid only supports perpetual futures (Swap).
Attempting to set any other value (Spot, Futures, Margin, Option)
will result in a validation error when calling build().
§Arguments
default_type- The default market type. Must beSwapfor HyperLiquid.
§Example
use ccxt_exchanges::hyperliquid::HyperLiquidBuilder;
use ccxt_core::types::default_type::DefaultType;
// This works - HyperLiquid supports Swap (perpetuals)
let exchange = HyperLiquidBuilder::new()
.default_type(DefaultType::Swap)
.build()
.unwrap();
// This will fail - HyperLiquid does not support Spot
let result = HyperLiquidBuilder::new()
.default_type(DefaultType::Spot)
.build();
assert!(result.is_err());Sourcepub fn timeout(self, timeout: Duration) -> HyperLiquidBuilder
pub fn timeout(self, timeout: Duration) -> HyperLiquidBuilder
Sets the request timeout.
Sourcepub fn timeout_secs(self, seconds: u64) -> HyperLiquidBuilder
pub fn timeout_secs(self, seconds: u64) -> HyperLiquidBuilder
Sets the request timeout in seconds (convenience method).
Sourcepub fn connect_timeout(self, timeout: Duration) -> HyperLiquidBuilder
pub fn connect_timeout(self, timeout: Duration) -> HyperLiquidBuilder
Sourcepub fn connect_timeout_secs(self, seconds: u64) -> HyperLiquidBuilder
pub fn connect_timeout_secs(self, seconds: u64) -> HyperLiquidBuilder
Sets the TCP connection timeout in seconds (convenience method).
§Arguments
seconds- Connection timeout duration in seconds.
Sourcepub fn retry_policy(self, policy: RetryPolicy) -> HyperLiquidBuilder
pub fn retry_policy(self, policy: RetryPolicy) -> HyperLiquidBuilder
Sets the retry policy.
Sourcepub fn proxy(self, proxy: ProxyConfig) -> HyperLiquidBuilder
pub fn proxy(self, proxy: ProxyConfig) -> HyperLiquidBuilder
Sets the HTTP proxy configuration.
Sourcepub fn proxy_url(self, url: impl Into<String>) -> HyperLiquidBuilder
pub fn proxy_url(self, url: impl Into<String>) -> HyperLiquidBuilder
Sets the HTTP proxy URL (convenience method).