/*
 * Binance Margin Trading REST API
 *
 * OpenAPI Specification for the Binance Margin Trading REST API
 *
 * The version of the OpenAPI document: 1.0.0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

#![allow(unused_imports)]
use http::Method;
use serde::de::DeserializeOwned;
use serde_json::Value;
use std::collections::BTreeMap;

use crate::common::{config::ConfigurationRestApi, models::RestApiResponse, utils::send_request};

mod apis;
mod models;

pub use apis::*;
pub use models::*;

#[derive(Debug, Clone)]
pub struct RestApi {
    configuration: ConfigurationRestApi,
    account_api_client: AccountApiClient,
    borrow_repay_api_client: BorrowRepayApiClient,
    market_data_api_client: MarketDataApiClient,
    risk_data_stream_api_client: RiskDataStreamApiClient,
    trade_api_client: TradeApiClient,
    transfer_api_client: TransferApiClient,
}

impl RestApi {
    pub fn new(configuration: ConfigurationRestApi) -> Self {
        let account_api_client = AccountApiClient::new(configuration.clone());
        let borrow_repay_api_client = BorrowRepayApiClient::new(configuration.clone());
        let market_data_api_client = MarketDataApiClient::new(configuration.clone());
        let risk_data_stream_api_client = RiskDataStreamApiClient::new(configuration.clone());
        let trade_api_client = TradeApiClient::new(configuration.clone());
        let transfer_api_client = TransferApiClient::new(configuration.clone());

        Self {
            configuration,
            account_api_client,
            borrow_repay_api_client,
            market_data_api_client,
            risk_data_stream_api_client,
            trade_api_client,
            transfer_api_client,
        }
    }

    /// 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
    pub async fn send_request<R: DeserializeOwned + Send + 'static>(
        &self,
        endpoint: &str,
        method: Method,
        query_params: BTreeMap<String, Value>,
        body_params: BTreeMap<String, Value>,
    ) -> anyhow::Result<RestApiResponse<R>> {
        send_request::<R>(
            &self.configuration,
            endpoint,
            method,
            query_params,
            body_params,
            None,
            false,
        )
        .await
    }

    /// 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
    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>,
    ) -> anyhow::Result<RestApiResponse<R>> {
        send_request::<R>(
            &self.configuration,
            endpoint,
            method,
            query_params,
            body_params,
            None,
            true,
        )
        .await
    }

    /// 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](https://www.binance.com/en/support/faq/how-to-activate-the-cross-margin-pro-mode-on-binance-e27786da05e743a694b8c625b3bc475d).
    ///
    /// Weight: 3000
    ///
    /// # Arguments
    ///
    /// - `params`: [`AdjustCrossMarginMaxLeverageParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Adjust-cross-margin-max-leverage).
    ///
    pub async fn adjust_cross_margin_max_leverage(
        &self,
        params: AdjustCrossMarginMaxLeverageParams,
    ) -> anyhow::Result<RestApiResponse<models::AdjustCrossMarginMaxLeverageResponse>> {
        self.account_api_client
            .adjust_cross_margin_max_leverage(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`DisableIsolatedMarginAccountParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Disable-Isolated-Margin-Account).
    ///
    pub async fn disable_isolated_margin_account(
        &self,
        params: DisableIsolatedMarginAccountParams,
    ) -> anyhow::Result<RestApiResponse<models::DisableIsolatedMarginAccountResponse>> {
        self.account_api_client
            .disable_isolated_margin_account(params)
            .await
    }

    /// Enable Isolated Margin Account (TRADE)
    ///
    /// Enable isolated margin account for a specific symbol(Only supports activation of previously disabled accounts).
    ///
    /// Weight: 300(UID)
    ///
    /// # Arguments
    ///
    /// - `params`: [`EnableIsolatedMarginAccountParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Enable-Isolated-Margin-Account).
    ///
    pub async fn enable_isolated_margin_account(
        &self,
        params: EnableIsolatedMarginAccountParams,
    ) -> anyhow::Result<RestApiResponse<models::EnableIsolatedMarginAccountResponse>> {
        self.account_api_client
            .enable_isolated_margin_account(params)
            .await
    }

    /// Get BNB Burn Status (`USER_DATA`)
    ///
    /// Get BNB Burn Status
    ///
    /// Weight: 1(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetBnbBurnStatusParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Get-BNB-Burn-Status).
    ///
    pub async fn get_bnb_burn_status(
        &self,
        params: GetBnbBurnStatusParams,
    ) -> anyhow::Result<RestApiResponse<models::GetBnbBurnStatusResponse>> {
        self.account_api_client.get_bnb_burn_status(params).await
    }

    /// Get Summary of Margin account (`USER_DATA`)
    ///
    /// Get personal margin level information
    ///
    /// Weight: 10(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetSummaryOfMarginAccountParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Get-Summary-of-Margin-account).
    ///
    pub async fn get_summary_of_margin_account(
        &self,
        params: GetSummaryOfMarginAccountParams,
    ) -> anyhow::Result<RestApiResponse<models::GetSummaryOfMarginAccountResponse>> {
        self.account_api_client
            .get_summary_of_margin_account(params)
            .await
    }

    /// Query Cross Isolated Margin Capital Flow (`USER_DATA`)
    ///
    /// Query Cross Isolated Margin Capital Flow
    ///
    /// Weight: 100(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCrossIsolatedMarginCapitalFlowParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Query-Cross-Isolated-Margin-Capital-Flow).
    ///
    pub async fn query_cross_isolated_margin_capital_flow(
        &self,
        params: QueryCrossIsolatedMarginCapitalFlowParams,
    ) -> anyhow::Result<
        RestApiResponse<Vec<models::QueryCrossIsolatedMarginCapitalFlowResponseInner>>,
    > {
        self.account_api_client
            .query_cross_isolated_margin_capital_flow(params)
            .await
    }

    /// Query Cross Margin Account Details (`USER_DATA`)
    ///
    /// Query Cross Margin Account Details
    ///
    /// Weight: 10(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCrossMarginAccountDetailsParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Account-Details).
    ///
    pub async fn query_cross_margin_account_details(
        &self,
        params: QueryCrossMarginAccountDetailsParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryCrossMarginAccountDetailsResponse>> {
        self.account_api_client
            .query_cross_margin_account_details(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryCrossMarginFeeDataParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Fee-Data).
    ///
    pub async fn query_cross_margin_fee_data(
        &self,
        params: QueryCrossMarginFeeDataParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryCrossMarginFeeDataResponseInner>>> {
        self.account_api_client
            .query_cross_margin_fee_data(params)
            .await
    }

    /// Query Enabled Isolated Margin Account Limit (`USER_DATA`)
    ///
    /// Query enabled isolated margin account limit.
    ///
    /// Weight: 1(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryEnabledIsolatedMarginAccountLimitParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Query-Enabled-Isolated-Margin-Account-Limit).
    ///
    pub async fn query_enabled_isolated_margin_account_limit(
        &self,
        params: QueryEnabledIsolatedMarginAccountLimitParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryEnabledIsolatedMarginAccountLimitResponse>>
    {
        self.account_api_client
            .query_enabled_isolated_margin_account_limit(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryIsolatedMarginAccountInfoParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Account-Info).
    ///
    pub async fn query_isolated_margin_account_info(
        &self,
        params: QueryIsolatedMarginAccountInfoParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryIsolatedMarginAccountInfoResponse>> {
        self.account_api_client
            .query_isolated_margin_account_info(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryIsolatedMarginFeeDataParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Fee-Data).
    ///
    pub async fn query_isolated_margin_fee_data(
        &self,
        params: QueryIsolatedMarginFeeDataParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryIsolatedMarginFeeDataResponseInner>>> {
        self.account_api_client
            .query_isolated_margin_fee_data(params)
            .await
    }

    /// Get future hourly interest rate (`USER_DATA`)
    ///
    /// Get future hourly interest rate
    ///
    /// Weight: 100
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetFutureHourlyInterestRateParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-a-future-hourly-interest-rate).
    ///
    pub async fn get_future_hourly_interest_rate(
        &self,
        params: GetFutureHourlyInterestRateParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetFutureHourlyInterestRateResponseInner>>>
    {
        self.borrow_repay_api_client
            .get_future_hourly_interest_rate(params)
            .await
    }

    /// 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 `startTime`and `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
    ///
    /// - `params`: [`GetInterestHistoryParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/borrow-and-repay/Get-Interest-History).
    ///
    pub async fn get_interest_history(
        &self,
        params: GetInterestHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::GetInterestHistoryResponse>> {
        self.borrow_repay_api_client
            .get_interest_history(params)
            .await
    }

    /// Margin account borrow/repay(MARGIN)
    ///
    /// Margin account borrow/repay(MARGIN)
    ///
    /// Weight: 1500
    ///
    /// # Arguments
    ///
    /// - `params`: [`MarginAccountBorrowRepayParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/borrow-and-repay/Margin-account-borrow-repay).
    ///
    pub async fn margin_account_borrow_repay(
        &self,
        params: MarginAccountBorrowRepayParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountBorrowRepayResponse>> {
        self.borrow_repay_api_client
            .margin_account_borrow_repay(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryBorrowRepayRecordsInMarginAccountParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Borrow-Repay).
    ///
    pub async fn query_borrow_repay_records_in_margin_account(
        &self,
        params: QueryBorrowRepayRecordsInMarginAccountParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryBorrowRepayRecordsInMarginAccountResponse>>
    {
        self.borrow_repay_api_client
            .query_borrow_repay_records_in_margin_account(params)
            .await
    }

    /// Query Margin Interest Rate History (`USER_DATA`)
    ///
    /// Query Margin Interest Rate History
    ///
    /// Weight: 1(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginInterestRateHistoryParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Margin-Interest-Rate-History).
    ///
    pub async fn query_margin_interest_rate_history(
        &self,
        params: QueryMarginInterestRateHistoryParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryMarginInterestRateHistoryResponseInner>>>
    {
        self.borrow_repay_api_client
            .query_margin_interest_rate_history(params)
            .await
    }

    /// Query Max Borrow (`USER_DATA`)
    ///
    /// Query Max Borrow
    ///
    /// * If isolatedSymbol is not sent, crossed margin data will be sent.
    /// * `borrowLimit` is also available from [https://www.binance.com/en/margin-fee](https://www.binance.com/en/margin-fee)
    ///
    /// Weight: 50(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMaxBorrowParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/borrow-and-repay/Query-Max-Borrow).
    ///
    pub async fn query_max_borrow(
        &self,
        params: QueryMaxBorrowParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMaxBorrowResponse>> {
        self.borrow_repay_api_client.query_max_borrow(params).await
    }

    /// 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](https://developers.binance.com/docs/margin_trading/market-data/Cross-margin-collateral-ratio).
    ///
    pub async fn cross_margin_collateral_ratio(
        &self,
    ) -> anyhow::Result<RestApiResponse<Vec<models::CrossMarginCollateralRatioResponseInner>>> {
        self.market_data_api_client
            .cross_margin_collateral_ratio()
            .await
    }

    /// Get All Cross Margin Pairs (`MARKET_DATA`)
    ///
    /// Get All Cross Margin Pairs
    ///
    /// Weight: 1(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetAllCrossMarginPairsParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs).
    ///
    pub async fn get_all_cross_margin_pairs(
        &self,
        params: GetAllCrossMarginPairsParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetAllCrossMarginPairsResponseInner>>> {
        self.market_data_api_client
            .get_all_cross_margin_pairs(params)
            .await
    }

    /// Get All Isolated Margin `Symbol(MARKET_DATA)`
    ///
    /// Get All Isolated Margin Symbol
    ///
    /// Weight: 10(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetAllIsolatedMarginSymbolParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol).
    ///
    pub async fn get_all_isolated_margin_symbol(
        &self,
        params: GetAllIsolatedMarginSymbolParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetAllIsolatedMarginSymbolResponseInner>>> {
        self.market_data_api_client
            .get_all_isolated_margin_symbol(params)
            .await
    }

    /// Get All Margin Assets (`MARKET_DATA`)
    ///
    /// Get All Margin Assets.
    ///
    /// Weight: 1(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetAllMarginAssetsParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets).
    ///
    pub async fn get_all_margin_assets(
        &self,
        params: GetAllMarginAssetsParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetAllMarginAssetsResponseInner>>> {
        self.market_data_api_client
            .get_all_margin_assets(params)
            .await
    }

    /// Get Delist Schedule (`MARKET_DATA`)
    ///
    /// Get tokens or symbols delist schedule for cross margin and isolated margin
    ///
    /// Weight: 100
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetDelistScheduleParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/market-data/Get-Delist-Schedule).
    ///
    pub async fn get_delist_schedule(
        &self,
        params: GetDelistScheduleParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetDelistScheduleResponseInner>>> {
        self.market_data_api_client
            .get_delist_schedule(params)
            .await
    }

    /// 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](https://developers.binance.com/docs/margin_trading/market-data/Get-Limit-Price-Pairs).
    ///
    pub async fn get_limit_price_pairs(
        &self,
    ) -> anyhow::Result<RestApiResponse<models::GetLimitPricePairsResponse>> {
        self.market_data_api_client.get_limit_price_pairs().await
    }

    /// Get list Schedule (`MARKET_DATA`)
    ///
    /// Get the upcoming tokens or symbols listing schedule for Cross Margin and Isolated Margin.
    ///
    /// Weight: 100
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetListScheduleParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/market-data/Get-list-Schedule).
    ///
    pub async fn get_list_schedule(
        &self,
        params: GetListScheduleParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetListScheduleResponseInner>>> {
        self.market_data_api_client.get_list_schedule(params).await
    }

    /// 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](https://developers.binance.com/docs/margin_trading/market-data/Get-Margin-Asset-Risk-Based-Liquidation-Ratio).
    ///
    pub async fn get_margin_asset_risk_based_liquidation_ratio(
        &self,
    ) -> anyhow::Result<
        RestApiResponse<Vec<models::GetMarginAssetRiskBasedLiquidationRatioResponseInner>>,
    > {
        self.market_data_api_client
            .get_margin_asset_risk_based_liquidation_ratio()
            .await
    }

    /// 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](https://developers.binance.com/docs/margin_trading/market-data/Get-Margin-Restricted-Assets).
    ///
    pub async fn get_margin_restricted_assets(
        &self,
    ) -> anyhow::Result<RestApiResponse<models::GetMarginRestrictedAssetsResponse>> {
        self.market_data_api_client
            .get_margin_restricted_assets()
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryIsolatedMarginTierDataParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/market-data/Query-Isolated-Margin-Tier-Data).
    ///
    pub async fn query_isolated_margin_tier_data(
        &self,
        params: QueryIsolatedMarginTierDataParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryIsolatedMarginTierDataResponseInner>>>
    {
        self.market_data_api_client
            .query_isolated_margin_tier_data(params)
            .await
    }

    /// 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](https://developers.binance.com/docs/margin_trading/market-data/Query-Liability-Coin-Leverage-Bracket-in-Cross-Margin-Pro-Mode).
    ///
    pub async fn query_liability_coin_leverage_bracket_in_cross_margin_pro_mode(
        &self,
    ) -> anyhow::Result<
        RestApiResponse<
            Vec<models::QueryLiabilityCoinLeverageBracketInCrossMarginProModeResponseInner>,
        >,
    > {
        self.market_data_api_client
            .query_liability_coin_leverage_bracket_in_cross_margin_pro_mode()
            .await
    }

    /// Query Margin Available `Inventory(USER_DATA)`
    ///
    /// Margin available Inventory query
    ///
    /// Weight: 50
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginAvailableInventoryParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/market-data/Query-margin-avaliable-inventory).
    ///
    pub async fn query_margin_available_inventory(
        &self,
        params: QueryMarginAvailableInventoryParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMarginAvailableInventoryResponse>> {
        self.market_data_api_client
            .query_margin_available_inventory(params)
            .await
    }

    /// Query Margin `PriceIndex` (`MARKET_DATA`)
    ///
    /// Query Margin `PriceIndex`
    ///
    /// Weight: 10(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginPriceindexParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/market-data/Query-Margin-PriceIndex).
    ///
    pub async fn query_margin_priceindex(
        &self,
        params: QueryMarginPriceindexParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMarginPriceindexResponse>> {
        self.market_data_api_client
            .query_margin_priceindex(params)
            .await
    }

    /// 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](https://developers.binance.com/docs/margin_trading/risk-data-stream/Close-User-Data-Stream).
    ///
    pub async fn close_user_data_stream(&self) -> anyhow::Result<RestApiResponse<Value>> {
        self.risk_data_stream_api_client
            .close_user_data_stream()
            .await
    }

    /// Keepalive User Data Stream (`USER_STREAM`)
    ///
    /// Keepalive a user data stream to prevent a time out.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`KeepaliveUserDataStreamParams`]
    ///   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](https://developers.binance.com/docs/margin_trading/risk-data-stream/Keepalive-User-Data-Stream).
    ///
    pub async fn keepalive_user_data_stream(
        &self,
        params: KeepaliveUserDataStreamParams,
    ) -> anyhow::Result<RestApiResponse<Value>> {
        self.risk_data_stream_api_client
            .keepalive_user_data_stream(params)
            .await
    }

    /// 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](https://developers.binance.com/docs/margin_trading/risk-data-stream/Start-User-Data-Stream).
    ///
    pub async fn start_user_data_stream(
        &self,
    ) -> anyhow::Result<RestApiResponse<models::StartUserDataStreamResponse>> {
        self.risk_data_stream_api_client
            .start_user_data_stream()
            .await
    }

    /// Create Special Key(Low-Latency Trading)(TRADE)
    ///
    /// - Binance Margin offers low-latency trading through a [special key](https://www.binance.com/en/support/faq/frequently-asked-questions-on-margin-special-api-key-3208663e900d4d2e9fec4140e1832f4e), 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](https://www.binance.com/en/support/faq/how-to-generate-an-rsa-key-pair-to-send-api-requests-on-binance-2b79728f331e43079b27440d9d15c5db) .
    ///
    /// Weight: 1(UID)
    ///
    /// # Arguments
    ///
    /// - `params`: [`CreateSpecialKeyParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Create-Special-Key-of-Low-Latency-Trading).
    ///
    pub async fn create_special_key(
        &self,
        params: CreateSpecialKeyParams,
    ) -> anyhow::Result<RestApiResponse<models::CreateSpecialKeyResponse>> {
        self.trade_api_client.create_special_key(params).await
    }

    /// 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
    ///
    /// - `params`: [`DeleteSpecialKeyParams`]
    ///   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](https://developers.binance.com/docs/margin_trading/trade/Delete-Special-Key-of-Low-Latency-Trading).
    ///
    pub async fn delete_special_key(
        &self,
        params: DeleteSpecialKeyParams,
    ) -> anyhow::Result<RestApiResponse<Value>> {
        self.trade_api_client.delete_special_key(params).await
    }

    /// 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
    ///
    /// - `params`: [`EditIpForSpecialKeyParams`]
    ///   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](https://developers.binance.com/docs/margin_trading/trade/Edit-ip-for-Special-Key-of-Low-Latency-Trading).
    ///
    pub async fn edit_ip_for_special_key(
        &self,
        params: EditIpForSpecialKeyParams,
    ) -> anyhow::Result<RestApiResponse<Value>> {
        self.trade_api_client.edit_ip_for_special_key(params).await
    }

    /// Get Force Liquidation Record (`USER_DATA`)
    ///
    /// Get Force Liquidation Record
    ///
    /// * Response in descending order
    ///
    /// Weight: 1(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetForceLiquidationRecordParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Get-Force-Liquidation-Record).
    ///
    pub async fn get_force_liquidation_record(
        &self,
        params: GetForceLiquidationRecordParams,
    ) -> anyhow::Result<RestApiResponse<models::GetForceLiquidationRecordResponse>> {
        self.trade_api_client
            .get_force_liquidation_record(params)
            .await
    }

    /// Get Small Liability Exchange Coin List (`USER_DATA`)
    ///
    /// Query the coins which can be small liability exchange
    ///
    /// Weight: 100
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetSmallLiabilityExchangeCoinListParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Get-Small-Liability-Exchange-Coin-List).
    ///
    pub async fn get_small_liability_exchange_coin_list(
        &self,
        params: GetSmallLiabilityExchangeCoinListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetSmallLiabilityExchangeCoinListResponseInner>>>
    {
        self.trade_api_client
            .get_small_liability_exchange_coin_list(params)
            .await
    }

    /// Get Small Liability Exchange History (`USER_DATA`)
    ///
    /// Get Small liability Exchange History
    ///
    /// Weight: 100(UID)
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetSmallLiabilityExchangeHistoryParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Get-Small-Liability-Exchange-History).
    ///
    pub async fn get_small_liability_exchange_history(
        &self,
        params: GetSmallLiabilityExchangeHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::GetSmallLiabilityExchangeHistoryResponse>> {
        self.trade_api_client
            .get_small_liability_exchange_history(params)
            .await
    }

    /// Margin Account Cancel all Open Orders on a Symbol (TRADE)
    ///
    /// Cancels all active orders on a symbol for margin account.<br></br>
    /// This includes OCO orders.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`MarginAccountCancelAllOpenOrdersOnASymbolParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-All-Open-Orders).
    ///
    pub async fn margin_account_cancel_all_open_orders_on_a_symbol(
        &self,
        params: MarginAccountCancelAllOpenOrdersOnASymbolParams,
    ) -> anyhow::Result<
        RestApiResponse<Vec<models::MarginAccountCancelAllOpenOrdersOnASymbolResponseInner>>,
    > {
        self.trade_api_client
            .margin_account_cancel_all_open_orders_on_a_symbol(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`MarginAccountCancelOcoParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-OCO).
    ///
    pub async fn margin_account_cancel_oco(
        &self,
        params: MarginAccountCancelOcoParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountCancelOcoResponse>> {
        self.trade_api_client
            .margin_account_cancel_oco(params)
            .await
    }

    /// Margin Account Cancel Order (TRADE)
    ///
    /// Cancel an active order for margin account.
    ///
    /// * Either orderId or origClientOrderId must be sent.
    ///
    /// Weight: 10(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`MarginAccountCancelOrderParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-Order).
    ///
    pub async fn margin_account_cancel_order(
        &self,
        params: MarginAccountCancelOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountCancelOrderResponse>> {
        self.trade_api_client
            .margin_account_cancel_order(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`MarginAccountNewOcoParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-OCO).
    ///
    pub async fn margin_account_new_oco(
        &self,
        params: MarginAccountNewOcoParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountNewOcoResponse>> {
        self.trade_api_client.margin_account_new_oco(params).await
    }

    /// 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
    ///
    /// - `params`: [`MarginAccountNewOrderParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-Order).
    ///
    pub async fn margin_account_new_order(
        &self,
        params: MarginAccountNewOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountNewOrderResponse>> {
        self.trade_api_client.margin_account_new_order(params).await
    }

    /// 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
    ///
    /// - `params`: [`MarginAccountNewOtoParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-OTO).
    ///
    pub async fn margin_account_new_oto(
        &self,
        params: MarginAccountNewOtoParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountNewOtoResponse>> {
        self.trade_api_client.margin_account_new_oto(params).await
    }

    /// 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](https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-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
    ///
    /// - `params`: [`MarginAccountNewOtocoParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Margin-Account-New-OTOCO).
    ///
    pub async fn margin_account_new_otoco(
        &self,
        params: MarginAccountNewOtocoParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountNewOtocoResponse>> {
        self.trade_api_client.margin_account_new_otoco(params).await
    }

    /// 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
    ///
    /// - `params`: [`MarginManualLiquidationParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Margin-Manual-Liquidation).
    ///
    pub async fn margin_manual_liquidation(
        &self,
        params: MarginManualLiquidationParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginManualLiquidationResponse>> {
        self.trade_api_client
            .margin_manual_liquidation(params)
            .await
    }

    /// Query Current Margin Order Count Usage (TRADE)
    ///
    /// Displays the user's current margin order count usage for all intervals.
    ///
    /// Weight: 20(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCurrentMarginOrderCountUsageParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Current-Margin-Order-Count-Usage).
    ///
    pub async fn query_current_margin_order_count_usage(
        &self,
        params: QueryCurrentMarginOrderCountUsageParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryCurrentMarginOrderCountUsageResponseInner>>>
    {
        self.trade_api_client
            .query_current_margin_order_count_usage(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryMarginAccountsAllOcoParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-all-OCO).
    ///
    pub async fn query_margin_accounts_all_oco(
        &self,
        params: QueryMarginAccountsAllOcoParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryMarginAccountsAllOcoResponseInner>>> {
        self.trade_api_client
            .query_margin_accounts_all_oco(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryMarginAccountsAllOrdersParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-All-Orders).
    ///
    pub async fn query_margin_accounts_all_orders(
        &self,
        params: QueryMarginAccountsAllOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryMarginAccountsAllOrdersResponseInner>>>
    {
        self.trade_api_client
            .query_margin_accounts_all_orders(params)
            .await
    }

    /// Query Margin Account's OCO (`USER_DATA`)
    ///
    /// Retrieves a specific OCO based on provided optional parameters
    ///
    /// Weight: 10(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginAccountsOcoParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-OCO).
    ///
    pub async fn query_margin_accounts_oco(
        &self,
        params: QueryMarginAccountsOcoParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMarginAccountsOcoResponse>> {
        self.trade_api_client
            .query_margin_accounts_oco(params)
            .await
    }

    /// Query Margin Account's Open OCO (`USER_DATA`)
    ///
    /// Query Margin Account's Open OCO
    ///
    /// Weight: 10(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginAccountsOpenOcoParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-OCO).
    ///
    pub async fn query_margin_accounts_open_oco(
        &self,
        params: QueryMarginAccountsOpenOcoParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryMarginAccountsOpenOcoResponseInner>>> {
        self.trade_api_client
            .query_margin_accounts_open_oco(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryMarginAccountsOpenOrdersParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Open-Orders).
    ///
    pub async fn query_margin_accounts_open_orders(
        &self,
        params: QueryMarginAccountsOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryMarginAccountsOpenOrdersResponseInner>>>
    {
        self.trade_api_client
            .query_margin_accounts_open_orders(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryMarginAccountsOrderParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Order).
    ///
    pub async fn query_margin_accounts_order(
        &self,
        params: QueryMarginAccountsOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMarginAccountsOrderResponse>> {
        self.trade_api_client
            .query_margin_accounts_order(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryMarginAccountsTradeListParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List).
    ///
    pub async fn query_margin_accounts_trade_list(
        &self,
        params: QueryMarginAccountsTradeListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryMarginAccountsTradeListResponseInner>>>
    {
        self.trade_api_client
            .query_margin_accounts_trade_list(params)
            .await
    }

    /// Query Prevented `Matches(USER_DATA)`
    ///
    ///
    /// Weight: 10(IP)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryPreventedMatchesParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Prevented-Matches).
    ///
    pub async fn query_prevented_matches(
        &self,
        params: QueryPreventedMatchesParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryPreventedMatchesResponseInner>>> {
        self.trade_api_client.query_prevented_matches(params).await
    }

    /// 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
    ///
    /// - `params`: [`QuerySpecialKeyParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Special-Key-of-Low-Latency-Trading).
    ///
    pub async fn query_special_key(
        &self,
        params: QuerySpecialKeyParams,
    ) -> anyhow::Result<RestApiResponse<models::QuerySpecialKeyResponse>> {
        self.trade_api_client.query_special_key(params).await
    }

    /// Query Special key List(Low Latency Trading)(TRADE)
    ///
    /// This only applies to Special Key for Low Latency Trading.
    ///
    /// Weight: 1(UID)
    ///
    /// # Arguments
    ///
    /// - `params`: [`QuerySpecialKeyListParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/trade/Query-Special-Key-List-of-Low-Latency-Trading).
    ///
    pub async fn query_special_key_list(
        &self,
        params: QuerySpecialKeyListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QuerySpecialKeyListResponseInner>>> {
        self.trade_api_client.query_special_key_list(params).await
    }

    /// 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
    ///
    /// - `params`: [`SmallLiabilityExchangeParams`]
    ///   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](https://developers.binance.com/docs/margin_trading/trade/Small-Liability-Exchange).
    ///
    pub async fn small_liability_exchange(
        &self,
        params: SmallLiabilityExchangeParams,
    ) -> anyhow::Result<RestApiResponse<Value>> {
        self.trade_api_client.small_liability_exchange(params).await
    }

    /// 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
    ///
    /// - `params`: [`GetCrossMarginTransferHistoryParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/transfer/Get-Cross-Margin-Transfer-History).
    ///
    pub async fn get_cross_margin_transfer_history(
        &self,
        params: GetCrossMarginTransferHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::GetCrossMarginTransferHistoryResponse>> {
        self.transfer_api_client
            .get_cross_margin_transfer_history(params)
            .await
    }

    /// 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
    ///
    /// - `params`: [`QueryMaxTransferOutAmountParams`]
    ///   The 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:
    ///   - `RequiredError`
    ///   - `ConnectorClientError`
    ///   - `UnauthorizedError`
    ///   - `ForbiddenError`
    ///   - `TooManyRequestsError`
    ///   - `RateLimitBanError`
    ///   - `ServerError`
    ///   - `NotFoundError`
    ///   - `NetworkError`
    ///   - `BadRequestError`
    ///
    ///
    /// For full API details, see the [Binance API Documentation](https://developers.binance.com/docs/margin_trading/transfer/Query-Max-Transfer-Out-Amount).
    ///
    pub async fn query_max_transfer_out_amount(
        &self,
        params: QueryMaxTransferOutAmountParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMaxTransferOutAmountResponse>> {
        self.transfer_api_client
            .query_max_transfer_out_amount(params)
            .await
    }
}
