pub struct BinanceFuturesWsTradingClient { /* private fields */ }Expand description
Binance Futures WebSocket Trading API client.
Provides order management via WebSocket with JSON responses, complementing the HTTP client with lower-latency order submission. Only available for USD-M Futures.
Implementations§
Source§impl BinanceFuturesWsTradingClient
impl BinanceFuturesWsTradingClient
Sourcepub fn new(
url: Option<String>,
api_key: String,
api_secret: String,
heartbeat: Option<u64>,
transport_backend: TransportBackend,
) -> Self
pub fn new( url: Option<String>, api_key: String, api_secret: String, heartbeat: Option<u64>, transport_backend: TransportBackend, ) -> Self
Creates a new BinanceFuturesWsTradingClient instance.
pub fn next_request_id(&self) -> String
Sourcepub async fn connect(&mut self) -> BinanceFuturesWsApiResult<()>
pub async fn connect(&mut self) -> BinanceFuturesWsApiResult<()>
Sourcepub async fn disconnect(&mut self)
pub async fn disconnect(&mut self)
Disconnects from the WebSocket Trading API server.
Sourcepub async fn place_order(
&self,
params: BinanceNewOrderParams,
) -> BinanceFuturesWsApiResult<String>
pub async fn place_order( &self, params: BinanceNewOrderParams, ) -> BinanceFuturesWsApiResult<String>
Places a new order via the WebSocket Trading API.
§Errors
Returns an error if the handler is unavailable.
Sourcepub async fn place_order_with_id(
&self,
id: String,
params: BinanceNewOrderParams,
) -> BinanceFuturesWsApiResult<()>
pub async fn place_order_with_id( &self, id: String, params: BinanceNewOrderParams, ) -> BinanceFuturesWsApiResult<()>
Places a new order via the WebSocket Trading API using a pre-generated request ID.
§Errors
Returns an error if the handler is unavailable.
Sourcepub async fn cancel_order(
&self,
params: BinanceCancelOrderParams,
) -> BinanceFuturesWsApiResult<String>
pub async fn cancel_order( &self, params: BinanceCancelOrderParams, ) -> BinanceFuturesWsApiResult<String>
Cancels an order via the WebSocket Trading API.
§Errors
Returns an error if the handler is unavailable.
Sourcepub async fn cancel_order_with_id(
&self,
id: String,
params: BinanceCancelOrderParams,
) -> BinanceFuturesWsApiResult<()>
pub async fn cancel_order_with_id( &self, id: String, params: BinanceCancelOrderParams, ) -> BinanceFuturesWsApiResult<()>
Cancels an order via the WebSocket Trading API using a pre-generated request ID.
§Errors
Returns an error if the handler is unavailable.
Sourcepub async fn modify_order(
&self,
params: BinanceModifyOrderParams,
) -> BinanceFuturesWsApiResult<String>
pub async fn modify_order( &self, params: BinanceModifyOrderParams, ) -> BinanceFuturesWsApiResult<String>
Modifies an order via the WebSocket Trading API (in-place amendment).
§Errors
Returns an error if the handler is unavailable.
Sourcepub async fn modify_order_with_id(
&self,
id: String,
params: BinanceModifyOrderParams,
) -> BinanceFuturesWsApiResult<()>
pub async fn modify_order_with_id( &self, id: String, params: BinanceModifyOrderParams, ) -> BinanceFuturesWsApiResult<()>
Modifies an order via the WebSocket Trading API using a pre-generated request ID.
§Errors
Returns an error if the handler is unavailable.
Sourcepub async fn recv(&self) -> Option<BinanceFuturesWsTradingMessage>
pub async fn recv(&self) -> Option<BinanceFuturesWsTradingMessage>
Receives the next message from the handler.
Returns None if the receiver is closed or not initialized.
§Panics
Panics if the internal output receiver mutex is poisoned.
Trait Implementations§
Source§impl Clone for BinanceFuturesWsTradingClient
impl Clone for BinanceFuturesWsTradingClient
Source§fn clone(&self) -> BinanceFuturesWsTradingClient
fn clone(&self) -> BinanceFuturesWsTradingClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BinanceFuturesWsTradingClient
impl !RefUnwindSafe for BinanceFuturesWsTradingClient
impl Send for BinanceFuturesWsTradingClient
impl Sync for BinanceFuturesWsTradingClient
impl Unpin for BinanceFuturesWsTradingClient
impl UnsafeUnpin for BinanceFuturesWsTradingClient
impl !UnwindSafe for BinanceFuturesWsTradingClient
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
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>
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