pub struct WebsocketApi { /* private fields */ }Implementations§
Source§impl WebsocketApi
impl WebsocketApi
Sourcepub fn subscribe_on_ws_events<F>(&self, callback: F) -> Subscription
pub fn subscribe_on_ws_events<F>(&self, callback: F) -> Subscription
Subscribes to WebSocket events with a provided callback function.
§Arguments
callback- A mutable function that will be called when a WebSocket event is received. The callback takes aWebsocketEventas its parameter.
§Returns
A Subscription that can be used to manage the event subscription.
§Examples
let subscription = websocket_api.subscribe_on_ws_events(|event| {
// Handle WebSocket event
});
Sourcepub fn unsubscribe_from_ws_events(&self, subscription: Subscription)
pub fn unsubscribe_from_ws_events(&self, subscription: Subscription)
Unsubscribes from WebSocket events using the provided Subscription.
§Arguments
subscription- TheSubscriptionto unsubscribe from WebSocket events.
§Examples
let subscription = websocket_api.subscribe_on_ws_events(|event| {
// Handle WebSocket event
});
websocket_api.unsubscribe_from_ws_events(subscription);
Sourcepub async fn disconnect(&self) -> Result<()>
pub async fn disconnect(&self) -> Result<()>
Disconnects the WebSocket connection.
§Returns
A Result indicating whether the disconnection was successful.
Returns an error if the disconnection fails.
§Errors
Returns an anyhow::Error if the connection fails.
§Examples
let result = websocket_api.disconnect().await;
Sourcepub async fn ping_server(&self)
pub async fn ping_server(&self)
Sends a ping message to the WebSocket server to check the connection status.
§Examples
websocket_api.ping_server().await;
This method sends a lightweight ping request to verify the WebSocket connection is still active.
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Checks if the WebSocket connection is currently active.
§Returns
A bool indicating whether the WebSocket connection is established and active.
§Examples
let is_active = websocket_api.is_connected().await;
if is_active {
// WebSocket connection is active
}
This method provides a way to check the current status of the WebSocket connection.
Sourcepub async fn send_message<R: DeserializeOwned + Send + Sync + 'static>(
&self,
method: &str,
payload: BTreeMap<String, Value>,
) -> Result<WebsocketApiResponse<R>, WebsocketError>
pub async fn send_message<R: DeserializeOwned + Send + Sync + 'static>( &self, method: &str, payload: BTreeMap<String, Value>, ) -> Result<WebsocketApiResponse<R>, WebsocketError>
Sends an unsigned WebSocket message with the specified method and payload.
§Type Parameters
R- The response type to deserialize the message into.
§Arguments
method- The WebSocket method to invoke.payload- A map of key-value pairs representing the message payload.
§Returns
A Result containing the deserialized response or a WebsocketError.
§Errors
Returns a WebsocketError if the WebSocket connection fails or the response cannot be deserialized.
§Examples
let response = websocket_api.send_message::method_name”, payload).await;
Sourcepub async fn send_signed_message<R: DeserializeOwned + Send + Sync + 'static>(
&self,
method: &str,
payload: BTreeMap<String, Value>,
) -> Result<WebsocketApiResponse<R>, WebsocketError>
pub async fn send_signed_message<R: DeserializeOwned + Send + Sync + 'static>( &self, method: &str, payload: BTreeMap<String, Value>, ) -> Result<WebsocketApiResponse<R>, WebsocketError>
Sends a signed WebSocket message with the specified method and payload.
§Type Parameters
R- The response type to deserialize the message into.
§Arguments
method- The WebSocket method to invoke.payload- A map of key-value pairs representing the message payload.
§Returns
A Result containing the deserialized response or a WebsocketError.
§Errors
Returns a WebsocketError if the WebSocket connection fails or the response cannot be deserialized.
§Examples
let response = websocket_api.send_signed_message::method_name”, payload).await;
Sourcepub async fn account_commission(
&self,
params: AccountCommissionParams,
) -> Result<WebsocketApiResponse<Box<AccountCommissionResponseResult>>>
pub async fn account_commission( &self, params: AccountCommissionParams, ) -> Result<WebsocketApiResponse<Box<AccountCommissionResponseResult>>>
WebSocket Account Commission Rates
Get current account commission rates. Weight: 20
§Arguments
params:AccountCommissionParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::AccountCommissionResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn account_rate_limits_orders(
&self,
params: AccountRateLimitsOrdersParams,
) -> Result<WebsocketApiResponse<Vec<AccountRateLimitsOrdersResponseResultInner>>>
pub async fn account_rate_limits_orders( &self, params: AccountRateLimitsOrdersParams, ) -> Result<WebsocketApiResponse<Vec<AccountRateLimitsOrdersResponseResultInner>>>
WebSocket Unfilled Order Count
Query your current unfilled order count for all intervals. Weight: 40
§Arguments
params:AccountRateLimitsOrdersParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::AccountRateLimitsOrdersResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn account_status(
&self,
params: AccountStatusParams,
) -> Result<WebsocketApiResponse<Box<AccountStatusResponseResult>>>
pub async fn account_status( &self, params: AccountStatusParams, ) -> Result<WebsocketApiResponse<Box<AccountStatusResponseResult>>>
WebSocket Account information
Query information about your account. Weight: 20
§Arguments
params:AccountStatusParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::AccountStatusResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn all_order_lists(
&self,
params: AllOrderListsParams,
) -> Result<WebsocketApiResponse<Vec<AllOrderListsResponseResultInner>>>
pub async fn all_order_lists( &self, params: AllOrderListsParams, ) -> Result<WebsocketApiResponse<Vec<AllOrderListsResponseResultInner>>>
WebSocket Account order list history
Query information about all your order lists, filtered by time range. Weight: 20
§Arguments
params:AllOrderListsParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::AllOrderListsResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn all_orders(
&self,
params: AllOrdersParams,
) -> Result<WebsocketApiResponse<Vec<AllOrdersResponseResultInner>>>
pub async fn all_orders( &self, params: AllOrdersParams, ) -> Result<WebsocketApiResponse<Vec<AllOrdersResponseResultInner>>>
WebSocket Account order history
Query information about all your orders – active, canceled, filled – filtered by time range. Weight: 20
§Arguments
params:AllOrdersParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::AllOrdersResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn my_allocations(
&self,
params: MyAllocationsParams,
) -> Result<WebsocketApiResponse<Vec<MyAllocationsResponseResultInner>>>
pub async fn my_allocations( &self, params: MyAllocationsParams, ) -> Result<WebsocketApiResponse<Vec<MyAllocationsResponseResultInner>>>
WebSocket Account allocations
Retrieves allocations resulting from SOR order placement. Weight: 20
§Arguments
params:MyAllocationsParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::MyAllocationsResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn my_filters(
&self,
params: MyFiltersParams,
) -> Result<WebsocketApiResponse<Box<MyFiltersResponseResult>>>
pub async fn my_filters( &self, params: MyFiltersParams, ) -> Result<WebsocketApiResponse<Box<MyFiltersResponseResult>>>
WebSocket Query Relevant Filters
Retrieves the list of filters relevant to an account on a given symbol. This is the only method that shows if an account has MAX_ASSET filters applied to it.
Weight: 40
§Arguments
params:MyFiltersParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::MyFiltersResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn my_prevented_matches(
&self,
params: MyPreventedMatchesParams,
) -> Result<WebsocketApiResponse<Vec<MyPreventedMatchesResponseResultInner>>>
pub async fn my_prevented_matches( &self, params: MyPreventedMatchesParams, ) -> Result<WebsocketApiResponse<Vec<MyPreventedMatchesResponseResultInner>>>
WebSocket Account prevented matches
Displays the list of orders that were expired due to STP.
These are the combinations supported:
symbol+preventedMatchIdsymbol+orderIdsymbol+orderId+fromPreventedMatchId(limitwill default to 500)symbol+orderId+fromPreventedMatchId+limitWeight: Case | Weight –– | —– Ifsymbolis invalid | 2 Querying bypreventedMatchId| 2 Querying byorderId| 20
§Arguments
params:MyPreventedMatchesParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::MyPreventedMatchesResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn my_trades(
&self,
params: MyTradesParams,
) -> Result<WebsocketApiResponse<Vec<MyTradesResponseResultInner>>>
pub async fn my_trades( &self, params: MyTradesParams, ) -> Result<WebsocketApiResponse<Vec<MyTradesResponseResultInner>>>
WebSocket Account trade history
Query information about all your trades, filtered by time range. Weight: Condition| Weight| —| — |Without orderId|20| |With orderId|5|
§Arguments
params:MyTradesParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::MyTradesResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn open_order_lists_status(
&self,
params: OpenOrderListsStatusParams,
) -> Result<WebsocketApiResponse<Vec<OpenOrderListsStatusResponseResultInner>>>
pub async fn open_order_lists_status( &self, params: OpenOrderListsStatusParams, ) -> Result<WebsocketApiResponse<Vec<OpenOrderListsStatusResponseResultInner>>>
WebSocket Current open Order lists
Query execution status of all open order lists.
If you need to continuously monitor order status updates, please consider using WebSocket Streams:
userDataStream.startrequestexecutionReportuser data stream event Weight: 6
§Arguments
params:OpenOrderListsStatusParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::OpenOrderListsStatusResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn open_orders_status(
&self,
params: OpenOrdersStatusParams,
) -> Result<WebsocketApiResponse<Vec<OpenOrdersStatusResponseResultInner>>>
pub async fn open_orders_status( &self, params: OpenOrdersStatusParams, ) -> Result<WebsocketApiResponse<Vec<OpenOrdersStatusResponseResultInner>>>
WebSocket Current open orders
Query execution status of all open orders.
If you need to continuously monitor order status updates, please consider using WebSocket Streams:
userDataStream.startrequestexecutionReportuser data stream event Weight: Adjusted based on the number of requested symbols:
| Parameter | Weight |
|---|---|
symbol | 6 |
| none | 80 |
§Arguments
params:OpenOrdersStatusParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::OpenOrdersStatusResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_amendments(
&self,
params: OrderAmendmentsParams,
) -> Result<WebsocketApiResponse<Vec<OrderAmendmentsResponseResultInner>>>
pub async fn order_amendments( &self, params: OrderAmendmentsParams, ) -> Result<WebsocketApiResponse<Vec<OrderAmendmentsResponseResultInner>>>
WebSocket Query Order Amendments
Queries all amendments of a single order. Weight: 4
§Arguments
params:OrderAmendmentsParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::OrderAmendmentsResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_list_status(
&self,
params: OrderListStatusParams,
) -> Result<WebsocketApiResponse<Box<AllOrderListsResponseResultInner>>>
pub async fn order_list_status( &self, params: OrderListStatusParams, ) -> Result<WebsocketApiResponse<Box<AllOrderListsResponseResultInner>>>
WebSocket Query Order list
Check execution status of an Order list.
For execution status of individual orders, use order.status.
Weight: 4
§Arguments
params:OrderListStatusParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::AllOrderListsResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_status(
&self,
params: OrderStatusParams,
) -> Result<WebsocketApiResponse<Box<OrderStatusResponseResult>>>
pub async fn order_status( &self, params: OrderStatusParams, ) -> Result<WebsocketApiResponse<Box<OrderStatusResponseResult>>>
WebSocket Query order
Check execution status of an order. Weight: 4
§Arguments
params:OrderStatusParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderStatusResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn session_logon(
&self,
params: SessionLogonParams,
) -> Result<Vec<WebsocketApiResponse<Box<SessionLogonResponseResult>>>>
pub async fn session_logon( &self, params: SessionLogonParams, ) -> Result<Vec<WebsocketApiResponse<Box<SessionLogonResponseResult>>>>
WebSocket Log in with API key
Authenticate WebSocket connection using the provided API key.
After calling session.logon, you can omit apiKey and signature parameters for future requests that require them.
Note that only one API key can be authenticated.
Calling session.logon multiple times changes the current authenticated API key.
Weight: 2
§Arguments
params:SessionLogonParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::SessionLogonResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn session_logout(
&self,
params: SessionLogoutParams,
) -> Result<Vec<WebsocketApiResponse<Box<SessionLogoutResponseResult>>>>
pub async fn session_logout( &self, params: SessionLogoutParams, ) -> Result<Vec<WebsocketApiResponse<Box<SessionLogoutResponseResult>>>>
WebSocket Log out of the session
Forget the API key previously authenticated. If the connection is not authenticated, this request does nothing.
Note that the WebSocket connection stays open after session.logout request.
You can continue using the connection,
but now you will have to explicitly provide the apiKey and signature parameters where needed.
Weight: 2
§Arguments
params:SessionLogoutParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::SessionLogoutResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn session_status(
&self,
params: SessionStatusParams,
) -> Result<WebsocketApiResponse<Box<SessionStatusResponseResult>>>
pub async fn session_status( &self, params: SessionStatusParams, ) -> Result<WebsocketApiResponse<Box<SessionStatusResponseResult>>>
WebSocket Query session status
Query the status of the WebSocket connection, inspecting which API key (if any) is used to authorize requests. Weight: 2
§Arguments
params:SessionStatusParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::SessionStatusResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn exchange_info(
&self,
params: ExchangeInfoParams,
) -> Result<WebsocketApiResponse<Box<ExchangeInfoResponseResult>>>
pub async fn exchange_info( &self, params: ExchangeInfoParams, ) -> Result<WebsocketApiResponse<Box<ExchangeInfoResponseResult>>>
WebSocket Exchange information
Query current exchange trading rules, rate limits, and symbol information. Weight: 20
§Arguments
params:ExchangeInfoParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::ExchangeInfoResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn execution_rules(
&self,
params: ExecutionRulesParams,
) -> Result<WebsocketApiResponse<Box<ExecutionRulesResponseResult>>>
pub async fn execution_rules( &self, params: ExecutionRulesParams, ) -> Result<WebsocketApiResponse<Box<ExecutionRulesResponseResult>>>
WebSocket Query Execution Rules
| Weight: Parameter | Weight |
|---|---|
symbol | 2 |
symbols | 2 for each symbol, capped at a max of 40 |
symbolStatus | 40 |
| None | 40 |
§Arguments
params:ExecutionRulesParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::ExecutionRulesResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn ping(
&self,
params: PingParams,
) -> Result<WebsocketApiResponse<Value>>
pub async fn ping( &self, params: PingParams, ) -> Result<WebsocketApiResponse<Value>>
WebSocket Test connectivity
Test connectivity to the WebSocket API. Weight: 1
§Arguments
params:PingParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<serde_json::Value> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn time(
&self,
params: TimeParams,
) -> Result<WebsocketApiResponse<Box<TimeResponseResult>>>
pub async fn time( &self, params: TimeParams, ) -> Result<WebsocketApiResponse<Box<TimeResponseResult>>>
WebSocket Check server time
Test connectivity to the WebSocket API and get the current server time. Weight: 1
§Arguments
params:TimeParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::TimeResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn avg_price(
&self,
params: AvgPriceParams,
) -> Result<WebsocketApiResponse<Box<AvgPriceResponseResult>>>
pub async fn avg_price( &self, params: AvgPriceParams, ) -> Result<WebsocketApiResponse<Box<AvgPriceResponseResult>>>
WebSocket Current average price
Get current average price for a symbol. Weight: 2
§Arguments
params:AvgPriceParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::AvgPriceResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn block_trades_historical(
&self,
params: BlockTradesHistoricalParams,
) -> Result<WebsocketApiResponse<Vec<BlockTradesHistoricalResponseResultInner>>>
pub async fn block_trades_historical( &self, params: BlockTradesHistoricalParams, ) -> Result<WebsocketApiResponse<Vec<BlockTradesHistoricalResponseResultInner>>>
WebSocket Historical Block Trades
Get block trades. Weight: 25
§Arguments
params:BlockTradesHistoricalParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::BlockTradesHistoricalResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn depth(
&self,
params: DepthParams,
) -> Result<WebsocketApiResponse<Box<DepthResponseResult>>>
pub async fn depth( &self, params: DepthParams, ) -> Result<WebsocketApiResponse<Box<DepthResponseResult>>>
WebSocket Order book
Get current order book.
Note that this request returns limited market depth.
If you need to continuously monitor order book updates, please consider using WebSocket Streams:
<symbol>@depth<levels><symbol>@depth
You can use depth request together with <symbol>@depth streams to maintain a local order book.
Weight: Adjusted based on the limit:
| Limit | Weight |
|---|---|
| 1–100 | 5 |
| 101–500 | 25 |
| 501–1000 | 50 |
| 1001–5000 | 250 |
§Arguments
params:DepthParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::DepthResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn klines(
&self,
params: KlinesParams,
) -> Result<WebsocketApiResponse<Vec<Vec<KlinesItemInner>>>>
pub async fn klines( &self, params: KlinesParams, ) -> Result<WebsocketApiResponse<Vec<Vec<KlinesItemInner>>>>
WebSocket Klines
Get klines (candlestick bars).
Klines are uniquely identified by their open & close time.
If you need access to real-time kline updates, please consider using WebSocket Streams:
<symbol>@kline_<interval>
If you need historical kline data, please consider using data.binance.vision. Weight: 2
§Arguments
params:KlinesParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<Vec<models::KlinesItemInner>>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn reference_price(
&self,
params: ReferencePriceParams,
) -> Result<WebsocketApiResponse<Box<ReferencePriceResponseResult>>>
pub async fn reference_price( &self, params: ReferencePriceParams, ) -> Result<WebsocketApiResponse<Box<ReferencePriceResponseResult>>>
WebSocket Query Reference Price
Weight: 2
§Arguments
params:ReferencePriceParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::ReferencePriceResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn reference_price_calculation(
&self,
params: ReferencePriceCalculationParams,
) -> Result<WebsocketApiResponse<Box<ReferencePriceCalculationResponseResult>>>
pub async fn reference_price_calculation( &self, params: ReferencePriceCalculationParams, ) -> Result<WebsocketApiResponse<Box<ReferencePriceCalculationResponseResult>>>
WebSocket Query Reference Price Calculation
Describes how reference price is calculated for a given symbol. Weight: 2
§Arguments
params:ReferencePriceCalculationParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::ReferencePriceCalculationResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn ticker(
&self,
params: TickerParams,
) -> Result<WebsocketApiResponse<TickerResponse>>
pub async fn ticker( &self, params: TickerParams, ) -> Result<WebsocketApiResponse<TickerResponse>>
WebSocket Rolling window price change statistics
Get rolling window price change statistics with a custom window.
This request is similar to ticker.24hr,
but statistics are computed on demand using the arbitrary window you specify.
Weight: Adjusted based on the number of requested symbols:
| Symbols | Weight |
|---|---|
| 1–50 | 4 per symbol |
| 51–100 | 200 |
§Arguments
params:TickerParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<models::TickerResponse> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn ticker24hr(
&self,
params: Ticker24hrParams,
) -> Result<WebsocketApiResponse<Ticker24hrResponse>>
pub async fn ticker24hr( &self, params: Ticker24hrParams, ) -> Result<WebsocketApiResponse<Ticker24hrResponse>>
WebSocket 24hr ticker price change statistics
Get 24-hour rolling window price change statistics.
If you need to continuously monitor trading statistics, please consider using WebSocket Streams:
<symbol>@tickeror!ticker@arr<symbol>@miniTickeror!miniTicker@arr
If you need different window sizes,
use the ticker request.
Weight: Adjusted based on the number of requested symbols:
| Symbols | Weight |
|---|---|
| 1–20 | 2 |
| 21–100 | 40 |
| 101 or more | 80 |
| all symbols | 80 |
§Arguments
params:Ticker24hrParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<models::Ticker24hrResponse> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn ticker_book(
&self,
params: TickerBookParams,
) -> Result<WebsocketApiResponse<TickerBookResponse>>
pub async fn ticker_book( &self, params: TickerBookParams, ) -> Result<WebsocketApiResponse<TickerBookResponse>>
WebSocket Symbol order book ticker
Get the current best price and quantity on the order book.
If you need access to real-time order book ticker updates, please consider using WebSocket Streams:
<symbol>@bookTickerWeight: Adjusted based on the number of requested symbols:
| Parameter | Weight |
|---|---|
symbol | 2 |
symbols | 4 |
| none | 4 |
§Arguments
params:TickerBookParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<models::TickerBookResponse> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn ticker_price(
&self,
params: TickerPriceParams,
) -> Result<WebsocketApiResponse<TickerPriceResponse>>
pub async fn ticker_price( &self, params: TickerPriceParams, ) -> Result<WebsocketApiResponse<TickerPriceResponse>>
WebSocket Symbol price ticker
Get the latest market price for a symbol.
If you need access to real-time price updates, please consider using WebSocket Streams:
<symbol>@aggTrade<symbol>@tradeWeight: Adjusted based on the number of requested symbols:
| Parameter | Weight |
|---|---|
symbol | 2 |
symbols | 4 |
| none | 4 |
§Arguments
params:TickerPriceParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<models::TickerPriceResponse> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn ticker_trading_day(
&self,
params: TickerTradingDayParams,
) -> Result<WebsocketApiResponse<Vec<TickerTradingDayResponseResultInner>>>
pub async fn ticker_trading_day( &self, params: TickerTradingDayParams, ) -> Result<WebsocketApiResponse<Vec<TickerTradingDayResponseResultInner>>>
WebSocket Trading Day Ticker
Price change statistics for a trading day.
Weight: 4 for each requested symbol.
The weight for this request will cap at 200 once the number of symbols in the request is more than 50.
§Arguments
params:TickerTradingDayParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::TickerTradingDayResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn trades_aggregate(
&self,
params: TradesAggregateParams,
) -> Result<WebsocketApiResponse<Vec<TradesAggregateResponseResultInner>>>
pub async fn trades_aggregate( &self, params: TradesAggregateParams, ) -> Result<WebsocketApiResponse<Vec<TradesAggregateResponseResultInner>>>
WebSocket Aggregate trades
Get aggregate trades.
An aggregate trade (aggtrade) represents one or more individual trades. Trades that fill at the same time, from the same taker order, with the same price – those trades are collected into an aggregate trade with total quantity of the individual trades.
If you need access to real-time trading activity, please consider using WebSocket Streams:
<symbol>@aggTrade
If you need historical aggregate trade data, please consider using data.binance.vision. Weight: 4
§Arguments
params:TradesAggregateParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::TradesAggregateResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn trades_historical(
&self,
params: TradesHistoricalParams,
) -> Result<WebsocketApiResponse<Vec<TradesHistoricalResponseResultInner>>>
pub async fn trades_historical( &self, params: TradesHistoricalParams, ) -> Result<WebsocketApiResponse<Vec<TradesHistoricalResponseResultInner>>>
WebSocket Historical trades
Get historical trades. Weight: 25
§Arguments
params:TradesHistoricalParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::TradesHistoricalResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn trades_recent(
&self,
params: TradesRecentParams,
) -> Result<WebsocketApiResponse<Vec<TradesRecentResponseResultInner>>>
pub async fn trades_recent( &self, params: TradesRecentParams, ) -> Result<WebsocketApiResponse<Vec<TradesRecentResponseResultInner>>>
WebSocket Recent trades
Get recent trades.
If you need access to real-time trading activity, please consider using WebSocket Streams:
<symbol>@tradeWeight: 25
§Arguments
params:TradesRecentParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::TradesRecentResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn ui_klines(
&self,
params: UiKlinesParams,
) -> Result<WebsocketApiResponse<Vec<Vec<KlinesItemInner>>>>
pub async fn ui_klines( &self, params: UiKlinesParams, ) -> Result<WebsocketApiResponse<Vec<Vec<KlinesItemInner>>>>
WebSocket UI Klines
Get klines (candlestick bars) optimized for presentation.
This request is similar to klines, having the same parameters and response.
uiKlines return modified kline data, optimized for presentation of candlestick charts.
Weight: 2
§Arguments
params:UiKlinesParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<Vec<models::KlinesItemInner>>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn open_orders_cancel_all(
&self,
params: OpenOrdersCancelAllParams,
) -> Result<WebsocketApiResponse<Vec<OpenOrdersCancelAllResponseResultInner>>>
pub async fn open_orders_cancel_all( &self, params: OpenOrdersCancelAllParams, ) -> Result<WebsocketApiResponse<Vec<OpenOrdersCancelAllResponseResultInner>>>
WebSocket Cancel open orders
Cancel all open orders on a symbol. This includes orders that are part of an order list. Weight: 1
§Arguments
params:OpenOrdersCancelAllParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::OpenOrdersCancelAllResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_amend_keep_priority(
&self,
params: OrderAmendKeepPriorityParams,
) -> Result<WebsocketApiResponse<Box<OrderAmendKeepPriorityResponseResult>>>
pub async fn order_amend_keep_priority( &self, params: OrderAmendKeepPriorityParams, ) -> Result<WebsocketApiResponse<Box<OrderAmendKeepPriorityResponseResult>>>
WebSocket Order Amend Keep Priority
Reduce the quantity of an existing open order.
This adds 0 orders to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.
Read Order Amend Keep Priority FAQ to learn more. Weight: 4
§Arguments
params:OrderAmendKeepPriorityParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderAmendKeepPriorityResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_cancel(
&self,
params: OrderCancelParams,
) -> Result<WebsocketApiResponse<Box<OrderCancelResponseResult>>>
pub async fn order_cancel( &self, params: OrderCancelParams, ) -> Result<WebsocketApiResponse<Box<OrderCancelResponseResult>>>
WebSocket Cancel order
Cancel an active order. Weight: 1
§Arguments
params:OrderCancelParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderCancelResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_cancel_replace(
&self,
params: OrderCancelReplaceParams,
) -> Result<WebsocketApiResponse<Box<OrderCancelReplaceResponseResult>>>
pub async fn order_cancel_replace( &self, params: OrderCancelReplaceParams, ) -> Result<WebsocketApiResponse<Box<OrderCancelReplaceResponseResult>>>
WebSocket Cancel and replace order
- Cancel an existing order and immediately place a new order instead of the canceled one.
- A new order that was not attempted (i.e. when
newOrderResult: NOT_ATTEMPTED), will still increase the unfilled order count by 1. - You can only cancel an individual order from an orderList using this method, but the result is the same as canceling the entire orderList. Weight: 1
§Arguments
params:OrderCancelReplaceParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderCancelReplaceResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_list_cancel(
&self,
params: OrderListCancelParams,
) -> Result<WebsocketApiResponse<Box<OrderListCancelResponseResult>>>
pub async fn order_list_cancel( &self, params: OrderListCancelParams, ) -> Result<WebsocketApiResponse<Box<OrderListCancelResponseResult>>>
WebSocket Cancel Order list
Cancel an active order list. Weight: 1
§Arguments
params:OrderListCancelParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderListCancelResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_list_place(
&self,
params: OrderListPlaceParams,
) -> Result<WebsocketApiResponse<Box<OrderListPlaceResponseResult>>>
👎Deprecated
pub async fn order_list_place( &self, params: OrderListPlaceParams, ) -> Result<WebsocketApiResponse<Box<OrderListPlaceResponseResult>>>
WebSocket Place new OCO - Deprecated
Send in a new one-cancels-the-other (OCO) pair:
LIMIT_MAKER + STOP_LOSS/STOP_LOSS_LIMIT orders (called legs),
where activation of one order immediately cancels the other.
This adds 1 order to EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter
Weight: 1
Unfilled Order Count: 1
§Arguments
params:OrderListPlaceParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderListPlaceResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
§Deprecation
Deprecated: This method may be removed in a future version.
Sourcepub async fn order_list_place_oco(
&self,
params: OrderListPlaceOcoParams,
) -> Result<WebsocketApiResponse<Box<OrderListPlaceOcoResponseResult>>>
pub async fn order_list_place_oco( &self, params: OrderListPlaceOcoParams, ) -> Result<WebsocketApiResponse<Box<OrderListPlaceOcoResponseResult>>>
WebSocket Place new Order list - OCO
Send in an one-cancels-the-other (OCO) pair, where activation of one order immediately cancels the other.
- An OCO has 2 orders called the above order and below order.
- One of the orders must be a
LIMIT_MAKER/TAKE_PROFIT/TAKE_PROFIT_LIMITorder and the other must beSTOP_LOSSorSTOP_LOSS_LIMITorder. - Price restrictions:
- If the OCO is on the
SELLside: LIMIT_MAKER/TAKE_PROFIT_LIMITprice> Last Traded Price >STOP_LOSS/STOP_LOSS_LIMITstopPriceTAKE_PROFIT stopPrice> Last Traded Price >STOP_LOSS/STOP_LOSS_LIMIT stopPrice- If the OCO is on the
BUYside: LIMIT_MAKERprice< Last Traded Price <STOP_LOSS/STOP_LOSS_LIMITstopPriceTAKE_PROFIT stopPrice> Last Traded Price >STOP_LOSS/STOP_LOSS_LIMIT stopPrice- OCOs add 2 orders to the
EXCHANGE_MAX_ORDERSfilter andMAX_NUM_ORDERSfilter. Weight: 1
Unfilled Order Count: 2
§Arguments
params:OrderListPlaceOcoParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderListPlaceOcoResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_list_place_opo(
&self,
params: OrderListPlaceOpoParams,
) -> Result<WebsocketApiResponse<Box<OrderListPlaceOpoResponseResult>>>
pub async fn order_list_place_opo( &self, params: OrderListPlaceOpoParams, ) -> Result<WebsocketApiResponse<Box<OrderListPlaceOpoResponseResult>>>
WebSocket OPO
Place an OPO.
- OPOs add 2 orders to the
EXCHANGE_MAX_NUM_ORDERSfilter andMAX_NUM_ORDERSfilter. Weight: 1
Unfilled Order Count: 2
§Arguments
params:OrderListPlaceOpoParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderListPlaceOpoResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_list_place_opoco(
&self,
params: OrderListPlaceOpocoParams,
) -> Result<WebsocketApiResponse<Box<OrderListPlaceOpocoResponseResult>>>
pub async fn order_list_place_opoco( &self, params: OrderListPlaceOpocoParams, ) -> Result<WebsocketApiResponse<Box<OrderListPlaceOpocoResponseResult>>>
WebSocket OPOCO
Place an OPOCO. Weight: 1
Unfilled Order Count: 3
§Arguments
params:OrderListPlaceOpocoParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderListPlaceOpocoResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_list_place_oto(
&self,
params: OrderListPlaceOtoParams,
) -> Result<WebsocketApiResponse<Box<OrderListPlaceOtoResponseResult>>>
pub async fn order_list_place_oto( &self, params: OrderListPlaceOtoParams, ) -> Result<WebsocketApiResponse<Box<OrderListPlaceOtoResponseResult>>>
WebSocket Place new Order list - OTO
Places an OTO.
- An OTO (One-Triggers-the-Other) is an order list comprised of 2 orders.
- The first order is called the working order and must be
LIMITorLIMIT_MAKER. Initially, only the working order goes on the order book. - The second order is called the pending order. It can be any order type except for
MARKETorders using parameterquoteOrderQty. The pending order is only placed on the order book when the working order gets fully filled. - If either the working order or the pending order is cancelled individually, the other order in the order list will also be canceled or expired.
- When the order list is placed, if the working order gets immediately fully filled, the placement response will show the working order as
FILLEDbut the pending order will still appear asPENDING_NEW. You need to query the status of the pending order again to see its updated status. - OTOs add 2 orders to the
EXCHANGE_MAX_NUM_ORDERSfilter andMAX_NUM_ORDERSfilter. Weight: 1
Unfilled Order Count: 2
§Arguments
params:OrderListPlaceOtoParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderListPlaceOtoResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_list_place_otoco(
&self,
params: OrderListPlaceOtocoParams,
) -> Result<WebsocketApiResponse<Box<OrderListPlaceOtocoResponseResult>>>
pub async fn order_list_place_otoco( &self, params: OrderListPlaceOtocoParams, ) -> Result<WebsocketApiResponse<Box<OrderListPlaceOtocoResponseResult>>>
WebSocket Place new Order list - OTOCO
Place an OTOCO.
- An OTOCO (One-Triggers-One-Cancels-the-Other) is an order list comprised of 3 orders.
- The first order is called the working order and must be
LIMITorLIMIT_MAKER. Initially, only the working order goes on the order book. - The behavior of the working order is the same as the OTO.
- OTOCO has 2 pending orders (pending above and pending below), forming an OCO pair. The pending orders are only placed on the order book when the working order gets fully filled.
- The rules of the pending above and pending below follow the same rules as the Order list OCO.
- OTOCOs add 3 orders to the
EXCHANGE_MAX_NUM_ORDERSfilter andMAX_NUM_ORDERSfilter. Weight: 1
Unfilled Order Count: 3
§Arguments
params:OrderListPlaceOtocoParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderListPlaceOtocoResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_place(
&self,
params: OrderPlaceParams,
) -> Result<WebsocketApiResponse<Box<OrderPlaceResponseResult>>>
pub async fn order_place( &self, params: OrderPlaceParams, ) -> Result<WebsocketApiResponse<Box<OrderPlaceResponseResult>>>
WebSocket Place new order
Send in a new order.
This adds 1 order to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.
Weight: 1
§Arguments
params:OrderPlaceParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderPlaceResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn order_test(
&self,
params: OrderTestParams,
) -> Result<WebsocketApiResponse<Box<OrderTestResponseResult>>>
pub async fn order_test( &self, params: OrderTestParams, ) -> Result<WebsocketApiResponse<Box<OrderTestResponseResult>>>
WebSocket Test new order
Test order placement.
Validates new order parameters and verifies your signature
but does not send the order into the matching engine.
Weight: |Condition| Request Weight|
|———— | ———— |
|Without computeCommissionRates| 1|
|With computeCommissionRates|20|
§Arguments
params:OrderTestParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::OrderTestResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn sor_order_place(
&self,
params: SorOrderPlaceParams,
) -> Result<WebsocketApiResponse<Vec<SorOrderPlaceResponseResultInner>>>
pub async fn sor_order_place( &self, params: SorOrderPlaceParams, ) -> Result<WebsocketApiResponse<Vec<SorOrderPlaceResponseResultInner>>>
WebSocket Place new order using SOR
Places an order using smart order routing (SOR).
This adds 1 order to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.
Read SOR FAQ to learn more. Weight: 1
Unfilled Order Count: 1
§Arguments
params:SorOrderPlaceParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::SorOrderPlaceResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn sor_order_test(
&self,
params: SorOrderTestParams,
) -> Result<WebsocketApiResponse<Box<SorOrderTestResponseResult>>>
pub async fn sor_order_test( &self, params: SorOrderTestParams, ) -> Result<WebsocketApiResponse<Box<SorOrderTestResponseResult>>>
WebSocket Test new order using SOR
Test new order creation and signature/recvWindow using smart order routing (SOR).
Creates and validates a new order but does not send it into the matching engine.
Weight: |Condition | Request Weight|
|———— | ———— |
|Without computeCommissionRates| 1 |
|With computeCommissionRates |20 |
§Arguments
params:SorOrderTestParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::SorOrderTestResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn session_subscriptions(
&self,
params: SessionSubscriptionsParams,
) -> Result<WebsocketApiResponse<Vec<SessionSubscriptionsResponseResultInner>>>
pub async fn session_subscriptions( &self, params: SessionSubscriptionsParams, ) -> Result<WebsocketApiResponse<Vec<SessionSubscriptionsResponseResultInner>>>
WebSocket Listing all subscriptions
Weight: 2
Data Source: Memory
§Arguments
params:SessionSubscriptionsParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Vec<models::SessionSubscriptionsResponseResultInner>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn user_data_stream_subscribe(
&self,
params: UserDataStreamSubscribeParams,
) -> Result<(WebsocketApiResponse<Box<UserDataStreamSubscribeResponseResult>>, Arc<WebsocketStream<UserDataStreamEventsResponse>>)>
pub async fn user_data_stream_subscribe( &self, params: UserDataStreamSubscribeParams, ) -> Result<(WebsocketApiResponse<Box<UserDataStreamSubscribeResponseResult>>, Arc<WebsocketStream<UserDataStreamEventsResponse>>)>
WebSocket Subscribe to User Data Stream
Subscribe to the User Data Stream in the current WebSocket connection. Weight: 2
§Arguments
params:UserDataStreamSubscribeParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::UserDataStreamSubscribeResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn user_data_stream_subscribe_signature(
&self,
params: UserDataStreamSubscribeSignatureParams,
) -> Result<(WebsocketApiResponse<Box<UserDataStreamSubscribeResponseResult>>, Arc<WebsocketStream<UserDataStreamEventsResponse>>)>
pub async fn user_data_stream_subscribe_signature( &self, params: UserDataStreamSubscribeSignatureParams, ) -> Result<(WebsocketApiResponse<Box<UserDataStreamSubscribeResponseResult>>, Arc<WebsocketStream<UserDataStreamEventsResponse>>)>
WebSocket Subscribe to User Data Stream through signature subscription
Weight: 2
§Arguments
params:UserDataStreamSubscribeSignatureParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<Box<models::UserDataStreamSubscribeResponseResult>> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Sourcepub async fn user_data_stream_unsubscribe(
&self,
params: UserDataStreamUnsubscribeParams,
) -> Result<WebsocketApiResponse<Value>>
pub async fn user_data_stream_unsubscribe( &self, params: UserDataStreamUnsubscribeParams, ) -> Result<WebsocketApiResponse<Value>>
WebSocket Unsubscribe from User Data Stream
Stop listening to the User Data Stream in the current WebSocket connection.
Note that session.logout will only close the subscription created with userDataStream.subscribe but not subscriptions opened with userDataStream.subscribe.signature.
Weight: 2
§Arguments
params:UserDataStreamUnsubscribeParamsThe parameters for this operation.
§Returns
WebsocketApiResponse<serde_json::Value> on success.
§Errors
Returns an anyhow::Error if the WebSocket request fails, if parameters are invalid, or if parsing the response fails.
For full API details, see the Binance API Documentation.
Trait Implementations§
Source§impl Clone for WebsocketApi
impl Clone for WebsocketApi
Source§fn clone(&self) -> WebsocketApi
fn clone(&self) -> WebsocketApi
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more