Skip to main content

RestApi

Struct RestApi 

Source
pub struct RestApi { /* private fields */ }

Implementations§

Source§

impl RestApi

Source

pub fn new(configuration: ConfigurationRestApi) -> Self

Source

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 to
  • method - The HTTP method to use for the request
  • query_params - A map of query parameters to send with the request
  • body_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

Source

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 to
  • method - The HTTP method to use for the request
  • query_params - A map of query parameters to send with the request
  • body_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

Source

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

  • 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.

Weight: 3000

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 300(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 300(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn get_bnb_burn_status( &self, params: GetBnbBurnStatusParams, ) -> Result<RestApiResponse<GetBnbBurnStatusResponse>>

Get BNB Burn Status (USER_DATA)

Get BNB Burn Status

Weight: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 100(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • 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.

Weight: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 100

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn get_interest_history( &self, params: GetInterestHistoryParams, ) -> Result<RestApiResponse<GetInterestHistoryResponse>>

Get Interest History (USER_DATA)

Get Interest History

  • Response in descending order
  • If isolatedSymbol is not sent, crossed margin data will be returned
  • The max interval between startTime and endTime is 30 days. It is a MUST to ensure data correctness.
  • If startTimeand endTime not sent, return records of the last 7 days by default.
  • If startTime is sent and endTime is not sent, return records of [max(startTime, now-30d), now].
  • If startTime is not sent and endTime is sent, return records of [endTime-7, endTime]
  • type in response has 4 enums:
  • PERIODIC interest charged per hour
  • ON_BORROW first interest charged on borrow
  • PERIODIC_CONVERTED interest charged per hour converted into BNB
  • ON_BORROW_CONVERTED first interest charged on borrow converted into BNB
  • PORTFOLIO interest charged daily on the portfolio margin negative balance

Weight: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn margin_account_borrow_repay( &self, params: MarginAccountBorrowRepayParams, ) -> Result<RestApiResponse<MarginAccountBorrowRepayResponse>>

Margin account borrow/repay(MARGIN)

Margin account borrow/repay(MARGIN)

Weight: 1500

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • txId or startTime must be sent. txId takes precedence.
  • If an asset is sent, data within 30 days before endTime; If an asset is not sent, data within 7 days before endTime
  • If neither startTime nor endTime is sent, the recent 7-day data will be returned.
  • startTime set as endTime - 7days by default, endTime set as current time by default

Weight: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn query_max_borrow( &self, params: QueryMaxBorrowParams, ) -> Result<RestApiResponse<QueryMaxBorrowResponse>>

Query Max Borrow (USER_DATA)

Query Max Borrow

Weight: 50(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn cross_margin_collateral_ratio( &self, ) -> Result<RestApiResponse<Vec<CrossMarginCollateralRatioResponseInner>>>

Cross margin collateral ratio (MARKET_DATA)

Cross margin collateral ratio

Weight: 100(IP)

§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 100

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1

§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 100

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1

§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn get_margin_restricted_assets( &self, ) -> Result<RestApiResponse<GetMarginRestrictedAssetsResponse>>

Get Margin Restricted Assets (MARKET_DATA)

Get Margin Restricted Assets

Weight: 1

§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1

§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn query_margin_available_inventory( &self, params: QueryMarginAvailableInventoryParams, ) -> Result<RestApiResponse<QueryMarginAvailableInventoryResponse>>

Query Margin Available Inventory(USER_DATA)

Margin available Inventory query

Weight: 50

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn query_margin_priceindex( &self, params: QueryMarginPriceindexParams, ) -> Result<RestApiResponse<QueryMarginPriceindexResponse>>

Query Margin PriceIndex (MARKET_DATA)

Query Margin PriceIndex

Weight: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn close_user_data_stream(&self) -> Result<RestApiResponse<Value>>

Close User Data Stream (USER_STREAM)

Close out a user data stream.

Weight: 3000

§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn start_user_data_stream( &self, ) -> Result<RestApiResponse<StartUserDataStreamResponse>>

Start User Data Stream (USER_STREAM)

Start a new user data stream.

Weight: 1

§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn create_special_key( &self, params: CreateSpecialKeyParams, ) -> Result<RestApiResponse<CreateSpecialKeyResponse>>

Create Special Key(Low-Latency Trading)(TRADE)

  • 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.

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 .

Weight: 1(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn delete_special_key( &self, params: DeleteSpecialKeyParams, ) -> Result<RestApiResponse<Value>>

Delete Special Key(Low-Latency Trading)(TRADE)

This only applies to Special Key for Low Latency Trading.

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 Trading” option for the API Key which requests this endpoint.

Weight: 1(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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 Trading” option for the API Key which requests this endpoint.

Weight: 1(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn get_force_liquidation_record( &self, params: GetForceLiquidationRecordParams, ) -> Result<RestApiResponse<GetForceLiquidationRecordResponse>>

Get Force Liquidation Record (USER_DATA)

Get Force Liquidation Record

  • Response in descending order

Weight: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 100

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 100(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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.

  • Canceling an individual leg will cancel the entire OCO

Weight: 1(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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.

  • Either orderId or origClientOrderId must be sent.

Weight: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution

Weight: 6(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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.

  • autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution

Weight: 6(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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 LIMIT or LIMIT_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 MARKET orders using parameter quoteOrderQty. 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 FILLED but the pending order will still appear as PENDING_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_ORDERS filter and MAX_NUM_ORDERS filter.
  • autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution
  • Depending on the pendingType or workingType, some optional parameters will become mandatory:

Weight: 6(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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 LIMIT or LIMIT_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_ORDERS filter, and MAX_NUM_ORDERS filter.
  • autoRepayAtCancel is suggested to set as “FALSE” to keep liability unrepaid under high frequent new order/cancel order execution
  • Depending on the pendingAboveType/pendingBelowType or workingType, some optional parameters will become mandatory:

Weight: 6(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn margin_manual_liquidation( &self, params: MarginManualLiquidationParams, ) -> Result<RestApiResponse<MarginManualLiquidationResponse>>

Margin Manual Liquidation(MARGIN)

Margin Manual Liquidation

  • This endpoint can support Cross Margin Classic Mode and Pro Mode.
  • And only support Isolated Margin for restricted region.

Weight: 3000

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 20(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 200(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • 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.

Weight: 200(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • 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.

Weight: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • Either orderId or origClientOrderId must be sent.
  • For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.

Weight: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • 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.

Weight: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn query_prevented_matches( &self, params: QueryPreventedMatchesParams, ) -> Result<RestApiResponse<Vec<QueryPreventedMatchesResponseInner>>>

Query Prevented Matches(USER_DATA)

Weight: 10(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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: 1(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

pub async fn small_liability_exchange( &self, params: SmallLiabilityExchangeParams, ) -> Result<RestApiResponse<Value>>

Small Liability Exchange (MARGIN)

Small Liability Exchange

  • Only convert once within 6 hours
  • Only liability valuation less than 10 USDT are supported
  • The maximum number of coin is 10

Weight: 3000(UID)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • Response in descending order
  • The max interval between startTime and endTime is 30 days.
  • Returns data for last 7 days by default

Weight: 1(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Source

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

  • If isolatedSymbol is not sent, crossed margin data will be sent.

Weight: 50(IP)

§Arguments
§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:
    • RequiredError
    • ConnectorClientError
    • UnauthorizedError
    • ForbiddenError
    • TooManyRequestsError
    • RateLimitBanError
    • ServerError
    • NotFoundError
    • NetworkError
    • BadRequestError

For full API details, see the Binance API Documentation.

Trait Implementations§

Source§

impl Clone for RestApi

Source§

fn clone(&self) -> RestApi

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RestApi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more