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 adjust_cross_margin_max_leverage(
&self,
params: AdjustCrossMarginMaxLeverageParams,
) -> Result<RestApiResponse<AdjustCrossMarginMaxLeverageResponse>>
pub async fn adjust_cross_margin_max_leverage( &self, params: AdjustCrossMarginMaxLeverageParams, ) -> Result<RestApiResponse<AdjustCrossMarginMaxLeverageResponse>>
Adjust cross margin max leverage (USER_DATA)
Adjust cross margin max leverage
Weight(UID): 3000, 1 times/min per IP
Security Type: USER_DATA
Notes:
- The margin level need higher than the initial risk ratio of adjusted leverage, the initial risk ratio of 3x is 1.5 , the initial risk ratio of 5x is 1.25; The detail conditions on how to switch between Cross Margin Classic and Cross Margin Pro can refer to the FAQ.
§Arguments
params:AdjustCrossMarginMaxLeverageParamsThe parameters for this operation.
§Returns
RestApiResponse<models::AdjustCrossMarginMaxLeverageResponse> 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 disable_isolated_margin_account(
&self,
params: DisableIsolatedMarginAccountParams,
) -> Result<RestApiResponse<DisableIsolatedMarginAccountResponse>>
pub async fn disable_isolated_margin_account( &self, params: DisableIsolatedMarginAccountParams, ) -> Result<RestApiResponse<DisableIsolatedMarginAccountResponse>>
Disable Isolated Margin Account (TRADE)
Disable isolated margin account for a specific symbol. Each trading pair can only be deactivated once every 24 hours.
Weight(UID): 300
Security Type: TRADE
§Arguments
params:DisableIsolatedMarginAccountParamsThe parameters for this operation.
§Returns
RestApiResponse<models::DisableIsolatedMarginAccountResponse> 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 enable_isolated_margin_account(
&self,
params: EnableIsolatedMarginAccountParams,
) -> Result<RestApiResponse<EnableIsolatedMarginAccountResponse>>
pub async fn enable_isolated_margin_account( &self, params: EnableIsolatedMarginAccountParams, ) -> Result<RestApiResponse<EnableIsolatedMarginAccountResponse>>
Enable Isolated Margin Account (TRADE)
Enable isolated margin account for a specific symbol(Only supports activation of previously disabled accounts).
Weight(UID): 300
Security Type: TRADE
§Arguments
params:EnableIsolatedMarginAccountParamsThe parameters for this operation.
§Returns
RestApiResponse<models::EnableIsolatedMarginAccountResponse> 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_bnb_burn_status(
&self,
params: GetBnbBurnStatusParams,
) -> Result<RestApiResponse<GetBnbBurnStatusResponse>>
pub async fn get_bnb_burn_status( &self, params: GetBnbBurnStatusParams, ) -> Result<RestApiResponse<GetBnbBurnStatusResponse>>
Get BNB Burn Status (USER_DATA)
Get BNB Burn Status
Weight(IP): 1
Security Type: USER_DATA
§Arguments
params:GetBnbBurnStatusParamsThe parameters for this operation.
§Returns
RestApiResponse<models::GetBnbBurnStatusResponse> 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_summary_of_margin_account(
&self,
params: GetSummaryOfMarginAccountParams,
) -> Result<RestApiResponse<GetSummaryOfMarginAccountResponse>>
pub async fn get_summary_of_margin_account( &self, params: GetSummaryOfMarginAccountParams, ) -> Result<RestApiResponse<GetSummaryOfMarginAccountResponse>>
Get Summary of Margin account (USER_DATA)
Get personal margin level information
Weight(IP): 10
Security Type: USER_DATA
§Arguments
params:GetSummaryOfMarginAccountParamsThe parameters for this operation.
§Returns
RestApiResponse<models::GetSummaryOfMarginAccountResponse> 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_cross_isolated_margin_capital_flow(
&self,
params: QueryCrossIsolatedMarginCapitalFlowParams,
) -> Result<RestApiResponse<Vec<QueryCrossIsolatedMarginCapitalFlowResponseInner>>>
pub async fn query_cross_isolated_margin_capital_flow( &self, params: QueryCrossIsolatedMarginCapitalFlowParams, ) -> Result<RestApiResponse<Vec<QueryCrossIsolatedMarginCapitalFlowResponseInner>>>
Query Cross Isolated Margin Capital Flow (USER_DATA)
Query Cross Isolated Margin Capital Flow
Weight(IP): 100
Security Type: USER_DATA
Notes:
-
Only supports querying the data of the last 90 days
-
The time between startTime and endTime cannot be longer than 7 days.
-
If fromId is set, the data with id > fromId will be returned. Otherwise the latest data will be returned
-
To query isolated data, Symbol needs to be entered.
§Arguments
params:QueryCrossIsolatedMarginCapitalFlowParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryCrossIsolatedMarginCapitalFlowResponseInner>> 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_cross_margin_account_details(
&self,
params: QueryCrossMarginAccountDetailsParams,
) -> Result<RestApiResponse<QueryCrossMarginAccountDetailsResponse>>
pub async fn query_cross_margin_account_details( &self, params: QueryCrossMarginAccountDetailsParams, ) -> Result<RestApiResponse<QueryCrossMarginAccountDetailsResponse>>
Query Cross Margin Account Details (USER_DATA)
Query Cross Margin Account Details
Weight(IP): 10
Security Type: USER_DATA
§Arguments
params:QueryCrossMarginAccountDetailsParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryCrossMarginAccountDetailsResponse> 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_cross_margin_fee_data(
&self,
params: QueryCrossMarginFeeDataParams,
) -> Result<RestApiResponse<Vec<QueryCrossMarginFeeDataResponseInner>>>
pub async fn query_cross_margin_fee_data( &self, params: QueryCrossMarginFeeDataParams, ) -> Result<RestApiResponse<Vec<QueryCrossMarginFeeDataResponseInner>>>
Query Cross Margin Fee Data (USER_DATA)
Get cross margin fee data collection with any vip level or user’s current specific data as https://www.binance.com/en/margin-fee
Weight: 1 when coin is specified;(IP) 5 when the coin parameter is omitted(IP)
Security Type: USER_DATA
§Arguments
params:QueryCrossMarginFeeDataParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryCrossMarginFeeDataResponseInner>> 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_enabled_isolated_margin_account_limit(
&self,
params: QueryEnabledIsolatedMarginAccountLimitParams,
) -> Result<RestApiResponse<QueryEnabledIsolatedMarginAccountLimitResponse>>
pub async fn query_enabled_isolated_margin_account_limit( &self, params: QueryEnabledIsolatedMarginAccountLimitParams, ) -> Result<RestApiResponse<QueryEnabledIsolatedMarginAccountLimitResponse>>
Query Enabled Isolated Margin Account Limit (USER_DATA)
Query enabled isolated margin account limit.
Weight(IP): 1
Security Type: USER_DATA
§Arguments
params:QueryEnabledIsolatedMarginAccountLimitParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryEnabledIsolatedMarginAccountLimitResponse> 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_isolated_margin_account_info(
&self,
params: QueryIsolatedMarginAccountInfoParams,
) -> Result<RestApiResponse<QueryIsolatedMarginAccountInfoResponse>>
pub async fn query_isolated_margin_account_info( &self, params: QueryIsolatedMarginAccountInfoParams, ) -> Result<RestApiResponse<QueryIsolatedMarginAccountInfoResponse>>
Query Isolated Margin Account Info (USER_DATA)
Query Isolated Margin Account Info
Weight(IP): 10
Security Type: USER_DATA
Notes:
-
If “symbols” is not sent, all isolated assets will be returned.
-
If “symbols” is sent, only the isolated assets of the sent symbols will be returned.
§Arguments
params:QueryIsolatedMarginAccountInfoParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryIsolatedMarginAccountInfoResponse> 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_isolated_margin_fee_data(
&self,
params: QueryIsolatedMarginFeeDataParams,
) -> Result<RestApiResponse<Vec<QueryIsolatedMarginFeeDataResponseInner>>>
pub async fn query_isolated_margin_fee_data( &self, params: QueryIsolatedMarginFeeDataParams, ) -> Result<RestApiResponse<Vec<QueryIsolatedMarginFeeDataResponseInner>>>
Query Isolated Margin Fee Data (USER_DATA)
Get isolated margin fee data collection with any vip level or user’s current specific data as https://www.binance.com/en/margin-fee
Weight: 1 when a single is specified;(IP) 10 when the symbol parameter is omitted(IP)
Security Type: USER_DATA
§Arguments
params:QueryIsolatedMarginFeeDataParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryIsolatedMarginFeeDataResponseInner>> 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_future_hourly_interest_rate(
&self,
params: GetFutureHourlyInterestRateParams,
) -> Result<RestApiResponse<Vec<GetFutureHourlyInterestRateResponseInner>>>
pub async fn get_future_hourly_interest_rate( &self, params: GetFutureHourlyInterestRateParams, ) -> Result<RestApiResponse<Vec<GetFutureHourlyInterestRateResponseInner>>>
Get future hourly interest rate (USER_DATA)
Get future hourly interest rate
Weight(IP): 100
Security Type: USER_DATA
§Arguments
params:GetFutureHourlyInterestRateParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::GetFutureHourlyInterestRateResponseInner>> 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_interest_history(
&self,
params: GetInterestHistoryParams,
) -> Result<RestApiResponse<GetInterestHistoryResponse>>
pub async fn get_interest_history( &self, params: GetInterestHistoryParams, ) -> Result<RestApiResponse<GetInterestHistoryResponse>>
Get Interest History (USER_DATA)
Get Interest History
Weight(IP): 1
Security Type: USER_DATA
Notes:
-
Response in descending order
-
If isolatedSymbol is not sent, crossed margin data will be returned
-
The max interval between
startTimeandendTimeis 30 days. It is a MUST to ensure data correctness. -
If
startTimeandendTimenot sent, return records of the last 7 days by default. -
If
startTimeis sent andendTimeis not sent, return records of [max(startTime, now-30d), now]. -
If
startTimeis not sent andendTimeis sent, return records of [endTime-7,endTime] -
typein response has 4 enums: -
PERIODICinterest charged per hour -
ON_BORROWfirst interest charged on borrow -
PERIODIC_CONVERTEDinterest charged per hour converted into BNB -
ON_BORROW_CONVERTEDfirst interest charged on borrow converted into BNB -
PORTFOLIOinterest charged daily on the portfolio margin negative balance
§Arguments
params:GetInterestHistoryParamsThe parameters for this operation.
§Returns
RestApiResponse<models::GetInterestHistoryResponse> 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 margin_account_borrow_repay(
&self,
params: MarginAccountBorrowRepayParams,
) -> Result<RestApiResponse<MarginAccountBorrowRepayResponse>>
pub async fn margin_account_borrow_repay( &self, params: MarginAccountBorrowRepayParams, ) -> Result<RestApiResponse<MarginAccountBorrowRepayResponse>>
Margin account borrow/repay (USER_DATA)
Margin account borrow/repay
Weight(UID): 1500
Security Type: USER_DATA
Notes:
-3045 INSUFFICIENT_INVENTORY: returned when system borrowable inventory is below the requested amount, or when inventory is severely insufficient (all borrow requests rejected regardless of size). Monitor system asset availability and adjust borrow strategy accordingly.-3006 EXCEED_MAX_BORROWABLE: borrow amount exceeds your current max borrowable limit. QueryGET /sapi/v1/margin/maxBorrowableand adjust the request.-3012 ASSET_ADMIN_BAN_BORROW: this asset does not currently support borrowing. QueryGET /sapi/v1/margin/allAssetsfor asset borrow availability.-3015 REPAY_EXCEED_LIABILITY: returned in two scenarios — (1) repay amount exceeds your outstanding liability, or (2) the remaining unpaid debt after this repayment would fall below Binance’s minimum threshold. Adjust the repay amount accordingly.-3007 HAS_PENDING_TRANSACTION: a borrow/repay transaction is already in progress on this account. Requests are processed in submission order across all assets, and an in-flight request briefly blocks subsequent ones. Typical processing time is ~100ms; space consecutive requests by at least 100ms. Auto-repay orders can also fail silently for this reason — verify outstanding liability after an auto-repay executes.
§Arguments
params:MarginAccountBorrowRepayParamsThe parameters for this operation.
§Returns
RestApiResponse<models::MarginAccountBorrowRepayResponse> 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_borrow_repay_records_in_margin_account(
&self,
params: QueryBorrowRepayRecordsInMarginAccountParams,
) -> Result<RestApiResponse<QueryBorrowRepayRecordsInMarginAccountResponse>>
pub async fn query_borrow_repay_records_in_margin_account( &self, params: QueryBorrowRepayRecordsInMarginAccountParams, ) -> Result<RestApiResponse<QueryBorrowRepayRecordsInMarginAccountResponse>>
Query borrow/repay records in Margin account (USER_DATA)
Query borrow/repay records in Margin account
Weight(IP): 10
Security Type: USER_DATA
Notes:
-
txIdorstartTimemust be sent.txIdtakes precedence. -
Response in descending order
-
If an asset is sent, data within 30 days before
endTime; If an asset is not sent, data within 7 days beforeendTime -
If neither
startTimenorendTimeis sent, the recent 7-day data will be returned. -
startTimeset asendTime- 7 days by default,endTimeset as current time by default
§Arguments
params:QueryBorrowRepayRecordsInMarginAccountParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryBorrowRepayRecordsInMarginAccountResponse> 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_margin_interest_rate_history(
&self,
params: QueryMarginInterestRateHistoryParams,
) -> Result<RestApiResponse<Vec<QueryMarginInterestRateHistoryResponseInner>>>
pub async fn query_margin_interest_rate_history( &self, params: QueryMarginInterestRateHistoryParams, ) -> Result<RestApiResponse<Vec<QueryMarginInterestRateHistoryResponseInner>>>
Query Margin Interest Rate History (USER_DATA)
Query Margin Interest Rate History
Weight(IP): 1
Security Type: USER_DATA
§Arguments
params:QueryMarginInterestRateHistoryParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryMarginInterestRateHistoryResponseInner>> 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_max_borrow(
&self,
params: QueryMaxBorrowParams,
) -> Result<RestApiResponse<QueryMaxBorrowResponse>>
pub async fn query_max_borrow( &self, params: QueryMaxBorrowParams, ) -> Result<RestApiResponse<QueryMaxBorrowResponse>>
Query Max Borrow (USER_DATA)
Query Max Borrow
Weight(IP): 50
Security Type: USER_DATA
Notes:
- If isolatedSymbol is not sent, crossed margin data will be sent.
borrowLimitis also available from https://www.binance.com/en/margin-fee
§Arguments
params:QueryMaxBorrowParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryMaxBorrowResponse> 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 cross_margin_collateral_ratio(
&self,
) -> Result<RestApiResponse<Vec<CrossMarginCollateralRatioResponseInner>>>
pub async fn cross_margin_collateral_ratio( &self, ) -> Result<RestApiResponse<Vec<CrossMarginCollateralRatioResponseInner>>>
Cross margin collateral ratio (MARKET_DATA)
Cross margin collateral ratio
Weight(IP): 100
Security Type: MARKET_DATA
§Arguments
params: [CrossMarginCollateralRatioParams] The parameters for this operation.
§Returns
RestApiResponse<Vec<models::CrossMarginCollateralRatioResponseInner>> 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_all_cross_margin_pairs(
&self,
params: GetAllCrossMarginPairsParams,
) -> Result<RestApiResponse<Vec<GetAllCrossMarginPairsResponseInner>>>
pub async fn get_all_cross_margin_pairs( &self, params: GetAllCrossMarginPairsParams, ) -> Result<RestApiResponse<Vec<GetAllCrossMarginPairsResponseInner>>>
Get All Cross Margin Pairs (MARKET_DATA)
Get All Cross Margin Pairs
Weight(IP): 1
Security Type: MARKET_DATA
§Arguments
params:GetAllCrossMarginPairsParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::GetAllCrossMarginPairsResponseInner>> 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_all_isolated_margin_symbol(
&self,
params: GetAllIsolatedMarginSymbolParams,
) -> Result<RestApiResponse<Vec<GetAllIsolatedMarginSymbolResponseInner>>>
pub async fn get_all_isolated_margin_symbol( &self, params: GetAllIsolatedMarginSymbolParams, ) -> Result<RestApiResponse<Vec<GetAllIsolatedMarginSymbolResponseInner>>>
Get All Isolated Margin Symbol (MARKET_DATA)
Get All Isolated Margin Symbol
Weight(IP): 10
Security Type: MARKET_DATA
§Arguments
params:GetAllIsolatedMarginSymbolParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::GetAllIsolatedMarginSymbolResponseInner>> 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_all_margin_assets(
&self,
params: GetAllMarginAssetsParams,
) -> Result<RestApiResponse<Vec<GetAllMarginAssetsResponseInner>>>
pub async fn get_all_margin_assets( &self, params: GetAllMarginAssetsParams, ) -> Result<RestApiResponse<Vec<GetAllMarginAssetsResponseInner>>>
Get All Margin Assets (MARKET_DATA)
Get All Margin Assets.
Weight(IP): 1
Security Type: MARKET_DATA
§Arguments
params:GetAllMarginAssetsParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::GetAllMarginAssetsResponseInner>> 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_delist_schedule(
&self,
params: GetDelistScheduleParams,
) -> Result<RestApiResponse<Vec<GetDelistScheduleResponseInner>>>
pub async fn get_delist_schedule( &self, params: GetDelistScheduleParams, ) -> Result<RestApiResponse<Vec<GetDelistScheduleResponseInner>>>
Get Delist Schedule (MARKET_DATA)
Get tokens or symbols delist schedule for cross margin and isolated margin
Weight(IP): 100
Security Type: MARKET_DATA
§Arguments
params:GetDelistScheduleParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::GetDelistScheduleResponseInner>> 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_limit_price_pairs(
&self,
) -> Result<RestApiResponse<GetLimitPricePairsResponse>>
pub async fn get_limit_price_pairs( &self, ) -> Result<RestApiResponse<GetLimitPricePairsResponse>>
Get Limit Price Pairs (MARKET_DATA)
Query trading pairs with restriction on limit price range.
In margin trading, you can place orders with limit price. Limit price should be within (-15%, 15%) of current index price for a list of margin trading pairs. This rule only impacts limit sell orders with limit price that is lower than current index price and limit buy orders with limit price that is higher than current index price.
-
Buy order: Your order will be rejected with an error message notification if the limit price is 15% above the index price.
-
Sell order: Your order will be rejected with an error message notification if the limit price is 15% below the index price.
Please review the limit price order placing strategy, backtest and calibrate the planned order size with the trading volume and order book depth to prevent trading loss.
Weight(IP): 1
Security Type: MARKET_DATA
§Arguments
params: [GetLimitPricePairsParams] The parameters for this operation.
§Returns
RestApiResponse<models::GetLimitPricePairsResponse> 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_list_schedule(
&self,
params: GetListScheduleParams,
) -> Result<RestApiResponse<Vec<GetListScheduleResponseInner>>>
pub async fn get_list_schedule( &self, params: GetListScheduleParams, ) -> Result<RestApiResponse<Vec<GetListScheduleResponseInner>>>
Get list Schedule (MARKET_DATA)
Get the upcoming tokens or symbols listing schedule for Cross Margin and Isolated Margin.
Weight(IP): 100
Security Type: MARKET_DATA
§Arguments
params:GetListScheduleParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::GetListScheduleResponseInner>> 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_margin_asset_risk_based_liquidation_ratio(
&self,
) -> Result<RestApiResponse<Vec<GetMarginAssetRiskBasedLiquidationRatioResponseInner>>>
pub async fn get_margin_asset_risk_based_liquidation_ratio( &self, ) -> Result<RestApiResponse<Vec<GetMarginAssetRiskBasedLiquidationRatioResponseInner>>>
Get Margin Asset Risk-Based Liquidation Ratio (MARKET_DATA)
Get Margin Asset Risk-Based Liquidation Ratio
Weight(IP): 1
Security Type: MARKET_DATA
§Arguments
params: [GetMarginAssetRiskBasedLiquidationRatioParams] The parameters for this operation.
§Returns
RestApiResponse<Vec<models::GetMarginAssetRiskBasedLiquidationRatioResponseInner>> 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_margin_restricted_assets(
&self,
) -> Result<RestApiResponse<GetMarginRestrictedAssetsResponse>>
pub async fn get_margin_restricted_assets( &self, ) -> Result<RestApiResponse<GetMarginRestrictedAssetsResponse>>
Get Margin Restricted Assets (MARKET_DATA)
Get the list of margin-restricted assets.
Weight(IP): 1
Security Type: MARKET_DATA
§Arguments
params: [GetMarginRestrictedAssetsParams] The parameters for this operation.
§Returns
RestApiResponse<models::GetMarginRestrictedAssetsResponse> 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_isolated_margin_tier_data(
&self,
params: QueryIsolatedMarginTierDataParams,
) -> Result<RestApiResponse<Vec<QueryIsolatedMarginTierDataResponseInner>>>
pub async fn query_isolated_margin_tier_data( &self, params: QueryIsolatedMarginTierDataParams, ) -> Result<RestApiResponse<Vec<QueryIsolatedMarginTierDataResponseInner>>>
Query Isolated Margin Tier Data (USER_DATA)
Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data
Weight(IP): 1
Security Type: USER_DATA
§Arguments
params:QueryIsolatedMarginTierDataParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryIsolatedMarginTierDataResponseInner>> 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_liability_coin_leverage_bracket_in_cross_margin_pro_mode(
&self,
) -> Result<RestApiResponse<Vec<QueryLiabilityCoinLeverageBracketInCrossMarginProModeResponseInner>>>
pub async fn query_liability_coin_leverage_bracket_in_cross_margin_pro_mode( &self, ) -> Result<RestApiResponse<Vec<QueryLiabilityCoinLeverageBracketInCrossMarginProModeResponseInner>>>
Query Liability Coin Leverage Bracket in Cross Margin Pro Mode (MARKET_DATA)
Liability Coin Leverage Bracket in Cross Margin Pro Mode
Weight(IP): 1
Security Type: MARKET_DATA
§Arguments
params: [QueryLiabilityCoinLeverageBracketInCrossMarginProModeParams] The parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryLiabilityCoinLeverageBracketInCrossMarginProModeResponseInner>> 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_margin_available_inventory(
&self,
params: QueryMarginAvailableInventoryParams,
) -> Result<RestApiResponse<QueryMarginAvailableInventoryResponse>>
pub async fn query_margin_available_inventory( &self, params: QueryMarginAvailableInventoryParams, ) -> Result<RestApiResponse<QueryMarginAvailableInventoryResponse>>
Query Margin Available Inventory (USER_DATA)
Margin available Inventory query
Weight(UID): 50
Security Type: USER_DATA
§Arguments
params:QueryMarginAvailableInventoryParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryMarginAvailableInventoryResponse> 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_margin_priceindex(
&self,
params: QueryMarginPriceindexParams,
) -> Result<RestApiResponse<QueryMarginPriceindexResponse>>
pub async fn query_margin_priceindex( &self, params: QueryMarginPriceindexParams, ) -> Result<RestApiResponse<QueryMarginPriceindexResponse>>
Query Margin PriceIndex (MARKET_DATA)
Query Margin PriceIndex
Weight(IP): 10
Security Type: MARKET_DATA
§Arguments
params:QueryMarginPriceindexParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryMarginPriceindexResponse> 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 create_special_key(
&self,
params: CreateSpecialKeyParams,
) -> Result<RestApiResponse<CreateSpecialKeyResponse>>
pub async fn create_special_key( &self, params: CreateSpecialKeyParams, ) -> Result<RestApiResponse<CreateSpecialKeyResponse>>
Create Special Key(Low-Latency Trading) (TRADE)
Eligibility
- Binance Margin offers low-latency trading through a special key, available exclusively to users with VIP level 7 or higher.
- If you are VIP level 6 or below, please contact your VIP manager for eligibility criterias.
- All new Margin Special Key users are required to read, understand, and agree to the Margin Special Key Supplemental Product Terms at the master account level before creating a Margin Special Key.
- Once signed at the master account level, the agreement applies to all sub-accounts. The master account and all sub-accounts (Cross Margin Classic and Portfolio Margin Pro) are authorized to create a Margin Special Key and are subject to the
LiquidationLoanpolicy.
For more information, please refer to FAQ.
Supported Products:
- Cross Margin
- Isolated Margin
- Portfolio Margin Pro
Unsupported Products:
- Portfolio Margin
We support several types of API keys:
- Ed25519 (recommended)
- HMAC
- RSA
We recommend to use Ed25519 API keys as it should provide the best performance and security out of all supported key types. We accept PKCS#8 (BEGIN PUBLIC KEY). For how to generate an RSA key pair to send API requests on Binance. Please refer to the document below FAQ .
How to use the Margin Special Key
- Use the below
sapiendpoint to create your margin special API Key. - For accessing the Cross Margin account, do not send the
symbolparameter. - For accessing the Isolated Margin account(s), pass the relevant
symbolparameter in the API Key creation request. - Use the generated API Key (and Secret key, if applicable) to perform margin trading and listenKey generation via Spot REST API (
https://api.binance.com/api/v3/*) endpoints.
Read REST API or WebSocket API documentation to learn how to use different API keys
You need to enable Permits “Enable Spot & Margin Trading” option for the API Key which requests this endpoint.
Weight(UID): 1
Security Type: TRADE
Response Notes:
-
Error Code Description
-
UNSUPPORTED_OPERATION: Portfolio Margin is an unsupported product, please change the account type to a supported margin product. -
Forbidden: Cross Margin Pro accounts require additional agreements, please contact your relationship manager.
§Arguments
params:CreateSpecialKeyParamsThe parameters for this operation.
§Returns
RestApiResponse<models::CreateSpecialKeyResponse> 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 delete_special_key(
&self,
params: DeleteSpecialKeyParams,
) -> Result<RestApiResponse<Value>>
pub async fn delete_special_key( &self, params: DeleteSpecialKeyParams, ) -> Result<RestApiResponse<Value>>
Delete Special Key(Low-Latency Trading) (TRADE)
Deleting your Margin Special Key alone does not exit you from the Margin Special Key framework or discharge your obligations under the Margin Special Key Supplemental Product Terms. To fully exit, you must:
- Delete your Margin Special Key.
- Ensure there are no outstanding liabilities on the account.
- Call the Exit Margin Special Key API endpoint.
- Confirm the exit status via the API response.
Only after step 4 is completed and the exit status is confirmed by Binance will your account revert to standard liquidation logic and no longer be subject to the Margin Special Key Supplemental Product Terms.
If apiKey is given, apiName will be ignored. If apiName is given with no apiKey, all apikeys with given apiName will be deleted.
You need to enable Permits “Enable Spot & Margin” option for the API Key which requests this endpoint.
Weight(UID): 1
Security Type: TRADE
§Arguments
params:DeleteSpecialKeyParamsThe parameters for this operation.
§Returns
RestApiResponse<Value> 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 edit_ip_for_special_key(
&self,
params: EditIpForSpecialKeyParams,
) -> Result<RestApiResponse<Value>>
pub async fn edit_ip_for_special_key( &self, params: EditIpForSpecialKeyParams, ) -> Result<RestApiResponse<Value>>
Edit ip for Special Key(Low-Latency Trading) (TRADE)
Edit ip restriction. This only applies to Special Key for Low Latency Trading.
You need to enable Permits “Enable Spot & Margin” option for the API Key which requests this endpoint.
Weight(UID): 1
Security Type: TRADE
§Arguments
params:EditIpForSpecialKeyParamsThe parameters for this operation.
§Returns
RestApiResponse<Value> 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 exit_special_key_mode(
&self,
params: ExitSpecialKeyModeParams,
) -> Result<RestApiResponse<Value>>
pub async fn exit_special_key_mode( &self, params: ExitSpecialKeyModeParams, ) -> Result<RestApiResponse<Value>>
Exit Special Key Mode (TRADE)
Exit the Margin Special Key mode for Cross Margin Classic accounts.
All outstanding liabilities under the Cross Margin Classic account must be fully repaid before calling this endpoint. Deleting the Margin Special Key alone does not constitute a valid exit.
When a user creates a Margin Special API Key, the account enters “Special Key Mode”. Upon a successful request, the following actions will be performed atomically:
- All existing Margin Special API Keys under the Cross Margin Classic mode account will be deleted.
- All pre-execution margin checks (including Open-order-loss calculation) will revert to standard mode.
- A cooldown period (default: 24 hours) will be enforced, during which the account will not be permitted to create new Margin Special API Keys.
For more information, please refer to FAQ.
Preconditions:
The following conditions must be met; otherwise the request will be rejected:
- Account type must be Cross Margin Classic.
- Account must currently be in Special Key Mode. If not, the request silently succeeds.
- Account must not be in liquidation.
- Account must have no liability.
You need to enable “Permits Enable Spot & Margin Trading” option for the API Key which requests this endpoint.
Weight(UID): 10
Security Type: TRADE
§Arguments
params:ExitSpecialKeyModeParamsThe parameters for this operation.
§Returns
RestApiResponse<serde_json::Value> 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_force_liquidation_record(
&self,
params: GetForceLiquidationRecordParams,
) -> Result<RestApiResponse<GetForceLiquidationRecordResponse>>
pub async fn get_force_liquidation_record( &self, params: GetForceLiquidationRecordParams, ) -> Result<RestApiResponse<GetForceLiquidationRecordResponse>>
Get Force Liquidation Record (USER_DATA)
Get Force Liquidation Record
Weight(IP): 1
Security Type: USER_DATA
Notes:
- Response in descending order
§Arguments
params:GetForceLiquidationRecordParamsThe parameters for this operation.
§Returns
RestApiResponse<models::GetForceLiquidationRecordResponse> 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_small_liability_exchange_coin_list(
&self,
params: GetSmallLiabilityExchangeCoinListParams,
) -> Result<RestApiResponse<Vec<GetSmallLiabilityExchangeCoinListResponseInner>>>
pub async fn get_small_liability_exchange_coin_list( &self, params: GetSmallLiabilityExchangeCoinListParams, ) -> Result<RestApiResponse<Vec<GetSmallLiabilityExchangeCoinListResponseInner>>>
Get Small Liability Exchange Coin List (USER_DATA)
Query the coins which can be small liability exchange
Weight(IP): 100
Security Type: USER_DATA
§Arguments
params:GetSmallLiabilityExchangeCoinListParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::GetSmallLiabilityExchangeCoinListResponseInner>> 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_small_liability_exchange_history(
&self,
params: GetSmallLiabilityExchangeHistoryParams,
) -> Result<RestApiResponse<GetSmallLiabilityExchangeHistoryResponse>>
pub async fn get_small_liability_exchange_history( &self, params: GetSmallLiabilityExchangeHistoryParams, ) -> Result<RestApiResponse<GetSmallLiabilityExchangeHistoryResponse>>
Get Small Liability Exchange History (USER_DATA)
Get Small liability Exchange History
Weight(UID): 100
Security Type: USER_DATA
§Arguments
params:GetSmallLiabilityExchangeHistoryParamsThe parameters for this operation.
§Returns
RestApiResponse<models::GetSmallLiabilityExchangeHistoryResponse> 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 liquidation_loan_repay(
&self,
params: LiquidationLoanRepayParams,
) -> Result<RestApiResponse<LiquidationLoanRepayResponse>>
pub async fn liquidation_loan_repay( &self, params: LiquidationLoanRepayParams, ) -> Result<RestApiResponse<LiquidationLoanRepayResponse>>
Liquidation Loan Repay (MARGIN)
Repays the outstanding cross-margin liquidation loan from the user’s spot wallet. A liquidation loan represents the account deficit incurred when account equity turns negative during liquidation (bankruptcy). The repayment amount must be greater than 0 and cannot exceed the remaining loan balance. If the Spot Account has insufficient USDC balance, the repayment will fail.
Weight(UID): 100
Security Type: MARGIN
§Arguments
params:LiquidationLoanRepayParamsThe parameters for this operation.
§Returns
RestApiResponse<models::LiquidationLoanRepayResponse> 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 margin_account_cancel_all_open_orders_on_a_symbol(
&self,
params: MarginAccountCancelAllOpenOrdersOnASymbolParams,
) -> Result<RestApiResponse<Vec<MarginAccountCancelAllOpenOrdersOnASymbolResponseInner>>>
pub async fn margin_account_cancel_all_open_orders_on_a_symbol( &self, params: MarginAccountCancelAllOpenOrdersOnASymbolParams, ) -> Result<RestApiResponse<Vec<MarginAccountCancelAllOpenOrdersOnASymbolResponseInner>>>
Margin Account Cancel all Open Orders on a Symbol (TRADE)
Cancels all active orders on a symbol for margin account.
This includes OCO orders.
Weight(IP): 1
Security Type: TRADE
§Arguments
params:MarginAccountCancelAllOpenOrdersOnASymbolParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::MarginAccountCancelAllOpenOrdersOnASymbolResponseInner>> 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 margin_account_cancel_oco(
&self,
params: MarginAccountCancelOcoParams,
) -> Result<RestApiResponse<MarginAccountCancelOcoResponse>>
pub async fn margin_account_cancel_oco( &self, params: MarginAccountCancelOcoParams, ) -> Result<RestApiResponse<MarginAccountCancelOcoResponse>>
Margin Account Cancel OCO (TRADE)
Cancel an entire Order List for a margin account.
Weight(UID): 1
Security Type: TRADE
Notes:
- Canceling an individual leg will cancel the entire OCO
§Arguments
params:MarginAccountCancelOcoParamsThe parameters for this operation.
§Returns
RestApiResponse<models::MarginAccountCancelOcoResponse> 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 margin_account_cancel_order(
&self,
params: MarginAccountCancelOrderParams,
) -> Result<RestApiResponse<MarginAccountCancelOrderResponse>>
pub async fn margin_account_cancel_order( &self, params: MarginAccountCancelOrderParams, ) -> Result<RestApiResponse<MarginAccountCancelOrderResponse>>
Margin Account Cancel Order (TRADE)
Cancel an active order for margin account.
Weight(IP): 10
Security Type: TRADE
Notes:
- Either orderId or origClientOrderId must be sent.
§Arguments
params:MarginAccountCancelOrderParamsThe parameters for this operation.
§Returns
RestApiResponse<models::MarginAccountCancelOrderResponse> 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 margin_account_new_oco(
&self,
params: MarginAccountNewOcoParams,
) -> Result<RestApiResponse<MarginAccountNewOcoResponse>>
pub async fn margin_account_new_oco( &self, params: MarginAccountNewOcoParams, ) -> Result<RestApiResponse<MarginAccountNewOcoResponse>>
Margin Account New OCO (TRADE)
Send in a new OCO for a margin account
Weight: 6(UID) or 1500(UID) when sideEffectType is MARGIN_BUY or AUTO_BORROW_REPAY
Security Type: TRADE
Notes:
- autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution
§Arguments
params:MarginAccountNewOcoParamsThe parameters for this operation.
§Returns
RestApiResponse<models::MarginAccountNewOcoResponse> 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 margin_account_new_order(
&self,
params: MarginAccountNewOrderParams,
) -> Result<RestApiResponse<MarginAccountNewOrderResponse>>
pub async fn margin_account_new_order( &self, params: MarginAccountNewOrderParams, ) -> Result<RestApiResponse<MarginAccountNewOrderResponse>>
Margin Account New Order (TRADE)
Post a new order for margin account.
Weight: 6(UID) or 1500(UID) when sideEffectType is MARGIN_BUY or AUTO_BORROW_REPAY
Security Type: TRADE
Notes:
- autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution
§Arguments
params:MarginAccountNewOrderParamsThe parameters for this operation.
§Returns
RestApiResponse<models::MarginAccountNewOrderResponse> 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 margin_account_new_oto(
&self,
params: MarginAccountNewOtoParams,
) -> Result<RestApiResponse<MarginAccountNewOtoResponse>>
pub async fn margin_account_new_oto( &self, params: MarginAccountNewOtoParams, ) -> Result<RestApiResponse<MarginAccountNewOtoResponse>>
Margin Account New OTO (TRADE)
Post a new OTO order for margin account:
-
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 unfilled order count,
EXCHANGE_MAX_NUM_ORDERSfilter andMAX_NUM_ORDERSfilter.
Weight: 6(UID) or 1500(UID) when sideEffectType is MARGIN_BUY or AUTO_BORROW_REPAY
Security Type: TRADE
Notes:
- autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution
- Depending on the
pendingTypeorworkingType, some optional - parameters will become mandatory: | Type | Additional mandatory parameters | Additional information | | –––––––––––––––––––––––––––– | ———————————————————— | ––––––––––– | |
workingType=LIMIT|workingTimeInForce| | |pendingType=LIMIT|pendingPrice,pendingTimeInForce| | |pendingType=STOP_LOSSorTAKE_PROFIT|pendingStopPriceand/orpendingTrailingDelta| | |pendingType=STOP_LOSS_LIMITorTAKE_PROFIT_LIMIT|pendingPrice,pendingStopPriceand/orpendingTrailingDelta,pendingTimeInForce| | |pendingTrailingDeltais provided |pendingPrice| |
§Arguments
params:MarginAccountNewOtoParamsThe parameters for this operation.
§Returns
RestApiResponse<models::MarginAccountNewOtoResponse> 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 margin_account_new_otoco(
&self,
params: MarginAccountNewOtocoParams,
) -> Result<RestApiResponse<MarginAccountNewOtocoResponse>>
pub async fn margin_account_new_otoco( &self, params: MarginAccountNewOtocoParams, ) -> Result<RestApiResponse<MarginAccountNewOtocoResponse>>
Margin Account New OTOCO (TRADE)
Post a new OTOCO order for margin account:
-
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 against the unfilled order count,
EXCHANGE_MAX_NUM_ORDERSfilter, andMAX_NUM_ORDERSfilter.
Weight: 6(UID) or 1500(UID) when sideEffectType is MARGIN_BUY or AUTO_BORROW_REPAY
Security Type: TRADE
Notes:
- autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution
- Depending on the
pendingAboveType/pendingBelowTypeorworkingType, some optional parameters will become mandatory: | Type | Additional mandatory parameters | Additional information | | ———————————— | ———————————————————— | ––––––––––– | |workingType=LIMIT|workingTimeInForce| | |pendingAboveType=LIMIT_MAKER|pendingAbovePrice| | |pendingAboveType=STOP_LOSS|pendingAboveStopPriceand/orpendingAboveTrailingDelta| | |pendingAboveType=STOP_LOSS_LIMIT|pendingAbovePrice,pendingAboveStopPriceand/orpendingAboveTrailingDelta,pendingAboveTimeInForce| | |pendingBelowType=LIMIT_MAKER|pendingBelowPrice| | |pendingBelowType=STOP_LOSS|pendingBelowStopPriceand/orpendingBelowTrailingDelta| | |pendingBelowType=STOP_LOSS_LIMIT|pendingBelowPrice,pendingBelowStopPriceand/orpendingBelowTrailingDelta,pendingBelowTimeInForce| | |pendingAboveTrailingDeltais provided |pendingAbovePrice| | |pendingBelowTrailingDeltais provided |pendingBelowPrice| |
§Arguments
params:MarginAccountNewOtocoParamsThe parameters for this operation.
§Returns
RestApiResponse<models::MarginAccountNewOtocoResponse> 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 margin_manual_liquidation(
&self,
params: MarginManualLiquidationParams,
) -> Result<RestApiResponse<MarginManualLiquidationResponse>>
pub async fn margin_manual_liquidation( &self, params: MarginManualLiquidationParams, ) -> Result<RestApiResponse<MarginManualLiquidationResponse>>
Margin Manual Liquidation (TRADE)
Margin Manual Liquidation
Weight(UID): 3000
Security Type: TRADE
Notes:
- This endpoint supports Cross Margin Classic Mode and Pro Mode.
- Isolated Margin is only supported in restricted regions.
§Arguments
params:MarginManualLiquidationParamsThe parameters for this operation.
§Returns
RestApiResponse<models::MarginManualLiquidationResponse> 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_current_margin_order_count_usage(
&self,
params: QueryCurrentMarginOrderCountUsageParams,
) -> Result<RestApiResponse<Vec<QueryCurrentMarginOrderCountUsageResponseInner>>>
pub async fn query_current_margin_order_count_usage( &self, params: QueryCurrentMarginOrderCountUsageParams, ) -> Result<RestApiResponse<Vec<QueryCurrentMarginOrderCountUsageResponseInner>>>
Query Current Margin Order Count Usage (TRADE)
Displays the user’s current margin order count usage for all intervals.
Weight(IP): 20
Security Type: TRADE
§Arguments
params:QueryCurrentMarginOrderCountUsageParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryCurrentMarginOrderCountUsageResponseInner>> 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_liquidation_loan(
&self,
params: QueryLiquidationLoanParams,
) -> Result<RestApiResponse<QueryLiquidationLoanResponse>>
pub async fn query_liquidation_loan( &self, params: QueryLiquidationLoanParams, ) -> Result<RestApiResponse<QueryLiquidationLoanResponse>>
Query Liquidation Loan (USER_DATA)
Query the current user’s cross-margin liquidation loan information, including the original loan amount, repaid amount, and remaining amount. When a cross-margin account is liquidated and the account equity turns negative (bankruptcy), the system generates a liquidation loan record representing the deficit. This represents the shortfall amount denominated in USDC.
Weight(UID): 100
Security Type: USER_DATA
§Arguments
params:QueryLiquidationLoanParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryLiquidationLoanResponse> 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_liquidation_loan_repay_history(
&self,
params: QueryLiquidationLoanRepayHistoryParams,
) -> Result<RestApiResponse<QueryLiquidationLoanRepayHistoryResponse>>
pub async fn query_liquidation_loan_repay_history( &self, params: QueryLiquidationLoanRepayHistoryParams, ) -> Result<RestApiResponse<QueryLiquidationLoanRepayHistoryResponse>>
Query Liquidation Loan Repay History (USER_DATA)
Query the repayment history of cross-margin liquidation loans (deficit caused by bankruptcy during liquidation). Supports time-range filtering and pagination.
Weight(UID): 100
Security Type: USER_DATA
Notes:
- The maximum query range is 90 days. If
startTimeis earlier than 90 days ago, it will be clamped to 90 days ago. - Only records with status
SUCCESSorPENDINGare returned. Failed repayment records are excluded.
§Arguments
params:QueryLiquidationLoanRepayHistoryParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryLiquidationLoanRepayHistoryResponse> 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_margin_accounts_all_oco(
&self,
params: QueryMarginAccountsAllOcoParams,
) -> Result<RestApiResponse<Vec<QueryMarginAccountsAllOcoResponseInner>>>
pub async fn query_margin_accounts_all_oco( &self, params: QueryMarginAccountsAllOcoParams, ) -> Result<RestApiResponse<Vec<QueryMarginAccountsAllOcoResponseInner>>>
Query Margin Account’s all OCO (USER_DATA)
Retrieves all OCO for a specific margin account based on provided optional parameters
Weight(IP): 200
Security Type: USER_DATA
§Arguments
params:QueryMarginAccountsAllOcoParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryMarginAccountsAllOcoResponseInner>> 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_margin_accounts_all_orders(
&self,
params: QueryMarginAccountsAllOrdersParams,
) -> Result<RestApiResponse<Vec<QueryMarginAccountsAllOrdersResponseInner>>>
pub async fn query_margin_accounts_all_orders( &self, params: QueryMarginAccountsAllOrdersParams, ) -> Result<RestApiResponse<Vec<QueryMarginAccountsAllOrdersResponseInner>>>
Query Margin Account’s All Orders (USER_DATA)
Query Margin Account’s All Orders
Weight(IP): 200
Security Type: USER_DATA
Notes:
-
If orderId is set, it will get orders >= that orderId. Otherwise the orders within 24 hours are returned.
-
For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.
-
Less than 24 hours between startTime and endTime.
§Arguments
params:QueryMarginAccountsAllOrdersParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryMarginAccountsAllOrdersResponseInner>> 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_margin_accounts_oco(
&self,
params: QueryMarginAccountsOcoParams,
) -> Result<RestApiResponse<QueryMarginAccountsOcoResponse>>
pub async fn query_margin_accounts_oco( &self, params: QueryMarginAccountsOcoParams, ) -> Result<RestApiResponse<QueryMarginAccountsOcoResponse>>
Query Margin Account’s OCO (USER_DATA)
Retrieves a specific OCO based on provided optional parameters
Weight(IP): 10
Security Type: USER_DATA
§Arguments
params:QueryMarginAccountsOcoParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryMarginAccountsOcoResponse> 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_margin_accounts_open_oco(
&self,
params: QueryMarginAccountsOpenOcoParams,
) -> Result<RestApiResponse<Vec<QueryMarginAccountsOpenOcoResponseInner>>>
pub async fn query_margin_accounts_open_oco( &self, params: QueryMarginAccountsOpenOcoParams, ) -> Result<RestApiResponse<Vec<QueryMarginAccountsOpenOcoResponseInner>>>
Query Margin Account’s Open OCO (USER_DATA)
Query Margin Account’s Open OCO
Weight(IP): 10
Security Type: USER_DATA
§Arguments
params:QueryMarginAccountsOpenOcoParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryMarginAccountsOpenOcoResponseInner>> 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_margin_accounts_open_orders(
&self,
params: QueryMarginAccountsOpenOrdersParams,
) -> Result<RestApiResponse<Vec<QueryMarginAccountsOpenOrdersResponseInner>>>
pub async fn query_margin_accounts_open_orders( &self, params: QueryMarginAccountsOpenOrdersParams, ) -> Result<RestApiResponse<Vec<QueryMarginAccountsOpenOrdersResponseInner>>>
Query Margin Account’s Open Orders (USER_DATA)
Query Margin Account’s Open Orders
Weight(IP): 10
Security Type: USER_DATA
Notes:
-
If the symbol is not sent, orders for all symbols will be returned in an array.
-
When all symbols are returned, the number of requests counted against the rate limiter is equal to the number of symbols currently trading on the exchange.
-
If isIsolated =“TRUE”, symbol must be sent.
§Arguments
params:QueryMarginAccountsOpenOrdersParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryMarginAccountsOpenOrdersResponseInner>> 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_margin_accounts_order(
&self,
params: QueryMarginAccountsOrderParams,
) -> Result<RestApiResponse<QueryMarginAccountsOrderResponse>>
pub async fn query_margin_accounts_order( &self, params: QueryMarginAccountsOrderParams, ) -> Result<RestApiResponse<QueryMarginAccountsOrderResponse>>
Query Margin Account’s Order (USER_DATA)
Query Margin Account’s Order
Weight(IP): 10
Security Type: USER_DATA
Notes:
-
Either orderId or origClientOrderId must be sent.
-
For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.
§Arguments
params:QueryMarginAccountsOrderParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryMarginAccountsOrderResponse> 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_margin_accounts_trade_list(
&self,
params: QueryMarginAccountsTradeListParams,
) -> Result<RestApiResponse<Vec<QueryMarginAccountsTradeListResponseInner>>>
pub async fn query_margin_accounts_trade_list( &self, params: QueryMarginAccountsTradeListParams, ) -> Result<RestApiResponse<Vec<QueryMarginAccountsTradeListResponseInner>>>
Query Margin Account’s Trade List (USER_DATA)
Query Margin Account’s Trade List
Weight(IP): 10
Security Type: USER_DATA
Notes:
-
If fromId is set, it will get trades >= that fromId. Otherwise the trades within 24 hours are returned.
-
Less than 24 hours between startTime and endTime.
§Arguments
params:QueryMarginAccountsTradeListParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryMarginAccountsTradeListResponseInner>> 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_prevented_matches(
&self,
params: QueryPreventedMatchesParams,
) -> Result<RestApiResponse<Vec<QueryPreventedMatchesResponseInner>>>
pub async fn query_prevented_matches( &self, params: QueryPreventedMatchesParams, ) -> Result<RestApiResponse<Vec<QueryPreventedMatchesResponseInner>>>
Query Prevented Matches (USER_DATA)
Displays the list of orders that were expired due to STP. (Self-Trade Prevention).
Weight(IP): 10
Security Type: USER_DATA
Notes:
-
Supported parameter combinations:
-
symbol+preventedMatchId -
symbol+orderId -
symbol+orderId+fromPreventedMatchId -
If
orderIdis provided, all prevented matches for that order will be returned. -
If
preventedMatchIdis provided, the specific prevented match will be returned. -
A single request returns a maximum of 500 records. If there are more than 500 records, use
symbol+orderId+fromPreventedMatchIdcombination for pagination.
§Arguments
params:QueryPreventedMatchesParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QueryPreventedMatchesResponseInner>> 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_special_key(
&self,
params: QuerySpecialKeyParams,
) -> Result<RestApiResponse<QuerySpecialKeyResponse>>
pub async fn query_special_key( &self, params: QuerySpecialKeyParams, ) -> Result<RestApiResponse<QuerySpecialKeyResponse>>
Query Special key(Low Latency Trading) (TRADE)
Query Special Key Information.
This only applies to Special Key for Low Latency Trading.
Weight(UID): 1
Security Type: TRADE
§Arguments
params:QuerySpecialKeyParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QuerySpecialKeyResponse> 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_special_key_list(
&self,
params: QuerySpecialKeyListParams,
) -> Result<RestApiResponse<Vec<QuerySpecialKeyListResponseInner>>>
pub async fn query_special_key_list( &self, params: QuerySpecialKeyListParams, ) -> Result<RestApiResponse<Vec<QuerySpecialKeyListResponseInner>>>
Query Special key List(Low Latency Trading) (TRADE)
This only applies to Special Key for Low Latency Trading.
Weight(UID): 1
Security Type: TRADE
§Arguments
params:QuerySpecialKeyListParamsThe parameters for this operation.
§Returns
RestApiResponse<Vec<models::QuerySpecialKeyListResponseInner>> 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 small_liability_exchange(
&self,
params: SmallLiabilityExchangeParams,
) -> Result<RestApiResponse<Value>>
pub async fn small_liability_exchange( &self, params: SmallLiabilityExchangeParams, ) -> Result<RestApiResponse<Value>>
Small Liability Exchange (MARGIN)
Small Liability Exchange
Weight(UID): 3000
Security Type: MARGIN
Notes:
- Only convert once within 6 hours
- Only liability valuation less than 10 USDT are supported
- The maximum number of coin is 10
§Arguments
params:SmallLiabilityExchangeParamsThe parameters for this operation.
§Returns
RestApiResponse<Value> 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_cross_margin_transfer_history(
&self,
params: GetCrossMarginTransferHistoryParams,
) -> Result<RestApiResponse<GetCrossMarginTransferHistoryResponse>>
pub async fn get_cross_margin_transfer_history( &self, params: GetCrossMarginTransferHistoryParams, ) -> Result<RestApiResponse<GetCrossMarginTransferHistoryResponse>>
Get Cross Margin Transfer History (USER_DATA)
Get Cross Margin Transfer History
Weight(IP): 1
Security Type: USER_DATA
Notes:
- Response in descending order
- The max interval between
startTimeandendTimeis 30 days. - Returns data for last 7 days by default
§Arguments
params:GetCrossMarginTransferHistoryParamsThe parameters for this operation.
§Returns
RestApiResponse<models::GetCrossMarginTransferHistoryResponse> 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_max_transfer_out_amount(
&self,
params: QueryMaxTransferOutAmountParams,
) -> Result<RestApiResponse<QueryMaxTransferOutAmountResponse>>
pub async fn query_max_transfer_out_amount( &self, params: QueryMaxTransferOutAmountParams, ) -> Result<RestApiResponse<QueryMaxTransferOutAmountResponse>>
Query Max Transfer-Out Amount (USER_DATA)
Query Max Transfer-Out Amount
Weight(IP): 50
Security Type: USER_DATA
Notes:
- If isolatedSymbol is not sent, crossed margin data will be sent.
§Arguments
params:QueryMaxTransferOutAmountParamsThe parameters for this operation.
§Returns
RestApiResponse<models::QueryMaxTransferOutAmountResponse> 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 close_user_data_stream(&self) -> Result<RestApiResponse<Value>>
pub async fn close_user_data_stream(&self) -> Result<RestApiResponse<Value>>
Close User Data Stream (USER_STREAM)
Close out a user data stream.
Weight(UID): 3000
Security Type: USER_STREAM
§Arguments
params: [CloseUserDataStreamParams] The parameters for this operation.
§Returns
RestApiResponse<Value> 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 keepalive_user_data_stream(
&self,
params: KeepaliveUserDataStreamParams,
) -> Result<RestApiResponse<Value>>
pub async fn keepalive_user_data_stream( &self, params: KeepaliveUserDataStreamParams, ) -> Result<RestApiResponse<Value>>
Keepalive User Data Stream (USER_STREAM)
Keepalive a user data stream to prevent a time out.
Weight(UID): 1
Security Type: USER_STREAM
§Arguments
params:KeepaliveUserDataStreamParamsThe parameters for this operation.
§Returns
RestApiResponse<Value> 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 start_user_data_stream(
&self,
) -> Result<RestApiResponse<StartUserDataStreamResponse>>
pub async fn start_user_data_stream( &self, ) -> Result<RestApiResponse<StartUserDataStreamResponse>>
Start User Data Stream (USER_STREAM)
Start a new user data stream.
Weight(UID): 1
Security Type: USER_STREAM
§Arguments
params: [StartUserDataStreamParams] The parameters for this operation.
§Returns
RestApiResponse<models::StartUserDataStreamResponse> 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.