pub struct AxOrdersWebSocketClient { /* private fields */ }Expand description
Orders WebSocket client for Ax.
Provides authenticated order management including placing, canceling, and monitoring order status via WebSocket.
Implementations§
Source§impl AxOrdersWebSocketClient
impl AxOrdersWebSocketClient
Sourcepub fn new(url: String, account_id: AccountId, heartbeat: Option<u64>) -> Self
pub fn new(url: String, account_id: AccountId, heartbeat: Option<u64>) -> Self
Creates a new Ax orders WebSocket client.
Sourcepub fn account_id(&self) -> AccountId
pub fn account_id(&self) -> AccountId
Returns the account ID.
Sourcepub fn cache_instrument(&self, instrument: InstrumentAny)
pub fn cache_instrument(&self, instrument: InstrumentAny)
Caches an instrument for use during message parsing.
Sourcepub fn get_cached_instrument(&self, symbol: &Ustr) -> Option<InstrumentAny>
pub fn get_cached_instrument(&self, symbol: &Ustr) -> Option<InstrumentAny>
Returns a cached instrument by symbol.
Sourcepub async fn connect(&mut self, bearer_token: &str) -> AxOrdersWsResult<()>
pub async fn connect(&mut self, bearer_token: &str) -> AxOrdersWsResult<()>
Sourcepub async fn place_order(
&self,
client_order_id: ClientOrderId,
symbol: Ustr,
side: AxOrderSide,
quantity: i64,
price: Decimal,
time_in_force: AxTimeInForce,
post_only: bool,
tag: Option<String>,
) -> AxOrdersWsResult<i64>
pub async fn place_order( &self, client_order_id: ClientOrderId, symbol: Ustr, side: AxOrderSide, quantity: i64, price: Decimal, time_in_force: AxTimeInForce, post_only: bool, tag: Option<String>, ) -> AxOrdersWsResult<i64>
Sourcepub async fn cancel_order(&self, order_id: &str) -> AxOrdersWsResult<i64>
pub async fn cancel_order(&self, order_id: &str) -> AxOrdersWsResult<i64>
Sourcepub async fn get_open_orders(&self) -> AxOrdersWsResult<i64>
pub async fn get_open_orders(&self) -> AxOrdersWsResult<i64>
Sourcepub fn stream(&mut self) -> impl Stream<Item = AxOrdersWsMessage> + use<'_>
pub fn stream(&mut self) -> impl Stream<Item = AxOrdersWsMessage> + use<'_>
Returns a stream of messages from the WebSocket.
§Panics
Panics if called more than once or before connecting.
Sourcepub async fn disconnect(&self)
pub async fn disconnect(&self)
Disconnects the WebSocket connection gracefully.
Trait Implementations§
Source§impl Clone for AxOrdersWebSocketClient
impl Clone for AxOrdersWebSocketClient
Auto Trait Implementations§
impl Freeze for AxOrdersWebSocketClient
impl !RefUnwindSafe for AxOrdersWebSocketClient
impl Send for AxOrdersWebSocketClient
impl Sync for AxOrdersWebSocketClient
impl Unpin for AxOrdersWebSocketClient
impl !UnwindSafe for AxOrdersWebSocketClient
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Converts
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>
Converts
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