pub struct HyperLiquid { /* private fields */ }Expand description
HyperLiquid exchange structure.
Implementations§
Source§impl HyperLiquid
impl HyperLiquid
Sourcepub async fn fetch_markets(&self) -> Result<HashMap<String, Arc<Market>>, Error>
pub async fn fetch_markets(&self) -> Result<HashMap<String, Arc<Market>>, Error>
Fetch all trading markets.
Sourcepub async fn load_markets(
&self,
reload: bool,
) -> Result<HashMap<String, Arc<Market>>, Error>
pub async fn load_markets( &self, reload: bool, ) -> Result<HashMap<String, Arc<Market>>, Error>
Load and cache market data.
Sourcepub async fn fetch_ticker(&self, symbol: &str) -> Result<Ticker, Error>
pub async fn fetch_ticker(&self, symbol: &str) -> Result<Ticker, Error>
Fetch ticker for a single trading pair.
Sourcepub async fn fetch_tickers(
&self,
symbols: Option<Vec<String>>,
) -> Result<Vec<Ticker>, Error>
pub async fn fetch_tickers( &self, symbols: Option<Vec<String>>, ) -> Result<Vec<Ticker>, Error>
Fetch tickers for multiple trading pairs.
Sourcepub async fn fetch_order_book(
&self,
symbol: &str,
_limit: Option<u32>,
) -> Result<OrderBook, Error>
pub async fn fetch_order_book( &self, symbol: &str, _limit: Option<u32>, ) -> Result<OrderBook, Error>
Fetch order book for a trading pair.
Sourcepub async fn fetch_trades(
&self,
symbol: &str,
limit: Option<u32>,
) -> Result<Vec<Trade>, Error>
pub async fn fetch_trades( &self, symbol: &str, limit: Option<u32>, ) -> Result<Vec<Trade>, Error>
Fetch recent public trades.
Sourcepub async fn fetch_ohlcv(
&self,
symbol: &str,
timeframe: &str,
since: Option<i64>,
limit: Option<u32>,
) -> Result<Vec<Ohlcv>, Error>
pub async fn fetch_ohlcv( &self, symbol: &str, timeframe: &str, since: Option<i64>, limit: Option<u32>, ) -> Result<Vec<Ohlcv>, Error>
Fetch OHLCV (candlestick) data.
Sourcepub async fn fetch_funding_rate(
&self,
symbol: &str,
) -> Result<FundingRate, Error>
pub async fn fetch_funding_rate( &self, symbol: &str, ) -> Result<FundingRate, Error>
Fetch current funding rate for a symbol.
Sourcepub async fn fetch_balance(&self) -> Result<Balance, Error>
pub async fn fetch_balance(&self) -> Result<Balance, Error>
Fetch account balance.
Sourcepub async fn fetch_positions(
&self,
symbols: Option<Vec<String>>,
) -> Result<Vec<Position>, Error>
pub async fn fetch_positions( &self, symbols: Option<Vec<String>>, ) -> Result<Vec<Position>, Error>
Fetch open positions.
Sourcepub async fn fetch_open_orders(
&self,
symbol: Option<&str>,
_since: Option<i64>,
_limit: Option<u32>,
) -> Result<Vec<Order>, Error>
pub async fn fetch_open_orders( &self, symbol: Option<&str>, _since: Option<i64>, _limit: Option<u32>, ) -> Result<Vec<Order>, Error>
Fetch open orders.
Sourcepub async fn create_order(
&self,
symbol: &str,
order_type: OrderType,
side: OrderSide,
amount: f64,
price: Option<f64>,
) -> Result<Order, Error>
pub async fn create_order( &self, symbol: &str, order_type: OrderType, side: OrderSide, amount: f64, price: Option<f64>, ) -> Result<Order, Error>
Create a new order.
Sourcepub async fn cancel_order(&self, id: &str, symbol: &str) -> Result<Order, Error>
pub async fn cancel_order(&self, id: &str, symbol: &str) -> Result<Order, Error>
Cancel an order.
Source§impl HyperLiquid
impl HyperLiquid
Sourcepub fn builder() -> HyperLiquidBuilder
pub fn builder() -> HyperLiquidBuilder
Creates a new HyperLiquid instance using the builder pattern.
This is the recommended way to create a HyperLiquid instance.
§Example
use ccxt_exchanges::hyperliquid::HyperLiquid;
let exchange = HyperLiquid::builder()
.private_key("0x...")
.testnet(true)
.build()
.unwrap();Sourcepub fn new_with_options(
config: ExchangeConfig,
options: HyperLiquidOptions,
auth: Option<HyperLiquidAuth>,
) -> Result<HyperLiquid, Error>
pub fn new_with_options( config: ExchangeConfig, options: HyperLiquidOptions, auth: Option<HyperLiquidAuth>, ) -> Result<HyperLiquid, Error>
Creates a new HyperLiquid instance with custom options.
This is used internally by the builder pattern.
§Arguments
config- Exchange configuration.options- HyperLiquid-specific options.auth- Optional authentication instance.
Sourcepub fn base(&self) -> &BaseExchange
pub fn base(&self) -> &BaseExchange
Returns a reference to the base exchange.
Sourcepub fn base_mut(&mut self) -> &mut BaseExchange
pub fn base_mut(&mut self) -> &mut BaseExchange
Returns a mutable reference to the base exchange.
Sourcepub fn options(&self) -> &HyperLiquidOptions
pub fn options(&self) -> &HyperLiquidOptions
Returns the HyperLiquid options.
Sourcepub fn auth(&self) -> Option<&HyperLiquidAuth>
pub fn auth(&self) -> Option<&HyperLiquidAuth>
Returns a reference to the authentication instance.
Sourcepub fn rate_limit(&self) -> u32
pub fn rate_limit(&self) -> u32
Returns the rate limit in requests per second.
Sourcepub fn is_sandbox(&self) -> bool
pub fn is_sandbox(&self) -> bool
Returns true if sandbox/testnet mode is enabled.
Sandbox mode is enabled when either:
config.sandboxis set totrueoptions.testnetis set totrue
§Returns
true if sandbox mode is enabled, false otherwise.
§Example
use ccxt_exchanges::hyperliquid::HyperLiquid;
let exchange = HyperLiquid::builder()
.testnet(true)
.build()
.unwrap();
assert!(exchange.is_sandbox());Sourcepub fn urls(&self) -> HyperLiquidUrls
pub fn urls(&self) -> HyperLiquidUrls
Returns the API URLs.
Returns testnet URLs when sandbox mode is enabled (either via
config.sandbox or options.testnet), otherwise returns mainnet URLs.
Sourcepub fn wallet_address(&self) -> Option<&str>
pub fn wallet_address(&self) -> Option<&str>
Returns the wallet address if authenticated.