/*
 * Binance Derivatives Trading Options REST API
 *
 * OpenAPI Specification for the Binance Derivatives Trading Options 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,
    market_maker_block_trade_api_client: MarketMakerBlockTradeApiClient,
    market_maker_endpoints_api_client: MarketMakerEndpointsApiClient,
    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 market_maker_block_trade_api_client =
            MarketMakerBlockTradeApiClient::new(configuration.clone());
        let market_maker_endpoints_api_client =
            MarketMakerEndpointsApiClient::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,
            market_maker_block_trade_api_client,
            market_maker_endpoints_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 Funding Flow (`USER_DATA`)
    ///
    /// Query account funding flows.
    ///
    ///
    /// * Only support querying data in the past 3 months
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`AccountFundingFlowParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::AccountFundingFlowResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/account/Account-Funding-Flow).
    ///
    pub async fn account_funding_flow(
        &self,
        params: AccountFundingFlowParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::AccountFundingFlowResponseInner>>> {
        self.account_api_client.account_funding_flow(params).await
    }

    /// Option Margin Account Information (`USER_DATA`)
    ///
    /// Get current account information.
    ///
    /// Weight: 3
    ///
    /// # Arguments
    ///
    /// - `params`: [`OptionMarginAccountInformationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OptionMarginAccountInformationResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/account/Option-Margin-Account-Information).
    ///
    pub async fn option_margin_account_information(
        &self,
        params: OptionMarginAccountInformationParams,
    ) -> anyhow::Result<RestApiResponse<models::OptionMarginAccountInformationResponse>> {
        self.account_api_client
            .option_margin_account_information(params)
            .await
    }

    /// Check Server Time
    ///
    /// Test connectivity to the Rest API and get the current server time.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CheckServerTimeParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CheckServerTimeResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Check-Server-Time).
    ///
    pub async fn check_server_time(
        &self,
    ) -> anyhow::Result<RestApiResponse<models::CheckServerTimeResponse>> {
        self.market_data_api_client.check_server_time().await
    }

    /// Exchange Information
    ///
    /// Current exchange trading rules and symbol information
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ExchangeInformationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ExchangeInformationResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Exchange-Information).
    ///
    pub async fn exchange_information(
        &self,
    ) -> anyhow::Result<RestApiResponse<models::ExchangeInformationResponse>> {
        self.market_data_api_client.exchange_information().await
    }

    /// Historical Exercise Records
    ///
    /// Get historical exercise records.
    /// * `REALISTIC_VALUE_STRICKEN` -> Exercised
    /// * `EXTRINSIC_VALUE_EXPIRED` -> Expired OTM
    ///
    /// Weight: 3
    ///
    /// # Arguments
    ///
    /// - `params`: [`HistoricalExerciseRecordsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::HistoricalExerciseRecordsResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Historical-Exercise-Records).
    ///
    pub async fn historical_exercise_records(
        &self,
        params: HistoricalExerciseRecordsParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::HistoricalExerciseRecordsResponseInner>>> {
        self.market_data_api_client
            .historical_exercise_records(params)
            .await
    }

    /// Index Price
    ///
    /// Get spot index price for option underlying.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`IndexPriceParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::IndexPriceResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Symbol-Price-Ticker).
    ///
    pub async fn index_price(
        &self,
        params: IndexPriceParams,
    ) -> anyhow::Result<RestApiResponse<models::IndexPriceResponse>> {
        self.market_data_api_client.index_price(params).await
    }

    /// Kline/Candlestick Data
    ///
    /// Kline/candlestick bars for an option symbol.
    /// Klines are uniquely identified by their open time.
    ///
    /// * If startTime and endTime are not sent, the most recent klines are returned.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`KlineCandlestickDataParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<Vec<models::KlineCandlestickDataResponseItemInner>>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Kline-Candlestick-Data).
    ///
    pub async fn kline_candlestick_data(
        &self,
        params: KlineCandlestickDataParams,
    ) -> anyhow::Result<RestApiResponse<Vec<Vec<models::KlineCandlestickDataResponseItemInner>>>>
    {
        self.market_data_api_client
            .kline_candlestick_data(params)
            .await
    }

    /// Open Interest
    ///
    /// Get open interest for specific underlying asset on specific expiration date.
    ///
    /// Weight: 0
    ///
    /// # Arguments
    ///
    /// - `params`: [`OpenInterestParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::OpenInterestResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Open-Interest).
    ///
    pub async fn open_interest(
        &self,
        params: OpenInterestParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::OpenInterestResponseInner>>> {
        self.market_data_api_client.open_interest(params).await
    }

    /// Option Mark Price
    ///
    /// Option mark price and greek info.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`OptionMarkPriceParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::OptionMarkPriceResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Option-Mark-Price).
    ///
    pub async fn option_mark_price(
        &self,
        params: OptionMarkPriceParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::OptionMarkPriceResponseInner>>> {
        self.market_data_api_client.option_mark_price(params).await
    }

    /// Order Book
    ///
    /// Check orderbook depth on specific symbol
    ///
    /// Weight: limit         | weight
    /// ------------  | ------------
    /// 5, 10, 20, 50 | 1
    /// 100           | 5
    /// 500           | 10
    /// 1000          | 20
    ///
    /// # Arguments
    ///
    /// - `params`: [`OrderBookParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::OrderBookResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Order-Book).
    ///
    pub async fn order_book(
        &self,
        params: OrderBookParams,
    ) -> anyhow::Result<RestApiResponse<models::OrderBookResponse>> {
        self.market_data_api_client.order_book(params).await
    }

    /// Recent Block Trades List
    ///
    /// Get recent block trades
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`RecentBlockTradesListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::RecentBlockTradesListResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Recent-Block-Trade-List).
    ///
    pub async fn recent_block_trades_list(
        &self,
        params: RecentBlockTradesListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::RecentBlockTradesListResponseInner>>> {
        self.market_data_api_client
            .recent_block_trades_list(params)
            .await
    }

    /// Recent Trades List
    ///
    /// Get recent market trades
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`RecentTradesListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::RecentTradesListResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/Recent-Trades-List).
    ///
    pub async fn recent_trades_list(
        &self,
        params: RecentTradesListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::RecentTradesListResponseInner>>> {
        self.market_data_api_client.recent_trades_list(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/options-trading/market-data/Test-Connectivity).
    ///
    pub async fn test_connectivity(&self) -> anyhow::Result<RestApiResponse<Value>> {
        self.market_data_api_client.test_connectivity().await
    }

    /// 24hr Ticker Price Change Statistics
    ///
    /// 24 hour rolling window price change statistics.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`Ticker24hrPriceChangeStatisticsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::Ticker24hrPriceChangeStatisticsResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-data/24hr-Ticker-Price-Change-Statistics).
    ///
    pub async fn ticker24hr_price_change_statistics(
        &self,
        params: Ticker24hrPriceChangeStatisticsParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::Ticker24hrPriceChangeStatisticsResponseInner>>>
    {
        self.market_data_api_client
            .ticker24hr_price_change_statistics(params)
            .await
    }

    /// Accept Block Trade Order (TRADE)
    ///
    /// Accept a block trade order
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`AcceptBlockTradeOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::AcceptBlockTradeOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-block-trade/Accept-Block-Trade-Order).
    ///
    pub async fn accept_block_trade_order(
        &self,
        params: AcceptBlockTradeOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::AcceptBlockTradeOrderResponse>> {
        self.market_maker_block_trade_api_client
            .accept_block_trade_order(params)
            .await
    }

    /// Account Block Trade List (`USER_DATA`)
    ///
    /// Gets block trades for a specific account.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`AccountBlockTradeListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::AccountBlockTradeListResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-block-trade/Account-Block-Trade-List).
    ///
    pub async fn account_block_trade_list(
        &self,
        params: AccountBlockTradeListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::AccountBlockTradeListResponseInner>>> {
        self.market_maker_block_trade_api_client
            .account_block_trade_list(params)
            .await
    }

    /// Cancel Block Trade Order (TRADE)
    ///
    /// Cancel a block trade order.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelBlockTradeOrderParams`]
    ///   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/options-trading/market-maker-block-trade/Cancel-Block-Trade-Order).
    ///
    pub async fn cancel_block_trade_order(
        &self,
        params: CancelBlockTradeOrderParams,
    ) -> anyhow::Result<RestApiResponse<Value>> {
        self.market_maker_block_trade_api_client
            .cancel_block_trade_order(params)
            .await
    }

    /// Extend Block Trade Order (TRADE)
    ///
    /// Extends a block trade expire time by 30 mins from the current time.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`ExtendBlockTradeOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ExtendBlockTradeOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-block-trade/Extend-Block-Trade-Order).
    ///
    pub async fn extend_block_trade_order(
        &self,
        params: ExtendBlockTradeOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::ExtendBlockTradeOrderResponse>> {
        self.market_maker_block_trade_api_client
            .extend_block_trade_order(params)
            .await
    }

    /// New Block Trade Order (TRADE)
    ///
    /// Send in a new block trade order.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`NewBlockTradeOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::NewBlockTradeOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-block-trade/New-Block-Trade-Order).
    ///
    pub async fn new_block_trade_order(
        &self,
        params: NewBlockTradeOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewBlockTradeOrderResponse>> {
        self.market_maker_block_trade_api_client
            .new_block_trade_order(params)
            .await
    }

    /// Query Block Trade Details (`USER_DATA`)
    ///
    /// Query block trade details; returns block trade details from counterparty's perspective.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryBlockTradeDetailsParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QueryBlockTradeDetailsResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-block-trade/Query-Block-Trade-Detail).
    ///
    pub async fn query_block_trade_details(
        &self,
        params: QueryBlockTradeDetailsParams,
    ) -> anyhow::Result<RestApiResponse<models::QueryBlockTradeDetailsResponse>> {
        self.market_maker_block_trade_api_client
            .query_block_trade_details(params)
            .await
    }

    /// Query Block Trade Order (TRADE)
    ///
    /// Check block trade order status.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryBlockTradeOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryBlockTradeOrderResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-block-trade/Query-Block-Trade-Order).
    ///
    pub async fn query_block_trade_order(
        &self,
        params: QueryBlockTradeOrderParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryBlockTradeOrderResponseInner>>> {
        self.market_maker_block_trade_api_client
            .query_block_trade_order(params)
            .await
    }

    /// Auto-Cancel All Open Orders (Kill-Switch) Heartbeat (TRADE)
    ///
    /// This endpoint resets the time from which the countdown will begin to the time this messaged is received.  It should be called repeatedly as heartbeats.  Multiple heartbeats can be updated at once by specifying the underlying symbols as a list (ex. BTCUSDT,ETHUSDT) in the underlyings parameter.
    ///
    /// * The response will only include underlying symbols where the heartbeat has been successfully updated.
    ///
    /// Weight: 10
    ///
    /// # Arguments
    ///
    /// - `params`: [`AutoCancelAllOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::AutoCancelAllOpenOrdersResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-endpoints/Auto-Cancel-All-Open-Orders-Heartbeat).
    ///
    pub async fn auto_cancel_all_open_orders(
        &self,
        params: AutoCancelAllOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::AutoCancelAllOpenOrdersResponse>> {
        self.market_maker_endpoints_api_client
            .auto_cancel_all_open_orders(params)
            .await
    }

    /// Get Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)
    ///
    /// This endpoint returns the auto-cancel parameters for each underlying symbol. Note only active auto-cancel parameters will be returned, if countdownTime is set to 0 (ie. countdownTime has been turned off), the underlying symbol and corresponding countdownTime parameter will not be returned in the response.
    ///
    /// * countdownTime = 0 means the function is disabled.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetAutoCancelAllOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetAutoCancelAllOpenOrdersResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-endpoints/Get-Auto-Cancel-All-Open-Orders-Config).
    ///
    pub async fn get_auto_cancel_all_open_orders(
        &self,
        params: GetAutoCancelAllOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::GetAutoCancelAllOpenOrdersResponse>> {
        self.market_maker_endpoints_api_client
            .get_auto_cancel_all_open_orders(params)
            .await
    }

    /// Get Market Maker Protection Config (TRADE)
    ///
    /// Get config for MMP.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`GetMarketMakerProtectionConfigParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::GetMarketMakerProtectionConfigResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-endpoints/Get-Market-Maker-Protection-Config).
    ///
    pub async fn get_market_maker_protection_config(
        &self,
        params: GetMarketMakerProtectionConfigParams,
    ) -> anyhow::Result<RestApiResponse<models::GetMarketMakerProtectionConfigResponse>> {
        self.market_maker_endpoints_api_client
            .get_market_maker_protection_config(params)
            .await
    }

    /// Reset Market Maker Protection Config (TRADE)
    ///
    /// Reset MMP, start MMP order again.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`ResetMarketMakerProtectionConfigParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::ResetMarketMakerProtectionConfigResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-endpoints/Reset-Market-Maker-Protection-Config).
    ///
    pub async fn reset_market_maker_protection_config(
        &self,
        params: ResetMarketMakerProtectionConfigParams,
    ) -> anyhow::Result<RestApiResponse<models::ResetMarketMakerProtectionConfigResponse>> {
        self.market_maker_endpoints_api_client
            .reset_market_maker_protection_config(params)
            .await
    }

    /// Set Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)
    ///
    /// This endpoint sets the parameters of the auto-cancel feature which cancels all open orders (both market maker protection and non market maker protection order types) of the underlying symbol at the end of the specified countdown time period if no heartbeat message is sent.  After the countdown time period, all open orders will be cancelled and new orders will be rejected with error code -2010 until either a heartbeat message is sent or the auto-cancel feature is turned off by setting countdownTime to 0.
    ///
    ///
    /// * This rest endpoint sets up the parameters to cancel your open orders in case of an outage or disconnection.
    /// * Example usage:
    /// Call this endpoint with a countdownTime value of 10000 (10 seconds) to turn on the auto-cancel feature. If the corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the specified underlying symbol, all open orders of the specified symbol will be automatically canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped.
    /// * The system will check all countdowns approximately every 100 milliseconds, **please note that sufficient redundancy should be considered when using this function**. We do not recommend setting the countdown time to be too precise or too small.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`SetAutoCancelAllOpenOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::SetAutoCancelAllOpenOrdersResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-endpoints/Set-Auto-Cancel-All-Open-Orders-Config).
    ///
    pub async fn set_auto_cancel_all_open_orders(
        &self,
        params: SetAutoCancelAllOpenOrdersParams,
    ) -> anyhow::Result<RestApiResponse<models::SetAutoCancelAllOpenOrdersResponse>> {
        self.market_maker_endpoints_api_client
            .set_auto_cancel_all_open_orders(params)
            .await
    }

    /// Set Market Maker Protection Config (TRADE)
    ///
    /// Set config for MMP.
    /// Market Maker Protection(MMP) is a set of protection mechanism for option market maker, this mechanism is able to prevent mass trading in short period time. Once market maker's account branches the threshold, the Market Maker Protection will be triggered. When Market Maker Protection triggers, all the current MMP orders will be canceled, new MMP orders will be rejected. Market maker can use this time to reevaluate market and modify order price.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`SetMarketMakerProtectionConfigParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::SetMarketMakerProtectionConfigResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/market-maker-endpoints/Set-Market-Maker-Protection-Config).
    ///
    pub async fn set_market_maker_protection_config(
        &self,
        params: SetMarketMakerProtectionConfigParams,
    ) -> anyhow::Result<RestApiResponse<models::SetMarketMakerProtectionConfigResponse>> {
        self.market_maker_endpoints_api_client
            .set_market_maker_protection_config(params)
            .await
    }

    /// Account Trade List (`USER_DATA`)
    ///
    /// Get trades for a specific account and symbol.
    ///
    /// * Only support querying trades in the past 3 months
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`AccountTradeListParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::AccountTradeListResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Account-Trade-List).
    ///
    pub async fn account_trade_list(
        &self,
        params: AccountTradeListParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::AccountTradeListResponseInner>>> {
        self.trade_api_client.account_trade_list(params).await
    }

    /// Cancel All Option Orders By Underlying (TRADE)
    ///
    /// Cancel all active orders on specified underlying.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelAllOptionOrdersByUnderlyingParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelAllOptionOrdersByUnderlyingResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Cancel-All-Option-Orders-By-Underlying).
    ///
    pub async fn cancel_all_option_orders_by_underlying(
        &self,
        params: CancelAllOptionOrdersByUnderlyingParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelAllOptionOrdersByUnderlyingResponse>> {
        self.trade_api_client
            .cancel_all_option_orders_by_underlying(params)
            .await
    }

    /// Cancel all Option orders on specific symbol (TRADE)
    ///
    /// Cancel all active order on a symbol.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelAllOptionOrdersOnSpecificSymbolParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelAllOptionOrdersOnSpecificSymbolResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Cancel-all-Option-orders-on-specific-symbol).
    ///
    pub async fn cancel_all_option_orders_on_specific_symbol(
        &self,
        params: CancelAllOptionOrdersOnSpecificSymbolParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelAllOptionOrdersOnSpecificSymbolResponse>>
    {
        self.trade_api_client
            .cancel_all_option_orders_on_specific_symbol(params)
            .await
    }

    /// Cancel Multiple Option Orders (TRADE)
    ///
    /// Cancel multiple orders.
    ///
    /// * At least one instance of `orderId` and `clientOrderId` must be sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelMultipleOptionOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::CancelMultipleOptionOrdersResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Cancel-Multiple-Option-Orders).
    ///
    pub async fn cancel_multiple_option_orders(
        &self,
        params: CancelMultipleOptionOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::CancelMultipleOptionOrdersResponseInner>>> {
        self.trade_api_client
            .cancel_multiple_option_orders(params)
            .await
    }

    /// Cancel Option Order (TRADE)
    ///
    /// Cancel an active order.
    ///
    /// * At least one instance of `orderId` and `clientOrderId` must be sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`CancelOptionOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::CancelOptionOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Cancel-Option-Order).
    ///
    pub async fn cancel_option_order(
        &self,
        params: CancelOptionOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::CancelOptionOrderResponse>> {
        self.trade_api_client.cancel_option_order(params).await
    }

    /// New Order (TRADE)
    ///
    /// Send a new order.
    ///
    /// Weight: 0
    ///
    /// # 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/derivatives/options-trading/trade/New-Order).
    ///
    pub async fn new_order(
        &self,
        params: NewOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::NewOrderResponse>> {
        self.trade_api_client.new_order(params).await
    }

    /// Option Position Information (`USER_DATA`)
    ///
    /// Get current position information.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`OptionPositionInformationParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::OptionPositionInformationResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Option-Position-Information).
    ///
    pub async fn option_position_information(
        &self,
        params: OptionPositionInformationParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::OptionPositionInformationResponseInner>>> {
        self.trade_api_client
            .option_position_information(params)
            .await
    }

    /// Place Multiple Orders(TRADE)
    ///
    /// Send multiple option orders.
    ///
    /// * Parameter rules are same with New Order
    /// * Batch orders are processed concurrently, and the order of matching is not guaranteed.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`PlaceMultipleOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::PlaceMultipleOrdersResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Place-Multiple-Orders).
    ///
    pub async fn place_multiple_orders(
        &self,
        params: PlaceMultipleOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::PlaceMultipleOrdersResponseInner>>> {
        self.trade_api_client.place_multiple_orders(params).await
    }

    /// Query Current Open Option Orders (`USER_DATA`)
    ///
    /// Query current all open orders, status: ACCEPTED `PARTIALLY_FILLED`
    ///
    /// Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryCurrentOpenOptionOrdersParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryCurrentOpenOptionOrdersResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Query-Current-Open-Option-Orders).
    ///
    pub async fn query_current_open_option_orders(
        &self,
        params: QueryCurrentOpenOptionOrdersParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryCurrentOpenOptionOrdersResponseInner>>>
    {
        self.trade_api_client
            .query_current_open_option_orders(params)
            .await
    }

    /// Query Option Order History (TRADE)
    ///
    /// Query all finished orders within 5 days, finished status: CANCELLED FILLED REJECTED.
    ///
    /// Weight: 3
    ///
    /// # Arguments
    ///
    /// - `params`: [`QueryOptionOrderHistoryParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::QueryOptionOrderHistoryResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Query-Option-Order-History).
    ///
    pub async fn query_option_order_history(
        &self,
        params: QueryOptionOrderHistoryParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::QueryOptionOrderHistoryResponseInner>>> {
        self.trade_api_client
            .query_option_order_history(params)
            .await
    }

    /// Query Single Order (TRADE)
    ///
    /// Check an order status.
    ///
    /// * These orders will not be found:
    /// * order status is `CANCELED` or `REJECTED`, **AND**
    /// * order has NO filled trade, **AND**
    /// * created time + 3 days < current time
    ///
    ///
    /// * Either `orderId` or `clientOrderId ` must be sent.
    ///
    /// Weight: 1
    ///
    /// # Arguments
    ///
    /// - `params`: [`QuerySingleOrderParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::QuerySingleOrderResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/Query-Single-Order).
    ///
    pub async fn query_single_order(
        &self,
        params: QuerySingleOrderParams,
    ) -> anyhow::Result<RestApiResponse<models::QuerySingleOrderResponse>> {
        self.trade_api_client.query_single_order(params).await
    }

    /// User Commission (`USER_DATA`)
    ///
    /// Get account commission.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`UserCommissionParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<models::UserCommissionResponse>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/User-Commission).
    ///
    pub async fn user_commission(
        &self,
        params: UserCommissionParams,
    ) -> anyhow::Result<RestApiResponse<models::UserCommissionResponse>> {
        self.trade_api_client.user_commission(params).await
    }

    /// User Exercise Record (`USER_DATA`)
    ///
    /// Get account exercise records.
    ///
    /// Weight: 5
    ///
    /// # Arguments
    ///
    /// - `params`: [`UserExerciseRecordParams`]
    ///   The parameters for this operation.
    ///
    /// # Returns
    ///
    /// [`RestApiResponse<Vec<models::UserExerciseRecordResponseInner>>`] on success.
    ///
    /// # Errors
    ///
    /// This function will return an [`anyhow::Error`] if:
    /// - the HTTP request fails
    /// - any parameter is invalid
    /// - the response cannot be parsed
    /// - or 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/options-trading/trade/User-Exercise-Record).
    ///
    pub async fn user_exercise_record(
        &self,
        params: UserExerciseRecordParams,
    ) -> anyhow::Result<RestApiResponse<Vec<models::UserExerciseRecordResponseInner>>> {
        self.trade_api_client.user_exercise_record(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/options-trading/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/options-trading/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/options-trading/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
    }
}
