/*
 * Binance Spot REST API
 *
 * OpenAPI Specifications for the Binance Spot REST API
 *
 * API documents:
 * - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md)
 * - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information)
 *
 *
 * 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,
    general_api_client: GeneralApiClient,
    market_api_client: MarketApiClient,
    trade_api_client: TradeApiClient,
}

impl RestApi {
    pub fn new(configuration: ConfigurationRestApi) -> Self {
        let account_api_client = AccountApiClient::new(configuration.clone());
        let general_api_client = GeneralApiClient::new(configuration.clone());
        let market_api_client = MarketApiClient::new(configuration.clone());
        let trade_api_client = TradeApiClient::new(configuration.clone());

        Self {
            configuration,
            account_api_client,
            general_api_client,
            market_api_client,
            trade_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
    }

    /// Query Commission Rates
    ///
    /// Get current account commission rates.
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`AccountCommissionParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::AccountCommissionResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-commission-rates-user_data).
    ///
    pub async fn account_commission(
        &self,
        params: AccountCommissionParams,
    ) -> anyhow::Result<RestApiResponse<models::AccountCommissionResponse>> {
        self.account_api_client.account_commission(params).await
    }

    /// Query all Order lists
    ///
    /// Retrieves all order lists based on provided optional parameters.
    ///
    /// Note that the time between `startTime` and `endTime` can't be longer than 24 hours.
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`AllOrderListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::AllOrderListResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-all-order-lists-user_data).
    ///
    pub async fn all_order_list(
        &self,
        params: AllOrderListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::AllOrderListResponseInner>>> {
        self.account_api_client.all_order_list(params).await
    }

    /// All orders
    ///
    /// Get all account orders; active, canceled, or filled.
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`AllOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::AllOrdersResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#all-orders-user_data).
    ///
    pub async fn all_orders(
        &self,
        params: AllOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::AllOrdersResponseInner>>> {
        self.account_api_client.all_orders(params).await
    }

    /// Account information
    ///
    /// Get current account information.
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetAccountParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetAccountResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#account-information-user_data).
    ///
    pub async fn get_account(
        &self,
        params: GetAccountParams,
    ) -> anyhow::Result<RestApiResponse<models::GetAccountResponse>> {
        self.account_api_client.get_account(params).await
    }

    /// Current open orders
    ///
    /// Get all open orders on a symbol. **Careful** when accessing this with no symbol.
    /// Weight: 6 for a single symbol; **80** when the symbol parameter is omitted
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::AllOrdersResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#current-open-orders-user_data).
    ///
    pub async fn get_open_orders(
        &self,
        params: GetOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::AllOrdersResponseInner>>> {
        self.account_api_client.get_open_orders(params).await
    }

    /// Query order
    ///
    /// Check an order's status.
    /// Weight: 4
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-order-user_data).
    ///
    pub async fn get_order(
        &self,
        params: GetOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::GetOrderResponse>> {
        self.account_api_client.get_order(params).await
    }

    /// Query Order list
    ///
    /// Retrieves a specific order list based on provided optional parameters.
    /// Weight: 4
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetOrderListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetOrderListResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-order-list-user_data).
    ///
    pub async fn get_order_list(
        &self,
        params: GetOrderListParams,
    ) -> anyhow::Result<RestApiResponse<models::GetOrderListResponse>> {
        self.account_api_client.get_order_list(params).await
    }

    /// Query Allocations
    ///
    /// Retrieves allocations resulting from SOR order placement.
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`MyAllocationsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::MyAllocationsResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-allocations-user_data).
    ///
    pub async fn my_allocations(
        &self,
        params: MyAllocationsParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::MyAllocationsResponseInner>>> {
        self.account_api_client.my_allocations(params).await
    }

    /// Query relevant filters
    ///
    /// Retrieves the list of [filters](filters.md) relevant to an account on a given symbol. This is the only endpoint that shows if an account has `MAX_ASSET` filters applied to it.
    /// Weight: 40
    ///
    /// # Arguments
    ///
    /// - `params`: [`MyFiltersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::MyFiltersResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-relevant-filters-user_data).
    ///
    pub async fn my_filters(
        &self,
        params: MyFiltersParams,
    ) -> anyhow::Result<RestApiResponse<models::MyFiltersResponse>> {
        self.account_api_client.my_filters(params).await
    }

    /// Query Prevented Matches
    ///
    /// Displays the list of orders that were expired due to STP.
    ///
    /// These are the combinations supported:
    ///
    /// * `symbol` + `preventedMatchId`
    /// * `symbol` + `orderId`
    /// * `symbol` + `orderId` + `fromPreventedMatchId` (`limit` will default to 500)
    /// * `symbol` + `orderId` + `fromPreventedMatchId` + `limit`
    /// Weight: Case                            | Weight
    /// ----                            | -----
    /// If `symbol` is invalid          | 2
    /// Querying by `preventedMatchId`  | 2
    /// Querying by `orderId`           | 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`MyPreventedMatchesParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::MyPreventedMatchesResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-prevented-matches-user_data).
    ///
    pub async fn my_prevented_matches(
        &self,
        params: MyPreventedMatchesParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::MyPreventedMatchesResponseInner>>> {
        self.account_api_client.my_prevented_matches(params).await
    }

    /// Account trade list
    ///
    /// Get trades for a specific account and symbol.
    /// Weight: Condition| Weight|
    /// ---| ---
    /// |Without orderId|20|
    /// |With orderId|5|
    ///
    /// # Arguments
    ///
    /// - `params`: [`MyTradesParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::MyTradesResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#account-trade-list-user_data).
    ///
    pub async fn my_trades(
        &self,
        params: MyTradesParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::MyTradesResponseInner>>> {
        self.account_api_client.my_trades(params).await
    }

    /// Query Open Order lists
    ///
    ///
    /// Weight: 6
    ///
    /// # Arguments
    ///
    /// - `params`: [`OpenOrderListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::OpenOrderListResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-open-order-lists-user_data).
    ///
    pub async fn open_order_list(
        &self,
        params: OpenOrderListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::OpenOrderListResponseInner>>> {
        self.account_api_client.open_order_list(params).await
    }

    /// Query Order Amendments
    ///
    /// Queries all amendments of a single order.
    /// Weight: 4
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderAmendmentsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::OrderAmendmentsResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-order-amendments-user_data).
    ///
    pub async fn order_amendments(
        &self,
        params: OrderAmendmentsParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::OrderAmendmentsResponseInner>>> {
        self.account_api_client.order_amendments(params).await
    }

    /// Query Unfilled Order Count
    ///
    /// Displays the user's unfilled order count for all intervals.
    /// Weight: 40
    ///
    /// # Arguments
    ///
    /// - `params`: [`RateLimitOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::RateLimitOrderResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/account-endpoints#query-unfilled-order-count-user_data).
    ///
    pub async fn rate_limit_order(
        &self,
        params: RateLimitOrderParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::RateLimitOrderResponseInner>>> {
        self.account_api_client.rate_limit_order(params).await
    }

    /// Exchange information
    ///
    /// Current exchange trading rules and symbol information
    /// Weight: 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`ExchangeInfoParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ExchangeInfoResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/general-endpoints#exchange-information).
    ///
    pub async fn exchange_info(
        &self,
        params: ExchangeInfoParams,
    ) -> anyhow::Result<RestApiResponse<models::ExchangeInfoResponse>> {
        self.general_api_client.exchange_info(params).await
    }

    /// Query Execution Rules
    ///
    ///
    /// Weight: Parameter | Weight|
    /// ---        | ---
    /// `symbol`  | 2
    /// `symbols` | 2 for each `symbol`, capped at a max of 40|
    /// `symbolStatus` |40|
    /// None            |40|
    ///
    /// # Arguments
    ///
    /// - `params`: [`ExecutionRulesParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ExecutionRulesResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/general-endpoints#query-execution-rules).
    ///
    pub async fn execution_rules(
        &self,
        params: ExecutionRulesParams,
    ) -> anyhow::Result<RestApiResponse<models::ExecutionRulesResponse>> {
        self.general_api_client.execution_rules(params).await
    }

    /// Test connectivity
    ///
    /// Test connectivity to the Rest API.
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`PingParams`]
    ///   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/binance-spot-api-docs/rest-api/general-endpoints#test-connectivity).
    ///
    pub async fn ping(&self) -> anyhow::Result<RestApiResponse<Value>> {
        self.general_api_client.ping().await
    }

    /// Check server time
    ///
    /// Test connectivity to the Rest API and get the current server time.
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`TimeParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TimeResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/general-endpoints#check-server-time).
    ///
    pub async fn time(&self) -> anyhow::Result<RestApiResponse<models::TimeResponse>> {
        self.general_api_client.time().await
    }

    /// Compressed/Aggregate trades list
    ///
    /// Get compressed, aggregate trades. Trades that fill at the time, from the same taker order, with the same price will have the quantity aggregated.
    /// Weight: 4
    ///
    /// # Arguments
    ///
    /// - `params`: [`AggTradesParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::AggTradesResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#compressedaggregate-trades-list).
    ///
    pub async fn agg_trades(
        &self,
        params: AggTradesParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::AggTradesResponseInner>>> {
        self.market_api_client.agg_trades(params).await
    }

    /// Current average price
    ///
    /// Current average price for a symbol.
    /// Weight: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`AvgPriceParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::AvgPriceResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#current-average-price).
    ///
    pub async fn avg_price(
        &self,
        params: AvgPriceParams,
    ) -> anyhow::Result<RestApiResponse<models::AvgPriceResponse>> {
        self.market_api_client.avg_price(params).await
    }

    /// Order book
    ///
    ///
    /// Weight: Adjusted based on the limit:
    ///
    /// |Limit|Request Weight
    /// ------|-------
    /// 1-100|  5
    /// 101-500| 25
    /// 501-1000| 50
    /// 1001-5000| 250
    ///
    /// # Arguments
    ///
    /// - `params`: [`DepthParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::DepthResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#order-book).
    ///
    pub async fn depth(
        &self,
        params: DepthParams,
    ) -> anyhow::Result<RestApiResponse<models::DepthResponse>> {
        self.market_api_client.depth(params).await
    }

    /// Recent trades list
    ///
    /// Get recent trades.
    /// Weight: 25
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetTradesParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::HistoricalTradesResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#recent-trades-list).
    ///
    pub async fn get_trades(
        &self,
        params: GetTradesParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::HistoricalTradesResponseInner>>> {
        self.market_api_client.get_trades(params).await
    }

    /// Old trade lookup
    ///
    /// Get older trades.
    /// Weight: 25
    ///
    /// # Arguments
    ///
    /// - `params`: [`HistoricalTradesParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::HistoricalTradesResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#old-trade-lookup).
    ///
    pub async fn historical_trades(
        &self,
        params: HistoricalTradesParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::HistoricalTradesResponseInner>>> {
        self.market_api_client.historical_trades(params).await
    }

    /// Kline/Candlestick data
    ///
    /// Kline/candlestick bars for a symbol.
    /// Klines are uniquely identified by their open time.
    /// Weight: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`KlinesParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<Vec<models::KlinesItemInner>>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data).
    ///
    pub async fn klines(
        &self,
        params: KlinesParams,
    ) -> anyhow::Result<RestApiResponse<Vec<Vec<models::KlinesItemInner>>>> {
        self.market_api_client.klines(params).await
    }

    /// Query Reference Price
    ///
    ///
    /// Weight: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`ReferencePriceParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ReferencePriceResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#query-reference-price).
    ///
    pub async fn reference_price(
        &self,
        params: ReferencePriceParams,
    ) -> anyhow::Result<RestApiResponse<models::ReferencePriceResponse>> {
        self.market_api_client.reference_price(params).await
    }

    /// Query Reference Price Calculation
    ///
    /// Describes how reference price is calculated for a given symbol.
    /// Weight: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`ReferencePriceCalculationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ReferencePriceCalculationResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#query-reference-price-calculation).
    ///
    pub async fn reference_price_calculation(
        &self,
        params: ReferencePriceCalculationParams,
    ) -> anyhow::Result<RestApiResponse<models::ReferencePriceCalculationResponse>> {
        self.market_api_client
            .reference_price_calculation(params)
            .await
    }

    /// Rolling window price change statistics
    ///
    ///
    /// Weight: 4 for each requested <tt>symbol</tt> regardless of <tt>windowSize</tt>. <br/><br/> The weight for this request will cap at 200 once the number of `symbols` in the request is more than 50.
    ///
    /// # Arguments
    ///
    /// - `params`: [`TickerParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TickerResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#rolling-window-price-change-statistics).
    ///
    pub async fn ticker(
        &self,
        params: TickerParams,
    ) -> anyhow::Result<RestApiResponse<models::TickerResponse>> {
        self.market_api_client.ticker(params).await
    }

    /// 24hr ticker price change statistics
    ///
    /// 24 hour rolling window price change statistics. **Careful** when accessing this with no symbol.
    /// Weight: <table>
    /// <thead>
    /// <tr>
    /// <th>Parameter</th>
    /// <th>Symbols Provided</th>
    /// <th>Weight</th>
    /// </tr>
    /// </thead>
    /// <tbody>
    /// <tr>
    /// <td rowspan="2">symbol</td>
    /// <td>1</td>
    /// <td>2</td>
    /// </tr>
    /// <tr>
    /// <td>symbol parameter is omitted</td>
    /// <td>80</td>
    /// </tr>
    /// <tr>
    /// <td rowspan="4">symbols</td>
    /// <td>1-20</td>
    /// <td>2</td>
    /// </tr>
    /// <tr>
    /// <td>21-100</td>
    /// <td>40</td>
    /// </tr>
    /// <tr>
    /// <td>101 or more</td>
    /// <td>80</td>
    /// </tr>
    /// <tr>
    /// <td>symbols parameter is omitted</td>
    /// <td>80</td>
    /// </tr>
    /// </tbody>
    /// </table>
    ///
    /// # Arguments
    ///
    /// - `params`: [`Ticker24hrParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::Ticker24hrResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#24hr-ticker-price-change-statistics).
    ///
    pub async fn ticker24hr(
        &self,
        params: Ticker24hrParams,
    ) -> anyhow::Result<RestApiResponse<models::Ticker24hrResponse>> {
        self.market_api_client.ticker24hr(params).await
    }

    /// Symbol order book ticker
    ///
    /// Best price/qty on the order book for a symbol or symbols.
    /// Weight: <table>
    /// <thead>
    /// <tr>
    /// <th>Parameter</th>
    /// <th>Symbols Provided</th>
    /// <th>Weight</th>
    /// </tr>
    /// </thead>
    /// <tbody>
    /// <tr>
    /// <td rowspan="2">symbol</td>
    /// <td>1</td>
    /// <td>2</td>
    /// </tr>
    /// <tr>
    /// <td>symbol parameter is omitted</td>
    /// <td>4</td>
    /// </tr>
    /// <tr>
    /// <td>symbols</td>
    /// <td>Any</td>
    /// <td>4</td>
    /// </tr>
    /// </tbody>
    /// </table>
    ///
    /// # Arguments
    ///
    /// - `params`: [`TickerBookTickerParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TickerBookTickerResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#symbol-order-book-ticker).
    ///
    pub async fn ticker_book_ticker(
        &self,
        params: TickerBookTickerParams,
    ) -> anyhow::Result<RestApiResponse<models::TickerBookTickerResponse>> {
        self.market_api_client.ticker_book_ticker(params).await
    }

    /// Symbol price ticker
    ///
    /// Latest price for a symbol or symbols.
    /// Weight: <table>
    /// <thead>
    /// <tr>
    /// <th>Parameter</th>
    /// <th>Symbols Provided</th>
    /// <th>Weight</th>
    /// </tr>
    /// </thead>
    /// <tbody>
    /// <tr>
    /// <td rowspan="2">symbol</td>
    /// <td>1</td>
    /// <td>2</td>
    /// </tr>
    /// <tr>
    /// <td>symbol parameter is omitted</td>
    /// <td>4</td>
    /// </tr>
    /// <tr>
    /// <td>symbols</td>
    /// <td>Any</td>
    /// <td>4</td>
    /// </tr>
    /// </tbody>
    /// </table>
    ///
    /// # Arguments
    ///
    /// - `params`: [`TickerPriceParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TickerPriceResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#symbol-price-ticker).
    ///
    pub async fn ticker_price(
        &self,
        params: TickerPriceParams,
    ) -> anyhow::Result<RestApiResponse<models::TickerPriceResponse>> {
        self.market_api_client.ticker_price(params).await
    }

    /// Trading Day Ticker
    ///
    /// Price change statistics for a trading day.
    /// Weight: 4 for each requested <tt>symbol</tt>. <br/><br/> The weight for this request will cap at 200 once the number of `symbols` in the request is more than 50.
    ///
    /// # Arguments
    ///
    /// - `params`: [`TickerTradingDayParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::TickerTradingDayResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#trading-day-ticker).
    ///
    pub async fn ticker_trading_day(
        &self,
        params: TickerTradingDayParams,
    ) -> anyhow::Result<RestApiResponse<models::TickerTradingDayResponse>> {
        self.market_api_client.ticker_trading_day(params).await
    }

    /// `UIKlines`
    ///
    /// The request is similar to klines having the same parameters and response.
    ///
    /// `uiKlines` return modified kline data, optimized for presentation of candlestick charts.
    /// Weight: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`UiKlinesParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<Vec<models::KlinesItemInner>>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/market-data-endpoints#uiklines).
    ///
    pub async fn ui_klines(
        &self,
        params: UiKlinesParams,
    ) -> anyhow::Result<RestApiResponse<Vec<Vec<models::KlinesItemInner>>>> {
        self.market_api_client.ui_klines(params).await
    }

    /// Cancel All Open Orders on a Symbol
    ///
    /// Cancels all active orders on a symbol.
    /// This includes orders that are part of an order list.
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`DeleteOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::DeleteOpenOrdersResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#cancel-all-open-orders-on-a-symbol-trade).
    ///
    pub async fn delete_open_orders(
        &self,
        params: DeleteOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::DeleteOpenOrdersResponseInner>>> {
        self.trade_api_client.delete_open_orders(params).await
    }

    /// Cancel order
    ///
    /// Cancel an active order.
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`DeleteOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::DeleteOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#cancel-order-trade).
    ///
    pub async fn delete_order(
        &self,
        params: DeleteOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::DeleteOrderResponse>> {
        self.trade_api_client.delete_order(params).await
    }

    /// Cancel Order list
    ///
    /// Cancel an entire Order list
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`DeleteOrderListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::DeleteOrderListResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#cancel-order-list-trade).
    ///
    pub async fn delete_order_list(
        &self,
        params: DeleteOrderListParams,
    ) -> anyhow::Result<RestApiResponse<models::DeleteOrderListResponse>> {
        self.trade_api_client.delete_order_list(params).await
    }

    /// New order
    ///
    /// Send in a new order.
    ///
    /// This adds 1 order to the `EXCHANGE_MAX_ORDERS` filter and the `MAX_NUM_ORDERS` filter.
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`NewOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::NewOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#new-order-trade).
    ///
    pub async fn new_order(
        &self,
        params: NewOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewOrderResponse>> {
        self.trade_api_client.new_order(params).await
    }

    /// Order Amend Keep Priority
    ///
    /// Reduce the quantity of an existing open order.
    ///
    /// This adds 0 orders to the `EXCHANGE_MAX_ORDERS` filter and the `MAX_NUM_ORDERS` filter.
    ///
    /// Read [Order Amend Keep Priority FAQ](faqs/order_amend_keep_priority.md) to learn more.
    /// Weight: 4
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderAmendKeepPriorityParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderAmendKeepPriorityResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#order-amend-keep-priority-trade).
    ///
    pub async fn order_amend_keep_priority(
        &self,
        params: OrderAmendKeepPriorityParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderAmendKeepPriorityResponse>> {
        self.trade_api_client
            .order_amend_keep_priority(params)
            .await
    }

    /// Cancel an Existing Order and Send a New Order
    ///
    /// * Cancels an existing order and places a new order on the same symbol.
    /// * Filters and Order Count are evaluated before the processing of the cancellation and order placement occurs.
    /// * A new order that was not attempted (i.e. when `newOrderResult: NOT_ATTEMPTED`), will still increase the unfilled order count by 1.
    /// * You can only cancel an individual order from an orderList using this endpoint, but the result is the same as canceling the entire orderList.
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderCancelReplaceParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderCancelReplaceResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#cancel-an-existing-order-and-send-a-new-order-trade).
    ///
    pub async fn order_cancel_replace(
        &self,
        params: OrderCancelReplaceParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderCancelReplaceResponse>> {
        self.trade_api_client.order_cancel_replace(params).await
    }

    /// New Order list - OCO
    ///
    /// Send in an one-cancels-the-other (OCO) pair, where activation of one order immediately cancels the other.
    ///
    /// * An OCO has 2 orders called the **above order** and **below order**.
    /// * One of the orders must be a `LIMIT_MAKER/TAKE_PROFIT/TAKE_PROFIT_LIMIT` order and the other must be `STOP_LOSS` or `STOP_LOSS_LIMIT` order.
    /// * Price restrictions
    /// * If the OCO is on the `SELL` side:
    /// * `LIMIT_MAKER/TAKE_PROFIT_LIMIT` `price` > Last Traded Price >  `STOP_LOSS/STOP_LOSS_LIMIT` `stopPrice`
    /// * `TAKE_PROFIT stopPrice` > Last Traded Price > `STOP_LOSS/STOP_LOSS_LIMIT stopPrice`
    /// * If the OCO is on the `BUY` side:
    /// * `LIMIT_MAKER/TAKE_PROFIT_LIMIT price` < Last Traded Price < `stopPrice`
    /// * `TAKE_PROFIT stopPrice` < Last Traded Price < `STOP_LOSS/STOP_LOSS_LIMIT stopPrice`
    /// * OCOs add **2 orders** to the `EXCHANGE_MAX_ORDERS` filter and the `MAX_NUM_ORDERS` filter.
    /// Weight: 1
    ///
    /// Unfilled Order Count: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderListOcoParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderListOcoResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---oco-trade).
    ///
    pub async fn order_list_oco(
        &self,
        params: OrderListOcoParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderListOcoResponse>> {
        self.trade_api_client.order_list_oco(params).await
    }

    /// New Order List - OPO
    ///
    /// Place an [OPO](./faqs/opo.md).
    ///
    /// * OPOs add 2 orders to the `EXCHANGE_MAX_NUM_ORDERS` filter and `MAX_NUM_ORDERS` filter.
    /// Weight: 1
    ///
    /// Unfilled Order Count: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderListOpoParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderListOpoResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---opo-trade).
    ///
    pub async fn order_list_opo(
        &self,
        params: OrderListOpoParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderListOpoResponse>> {
        self.trade_api_client.order_list_opo(params).await
    }

    /// New Order List - OPOCO
    ///
    /// Place an [OPOCO](./faqs/opo.md).
    /// Weight: 1
    ///
    /// Unfilled Order Count: 3
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderListOpocoParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderListOpocoResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---opoco-trade).
    ///
    pub async fn order_list_opoco(
        &self,
        params: OrderListOpocoParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderListOpocoResponse>> {
        self.trade_api_client.order_list_opoco(params).await
    }

    /// New Order list - OTO
    ///
    /// Place an OTO.
    ///
    /// * An OTO (One-Triggers-the-Other) is an order list comprised of 2 orders.
    /// * The first order is called the **working order** and must be `LIMIT` or `LIMIT_MAKER`. Initially, only the working order goes on the order book.
    /// * The second order is called the **pending order**. It can be any order type except for `MARKET` orders using parameter `quoteOrderQty`. The pending order is only placed on the order book when the working order gets **fully filled**.
    /// * If either the working order or the pending order is cancelled individually, the other order in the order list will also be canceled or expired.
    /// * When the order list is placed, if the working order gets **immediately fully filled**, the placement response will show the working order as `FILLED` but the pending order will still appear as `PENDING_NEW`. You need to query the status of the pending order again to see its updated status.
    /// * OTOs add **2 orders** to the `EXCHANGE_MAX_NUM_ORDERS` filter and `MAX_NUM_ORDERS` filter.
    /// Weight: 1
    ///
    /// Unfilled Order Count: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderListOtoParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderListOtoResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---oto-trade).
    ///
    pub async fn order_list_oto(
        &self,
        params: OrderListOtoParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderListOtoResponse>> {
        self.trade_api_client.order_list_oto(params).await
    }

    /// New Order list - OTOCO
    ///
    /// Place an OTOCO.
    ///
    /// * An OTOCO (One-Triggers-One-Cancels-the-Other) is an order list comprised of 3 orders.
    /// * The first order is called the **working order** and must be `LIMIT` or `LIMIT_MAKER`. Initially, only the working order goes on the order book.
    /// * The behavior of the working order is the same as the [OTO](#new-order-list---oto-trade).
    /// * OTOCO has 2 pending orders (pending above and pending below), forming an OCO pair. The pending orders are only placed on the order book when the working order gets **fully filled**.
    /// * The rules of the pending above and pending below follow the same rules as the [Order list OCO](#new-order-list---oco-trade).
    /// * OTOCOs add **3 orders** to the `EXCHANGE_MAX_NUM_ORDERS` filter and `MAX_NUM_ORDERS` filter.
    /// Weight: 1
    ///
    /// Unfilled Order Count: 3
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderListOtocoParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderListOtocoResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---otoco-trade).
    ///
    pub async fn order_list_otoco(
        &self,
        params: OrderListOtocoParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderListOtocoResponse>> {
        self.trade_api_client.order_list_otoco(params).await
    }

    /// New OCO - Deprecated
    ///
    /// Send in a new OCO.
    ///
    /// * 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
    /// * `OCO` adds **2 orders** to the `EXCHANGE_MAX_ORDERS` filter and the `MAX_NUM_ORDERS` filter.
    /// Weight: 1
    ///
    /// Unfilled Order Count: 2
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderOcoParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderOcoResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#new-oco---deprecated-trade).
    ///
    /// # Deprecation
    ///
    /// **Deprecated:** This method may be removed in a future version.
    #[deprecated]
    pub async fn order_oco(
        &self,
        params: OrderOcoParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderOcoResponse>> {
        self.trade_api_client.order_oco(params).await
    }

    /// Test new order
    ///
    /// Test new order creation and signature/recvWindow long.
    /// Creates and validates a new order but does not send it into the matching engine.
    /// Weight: |Condition| Request Weight|
    /// |------------           | ------------ |
    /// |Without `computeCommissionRates`| 1|
    /// |With `computeCommissionRates`|20|
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderTestParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderTestResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#test-new-order-trade).
    ///
    pub async fn order_test(
        &self,
        params: OrderTestParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderTestResponse>> {
        self.trade_api_client.order_test(params).await
    }

    /// New order using SOR
    ///
    /// Places an order using smart order routing (SOR).
    ///
    /// This adds 1 order to the `EXCHANGE_MAX_ORDERS` filter and the `MAX_NUM_ORDERS` filter.
    ///
    /// Read [SOR FAQ](faqs/sor_faq.md) to learn more.
    /// Weight: 1
    ///
    /// Unfilled Order Count: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`SorOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::SorOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#new-order-using-sor-trade).
    ///
    pub async fn sor_order(
        &self,
        params: SorOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::SorOrderResponse>> {
        self.trade_api_client.sor_order(params).await
    }

    /// Test new order using SOR
    ///
    /// Test new order creation and signature/recvWindow using smart order routing (SOR).
    /// Creates and validates a new order but does not send it into the matching engine.
    /// Weight: | Condition | Request Weight |
    /// | --------- | -------------- |
    /// | Without `computeCommissionRates`  |  1 |
    /// | With `computeCommissionRates`     | 20 |
    ///
    /// # Arguments
    ///
    /// - `params`: [`SorOrderTestParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::SorOrderTestResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will 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/binance-spot-api-docs/rest-api/trading-endpoints#test-new-order-using-sor-trade).
    ///
    pub async fn sor_order_test(
        &self,
        params: SorOrderTestParams,
    ) -> anyhow::Result<RestApiResponse<models::SorOrderTestResponse>> {
        self.trade_api_client.sor_order_test(params).await
    }
}
