pub struct HyperliquidClient { /* private fields */ }Implementations§
Trait Implementations§
Source§impl Default for HyperliquidClient
impl Default for HyperliquidClient
Source§impl GetAccountSnapshot for HyperliquidClient
impl GetAccountSnapshot for HyperliquidClient
Source§async fn get_positions(&self) -> Result<Vec<Position>, String>
async fn get_positions(&self) -> Result<Vec<Position>, String>
Returns open positions from clearinghouseState. Requires with_auth.
Zero-size positions are filtered out. Positive szi = long, negative = short.
Source§async fn get_open_orders(&self) -> Result<Vec<OpenOrder>, String>
async fn get_open_orders(&self) -> Result<Vec<OpenOrder>, String>
Returns resting orders from Hyperliquid’s openOrders endpoint. Requires with_auth.
filled_quantity is derived as origSz - sz (original size minus remaining size).
Source§async fn get_collateral(&self) -> Result<Decimal, String>
async fn get_collateral(&self) -> Result<Decimal, String>
Returns total account value (collateral) from clearinghouseState. Requires with_auth.
Source§impl GetMarketData for HyperliquidClient
impl GetMarketData for HyperliquidClient
Source§async fn get_symbol(&self) -> Result<Vec<String>, String>
async fn get_symbol(&self) -> Result<Vec<String>, String>
Returns all perpetual asset names from Hyperliquid’s meta endpoint.
Source§async fn get_open_interest(&self, symbol: String) -> Result<Decimal, String>
async fn get_open_interest(&self, symbol: String) -> Result<Decimal, String>
Returns the current open interest for symbol from metaAndAssetCtxs.
Source§async fn get_asset_context(
&self,
symbol: String,
) -> Result<AssetContext, String>
async fn get_asset_context( &self, symbol: String, ) -> Result<AssetContext, String>
Returns a full AssetContext snapshot for symbol from metaAndAssetCtxs.
Source§async fn get_all_asset_contexts(&self) -> Result<Vec<AssetContext>, String>
async fn get_all_asset_contexts(&self) -> Result<Vec<AssetContext>, String>
Fetches metaAndAssetCtxs once and returns all asset contexts in universe order.
Prefer this over repeated get_asset_context calls to avoid rate-limiting.
Source§async fn get_l2_orderbook(
&self,
symbol: String,
) -> Result<Vec<L2Update>, String>
async fn get_l2_orderbook( &self, symbol: String, ) -> Result<Vec<L2Update>, String>
Returns a full L2 orderbook snapshot for symbol from the l2Book REST endpoint.
Levels are returned as individual L2Update items; all share the same sequence (timestamp).
Source§async fn get_price(&self, symbol: String) -> Result<Decimal, String>
async fn get_price(&self, symbol: String) -> Result<Decimal, String>
Returns the mid-price of symbol (e.g. “BTC”) from allMids.
Source§async fn get_predicted_fundings(&self) -> Result<Vec<PredictedFunding>, String>
async fn get_predicted_fundings(&self) -> Result<Vec<PredictedFunding>, String>
Returns predicted funding rates for all symbols across all venues. Null venue entries (unsupported coins) are silently skipped.
Source§impl ManageOrder for HyperliquidClient
impl ManageOrder for HyperliquidClient
Source§async fn place_order(
&self,
symbol: String,
side: OrderSide,
price: Decimal,
volume: Decimal,
order_type: OrderType,
time_in_force: TimeInForce,
cloid: Option<String>,
) -> Result<OrderPlacement, String>
async fn place_order( &self, symbol: String, side: OrderSide, price: Decimal, volume: Decimal, order_type: OrderType, time_in_force: TimeInForce, cloid: Option<String>, ) -> Result<OrderPlacement, String>
Places an order on Hyperliquid. Requires with_auth. Returns an OrderPlacement with
the exchange-assigned order ID. Market orders are submitted as aggressive limit orders (IOC).
If cloid is provided, Hyperliquid attaches it to the order lifecycle — fills and order
updates will carry the same cloid back, enabling end-to-end intent tracing without a
separate order_id mapping.
Source§async fn change_order_by_cloid(
&self,
cloid: i64,
price: Decimal,
volume: Decimal,
) -> Result<i64, String>
async fn change_order_by_cloid( &self, cloid: i64, price: Decimal, volume: Decimal, ) -> Result<i64, String>
Modifies price and size of an existing order by its order ID. Requires with_auth.
Fetches the order’s current coin and side before submitting the modify action.
Source§impl SubscribeMarketData for HyperliquidClient
impl SubscribeMarketData for HyperliquidClient
Source§fn subscribe_l2_update(
&self,
symbol: String,
) -> BoxStream<Result<L2Update, String>>
fn subscribe_l2_update( &self, symbol: String, ) -> BoxStream<Result<L2Update, String>>
Source§fn subscribe_asset_context(
&self,
symbol: String,
) -> BoxStream<Result<AssetContext, String>>
fn subscribe_asset_context( &self, symbol: String, ) -> BoxStream<Result<AssetContext, String>>
Source§fn subscribe_liquidation(
&self,
user: String,
) -> BoxStream<Result<Liquidation, String>>
fn subscribe_liquidation( &self, user: String, ) -> BoxStream<Result<Liquidation, String>>
Source§impl SubscribeUserEvents for HyperliquidClient
impl SubscribeUserEvents for HyperliquidClient
Source§fn subscribe_spot_balance(&self) -> BoxStream<Result<Vec<Balance>, String>>
fn subscribe_spot_balance(&self) -> BoxStream<Result<Vec<Balance>, String>>
Subscribe to spot wallet balance updates for the registered user address. Requires authentication (address must be set). Returns error if address not registered.
Source§fn subscribe_spot_balance_with_address(
&self,
address: String,
) -> BoxStream<Result<Vec<Balance>, String>>
fn subscribe_spot_balance_with_address( &self, address: String, ) -> BoxStream<Result<Vec<Balance>, String>>
Subscribe to spot wallet balance updates for a specific address.