Skip to main content

HyperliquidClient

Struct HyperliquidClient 

Source
pub struct HyperliquidClient { /* private fields */ }

Implementations§

Trait Implementations§

Source§

impl GetAccountSnapshot for HyperliquidClient

Source§

async fn get_positions(&self) -> Result<Vec<Position>, String>

get current open positions
Source§

async fn get_open_orders(&self) -> Result<Vec<OpenOrder>, String>

get currently resting orders
Source§

async fn get_collateral(&self) -> Result<Decimal, String>

get available account collateral
Source§

impl GetMarketData for HyperliquidClient

Source§

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>

Returns the current open interest for symbol from metaAndAssetCtxs.

Source§

async fn get_price(&self, symbol: String) -> Result<Decimal, String>

Returns the mid-price of symbol (e.g. “BTC”) from allMids.

Source§

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, ) -> Result<OrderPlacement, String>

place order
Source§

async fn change_order_by_cloid( &self, cloid: i64, price: Decimal, volume: Decimal, ) -> Result<i64, String>

change order
Source§

async fn cancel_order(&self, cloid: i64) -> Result<i64, String>

cancel order by cloid
Source§

async fn cancel_all_order(&self) -> Result<bool, String>

cancel all order regardless of cloid/symbol
Source§

impl SubscribeMarketData for HyperliquidClient

Source§

fn subscribe_l2_update(&self, symbol: String) -> BoxStream<L2Update>

Streams L2 orderbook updates for symbol. Each message from Hyperliquid is a full-depth snapshot; every level is emitted as an individual L2Update event. All levels in the same snapshot share the same sequence value.

Source§

fn subscribe_asset_context(&self, symbol: String) -> BoxStream<AssetContext>

Streams asset context updates for symbol via Hyperliquid’s activeAssetCtx subscription. Each message carries OI, funding rate, mark price, and 24h notional volume.

Source§

fn subscribe_liquidation(&self, user: String) -> BoxStream<Liquidation>

Streams liquidation events for a user address via Hyperliquid’s userEvents subscription. Note: Hyperliquid’s liquidation event is account-level; symbol is set to empty string and side defaults to OrderSide::Sell as the data source does not provide per-position detail.

Source§

fn subscribe_fill(&self, symbol: String) -> BoxStream<Fill>

Streams public trade fills for symbol. Maps to Hyperliquid’s trades subscription. side reflects the aggressor: “B” (buyer) → OrderSide::Buy, otherwise → OrderSide::Sell.

Source§

impl SubscribeUserEvents for HyperliquidClient

Source§

fn subscribe_user_fills(&self) -> BoxStream<UserFill>

stream executions of the user’s own orders
Source§

fn subscribe_order_updates(&self) -> BoxStream<OrderUpdate>

stream order lifecycle updates
Source§

fn subscribe_funding_payments(&self) -> BoxStream<FundingPayment>

stream funding payments applied to positions
Source§

fn subscribe_deposits(&self) -> BoxStream<Deposit>

stream account deposit events
Source§

fn subscribe_withdrawals(&self) -> BoxStream<Withdrawal>

stream account withdrawal events
Source§

impl TestServer for HyperliquidClient

Source§

async fn ping(&self) -> Result<bool, String>

Sends a lightweight allMids request; returns true if the server responds 200 OK.

Source§

async fn get_server_time(&self) -> Result<i64, String>

Hyperliquid has no dedicated server-time endpoint; returns local UTC ms.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more