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
- User needs to supply either or both of the input parameter
- If not defined for both fromAsset and toAsset, only partial token pairs will be returned
Weight: 3000(IP)
§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: 100(IP)
§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: 500(UID)
§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 (USER_DATA)
Enable users to cancel a limit order
Weight: 200(UID)
§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
- The max interval between startTime and endTime is 30 days.
Weight: 3000
§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: 100(UID)
§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 (USER_DATA)
Enable users to place a limit order
baseAssetorquoteAssetcan be determined viaexchangeInfoendpoint.- Limit price is defined from
baseAssettoquoteAsset. - Either
baseAmountorquoteAmountis used.
Weight: 500(UID)
§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)
Request a quote for the requested token pairs
Weight: 3000(UID)
§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(USER_DATA)
Request a quote for the requested token pairs
- Either fromAmount or toAmount should be sent
quoteIdwill be returned only if you have enough funds to convert
Weight: 200(UID)
§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.