/*
 * Binance Derivatives Trading Portfolio Margin REST API
 *
 * OpenAPI Specification for the Binance Derivatives Trading Portfolio Margin 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,
    market_data_api_client: MarketDataApiClient,
    trade_api_client: TradeApiClient,
    user_data_streams_api_client: UserDataStreamsApiClient,
}

impl RestApi {
    pub fn new(configuration: ConfigurationRestApi) -> Self {
        let account_api_client = AccountApiClient::new(configuration.clone());
        let market_data_api_client = MarketDataApiClient::new(configuration.clone());
        let trade_api_client = TradeApiClient::new(configuration.clone());
        let user_data_streams_api_client = UserDataStreamsApiClient::new(configuration.clone());

        Self {
            configuration,
            account_api_client,
            market_data_api_client,
            trade_api_client,
            user_data_streams_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
    }

    /// Account `Balance(USER_DATA)`
    ///
    /// Query account balance
    ///
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`AccountBalanceParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::AccountBalanceResponse>`] 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/derivatives/portfolio-margin/account/Account-Balance).
    ///
    pub async fn account_balance(
        &self,
        params: AccountBalanceParams,
    ) -> anyhow::Result<RestApiResponse<models::AccountBalanceResponse>> {
        self.account_api_client.account_balance(params).await
    }

    /// Account `Information(USER_DATA)`
    ///
    /// Query account information
    ///
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`AccountInformationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::AccountInformationResponse>`] 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/derivatives/portfolio-margin/account/Account-Information).
    ///
    pub async fn account_information(
        &self,
        params: AccountInformationParams,
    ) -> anyhow::Result<RestApiResponse<models::AccountInformationResponse>> {
        self.account_api_client.account_information(params).await
    }

    /// BNB transfer (TRADE)
    ///
    /// Transfer BNB in and out of UM
    ///
    /// * The endpoint can only be called 10 times per 10 minutes in a rolling manner
    ///
    /// Weight: 750
    ///
    /// # Arguments
    ///
    /// - `params`: [`BnbTransferParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::BnbTransferResponse>`] 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/derivatives/portfolio-margin/account/BNB-transfer).
    ///
    pub async fn bnb_transfer(
        &self,
        params: BnbTransferParams,
    ) -> anyhow::Result<RestApiResponse<models::BnbTransferResponse>> {
        self.account_api_client.bnb_transfer(params).await
    }

    /// Change Auto-repay-futures Status(TRADE)
    ///
    /// Change Auto-repay-futures Status
    ///
    /// Weight: 750
    ///
    /// # Arguments
    ///
    /// - `params`: [`ChangeAutoRepayFuturesStatusParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ChangeAutoRepayFuturesStatusResponse>`] 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/derivatives/portfolio-margin/account/Change-Auto-repay-futures-Status).
    ///
    pub async fn change_auto_repay_futures_status(
        &self,
        params: ChangeAutoRepayFuturesStatusParams,
    ) -> anyhow::Result<RestApiResponse<models::ChangeAutoRepayFuturesStatusResponse>> {
        self.account_api_client
            .change_auto_repay_futures_status(params)
            .await
    }

    /// Change CM Initial Leverage (TRADE)
    ///
    /// Change user's initial leverage of specific symbol in CM.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ChangeCmInitialLeverageParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ChangeCmInitialLeverageResponse>`] 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/derivatives/portfolio-margin/account/Change-CM-Initial-Leverage).
    ///
    pub async fn change_cm_initial_leverage(
        &self,
        params: ChangeCmInitialLeverageParams,
    ) -> anyhow::Result<RestApiResponse<models::ChangeCmInitialLeverageResponse>> {
        self.account_api_client
            .change_cm_initial_leverage(params)
            .await
    }

    /// Change CM Position Mode(TRADE)
    ///
    /// Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in CM
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ChangeCmPositionModeParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ChangeCmPositionModeResponse>`] 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/derivatives/portfolio-margin/account/Change-CM-Position-Mode).
    ///
    pub async fn change_cm_position_mode(
        &self,
        params: ChangeCmPositionModeParams,
    ) -> anyhow::Result<RestApiResponse<models::ChangeCmPositionModeResponse>> {
        self.account_api_client
            .change_cm_position_mode(params)
            .await
    }

    /// Change UM Initial Leverage(TRADE)
    ///
    /// Change user's initial leverage of specific symbol in UM.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ChangeUmInitialLeverageParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ChangeUmInitialLeverageResponse>`] 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/derivatives/portfolio-margin/account/Change-UM-Initial-Leverage).
    ///
    pub async fn change_um_initial_leverage(
        &self,
        params: ChangeUmInitialLeverageParams,
    ) -> anyhow::Result<RestApiResponse<models::ChangeUmInitialLeverageResponse>> {
        self.account_api_client
            .change_um_initial_leverage(params)
            .await
    }

    /// Change UM Position Mode(TRADE)
    ///
    /// Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ChangeUmPositionModeParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ChangeUmPositionModeResponse>`] 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/derivatives/portfolio-margin/account/Change-UM-Position-Mode).
    ///
    pub async fn change_um_position_mode(
        &self,
        params: ChangeUmPositionModeParams,
    ) -> anyhow::Result<RestApiResponse<models::ChangeUmPositionModeResponse>> {
        self.account_api_client
            .change_um_position_mode(params)
            .await
    }

    /// CM Notional and Leverage `Brackets(USER_DATA)`
    ///
    /// Query CM notional and leverage brackets
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CmNotionalAndLeverageBracketsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::CmNotionalAndLeverageBracketsResponseInner>>`] 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/derivatives/portfolio-margin/account/CM-Notional-and-Leverage-Brackets).
    ///
    pub async fn cm_notional_and_leverage_brackets(
        &self,
        params: CmNotionalAndLeverageBracketsParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::CmNotionalAndLeverageBracketsResponseInner>>>
    {
        self.account_api_client
            .cm_notional_and_leverage_brackets(params)
            .await
    }

    /// Fund Auto-collection(TRADE)
    ///
    /// Fund collection for Portfolio Margin
    ///
    /// * The BNB would not be collected from UM-PM account to the Portfolio Margin account.
    /// * You can only use this function 500 times per hour in a rolling manner.
    ///
    /// Weight: 750
    ///
    /// # Arguments
    ///
    /// - `params`: [`FundAutoCollectionParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::FundAutoCollectionResponse>`] 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/derivatives/portfolio-margin/account/Fund-Auto-collection).
    ///
    pub async fn fund_auto_collection(
        &self,
        params: FundAutoCollectionParams,
    ) -> anyhow::Result<RestApiResponse<models::FundAutoCollectionResponse>> {
        self.account_api_client.fund_auto_collection(params).await
    }

    /// Fund Collection by Asset(TRADE)
    ///
    /// Transfers specific asset from Futures Account to Margin account
    ///
    /// * The BNB transfer is not be supported
    ///
    /// Weight: 30
    ///
    /// # Arguments
    ///
    /// - `params`: [`FundCollectionByAssetParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::FundCollectionByAssetResponse>`] 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/derivatives/portfolio-margin/account/Fund-Collection-by-Asset).
    ///
    pub async fn fund_collection_by_asset(
        &self,
        params: FundCollectionByAssetParams,
    ) -> anyhow::Result<RestApiResponse<models::FundCollectionByAssetResponse>> {
        self.account_api_client
            .fund_collection_by_asset(params)
            .await
    }

    /// Get Auto-repay-futures `Status(USER_DATA)`
    ///
    /// Query Auto-repay-futures Status
    ///
    /// Weight: 30
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetAutoRepayFuturesStatusParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetAutoRepayFuturesStatusResponse>`] 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/derivatives/portfolio-margin/account/Get-Auto-repay-futures-Status).
    ///
    pub async fn get_auto_repay_futures_status(
        &self,
        params: GetAutoRepayFuturesStatusParams,
    ) -> anyhow::Result<RestApiResponse<models::GetAutoRepayFuturesStatusResponse>> {
        self.account_api_client
            .get_auto_repay_futures_status(params)
            .await
    }

    /// Get CM Account `Detail(USER_DATA)`
    ///
    /// Get current CM account asset and position information.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetCmAccountDetailParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetCmAccountDetailResponse>`] 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/derivatives/portfolio-margin/account/Get-CM-Account-Detail).
    ///
    pub async fn get_cm_account_detail(
        &self,
        params: GetCmAccountDetailParams,
    ) -> anyhow::Result<RestApiResponse<models::GetCmAccountDetailResponse>> {
        self.account_api_client.get_cm_account_detail(params).await
    }

    /// Get CM Current Position `Mode(USER_DATA)`
    ///
    /// Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in CM
    ///
    /// Weight: 30
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetCmCurrentPositionModeParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetCmCurrentPositionModeResponse>`] 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/derivatives/portfolio-margin/account/Get-CM-Current-Position-Mode).
    ///
    pub async fn get_cm_current_position_mode(
        &self,
        params: GetCmCurrentPositionModeParams,
    ) -> anyhow::Result<RestApiResponse<models::GetCmCurrentPositionModeResponse>> {
        self.account_api_client
            .get_cm_current_position_mode(params)
            .await
    }

    /// Get CM Income `History(USER_DATA)`
    ///
    /// Get CM Income History
    ///
    ///
    /// * If `incomeType` is not sent, all kinds of flow will be returned
    /// * "trandId" is unique in the same "incomeType" for a user
    /// * The interval between `startTime` and `endTime` can not exceed 200 days:
    /// * If `startTime` and `endTime` are not sent, the last 200 days will be returned
    ///
    /// Weight: 30
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetCmIncomeHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::GetCmIncomeHistoryResponseInner>>`] 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/derivatives/portfolio-margin/account/Get-CM-Income-History).
    ///
    pub async fn get_cm_income_history(
        &self,
        params: GetCmIncomeHistoryParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetCmIncomeHistoryResponseInner>>> {
        self.account_api_client.get_cm_income_history(params).await
    }

    /// Get Download Id For UM Futures Order History (`USER_DATA`)
    ///
    /// Get download id for UM futures order history
    ///
    /// * Request Limitation is 10 times per month, shared by front end download page and rest api
    /// * The time between `startTime` and `endTime` can not be longer than 1 year
    ///
    /// Weight: 1500
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetDownloadIdForUmFuturesOrderHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetDownloadIdForUmFuturesOrderHistoryResponse>`] 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/derivatives/portfolio-margin/account/Get-Download-Id-For-UM-Futures-Order-History).
    ///
    pub async fn get_download_id_for_um_futures_order_history(
        &self,
        params: GetDownloadIdForUmFuturesOrderHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::GetDownloadIdForUmFuturesOrderHistoryResponse>>
    {
        self.account_api_client
            .get_download_id_for_um_futures_order_history(params)
            .await
    }

    /// Get Download Id For UM Futures Trade History (`USER_DATA`)
    ///
    /// Get download id for UM futures trade history
    ///
    /// * Request Limitation is 5 times per month, shared by front end download page and rest api
    /// * The time between `startTime` and `endTime` can not be longer than 1 year
    ///
    /// Weight: 1500
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetDownloadIdForUmFuturesTradeHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetDownloadIdForUmFuturesTradeHistoryResponse>`] 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/derivatives/portfolio-margin/account/Get-Download-Id-For-UM-Futures-Trade-History).
    ///
    pub async fn get_download_id_for_um_futures_trade_history(
        &self,
        params: GetDownloadIdForUmFuturesTradeHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::GetDownloadIdForUmFuturesTradeHistoryResponse>>
    {
        self.account_api_client
            .get_download_id_for_um_futures_trade_history(params)
            .await
    }

    /// Get Download Id For UM Futures Transaction History (`USER_DATA`)
    ///
    /// Get download id for UM futures transaction history
    ///
    /// * Request Limitation is 5 times per month, shared by front end download page and rest api
    /// * The time between `startTime` and `endTime` can not be longer than 1 year
    ///
    /// Weight: 1500
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetDownloadIdForUmFuturesTransactionHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetDownloadIdForUmFuturesTransactionHistoryResponse>`] 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/derivatives/portfolio-margin/account/Get-Download-Id-For-UM-Futures-Transaction-History).
    ///
    pub async fn get_download_id_for_um_futures_transaction_history(
        &self,
        params: GetDownloadIdForUmFuturesTransactionHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::GetDownloadIdForUmFuturesTransactionHistoryResponse>>
    {
        self.account_api_client
            .get_download_id_for_um_futures_transaction_history(params)
            .await
    }

    /// Get Margin Borrow/Loan Interest `History(USER_DATA)`
    ///
    /// Get Margin Borrow/Loan Interest History
    ///
    ///
    /// * Response in descending order
    /// * 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, the records from `startTime` to the present will be returned; if `startTime` is more than 30 days ago, the records of the past 30 days will be returned.
    /// * If `startTime` is not sent and `endTime` is sent, the records of the 7 days before `endTime` is returned.
    /// * Type in response has 5 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` Portfolio Margin negative balance daily interest
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetMarginBorrowLoanInterestHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetMarginBorrowLoanInterestHistoryResponse>`] 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/derivatives/portfolio-margin/account/Get-Margin-BorrowLoan-Interest-History).
    ///
    pub async fn get_margin_borrow_loan_interest_history(
        &self,
        params: GetMarginBorrowLoanInterestHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::GetMarginBorrowLoanInterestHistoryResponse>> {
        self.account_api_client
            .get_margin_borrow_loan_interest_history(params)
            .await
    }

    /// Get UM Account `Detail(USER_DATA)`
    ///
    /// Get current UM account asset and position information.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUmAccountDetailParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUmAccountDetailResponse>`] 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/derivatives/portfolio-margin/account/Get-UM-Account-Detail).
    ///
    pub async fn get_um_account_detail(
        &self,
        params: GetUmAccountDetailParams,
    ) -> anyhow::Result<RestApiResponse<models::GetUmAccountDetailResponse>> {
        self.account_api_client.get_um_account_detail(params).await
    }

    /// Get UM Account Detail `V2(USER_DATA)`
    ///
    /// Get current UM account asset and position information.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUmAccountDetailV2Params`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUmAccountDetailV2Response>`] 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/derivatives/portfolio-margin/account/Get-UM-Account-Detail-V2).
    ///
    pub async fn get_um_account_detail_v2(
        &self,
        params: GetUmAccountDetailV2Params,
    ) -> anyhow::Result<RestApiResponse<models::GetUmAccountDetailV2Response>> {
        self.account_api_client
            .get_um_account_detail_v2(params)
            .await
    }

    /// Get UM Current Position `Mode(USER_DATA)`
    ///
    /// Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM
    ///
    /// Weight: 30
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUmCurrentPositionModeParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUmCurrentPositionModeResponse>`] 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/derivatives/portfolio-margin/account/Get-UM-Current-Position-Mode).
    ///
    pub async fn get_um_current_position_mode(
        &self,
        params: GetUmCurrentPositionModeParams,
    ) -> anyhow::Result<RestApiResponse<models::GetUmCurrentPositionModeResponse>> {
        self.account_api_client
            .get_um_current_position_mode(params)
            .await
    }

    /// Get UM Futures Order Download Link by `Id(USER_DATA)`
    ///
    /// Get UM futures order download link by Id
    ///
    /// * Download link expiration: 24h
    ///
    /// Weight: 10
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUmFuturesOrderDownloadLinkByIdParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUmFuturesOrderDownloadLinkByIdResponse>`] 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/derivatives/portfolio-margin/account/Get-UM-Futures-Order-Download-Link-by-Id).
    ///
    pub async fn get_um_futures_order_download_link_by_id(
        &self,
        params: GetUmFuturesOrderDownloadLinkByIdParams,
    ) -> anyhow::Result<RestApiResponse<models::GetUmFuturesOrderDownloadLinkByIdResponse>> {
        self.account_api_client
            .get_um_futures_order_download_link_by_id(params)
            .await
    }

    /// Get UM Futures Trade Download Link by `Id(USER_DATA)`
    ///
    /// Get UM futures trade download link by Id
    ///
    /// * Download link expiration: 24h
    ///
    /// Weight: 10
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUmFuturesTradeDownloadLinkByIdParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUmFuturesTradeDownloadLinkByIdResponse>`] 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/derivatives/portfolio-margin/account/Get-UM-Futures-Trade-Download-Link-by-Id).
    ///
    pub async fn get_um_futures_trade_download_link_by_id(
        &self,
        params: GetUmFuturesTradeDownloadLinkByIdParams,
    ) -> anyhow::Result<RestApiResponse<models::GetUmFuturesTradeDownloadLinkByIdResponse>> {
        self.account_api_client
            .get_um_futures_trade_download_link_by_id(params)
            .await
    }

    /// Get UM Futures Transaction Download Link by `Id(USER_DATA)`
    ///
    /// Get UM futures Transaction download link by Id
    ///
    /// * Download link expiration: 24h
    ///
    /// Weight: 10
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUmFuturesTransactionDownloadLinkByIdParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUmFuturesTransactionDownloadLinkByIdResponse>`] 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/derivatives/portfolio-margin/account/Get-UM-Futures-Transaction-Download-Link-by-Id).
    ///
    pub async fn get_um_futures_transaction_download_link_by_id(
        &self,
        params: GetUmFuturesTransactionDownloadLinkByIdParams,
    ) -> anyhow::Result<RestApiResponse<models::GetUmFuturesTransactionDownloadLinkByIdResponse>>
    {
        self.account_api_client
            .get_um_futures_transaction_download_link_by_id(params)
            .await
    }

    /// Get UM Income `History(USER_DATA)`
    ///
    /// Get UM Income History
    ///
    /// * If neither `startTime` nor `endTime` is sent, the recent 7-day data will be returned.
    /// * If `incomeType` is not sent, all kinds of flow will be returned
    /// * "trandId" is unique in the same incomeType for a user
    /// * Income history only contains data for the last three months
    ///
    /// Weight: 30
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUmIncomeHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::GetUmIncomeHistoryResponseInner>>`] 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/derivatives/portfolio-margin/account/Get-UM-Income-History).
    ///
    pub async fn get_um_income_history(
        &self,
        params: GetUmIncomeHistoryParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::GetUmIncomeHistoryResponseInner>>> {
        self.account_api_client.get_um_income_history(params).await
    }

    /// Get User Commission Rate for `CM(USER_DATA)`
    ///
    /// Get User Commission Rate for CM
    ///
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUserCommissionRateForCmParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUserCommissionRateForCmResponse>`] 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/derivatives/portfolio-margin/account/Get-User-Commission-Rate-for-CM).
    ///
    pub async fn get_user_commission_rate_for_cm(
        &self,
        params: GetUserCommissionRateForCmParams,
    ) -> anyhow::Result<RestApiResponse<models::GetUserCommissionRateForCmResponse>> {
        self.account_api_client
            .get_user_commission_rate_for_cm(params)
            .await
    }

    /// Get User Commission Rate for `UM(USER_DATA)`
    ///
    /// Get User Commission Rate for UM
    ///
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUserCommissionRateForUmParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUserCommissionRateForUmResponse>`] 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/derivatives/portfolio-margin/account/Get-User-Commission-Rate-for-UM).
    ///
    pub async fn get_user_commission_rate_for_um(
        &self,
        params: GetUserCommissionRateForUmParams,
    ) -> anyhow::Result<RestApiResponse<models::GetUserCommissionRateForUmResponse>> {
        self.account_api_client
            .get_user_commission_rate_for_um(params)
            .await
    }

    /// Margin Max `Borrow(USER_DATA)`
    ///
    /// Query margin max borrow
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`MarginMaxBorrowParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::MarginMaxBorrowResponse>`] 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/derivatives/portfolio-margin/account/Margin-Max-Borrow).
    ///
    pub async fn margin_max_borrow(
        &self,
        params: MarginMaxBorrowParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginMaxBorrowResponse>> {
        self.account_api_client.margin_max_borrow(params).await
    }

    /// Portfolio Margin UM Trading Quantitative Rules `Indicators(USER_DATA)`
    ///
    /// Portfolio Margin UM Trading Quantitative Rules Indicators
    ///
    /// Weight: 1 for a single symbol
    /// 10 when the symbol parameter is omitted
    ///
    /// # Arguments
    ///
    /// - `params`: [`PortfolioMarginUmTradingQuantitativeRulesIndicatorsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::PortfolioMarginUmTradingQuantitativeRulesIndicatorsResponse>`] 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/derivatives/portfolio-margin/account/Portfolio-Margin-UM-Trading-Quantitative-Rules-Indicators).
    ///
    pub async fn portfolio_margin_um_trading_quantitative_rules_indicators(
        &self,
        params: PortfolioMarginUmTradingQuantitativeRulesIndicatorsParams,
    ) -> anyhow::Result<
        RestApiResponse<models::PortfolioMarginUmTradingQuantitativeRulesIndicatorsResponse>,
    > {
        self.account_api_client
            .portfolio_margin_um_trading_quantitative_rules_indicators(params)
            .await
    }

    /// Query CM Position `Information(USER_DATA)`
    ///
    /// Get current CM position information.
    ///
    /// * If neither `marginAsset` nor `pair` is sent, positions of all symbols with `TRADING` status will be returned.
    /// * for One-way Mode user, the response will only show the "BOTH" positions
    /// * for Hedge Mode user, the response will show "LONG", and "SHORT" positions.
    /// * Please use with user data stream `ACCOUNT_UPDATE` to meet your timeliness and accuracy needs.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCmPositionInformationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryCmPositionInformationResponseInner>>`] 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/derivatives/portfolio-margin/account/Query-CM-Position-Information).
    ///
    pub async fn query_cm_position_information(
        &self,
        params: QueryCmPositionInformationParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryCmPositionInformationResponseInner>>> {
        self.account_api_client
            .query_cm_position_information(params)
            .await
    }

    /// Query Margin Loan `Record(USER_DATA)`
    ///
    /// Query margin loan record
    ///
    /// * txId or startTime must be sent. txId takes precedence.
    /// * Response in descending order
    /// * The max interval between `startTime` and `endTime` is 30 days.
    /// * If `startTime` and `endTime` not sent, return records of the last 7 days by default
    /// * Set `archived` to `true` to query data from 6 months ago
    ///
    /// Weight: 10
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginLoanRecordParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryMarginLoanRecordResponse>`] 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/derivatives/portfolio-margin/account/Query-Margin-Loan-Record).
    ///
    pub async fn query_margin_loan_record(
        &self,
        params: QueryMarginLoanRecordParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMarginLoanRecordResponse>> {
        self.account_api_client
            .query_margin_loan_record(params)
            .await
    }

    /// Query Margin Max `Withdraw(USER_DATA)`
    ///
    /// Query Margin Max Withdraw
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginMaxWithdrawParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryMarginMaxWithdrawResponse>`] 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/derivatives/portfolio-margin/account/Query-Margin-Max-Withdraw).
    ///
    pub async fn query_margin_max_withdraw(
        &self,
        params: QueryMarginMaxWithdrawParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMarginMaxWithdrawResponse>> {
        self.account_api_client
            .query_margin_max_withdraw(params)
            .await
    }

    /// Query Margin repay `Record(USER_DATA)`
    ///
    /// Query margin repay record.
    ///
    /// * txId or startTime must be sent. txId takes precedence.
    /// * Response in descending order
    /// * The max interval between `startTime` and `endTime` is 30 days.
    /// * If `startTime` and `endTime` not sent, return records of the last 7 days by default
    /// * Set `archived` to `true` to query data from 6 months ago
    ///
    /// Weight: 10
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginRepayRecordParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryMarginRepayRecordResponse>`] 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/derivatives/portfolio-margin/account/Query-Margin-repay-Record).
    ///
    pub async fn query_margin_repay_record(
        &self,
        params: QueryMarginRepayRecordParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMarginRepayRecordResponse>> {
        self.account_api_client
            .query_margin_repay_record(params)
            .await
    }

    /// Query Portfolio Margin Negative Balance Interest `History(USER_DATA)`
    ///
    /// Query interest history of negative balance for portfolio margin.
    ///
    /// * Response in descending order
    /// * 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, the records from `startTime` to the present will be returned; if `startTime` is more than 30 days ago, the records of the past 30 days will be returned.
    /// * If `startTime` is not sent and `endTime` is sent, the records of the 7 days before `endTime` is returned.
    ///
    /// Weight: 50
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryPortfolioMarginNegativeBalanceInterestHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryPortfolioMarginNegativeBalanceInterestHistoryResponseInner>>`] 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/derivatives/portfolio-margin/account/Query-Portfolio-Margin-Negative-Balance-Interest-History).
    ///
    pub async fn query_portfolio_margin_negative_balance_interest_history(
        &self,
        params: QueryPortfolioMarginNegativeBalanceInterestHistoryParams,
    ) -> anyhow::Result<
        RestApiResponse<
            Vec<models::QueryPortfolioMarginNegativeBalanceInterestHistoryResponseInner>,
        >,
    > {
        self.account_api_client
            .query_portfolio_margin_negative_balance_interest_history(params)
            .await
    }

    /// Query UM Position `Information(USER_DATA)`
    ///
    /// Get current UM position information.
    ///
    /// * Please use with user data stream `ACCOUNT_UPDATE` to meet your timeliness and accuracy needs.
    /// * for One-way Mode user, the response will only show the "BOTH" positions
    /// * for Hedge Mode user, the response will show "LONG", and "SHORT" positions.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUmPositionInformationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryUmPositionInformationResponseInner>>`] 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/derivatives/portfolio-margin/account/Query-UM-Position-Information).
    ///
    pub async fn query_um_position_information(
        &self,
        params: QueryUmPositionInformationParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryUmPositionInformationResponseInner>>> {
        self.account_api_client
            .query_um_position_information(params)
            .await
    }

    /// Query User Negative Balance Auto Exchange Record (`USER_DATA`)
    ///
    /// Query user negative balance auto exchange record
    ///
    /// * Response in descending order
    /// * The max interval between `startTime` and `endTime` is 3 months.
    ///
    /// Weight: 100
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUserNegativeBalanceAutoExchangeRecordParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryUserNegativeBalanceAutoExchangeRecordResponse>`] 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/derivatives/portfolio-margin/account/Query-User-Negative-Balance-Auto-Exchange-Record).
    ///
    pub async fn query_user_negative_balance_auto_exchange_record(
        &self,
        params: QueryUserNegativeBalanceAutoExchangeRecordParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryUserNegativeBalanceAutoExchangeRecordResponse>>
    {
        self.account_api_client
            .query_user_negative_balance_auto_exchange_record(params)
            .await
    }

    /// Query User Rate Limit (`USER_DATA`)
    ///
    /// Query User Rate Limit
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUserRateLimitParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryUserRateLimitResponseInner>>`] 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/derivatives/portfolio-margin/account/Query-User-Rate-Limit).
    ///
    pub async fn query_user_rate_limit(
        &self,
        params: QueryUserRateLimitParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryUserRateLimitResponseInner>>> {
        self.account_api_client.query_user_rate_limit(params).await
    }

    /// Repay futures Negative `Balance(USER_DATA)`
    ///
    /// Repay futures Negative Balance
    ///
    /// Weight: 750
    ///
    /// # Arguments
    ///
    /// - `params`: [`RepayFuturesNegativeBalanceParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::RepayFuturesNegativeBalanceResponse>`] 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/derivatives/portfolio-margin/account/Repay-futures-Negative-Balance).
    ///
    pub async fn repay_futures_negative_balance(
        &self,
        params: RepayFuturesNegativeBalanceParams,
    ) -> anyhow::Result<RestApiResponse<models::RepayFuturesNegativeBalanceResponse>> {
        self.account_api_client
            .repay_futures_negative_balance(params)
            .await
    }

    /// UM Futures Account `Configuration(USER_DATA)`
    ///
    /// Query UM Futures account configuration
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`UmFuturesAccountConfigurationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::UmFuturesAccountConfigurationResponse>`] 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/derivatives/portfolio-margin/account/Get-UM-Futures-Account-Config).
    ///
    pub async fn um_futures_account_configuration(
        &self,
        params: UmFuturesAccountConfigurationParams,
    ) -> anyhow::Result<RestApiResponse<models::UmFuturesAccountConfigurationResponse>> {
        self.account_api_client
            .um_futures_account_configuration(params)
            .await
    }

    /// UM Futures Symbol `Configuration(USER_DATA)`
    ///
    /// Get current UM account symbol configuration.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`UmFuturesSymbolConfigurationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::UmFuturesSymbolConfigurationResponseInner>>`] 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/derivatives/portfolio-margin/account/Get-UM-Futures-Symbol-Config).
    ///
    pub async fn um_futures_symbol_configuration(
        &self,
        params: UmFuturesSymbolConfigurationParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::UmFuturesSymbolConfigurationResponseInner>>>
    {
        self.account_api_client
            .um_futures_symbol_configuration(params)
            .await
    }

    /// UM Notional and Leverage Brackets (`USER_DATA`)
    ///
    /// Query UM notional and leverage brackets
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`UmNotionalAndLeverageBracketsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::UmNotionalAndLeverageBracketsResponseInner>>`] 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/derivatives/portfolio-margin/account/UM-Notional-and-Leverage-Brackets).
    ///
    pub async fn um_notional_and_leverage_brackets(
        &self,
        params: UmNotionalAndLeverageBracketsParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::UmNotionalAndLeverageBracketsResponseInner>>>
    {
        self.account_api_client
            .um_notional_and_leverage_brackets(params)
            .await
    }

    /// Test Connectivity
    ///
    /// Test connectivity to the Rest API.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`TestConnectivityParams`]
    ///   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/derivatives/portfolio-margin/market-data/Test-Connectivity).
    ///
    pub async fn test_connectivity(&self) -> anyhow::Result<RestApiResponse<Value>> {
        self.market_data_api_client.test_connectivity().await
    }

    /// Cancel All CM Open Conditional Orders(TRADE)
    ///
    /// Cancel All CM Open Conditional Orders
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelAllCmOpenConditionalOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelAllCmOpenConditionalOrdersResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Conditional-Orders).
    ///
    pub async fn cancel_all_cm_open_conditional_orders(
        &self,
        params: CancelAllCmOpenConditionalOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelAllCmOpenConditionalOrdersResponse>> {
        self.trade_api_client
            .cancel_all_cm_open_conditional_orders(params)
            .await
    }

    /// Cancel All CM Open Orders(TRADE)
    ///
    /// Cancel all active LIMIT orders on specific symbol
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelAllCmOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelAllCmOpenOrdersResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-All-CM-Open-Orders).
    ///
    pub async fn cancel_all_cm_open_orders(
        &self,
        params: CancelAllCmOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelAllCmOpenOrdersResponse>> {
        self.trade_api_client
            .cancel_all_cm_open_orders(params)
            .await
    }

    /// Cancel All UM Algo Open Orders (TRADE)
    ///
    /// Cancel All UM Algo Open Orders
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelAllUmAlgoOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelAllUmAlgoOpenOrdersResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-All-UM-Algo-Open-Orders).
    ///
    pub async fn cancel_all_um_algo_open_orders(
        &self,
        params: CancelAllUmAlgoOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelAllUmAlgoOpenOrdersResponse>> {
        self.trade_api_client
            .cancel_all_um_algo_open_orders(params)
            .await
    }

    /// Cancel All UM Open Conditional Orders
    ///
    /// Cancel All UM Open Conditional Orders
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelAllUmOpenConditionalOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelAllUmOpenConditionalOrdersResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-All-UM-Open-Conditional-Orders).
    ///
    /// # Deprecation
    ///
    /// **Deprecated:** This method may be removed in a future version.
    #[deprecated]
    pub async fn cancel_all_um_open_conditional_orders(
        &self,
        params: CancelAllUmOpenConditionalOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelAllUmOpenConditionalOrdersResponse>> {
        self.trade_api_client
            .cancel_all_um_open_conditional_orders(params)
            .await
    }

    /// Cancel All UM Open Orders(TRADE)
    ///
    /// Cancel all active LIMIT orders on specific symbol
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelAllUmOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelAllUmOpenOrdersResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-All-UM-Open-Orders).
    ///
    pub async fn cancel_all_um_open_orders(
        &self,
        params: CancelAllUmOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelAllUmOpenOrdersResponse>> {
        self.trade_api_client
            .cancel_all_um_open_orders(params)
            .await
    }

    /// Cancel CM Conditional Order(TRADE)
    ///
    /// Cancel CM Conditional Order
    ///
    /// * Either `strategyId` or `newClientStrategyId` must be sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelCmConditionalOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelCmConditionalOrderResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-CM-Conditional-Order).
    ///
    pub async fn cancel_cm_conditional_order(
        &self,
        params: CancelCmConditionalOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelCmConditionalOrderResponse>> {
        self.trade_api_client
            .cancel_cm_conditional_order(params)
            .await
    }

    /// Cancel CM Order(TRADE)
    ///
    /// Cancel an active LIMIT order
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelCmOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelCmOrderResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-CM-Order).
    ///
    pub async fn cancel_cm_order(
        &self,
        params: CancelCmOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelCmOrderResponse>> {
        self.trade_api_client.cancel_cm_order(params).await
    }

    /// Cancel Margin Account All Open Orders on a Symbol(TRADE)
    ///
    /// Cancel Margin Account All Open Orders on a Symbol
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelMarginAccountAllOpenOrdersOnASymbolParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::CancelMarginAccountAllOpenOrdersOnASymbolResponseInner>>`] 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/derivatives/portfolio-margin/trade/Cancel-Margin-Account-All-Open-Orders-on-a-Symbol).
    ///
    pub async fn cancel_margin_account_all_open_orders_on_a_symbol(
        &self,
        params: CancelMarginAccountAllOpenOrdersOnASymbolParams,
    ) -> anyhow::Result<
        RestApiResponse<Vec<models::CancelMarginAccountAllOpenOrdersOnASymbolResponseInner>>,
    > {
        self.trade_api_client
            .cancel_margin_account_all_open_orders_on_a_symbol(params)
            .await
    }

    /// Cancel Margin Account OCO Orders(TRADE)
    ///
    /// Cancel Margin Account OCO Orders
    ///
    /// * Additional notes: Canceling an individual leg will cancel the entire OCO
    ///
    /// Weight: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelMarginAccountOcoOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelMarginAccountOcoOrdersResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-Margin-Account-OCO-Orders).
    ///
    pub async fn cancel_margin_account_oco_orders(
        &self,
        params: CancelMarginAccountOcoOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelMarginAccountOcoOrdersResponse>> {
        self.trade_api_client
            .cancel_margin_account_oco_orders(params)
            .await
    }

    /// Cancel Margin Account Order(TRADE)
    ///
    /// Cancel Margin Account Order
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent.
    ///
    /// Weight: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelMarginAccountOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelMarginAccountOrderResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-Margin-Account-Order).
    ///
    pub async fn cancel_margin_account_order(
        &self,
        params: CancelMarginAccountOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelMarginAccountOrderResponse>> {
        self.trade_api_client
            .cancel_margin_account_order(params)
            .await
    }

    /// Cancel UM Algo Order (TRADE)
    ///
    /// Cancel an active UM algo order.
    ///
    /// * Either `algoId` or `clientAlgoId` must be sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelUmAlgoOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelUmAlgoOrderResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-UM-Algo-Order).
    ///
    pub async fn cancel_um_algo_order(
        &self,
        params: CancelUmAlgoOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelUmAlgoOrderResponse>> {
        self.trade_api_client.cancel_um_algo_order(params).await
    }

    /// Cancel UM Conditional Order
    ///
    /// Cancel UM Conditional Order
    ///
    /// * Either `strategyId` or `newClientStrategyId` must be sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelUmConditionalOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelUmConditionalOrderResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-UM-Conditional-Order).
    ///
    /// # Deprecation
    ///
    /// **Deprecated:** This method may be removed in a future version.
    #[deprecated]
    pub async fn cancel_um_conditional_order(
        &self,
        params: CancelUmConditionalOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelUmConditionalOrderResponse>> {
        self.trade_api_client
            .cancel_um_conditional_order(params)
            .await
    }

    /// Cancel UM Order(TRADE)
    ///
    /// Cancel an active UM LIMIT order
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelUmOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelUmOrderResponse>`] 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/derivatives/portfolio-margin/trade/Cancel-UM-Order).
    ///
    pub async fn cancel_um_order(
        &self,
        params: CancelUmOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelUmOrderResponse>> {
        self.trade_api_client.cancel_um_order(params).await
    }

    /// CM Account Trade `List(USER_DATA)`
    ///
    /// Get trades for a specific account and CM symbol.
    ///
    /// * Either `symbol` or `pair` must be sent
    /// * `symbol` and `pair` cannot be sent together
    /// * `pair` and `fromId` cannot be sent together
    /// * `OrderId` can only be sent together with symbol
    /// * If a `pair` is sent, tickers for all symbols of the `pair` will be returned
    /// * The parameter `fromId` cannot be sent with `startTime` or `endTime`
    /// * If `startTime` and `endTime` are both not sent, then the last '24 hours' data will be returned.
    /// * The time between `startTime` and `endTime` cannot be longer than 24 hours.
    ///
    /// Weight: 20 with symbol, 40 with pair
    ///
    /// # Arguments
    ///
    /// - `params`: [`CmAccountTradeListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::CmAccountTradeListResponseInner>>`] 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/derivatives/portfolio-margin/trade/CM-Account-Trade-List).
    ///
    pub async fn cm_account_trade_list(
        &self,
        params: CmAccountTradeListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::CmAccountTradeListResponseInner>>> {
        self.trade_api_client.cm_account_trade_list(params).await
    }

    /// CM Position ADL Quantile `Estimation(USER_DATA)`
    ///
    /// Query CM Position ADL Quantile Estimation
    /// * Values update every 30s.
    /// * Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high.
    /// * For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides.
    /// * If the positions of the symbol are crossed margined in Hedge Mode:
    /// * "HEDGE" as a sign will be returned instead of "BOTH";
    /// * A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`CmPositionAdlQuantileEstimationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::CmPositionAdlQuantileEstimationResponseInner>>`] 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/derivatives/portfolio-margin/trade/CM-Position-ADL-Quantile-Estimation).
    ///
    pub async fn cm_position_adl_quantile_estimation(
        &self,
        params: CmPositionAdlQuantileEstimationParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::CmPositionAdlQuantileEstimationResponseInner>>>
    {
        self.trade_api_client
            .cm_position_adl_quantile_estimation(params)
            .await
    }

    /// Futures `TradFi` Perps `Contract(USER_DATA)`
    ///
    /// Sign TradFi-Perps agreement contract
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`FuturesTradfiPerpsContractParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::FuturesTradfiPerpsContractResponse>`] 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/derivatives/portfolio-margin/trade/Futures-TradFi-Perps-Contract).
    ///
    pub async fn futures_tradfi_perps_contract(
        &self,
        params: FuturesTradfiPerpsContractParams,
    ) -> anyhow::Result<RestApiResponse<models::FuturesTradfiPerpsContractResponse>> {
        self.trade_api_client
            .futures_tradfi_perps_contract(params)
            .await
    }

    /// Get UM Futures BNB Burn Status (`USER_DATA`)
    ///
    /// Get user's BNB Fee Discount for UM Futures (Fee Discount On or Fee Discount Off )
    ///
    /// Weight: 30
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetUmFuturesBnbBurnStatusParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetUmFuturesBnbBurnStatusResponse>`] 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/derivatives/portfolio-margin/trade/Get-UM-Futures-BNB-Burn-Status).
    ///
    pub async fn get_um_futures_bnb_burn_status(
        &self,
        params: GetUmFuturesBnbBurnStatusParams,
    ) -> anyhow::Result<RestApiResponse<models::GetUmFuturesBnbBurnStatusResponse>> {
        self.trade_api_client
            .get_um_futures_bnb_burn_status(params)
            .await
    }

    /// Margin Account Borrow(MARGIN)
    ///
    /// Apply for a margin loan.
    ///
    /// Weight: 100
    ///
    /// # Arguments
    ///
    /// - `params`: [`MarginAccountBorrowParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::MarginAccountBorrowResponse>`] 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/derivatives/portfolio-margin/trade/Margin-Account-Borrow).
    ///
    pub async fn margin_account_borrow(
        &self,
        params: MarginAccountBorrowParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountBorrowResponse>> {
        self.trade_api_client.margin_account_borrow(params).await
    }

    /// Margin Account New OCO(TRADE)
    ///
    /// Send in a new OCO for a margin account
    ///
    /// * Price Restrictions:
    /// * `SELL`: Limit Price > Last Price > Stop Price
    /// * `BUY`: Limit Price < Last Price < Stop Price
    /// * Quantity Restrictions:
    /// * Both legs must have the same quantity
    /// * `ICEBERG` quantities however do not have to be the same.
    /// * Order Rate Limit
    /// * `OCO` counts as 2 orders against the order rate limit.
    ///
    /// Weight: 1
    ///
    /// # 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/derivatives/portfolio-margin/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 Repay(MARGIN)
    ///
    /// Repay for a margin loan.
    ///
    /// Weight: 100
    ///
    /// # Arguments
    ///
    /// - `params`: [`MarginAccountRepayParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::MarginAccountRepayResponse>`] 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/derivatives/portfolio-margin/trade/Margin-Account-Repay).
    ///
    pub async fn margin_account_repay(
        &self,
        params: MarginAccountRepayParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountRepayResponse>> {
        self.trade_api_client.margin_account_repay(params).await
    }

    /// Margin Account Repay Debt(TRADE)
    ///
    /// Repay debt for a margin loan.
    ///
    /// * The repay asset amount cannot exceed 50000 USD equivalent value for a single request.
    /// * If `amount` is not sent, all the asset loan will be repaid if having enough specific repay assets.
    /// * If `amount` is sent, only the certain amount of the asset loan will be repaid if having enough specific repay assets.
    /// * The system will use the same asset to repay the loan first (if have) no matter whether put the asset in `specifyRepayAssets`
    ///
    /// Weight: 3000
    ///
    /// # Arguments
    ///
    /// - `params`: [`MarginAccountRepayDebtParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::MarginAccountRepayDebtResponse>`] 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/derivatives/portfolio-margin/trade/Margin-Account-Repay-Debt).
    ///
    pub async fn margin_account_repay_debt(
        &self,
        params: MarginAccountRepayDebtParams,
    ) -> anyhow::Result<RestApiResponse<models::MarginAccountRepayDebtResponse>> {
        self.trade_api_client
            .margin_account_repay_debt(params)
            .await
    }

    /// Margin Account Trade List (`USER_DATA`)
    ///
    /// Margin Account Trade List
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`MarginAccountTradeListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::MarginAccountTradeListResponseInner>>`] 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/derivatives/portfolio-margin/trade/Margin-Account-Trade-List).
    ///
    pub async fn margin_account_trade_list(
        &self,
        params: MarginAccountTradeListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::MarginAccountTradeListResponseInner>>> {
        self.trade_api_client
            .margin_account_trade_list(params)
            .await
    }

    /// Modify CM Order(TRADE)
    ///
    /// Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent, and the `orderId` will prevail if both are sent.
    /// * Both `quantity` and `price` must be sent
    /// * When the new `quantity` or `price` doesn't satisfy `PRICE_FILTER` / `PERCENT_FILTER` / `LOT_SIZE`, amendment will be rejected and the order will stay as it is.
    /// * However the order will be cancelled by the amendment in the following situations:
    /// * when the order is in partially filled status and the new `quantity` <= `executedQty`
    /// * When the order is `GTX` and the new price will cause it to be executed immediately
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ModifyCmOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ModifyCmOrderResponse>`] 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/derivatives/portfolio-margin/trade/Modify-CM-Order).
    ///
    pub async fn modify_cm_order(
        &self,
        params: ModifyCmOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::ModifyCmOrderResponse>> {
        self.trade_api_client.modify_cm_order(params).await
    }

    /// Modify UM Order(TRADE)
    ///
    /// Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue
    ///
    /// * Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent.
    /// * Both quantity and price must be sent
    /// * When the new quantity or price doesn't satisfy `PRICE_FILTER` / `PERCENT_FILTER` / `LOT_SIZE`, amendment will be rejected and the order will stay as it is.
    /// * However the order will be cancelled by the amendment in the following situations:
    /// * when the order is in partially filled status and the new quantity <= executedQty
    /// * When the order is GTX and the new price will cause it to be executed immediately
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ModifyUmOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ModifyUmOrderResponse>`] 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/derivatives/portfolio-margin/trade/Modify-UM-Order).
    ///
    pub async fn modify_um_order(
        &self,
        params: ModifyUmOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::ModifyUmOrderResponse>> {
        self.trade_api_client.modify_um_order(params).await
    }

    /// New CM Conditional Order(TRADE)
    ///
    /// New CM Conditional Order
    ///
    /// * Order with type `STOP/TAKE_PROFIT`, parameter `timeInForce` can be sent ( default `GTC`).
    /// * Condition orders will be triggered when:
    /// * `STOP`, `STOP_MARKET`:
    /// * BUY: "`MARK_PRICE`"  >= `stopPrice`
    /// * SELL: "`MARK_PRICE`" <= `stopPrice`
    /// * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
    /// * BUY: "`MARK_PRICE`" <= `stopPrice`
    /// * SELL: "`MARK_PRICE`" >= `stopPrice`
    /// * `TRAILING_STOP_MARKET`:
    /// * BUY: the lowest mark price after order placed `<= `activationPrice`, and the latest mark price >`= the lowest mark price * (1 + `callbackRate`)
    /// * SELL: the highest mark price after order placed >= `activationPrice`, and the latest mark price <= the highest mark price * (1 - `callbackRate`)
    /// * For `TRAILING_STOP_MARKET`, if you got such error code. `{"code": -2021, "msg": "Order would immediately trigger."}` means that the parameters you send do not meet the following requirements:
    /// * BUY: `activationPrice` should be smaller than latest mark price.
    /// * SELL: `activationPrice` should be larger than latest mark price.
    /// * Condition orders will be triggered when:
    /// * If parameter`priceProtect`is sent as true:
    /// * when price reaches the `stopPrice` ，the difference rate between "`MARK_PRICE`" and "`CONTRACT_PRICE`" cannot be larger than the "triggerProtect" of the symbol
    /// * "triggerProtect" of a symbol can be got from `GET /fapi/v1/exchangeInfo`
    /// * `STOP`, `STOP_MARKET`:
    /// * BUY: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") >= `stopPrice`
    /// * SELL: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") <= `stopPrice`
    /// * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
    /// * BUY: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") <= `stopPrice`
    /// * SELL: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") >= `stopPrice`
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`NewCmConditionalOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::NewCmConditionalOrderResponse>`] 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/derivatives/portfolio-margin/trade/New-CM-Conditional-Order).
    ///
    pub async fn new_cm_conditional_order(
        &self,
        params: NewCmConditionalOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewCmConditionalOrderResponse>> {
        self.trade_api_client.new_cm_conditional_order(params).await
    }

    /// New CM Order(TRADE)
    ///
    /// Place new CM order
    ///
    /// * If `newOrderRespType` is sent as `RESULT` :
    /// * `MARKET` order: the final FILLED result of the order will be return directly.
    /// * `LIMIT` order with special `timeInForce`: the final status result of the order(FILLED or EXPIRED) will be returned directly.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`NewCmOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::NewCmOrderResponse>`] 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/derivatives/portfolio-margin/trade/New-CM-Order).
    ///
    pub async fn new_cm_order(
        &self,
        params: NewCmOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewCmOrderResponse>> {
        self.trade_api_client.new_cm_order(params).await
    }

    /// New Margin Order(TRADE)
    ///
    /// New Margin Order
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`NewMarginOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::NewMarginOrderResponse>`] 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/derivatives/portfolio-margin/trade/New-Margin-Order).
    ///
    pub async fn new_margin_order(
        &self,
        params: NewMarginOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewMarginOrderResponse>> {
        self.trade_api_client.new_margin_order(params).await
    }

    /// New UM Algo Order (TRADE)
    ///
    /// Place new UM conditional order
    ///
    /// * Algo order with type `STOP`,  parameter `timeInForce` can be sent ( default `GTC`).
    /// * Algo order with type `TAKE_PROFIT`,  parameter `timeInForce` can be sent ( default `GTC`).
    /// * Condition orders will be triggered when:
    ///
    /// * If parameter`priceProtect`is sent as true:
    /// * when price reaches the `triggerPrice` , the difference rate between "`MARK_PRICE`" and "`CONTRACT_PRICE`" cannot be larger than the "triggerProtect" of the symbol
    /// * "triggerProtect" of a symbol can be got from `GET /fapi/v1/exchangeInfo`
    ///
    /// * `STOP`, `STOP_MARKET`:
    /// * BUY: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") >= `triggerPrice`
    /// * SELL: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") <= `triggerPrice`
    /// * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
    /// * BUY: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") <= `triggerPrice`
    /// * SELL: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") >= `triggerPrice`
    /// * `TRAILING_STOP_MARKET`:
    /// * BUY: the lowest price after order placed <= `activatePrice`, and the latest price >= the lowest price * (1 + `callbackRate`)
    /// * SELL: the highest price after order placed >= `activatePrice`, and the latest price <= the highest price * (1 - `callbackRate`)
    ///
    /// * For `TRAILING_STOP_MARKET`, if you got such error code.
    /// ``{"code": -2021, "msg": "Order would immediately trigger."}``
    /// means that the parameters you send do not meet the following requirements:
    /// * BUY: `activatePrice` should be smaller than latest price.
    /// * SELL: `activatePrice` should be larger than latest price.
    ///
    /// * `STOP_MARKET`, `TAKE_PROFIT_MARKET` with `closePosition`=`true`:
    /// * Follow the same rules for condition orders.
    /// * If triggered, **close all** current long position( if `SELL`) or current short position( if `BUY`).
    /// * Cannot be used with `quantity` paremeter
    /// * Cannot be used with `reduceOnly` parameter
    /// * In Hedge Mode,cannot be used with `BUY` orders in `LONG` position side. and cannot be used with `SELL` orders in `SHORT` position side
    /// * `selfTradePreventionMode` is only effective when `timeInForce` set to `IOC` or `GTC` or `GTD`.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`NewUmAlgoOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::NewUmAlgoOrderResponse>`] 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/derivatives/portfolio-margin/trade/New-UM-Algo-Order).
    ///
    pub async fn new_um_algo_order(
        &self,
        params: NewUmAlgoOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewUmAlgoOrderResponse>> {
        self.trade_api_client.new_um_algo_order(params).await
    }

    /// New UM Conditional Order
    ///
    /// Place new UM conditional order
    ///
    /// * Order with type `STOP/TAKE_PROFIT`, parameter `timeInForce` can be sent ( default `GTC`).
    /// * Condition orders will be triggered when:
    /// * `STOP`, `STOP_MARKET`:
    /// * BUY: "`MARK_PRICE`"  >= `stopPrice`
    /// * SELL: "`MARK_PRICE`" <= `stopPrice`
    /// * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
    /// * BUY: "`MARK_PRICE`" <= `stopPrice`
    /// * SELL: "`MARK_PRICE`" >= `stopPrice`
    /// * `TRAILING_STOP_MARKET`:
    /// * BUY: the lowest mark price after order placed `<= `activationPrice`, and the latest mark price >`= the lowest mark price * (1 + `callbackRate`)
    /// * SELL: the highest mark price after order placed >= `activationPrice`, and the latest mark price <= the highest mark price * (1 - `callbackRate`)
    /// * For `TRAILING_STOP_MARKET`, if you got such error code. `{"code": -2021, "msg": "Order would immediately trigger."}` means that the parameters you send do not meet the following requirements:
    /// * BUY: `activationPrice` should be smaller than latest mark price.
    /// * SELL: `activationPrice` should be larger than latest mark price.
    /// * Condition orders will be triggered when:
    /// * If parameter`priceProtect`is sent as true:
    /// * when price reaches the `stopPrice` ，the difference rate between "`MARK_PRICE`" and "`CONTRACT_PRICE`" cannot be larger than the "triggerProtect" of the symbol
    /// * "triggerProtect" of a symbol can be got from `GET /fapi/v1/exchangeInfo`
    /// * `STOP`, `STOP_MARKET`:
    /// * BUY: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") >= `stopPrice`
    /// * SELL: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") <= `stopPrice`
    /// * `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`:
    /// * BUY: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") <= `stopPrice`
    /// * SELL: latest price ("`MARK_PRICE`" or "`CONTRACT_PRICE`") >= `stopPrice`
    /// * `selfTradePreventionMode` is only effective when `timeInForce` set to `IOC` or `GTC` or `GTD`.
    /// * In extreme market conditions, timeInForce `GTD` order auto cancel time might be delayed comparing to `goodTillDate`
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`NewUmConditionalOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::NewUmConditionalOrderResponse>`] 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/derivatives/portfolio-margin/trade/New-UM-Conditional-Order).
    ///
    /// # Deprecation
    ///
    /// **Deprecated:** This method may be removed in a future version.
    #[deprecated]
    pub async fn new_um_conditional_order(
        &self,
        params: NewUmConditionalOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewUmConditionalOrderResponse>> {
        self.trade_api_client.new_um_conditional_order(params).await
    }

    /// New UM Order (TRADE)
    ///
    /// Place new UM order
    ///
    /// * If `newOrderRespType` is sent as `RESULT` :
    /// * `MARKET` order: the final FILLED result of the order will be return directly.
    /// * `LIMIT` order with special `timeInForce`: the final status result of the order(FILLED or EXPIRED) will be returned directly.
    /// * `selfTradePreventionMode` is only effective when `timeInForce` set to `IOC` or `GTC` or `GTD`.
    /// * In extreme market conditions, timeInForce `GTD` order auto cancel time might be delayed comparing to `goodTillDate`
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`NewUmOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::NewUmOrderResponse>`] 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/derivatives/portfolio-margin/trade/New-UM-Order).
    ///
    pub async fn new_um_order(
        &self,
        params: NewUmOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewUmOrderResponse>> {
        self.trade_api_client.new_um_order(params).await
    }

    /// Query All CM Conditional `Orders(USER_DATA)`
    ///
    /// Query All CM Conditional Orders
    ///
    /// * These orders will not be found:
    /// * order strategyStatus is `CANCELED` or `EXPIRED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 7 days < current time
    /// * The query time period must be less than 7 days( default as the recent 7 days).
    ///
    /// Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllCmConditionalOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCmConditionalOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-CM-Conditional-Orders).
    ///
    pub async fn query_all_cm_conditional_orders(
        &self,
        params: QueryAllCmConditionalOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllCmConditionalOrdersResponseInner>>>
    {
        self.trade_api_client
            .query_all_cm_conditional_orders(params)
            .await
    }

    /// Query All CM Orders (`USER_DATA`)
    ///
    /// Get all account CM orders; active, canceled, or filled.
    ///
    /// * Either `symbol` or `pair` must be sent.
    /// * If `orderId` is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
    /// * These orders will not be found:
    /// * order status is `CANCELED` or `EXPIRED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 3 days < current time
    ///
    /// Weight: 20 with symbol, 40 with pair
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllCmOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCmOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-CM-Orders).
    ///
    pub async fn query_all_cm_orders(
        &self,
        params: QueryAllCmOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllCmOrdersResponseInner>>> {
        self.trade_api_client.query_all_cm_orders(params).await
    }

    /// Query All Current CM Open Conditional Orders (`USER_DATA`)
    ///
    /// Get all open conditional orders on a symbol. **Careful** when accessing this with no symbol.
    ///
    /// * If the symbol is not sent, orders for all symbols will be returned in an array.
    ///
    /// Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllCurrentCmOpenConditionalOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCurrentCmOpenConditionalOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Conditional-Orders).
    ///
    pub async fn query_all_current_cm_open_conditional_orders(
        &self,
        params: QueryAllCurrentCmOpenConditionalOrdersParams,
    ) -> anyhow::Result<
        RestApiResponse<Vec<models::QueryAllCurrentCmOpenConditionalOrdersResponseInner>>,
    > {
        self.trade_api_client
            .query_all_current_cm_open_conditional_orders(params)
            .await
    }

    /// Query All Current CM Open `Orders(USER_DATA)`
    ///
    /// Get all open orders on a symbol.
    ///
    /// * If the symbol is not sent, orders for all symbols will be returned in an array.
    ///
    /// Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
    /// Careful when accessing this with no symbol.
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllCurrentCmOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCmOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-Current-CM-Open-Orders).
    ///
    pub async fn query_all_current_cm_open_orders(
        &self,
        params: QueryAllCurrentCmOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllCmOrdersResponseInner>>> {
        self.trade_api_client
            .query_all_current_cm_open_orders(params)
            .await
    }

    /// Query All Current UM Open Algo Orders (`USER_DATA`)
    ///
    /// Get all UM open algo orders on a symbol.
    ///
    /// * If the symbol is not sent, orders for all symbols will be returned in an array.
    ///
    /// Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
    /// Careful when accessing this with no symbol.
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllCurrentUmOpenAlgoOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCurrentUmOpenAlgoOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Algo-Orders).
    ///
    pub async fn query_all_current_um_open_algo_orders(
        &self,
        params: QueryAllCurrentUmOpenAlgoOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllCurrentUmOpenAlgoOrdersResponseInner>>>
    {
        self.trade_api_client
            .query_all_current_um_open_algo_orders(params)
            .await
    }

    /// Query All Current UM Open Conditional Orders
    ///
    /// Get all open conditional orders on a symbol.
    ///
    /// * If the symbol is not sent, orders for all symbols will be returned in an array.
    ///
    /// Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
    /// Careful when accessing this with no symbol.
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllCurrentUmOpenConditionalOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCurrentUmOpenConditionalOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Conditional-Orders).
    ///
    /// # Deprecation
    ///
    /// **Deprecated:** This method may be removed in a future version.
    #[deprecated]
    pub async fn query_all_current_um_open_conditional_orders(
        &self,
        params: QueryAllCurrentUmOpenConditionalOrdersParams,
    ) -> anyhow::Result<
        RestApiResponse<Vec<models::QueryAllCurrentUmOpenConditionalOrdersResponseInner>>,
    > {
        self.trade_api_client
            .query_all_current_um_open_conditional_orders(params)
            .await
    }

    /// Query All Current UM Open `Orders(USER_DATA)`
    ///
    /// Get all open orders on a symbol.
    ///
    ///
    /// * If the symbol is not sent, orders for all symbols will be returned in an array.
    ///
    /// Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllCurrentUmOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCurrentUmOpenOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-Current-UM-Open-Orders).
    ///
    pub async fn query_all_current_um_open_orders(
        &self,
        params: QueryAllCurrentUmOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllCurrentUmOpenOrdersResponseInner>>>
    {
        self.trade_api_client
            .query_all_current_um_open_orders(params)
            .await
    }

    /// Query All Margin Account Orders (`USER_DATA`)
    ///
    /// Query All Margin Account Orders
    ///
    /// Weight: 100
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllMarginAccountOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllMarginAccountOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-Margin-Account-Orders).
    ///
    pub async fn query_all_margin_account_orders(
        &self,
        params: QueryAllMarginAccountOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllMarginAccountOrdersResponseInner>>>
    {
        self.trade_api_client
            .query_all_margin_account_orders(params)
            .await
    }

    /// Query All UM Conditional Orders
    ///
    /// Query All UM Conditional Orders
    ///
    /// * These orders will not be found:
    /// * order strategyStatus is `CANCELED` or `EXPIRED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 7 days < current time
    /// * The query time period must be less than 7 days( default as the recent 7 days).
    ///
    /// Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllUmConditionalOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllUmConditionalOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-UM-Conditional-Orders).
    ///
    /// # Deprecation
    ///
    /// **Deprecated:** This method may be removed in a future version.
    #[deprecated]
    pub async fn query_all_um_conditional_orders(
        &self,
        params: QueryAllUmConditionalOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllUmConditionalOrdersResponseInner>>>
    {
        self.trade_api_client
            .query_all_um_conditional_orders(params)
            .await
    }

    /// Query All UM `Orders(USER_DATA)`
    ///
    /// Get all account UM orders; active, canceled, or filled.
    /// * These orders will not be found:
    /// * order status is `CANCELED` or `EXPIRED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 3 days < current time
    ///
    /// * If `orderId` is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
    /// * The query time period must be less then 7 days( default as the recent 7 days).
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryAllUmOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCurrentUmOpenOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-All-UM-Orders).
    ///
    pub async fn query_all_um_orders(
        &self,
        params: QueryAllUmOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllCurrentUmOpenOrdersResponseInner>>>
    {
        self.trade_api_client.query_all_um_orders(params).await
    }

    /// Query CM Conditional Order `History(USER_DATA)`
    ///
    /// Query CM Conditional Order History
    ///
    ///
    /// * Either `strategyId` or `newClientStrategyId` must be sent.
    /// * `NEW` orders will not be found.
    /// * These orders will not be found:
    /// * order status is `CANCELED` or `EXPIRED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 7 days < current time
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCmConditionalOrderHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryCmConditionalOrderHistoryResponse>`] 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/derivatives/portfolio-margin/trade/Query-CM-Conditional-Order-History).
    ///
    pub async fn query_cm_conditional_order_history(
        &self,
        params: QueryCmConditionalOrderHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryCmConditionalOrderHistoryResponse>> {
        self.trade_api_client
            .query_cm_conditional_order_history(params)
            .await
    }

    /// Query CM Modify Order History(TRADE)
    ///
    /// Get order modification history
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent, and the `orderId` will prevail if both are sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCmModifyOrderHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryCmModifyOrderHistoryResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-CM-Modify-Order-History).
    ///
    pub async fn query_cm_modify_order_history(
        &self,
        params: QueryCmModifyOrderHistoryParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryCmModifyOrderHistoryResponseInner>>> {
        self.trade_api_client
            .query_cm_modify_order_history(params)
            .await
    }

    /// Query CM `Order(USER_DATA)`
    ///
    /// Check an CM order's status.
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent.
    /// * These orders will not be found:
    /// * order status is `CANCELED` or `EXPIRED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 3 days < current time
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCmOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryCmOrderResponse>`] 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/derivatives/portfolio-margin/trade/Query-CM-Order).
    ///
    pub async fn query_cm_order(
        &self,
        params: QueryCmOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryCmOrderResponse>> {
        self.trade_api_client.query_cm_order(params).await
    }

    /// Query Current CM Open Conditional `Order(USER_DATA)`
    ///
    /// Query Current CM Open Conditional Order
    ///
    /// * Either `strategyId` or `newClientStrategyId` must be sent.
    /// * If the queried order has been triggered, cancelled or expired, the error message "Order does not exist" will be returned.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCurrentCmOpenConditionalOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryCurrentCmOpenConditionalOrderResponse>`] 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/derivatives/portfolio-margin/trade/Query-Current-CM-Open-Conditional-Order).
    ///
    pub async fn query_current_cm_open_conditional_order(
        &self,
        params: QueryCurrentCmOpenConditionalOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryCurrentCmOpenConditionalOrderResponse>> {
        self.trade_api_client
            .query_current_cm_open_conditional_order(params)
            .await
    }

    /// Query Current CM Open Order (`USER_DATA`)
    ///
    /// Query current CM open order
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent.
    /// * If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCurrentCmOpenOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryAllCmOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-Current-CM-Open-Order).
    ///
    pub async fn query_current_cm_open_order(
        &self,
        params: QueryCurrentCmOpenOrderParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryAllCmOrdersResponseInner>>> {
        self.trade_api_client
            .query_current_cm_open_order(params)
            .await
    }

    /// Query Current Margin Open Order (`USER_DATA`)
    ///
    /// Query Current Margin Open Order
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCurrentMarginOpenOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryCurrentMarginOpenOrderResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-Current-Margin-Open-Order).
    ///
    pub async fn query_current_margin_open_order(
        &self,
        params: QueryCurrentMarginOpenOrderParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryCurrentMarginOpenOrderResponseInner>>>
    {
        self.trade_api_client
            .query_current_margin_open_order(params)
            .await
    }

    /// Query Current UM Open Algo Order (`USER_DATA`)
    ///
    /// Check an UM algo order's status.
    ///
    /// * These orders will not be found:
    /// * order status is `CANCELED` or `EXPIRED` **AND** order has NO filled trade **AND** created time + 3 days < current time
    /// * order create time + 90 days < current time
    ///
    /// * Either `algoId` or `clientAlgoId` must be sent.
    /// * `algoId` is self-increment for each specific `symbol`
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCurrentUmOpenAlgoOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryCurrentUmOpenAlgoOrderResponse>`] 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/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Algo-Order).
    ///
    pub async fn query_current_um_open_algo_order(
        &self,
        params: QueryCurrentUmOpenAlgoOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryCurrentUmOpenAlgoOrderResponse>> {
        self.trade_api_client
            .query_current_um_open_algo_order(params)
            .await
    }

    /// Query Current UM Open Conditional Order
    ///
    /// Query Current UM Open Conditional Order
    ///
    /// * Either `strategyId` or `newClientStrategyId` must be sent.
    /// * If the queried order has been `CANCELED`, `TRIGGERED` or `EXPIRED`, the error message "Order does not exist" will be returned.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCurrentUmOpenConditionalOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryCurrentUmOpenConditionalOrderResponse>`] 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/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Conditional-Order).
    ///
    /// # Deprecation
    ///
    /// **Deprecated:** This method may be removed in a future version.
    #[deprecated]
    pub async fn query_current_um_open_conditional_order(
        &self,
        params: QueryCurrentUmOpenConditionalOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryCurrentUmOpenConditionalOrderResponse>> {
        self.trade_api_client
            .query_current_um_open_conditional_order(params)
            .await
    }

    /// Query Current UM Open `Order(USER_DATA)`
    ///
    /// Query current UM open order
    ///
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent.
    /// * If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCurrentUmOpenOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryCurrentUmOpenOrderResponse>`] 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/derivatives/portfolio-margin/trade/Query-Current-UM-Open-Order).
    ///
    pub async fn query_current_um_open_order(
        &self,
        params: QueryCurrentUmOpenOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryCurrentUmOpenOrderResponse>> {
        self.trade_api_client
            .query_current_um_open_order(params)
            .await
    }

    /// Query Margin Account Order (`USER_DATA`)
    ///
    /// Query Margin Account Order
    ///
    /// Weight: 10
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryMarginAccountOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryMarginAccountOrderResponse>`] 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/derivatives/portfolio-margin/trade/Query-Margin-Account-Order).
    ///
    pub async fn query_margin_account_order(
        &self,
        params: QueryMarginAccountOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryMarginAccountOrderResponse>> {
        self.trade_api_client
            .query_margin_account_order(params)
            .await
    }

    /// Query Margin Account's all OCO (`USER_DATA`)
    ///
    /// Query all OCO for a specific margin account based on provided optional parameters
    ///
    /// Weight: 100
    ///
    /// # 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/derivatives/portfolio-margin/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 OCO (`USER_DATA`)
    ///
    /// Retrieves a specific OCO based on provided optional parameters
    ///
    /// Weight: 5
    ///
    /// # 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/derivatives/portfolio-margin/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: 5
    ///
    /// # 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/derivatives/portfolio-margin/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 UM Algo Order History (`USER_DATA`)
    ///
    /// Get all algo orders; ACTIVE, CANCELED, TRIGGERED or FINISHED .
    ///
    /// * If `algoId` is set, it will get orders >= that `algoId`. Otherwise most recent orders are returned.
    /// * The query time period must be less then 7 days( default as the recent 7 days).
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUmAlgoOrderHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryUmAlgoOrderHistoryResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-UM-Algo-Order-History).
    ///
    pub async fn query_um_algo_order_history(
        &self,
        params: QueryUmAlgoOrderHistoryParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryUmAlgoOrderHistoryResponseInner>>> {
        self.trade_api_client
            .query_um_algo_order_history(params)
            .await
    }

    /// Query UM Conditional Order History
    ///
    /// Query UM Conditional Order History
    ///
    /// * Either `strategyId` or `newClientStrategyId` must be sent.
    /// * `NEW` orders will not be found.
    /// * These orders will not be found:
    /// * order status is `CANCELED` or `EXPIRED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 7 days < current time
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUmConditionalOrderHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryUmConditionalOrderHistoryResponse>`] 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/derivatives/portfolio-margin/trade/Query-UM-Conditional-Order-History).
    ///
    /// # Deprecation
    ///
    /// **Deprecated:** This method may be removed in a future version.
    #[deprecated]
    pub async fn query_um_conditional_order_history(
        &self,
        params: QueryUmConditionalOrderHistoryParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryUmConditionalOrderHistoryResponse>> {
        self.trade_api_client
            .query_um_conditional_order_history(params)
            .await
    }

    /// Query UM Modify Order History(TRADE)
    ///
    /// Get order modification history
    ///
    /// * Either `orderId` or `origClientOrderId` must be sent, and the `orderId` will prevail if both are sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUmModifyOrderHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryUmModifyOrderHistoryResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-UM-Modify-Order-History).
    ///
    pub async fn query_um_modify_order_history(
        &self,
        params: QueryUmModifyOrderHistoryParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryUmModifyOrderHistoryResponseInner>>> {
        self.trade_api_client
            .query_um_modify_order_history(params)
            .await
    }

    /// Query UM Order (`USER_DATA`)
    ///
    /// Check an UM order's status.
    ///
    /// * These orders will not be found:
    /// * Either `orderId` or `origClientOrderId` must be sent.
    /// * order status is `CANCELED` or `EXPIRED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 3 days < current time
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUmOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryUmOrderResponse>`] 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/derivatives/portfolio-margin/trade/Query-UM-Order).
    ///
    pub async fn query_um_order(
        &self,
        params: QueryUmOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryUmOrderResponse>> {
        self.trade_api_client.query_um_order(params).await
    }

    /// Query User's CM Force `Orders(USER_DATA)`
    ///
    /// Query User's CM Force Orders
    ///
    /// * If "autoCloseType" is not sent, orders with both of the types will be returned
    /// * If "startTime" is not sent, data within 7 days before "endTime" can be queried
    /// * Only support querying data in the past 90 days
    ///
    /// Weight: 20 with symbol, 50 without symbol
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUsersCmForceOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryUsersCmForceOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-Users-CM-Force-Orders).
    ///
    pub async fn query_users_cm_force_orders(
        &self,
        params: QueryUsersCmForceOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryUsersCmForceOrdersResponseInner>>> {
        self.trade_api_client
            .query_users_cm_force_orders(params)
            .await
    }

    /// Query User's Margin Force `Orders(USER_DATA)`
    ///
    /// Query user's margin force orders
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUsersMarginForceOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryUsersMarginForceOrdersResponse>`] 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/derivatives/portfolio-margin/trade/Query-Users-Margin-Force-Orders).
    ///
    pub async fn query_users_margin_force_orders(
        &self,
        params: QueryUsersMarginForceOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryUsersMarginForceOrdersResponse>> {
        self.trade_api_client
            .query_users_margin_force_orders(params)
            .await
    }

    /// Query User's UM Force Orders (`USER_DATA`)
    ///
    /// Query User's UM Force Orders
    ///
    /// * If `autoCloseType` is not sent, orders with both of the types will be returned
    /// * If `startTime` is not sent, data within 7 days before `endTime` can be queried
    /// * Only support querying data in the past 90 days
    ///
    /// Weight: 20 with symbol, 50 without symbol
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryUsersUmForceOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryUsersUmForceOrdersResponseInner>>`] 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/derivatives/portfolio-margin/trade/Query-Users-UM-Force-Orders).
    ///
    pub async fn query_users_um_force_orders(
        &self,
        params: QueryUsersUmForceOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryUsersUmForceOrdersResponseInner>>> {
        self.trade_api_client
            .query_users_um_force_orders(params)
            .await
    }

    /// Toggle BNB Burn On UM Futures Trade (TRADE)
    ///
    /// Change user's BNB Fee Discount for UM Futures (Fee Discount On or Fee Discount Off ) on ***EVERY symbol***
    ///
    ///
    /// * The BNB would not be collected from UM-PM account to the Portfolio Margin account.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ToggleBnbBurnOnUmFuturesTradeParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ToggleBnbBurnOnUmFuturesTradeResponse>`] 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/derivatives/portfolio-margin/trade/Toggle-BNB-Burn-On-UM-Futures-Trade).
    ///
    pub async fn toggle_bnb_burn_on_um_futures_trade(
        &self,
        params: ToggleBnbBurnOnUmFuturesTradeParams,
    ) -> anyhow::Result<RestApiResponse<models::ToggleBnbBurnOnUmFuturesTradeResponse>> {
        self.trade_api_client
            .toggle_bnb_burn_on_um_futures_trade(params)
            .await
    }

    /// UM Account Trade `List(USER_DATA)`
    ///
    /// Get trades for a specific account and UM symbol.
    ///
    ///
    /// * If `startTime` and `endTime` are both not sent, then the last '7 days' data will be returned.
    /// * The time between `startTime` and `endTime` cannot be longer than 7 days.
    /// * The parameter `fromId` cannot be sent with `startTime` or `endTime`.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`UmAccountTradeListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::UmAccountTradeListResponseInner>>`] 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/derivatives/portfolio-margin/trade/UM-Account-Trade-List).
    ///
    pub async fn um_account_trade_list(
        &self,
        params: UmAccountTradeListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::UmAccountTradeListResponseInner>>> {
        self.trade_api_client.um_account_trade_list(params).await
    }

    /// UM Position ADL Quantile `Estimation(USER_DATA)`
    ///
    /// Query UM Position ADL Quantile Estimation
    ///
    /// * Values update every 30s.
    /// * Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high.
    /// * For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides.
    /// * If the positions of the symbol are crossed margined in Hedge Mode:
    /// * "HEDGE" as a sign will be returned instead of "BOTH";
    /// * A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`UmPositionAdlQuantileEstimationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::UmPositionAdlQuantileEstimationResponseInner>>`] 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/derivatives/portfolio-margin/trade/UM-Position-ADL-Quantile-Estimation).
    ///
    pub async fn um_position_adl_quantile_estimation(
        &self,
        params: UmPositionAdlQuantileEstimationParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::UmPositionAdlQuantileEstimationResponseInner>>>
    {
        self.trade_api_client
            .um_position_adl_quantile_estimation(params)
            .await
    }

    /// Close User Data `Stream(USER_STREAM)`
    ///
    /// Close out a user data stream.
    ///
    /// Weight: 1
    ///
    /// # 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/derivatives/portfolio-margin/user-data-streams/Close-User-Data-Stream).
    ///
    pub async fn close_user_data_stream(&self) -> anyhow::Result<RestApiResponse<Value>> {
        self.user_data_streams_api_client
            .close_user_data_stream()
            .await
    }

    /// Keepalive User Data Stream (`USER_STREAM`)
    ///
    /// Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes.
    ///
    /// 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/derivatives/portfolio-margin/user-data-streams/Keepalive-User-Data-Stream).
    ///
    pub async fn keepalive_user_data_stream(&self) -> anyhow::Result<RestApiResponse<Value>> {
        self.user_data_streams_api_client
            .keepalive_user_data_stream()
            .await
    }

    /// Start User Data `Stream(USER_STREAM)`
    ///
    /// Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes.
    ///
    /// 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/derivatives/portfolio-margin/user-data-streams/Start-User-Data-Stream).
    ///
    pub async fn start_user_data_stream(
        &self,
    ) -> anyhow::Result<RestApiResponse<models::StartUserDataStreamResponse>> {
        self.user_data_streams_api_client
            .start_user_data_stream()
            .await
    }
}
