pub struct HyperliquidWebSocketClient { /* private fields */ }
Expand description
High-level Hyperliquid WebSocket client that provides standardized domain methods.
This is the outer client that wraps the inner client and provides Nautilus-specific functionality for WebSocket operations using standard domain methods.
Implementations§
Source§impl HyperliquidWebSocketClient
impl HyperliquidWebSocketClient
Sourcepub async fn subscribe_order_updates(&mut self, user: &str) -> Result<()>
pub async fn subscribe_order_updates(&mut self, user: &str) -> Result<()>
Subscribe to order updates for a specific user address.
Sourcepub async fn subscribe_user_events(&mut self, user: &str) -> Result<()>
pub async fn subscribe_user_events(&mut self, user: &str) -> Result<()>
Subscribe to user events (fills, funding, liquidations) for a specific user address.
Sourcepub async fn subscribe_all_user_channels(&mut self, user: &str) -> Result<()>
pub async fn subscribe_all_user_channels(&mut self, user: &str) -> Result<()>
Subscribe to all user channels (order updates + user events) for convenience.
Sourcepub async fn next_event(&mut self) -> Option<HyperliquidWsMessage>
pub async fn next_event(&mut self) -> Option<HyperliquidWsMessage>
Get the next event from the WebSocket stream. Returns None when the connection is closed or the receiver is exhausted.
Sourcepub fn is_reconnecting(&self) -> bool
pub fn is_reconnecting(&self) -> bool
Returns true if the WebSocket is reconnecting.
Sourcepub fn is_disconnecting(&self) -> bool
pub fn is_disconnecting(&self) -> bool
Returns true if the WebSocket is disconnecting.
Sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
Disconnect the WebSocket client.
Sourcepub async fn send_raw(&mut self, request: &HyperliquidWsRequest) -> Result<()>
pub async fn send_raw(&mut self, request: &HyperliquidWsRequest) -> Result<()>
Escape hatch: send raw requests for tests/power users.
Sourcepub async fn info_l2_book(
&mut self,
coin: &str,
timeout: Duration,
) -> HyperliquidResult<HyperliquidL2Book>
pub async fn info_l2_book( &mut self, coin: &str, timeout: Duration, ) -> HyperliquidResult<HyperliquidL2Book>
High-level: call info l2Book (WS post)
Sourcepub async fn post_info_raw(
&mut self,
payload: Value,
timeout: Duration,
) -> HyperliquidResult<PostResponsePayload>
pub async fn post_info_raw( &mut self, payload: Value, timeout: Duration, ) -> HyperliquidResult<PostResponsePayload>
High-level: fire arbitrary info (WS post) returning raw payload.
Sourcepub async fn post_action_raw(
&mut self,
action: ActionPayload,
timeout: Duration,
) -> HyperliquidResult<PostResponsePayload>
pub async fn post_action_raw( &mut self, action: ActionPayload, timeout: Duration, ) -> HyperliquidResult<PostResponsePayload>
High-level: fire action (already signed ActionPayload)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for HyperliquidWebSocketClient
impl !RefUnwindSafe for HyperliquidWebSocketClient
impl Send for HyperliquidWebSocketClient
impl Sync for HyperliquidWebSocketClient
impl Unpin for HyperliquidWebSocketClient
impl !UnwindSafe for HyperliquidWebSocketClient
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more