pub struct RestApi { /* private fields */ }Implementations§
Source§impl RestApi
impl RestApi
pub fn new(configuration: ConfigurationRestApi) -> Self
Sourcepub async fn send_request<R: DeserializeOwned + Send + 'static>(
&self,
endpoint: &str,
method: Method,
query_params: BTreeMap<String, Value>,
body_params: BTreeMap<String, Value>,
) -> Result<RestApiResponse<R>>
pub async fn send_request<R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, method: Method, query_params: BTreeMap<String, Value>, body_params: BTreeMap<String, Value>, ) -> Result<RestApiResponse<R>>
Send an unsigned request to the API
§Arguments
endpoint- The API endpoint to send the request tomethod- The HTTP method to use for the requestquery_params- A map of query parameters to send with the requestbody_params- A map of body parameters to send with the request
§Returns
A RestApiResponse containing the deserialized response data on success, or an error if the request fails
§Errors
Returns an anyhow::Error if the HTTP request fails or if parsing the response fails
Sourcepub async fn send_signed_request<R: DeserializeOwned + Send + 'static>(
&self,
endpoint: &str,
method: Method,
query_params: BTreeMap<String, Value>,
body_params: BTreeMap<String, Value>,
) -> Result<RestApiResponse<R>>
pub async fn send_signed_request<R: DeserializeOwned + Send + 'static>( &self, endpoint: &str, method: Method, query_params: BTreeMap<String, Value>, body_params: BTreeMap<String, Value>, ) -> Result<RestApiResponse<R>>
Send a signed request to the API
§Arguments
endpoint- The API endpoint to send the request tomethod- The HTTP method to use for the requestquery_params- A map of query parameters to send with the requestbody_params- A map of body parameters to send with the request
§Returns
A RestApiResponse containing the deserialized response data on success, or an error if the request fails
§Errors
Returns an anyhow::Error if the HTTP request fails or if parsing the response fails
Sourcepub async fn list_all_convert_pairs(
&self,
params: ListAllConvertPairsParams,
) -> Result<RestApiResponse<Vec<ListAllConvertPairsResponseInner>>>
pub async fn list_all_convert_pairs( &self, params: ListAllConvertPairsParams, ) -> Result<RestApiResponse<Vec<ListAllConvertPairsResponseInner>>>
List All Convert Pairs
Query for all convertible token pairs and the tokens’ respective upper/lower limits
Weight(IP): 3000
Notes:
- User needs to supply either or both input parameters.
- If only one of
fromAssetandtoAssetis provided, only partial token pairs are returned.
§Arguments
params:ListAllConvertPairsParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::ListAllConvertPairsResponseInner>> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn query_order_quantity_precision_per_asset(
&self,
params: QueryOrderQuantityPrecisionPerAssetParams,
) -> Result<RestApiResponse<Vec<QueryOrderQuantityPrecisionPerAssetResponseInner>>>
pub async fn query_order_quantity_precision_per_asset( &self, params: QueryOrderQuantityPrecisionPerAssetParams, ) -> Result<RestApiResponse<Vec<QueryOrderQuantityPrecisionPerAssetResponseInner>>>
Query order quantity precision per asset (USER_DATA)
Query for supported asset’s precision information
Weight(IP): 100
Security Type: USER_DATA
§Arguments
params:QueryOrderQuantityPrecisionPerAssetParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryOrderQuantityPrecisionPerAssetResponseInner>> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn accept_quote(
&self,
params: AcceptQuoteParams,
) -> Result<RestApiResponse<AcceptQuoteResponse>>
pub async fn accept_quote( &self, params: AcceptQuoteParams, ) -> Result<RestApiResponse<AcceptQuoteResponse>>
Accept Quote (TRADE)
Accept the offered quote by quote ID.
Weight(UID): 500
Security Type: TRADE
§Arguments
params:AcceptQuoteParamsThe parameters for this operation.
§Returns
RestApiResponse<models::AcceptQuoteResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn cancel_limit_order(
&self,
params: CancelLimitOrderParams,
) -> Result<RestApiResponse<CancelLimitOrderResponse>>
pub async fn cancel_limit_order( &self, params: CancelLimitOrderParams, ) -> Result<RestApiResponse<CancelLimitOrderResponse>>
Cancel limit order (TRADE)
Enable users to cancel a limit order
Weight(UID): 200
Security Type: TRADE
§Arguments
params:CancelLimitOrderParamsThe parameters for this operation.
§Returns
RestApiResponse<models::CancelLimitOrderResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn get_convert_trade_history(
&self,
params: GetConvertTradeHistoryParams,
) -> Result<RestApiResponse<GetConvertTradeHistoryResponse>>
pub async fn get_convert_trade_history( &self, params: GetConvertTradeHistoryParams, ) -> Result<RestApiResponse<GetConvertTradeHistoryResponse>>
Get Convert Trade History (USER_DATA)
Get Convert Trade History
Weight(UID): 3000
Security Type: USER_DATA
Notes:
- The max interval between
startTimeandendTimeis 30 days.
§Arguments
params:GetConvertTradeHistoryParamsThe parameters for this operation.
§Returns
RestApiResponse<models::GetConvertTradeHistoryResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn order_status(
&self,
params: OrderStatusParams,
) -> Result<RestApiResponse<OrderStatusResponse>>
pub async fn order_status( &self, params: OrderStatusParams, ) -> Result<RestApiResponse<OrderStatusResponse>>
Order status (USER_DATA)
Query order status by order ID.
Weight(UID): 100
Security Type: USER_DATA
§Arguments
params:OrderStatusParamsThe parameters for this operation.
§Returns
RestApiResponse<models::OrderStatusResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn place_limit_order(
&self,
params: PlaceLimitOrderParams,
) -> Result<RestApiResponse<PlaceLimitOrderResponse>>
pub async fn place_limit_order( &self, params: PlaceLimitOrderParams, ) -> Result<RestApiResponse<PlaceLimitOrderResponse>>
Place limit order (TRADE)
Enable users to place a limit order
Weight(UID): 500
Security Type: TRADE
Notes:
baseAssetandquoteAssetcan be determined via theexchangeInfoendpoint.- Limit price is defined from
baseAssettoquoteAsset. - Exactly one of
baseAmountorquoteAmountshould be sent.
§Arguments
params:PlaceLimitOrderParamsThe parameters for this operation.
§Returns
RestApiResponse<models::PlaceLimitOrderResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn query_limit_open_orders(
&self,
params: QueryLimitOpenOrdersParams,
) -> Result<RestApiResponse<QueryLimitOpenOrdersResponse>>
pub async fn query_limit_open_orders( &self, params: QueryLimitOpenOrdersParams, ) -> Result<RestApiResponse<QueryLimitOpenOrdersResponse>>
Query limit open orders (USER_DATA)
Query current open limit orders
Weight(UID): 3000
Security Type: USER_DATA
§Arguments
params:QueryLimitOpenOrdersParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryLimitOpenOrdersResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.
Sourcepub async fn send_quote_request(
&self,
params: SendQuoteRequestParams,
) -> Result<RestApiResponse<SendQuoteRequestResponse>>
pub async fn send_quote_request( &self, params: SendQuoteRequestParams, ) -> Result<RestApiResponse<SendQuoteRequestResponse>>
Send Quote Request (TRADE)
Request a quote for the requested token pairs
Weight(UID): 200
Security Type: TRADE
Notes:
- Either
fromAmountortoAmountshould be sent. quoteIdis returned only if you have enough funds to convert.
§Arguments
params:SendQuoteRequestParamsThe parameters for this operation.
§Returns
RestApiResponse<models::SendQuoteRequestResponse> on success.
§Errors
This function will return an anyhow::Error if:
- the HTTP request fails
- any parameter is invalid
- the response cannot be parsed
- or one of the following occurs:
RequiredErrorConnectorClientErrorUnauthorizedErrorForbiddenErrorTooManyRequestsErrorRateLimitBanErrorServerErrorNotFoundErrorNetworkErrorBadRequestError
For full API details, see the Binance API Documentation.