"""
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
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
"""

import requests
from typing import Optional, List, TypeVar, Union
from binance_common.configuration import ConfigurationRestAPI
from binance_common.models import ApiResponse
from binance_common.signature import Signers
from binance_common.utils import send_request
from .api.account_api import AccountApi
from .api.general_api import GeneralApi
from .api.market_api import MarketApi
from .api.trade_api import TradeApi

from .models import AccountCommissionResponse
from .models import AllOrderListResponse
from .models import AllOrdersResponse
from .models import GetAccountResponse
from .models import GetOpenOrdersResponse
from .models import GetOrderResponse
from .models import GetOrderListResponse
from .models import MyAllocationsResponse
from .models import MyFiltersResponse
from .models import MyPreventedMatchesResponse
from .models import MyTradesResponse
from .models import OpenOrderListResponse
from .models import OrderAmendmentsResponse
from .models import RateLimitOrderResponse
from .models import ExchangeInfoResponse

from .models import TimeResponse
from .models import AggTradesResponse
from .models import AvgPriceResponse
from .models import DepthResponse
from .models import GetTradesResponse
from .models import HistoricalTradesResponse
from .models import KlinesResponse
from .models import TickerResponse
from .models import Ticker24hrResponse
from .models import TickerBookTickerResponse
from .models import TickerPriceResponse
from .models import TickerTradingDayResponse
from .models import UiKlinesResponse
from .models import DeleteOpenOrdersResponse
from .models import DeleteOrderResponse
from .models import DeleteOrderListResponse
from .models import NewOrderResponse
from .models import OrderAmendKeepPriorityResponse
from .models import OrderCancelReplaceResponse
from .models import OrderListOcoResponse
from .models import OrderListOpoResponse
from .models import OrderListOpocoResponse
from .models import OrderListOtoResponse
from .models import OrderListOtocoResponse
from .models import OrderOcoResponse
from .models import OrderTestResponse
from .models import SorOrderResponse
from .models import SorOrderTestResponse


from .models import ExchangeInfoSymbolStatusEnum
from .models import DepthSymbolStatusEnum
from .models import KlinesIntervalEnum
from .models import TickerWindowSizeEnum
from .models import TickerTypeEnum
from .models import TickerSymbolStatusEnum
from .models import Ticker24hrTypeEnum
from .models import Ticker24hrSymbolStatusEnum
from .models import TickerBookTickerSymbolStatusEnum
from .models import TickerPriceSymbolStatusEnum
from .models import TickerTradingDayTypeEnum
from .models import TickerTradingDaySymbolStatusEnum
from .models import UiKlinesIntervalEnum
from .models import DeleteOrderCancelRestrictionsEnum
from .models import NewOrderSideEnum
from .models import NewOrderTypeEnum
from .models import NewOrderTimeInForceEnum
from .models import NewOrderNewOrderRespTypeEnum
from .models import NewOrderSelfTradePreventionModeEnum
from .models import NewOrderPegPriceTypeEnum
from .models import NewOrderPegOffsetTypeEnum
from .models import OrderCancelReplaceSideEnum
from .models import OrderCancelReplaceTypeEnum
from .models import OrderCancelReplaceCancelReplaceModeEnum
from .models import OrderCancelReplaceTimeInForceEnum
from .models import OrderCancelReplaceNewOrderRespTypeEnum
from .models import OrderCancelReplaceSelfTradePreventionModeEnum
from .models import OrderCancelReplaceCancelRestrictionsEnum
from .models import OrderCancelReplaceOrderRateLimitExceededModeEnum
from .models import OrderCancelReplacePegPriceTypeEnum
from .models import OrderCancelReplacePegOffsetTypeEnum
from .models import OrderListOcoSideEnum
from .models import OrderListOcoAboveTypeEnum
from .models import OrderListOcoBelowTypeEnum
from .models import OrderListOcoAboveTimeInForceEnum
from .models import OrderListOcoAbovePegPriceTypeEnum
from .models import OrderListOcoAbovePegOffsetTypeEnum
from .models import OrderListOcoBelowTimeInForceEnum
from .models import OrderListOcoBelowPegPriceTypeEnum
from .models import OrderListOcoBelowPegOffsetTypeEnum
from .models import OrderListOcoNewOrderRespTypeEnum
from .models import OrderListOcoSelfTradePreventionModeEnum
from .models import OrderListOpoWorkingTypeEnum
from .models import OrderListOpoWorkingSideEnum
from .models import OrderListOpoPendingTypeEnum
from .models import OrderListOpoPendingSideEnum
from .models import OrderListOpoNewOrderRespTypeEnum
from .models import OrderListOpoSelfTradePreventionModeEnum
from .models import OrderListOpoWorkingTimeInForceEnum
from .models import OrderListOpoWorkingPegPriceTypeEnum
from .models import OrderListOpoWorkingPegOffsetTypeEnum
from .models import OrderListOpoPendingTimeInForceEnum
from .models import OrderListOpoPendingPegPriceTypeEnum
from .models import OrderListOpoPendingPegOffsetTypeEnum
from .models import OrderListOpocoWorkingTypeEnum
from .models import OrderListOpocoWorkingSideEnum
from .models import OrderListOpocoPendingSideEnum
from .models import OrderListOpocoPendingAboveTypeEnum
from .models import OrderListOpocoNewOrderRespTypeEnum
from .models import OrderListOpocoSelfTradePreventionModeEnum
from .models import OrderListOpocoWorkingTimeInForceEnum
from .models import OrderListOpocoWorkingPegPriceTypeEnum
from .models import OrderListOpocoWorkingPegOffsetTypeEnum
from .models import OrderListOpocoPendingAboveTimeInForceEnum
from .models import OrderListOpocoPendingAbovePegPriceTypeEnum
from .models import OrderListOpocoPendingAbovePegOffsetTypeEnum
from .models import OrderListOpocoPendingBelowTypeEnum
from .models import OrderListOpocoPendingBelowTimeInForceEnum
from .models import OrderListOpocoPendingBelowPegPriceTypeEnum
from .models import OrderListOpocoPendingBelowPegOffsetTypeEnum
from .models import OrderListOtoWorkingTypeEnum
from .models import OrderListOtoWorkingSideEnum
from .models import OrderListOtoPendingTypeEnum
from .models import OrderListOtoPendingSideEnum
from .models import OrderListOtoNewOrderRespTypeEnum
from .models import OrderListOtoSelfTradePreventionModeEnum
from .models import OrderListOtoWorkingTimeInForceEnum
from .models import OrderListOtoWorkingPegPriceTypeEnum
from .models import OrderListOtoWorkingPegOffsetTypeEnum
from .models import OrderListOtoPendingTimeInForceEnum
from .models import OrderListOtoPendingPegPriceTypeEnum
from .models import OrderListOtoPendingPegOffsetTypeEnum
from .models import OrderListOtocoWorkingTypeEnum
from .models import OrderListOtocoWorkingSideEnum
from .models import OrderListOtocoPendingSideEnum
from .models import OrderListOtocoPendingAboveTypeEnum
from .models import OrderListOtocoNewOrderRespTypeEnum
from .models import OrderListOtocoSelfTradePreventionModeEnum
from .models import OrderListOtocoWorkingTimeInForceEnum
from .models import OrderListOtocoWorkingPegPriceTypeEnum
from .models import OrderListOtocoWorkingPegOffsetTypeEnum
from .models import OrderListOtocoPendingAboveTimeInForceEnum
from .models import OrderListOtocoPendingAbovePegPriceTypeEnum
from .models import OrderListOtocoPendingAbovePegOffsetTypeEnum
from .models import OrderListOtocoPendingBelowTypeEnum
from .models import OrderListOtocoPendingBelowTimeInForceEnum
from .models import OrderListOtocoPendingBelowPegPriceTypeEnum
from .models import OrderListOtocoPendingBelowPegOffsetTypeEnum
from .models import OrderOcoSideEnum
from .models import OrderOcoStopLimitTimeInForceEnum
from .models import OrderOcoNewOrderRespTypeEnum
from .models import OrderOcoSelfTradePreventionModeEnum
from .models import OrderTestSideEnum
from .models import OrderTestTypeEnum
from .models import OrderTestTimeInForceEnum
from .models import OrderTestNewOrderRespTypeEnum
from .models import OrderTestSelfTradePreventionModeEnum
from .models import OrderTestPegPriceTypeEnum
from .models import OrderTestPegOffsetTypeEnum
from .models import SorOrderSideEnum
from .models import SorOrderTypeEnum
from .models import SorOrderTimeInForceEnum
from .models import SorOrderNewOrderRespTypeEnum
from .models import SorOrderSelfTradePreventionModeEnum
from .models import SorOrderTestSideEnum
from .models import SorOrderTestTypeEnum
from .models import SorOrderTestTimeInForceEnum
from .models import SorOrderTestNewOrderRespTypeEnum
from .models import SorOrderTestSelfTradePreventionModeEnum


T = TypeVar("T")


class SpotRestAPI:
    def __init__(
        self,
        configuration: ConfigurationRestAPI,
    ) -> None:
        self.configuration = configuration
        self._session = requests.Session()
        self._signer = (
            Signers.get_signer(
                configuration.private_key, configuration.private_key_passphrase
            )
            if configuration.private_key is not None
            else None
        )

        self._accountApi = AccountApi(self.configuration, self._session, self._signer)
        self._generalApi = GeneralApi(self.configuration, self._session, self._signer)
        self._marketApi = MarketApi(self.configuration, self._session, self._signer)
        self._tradeApi = TradeApi(self.configuration, self._session, self._signer)

    def send_request(
        self,
        endpoint: str,
        method: str,
        query_params: Optional[dict] = None,
        body_params: Optional[dict] = None,
        time_unit: Optional[str] = None,
    ) -> ApiResponse[T]:
        """
        Sends an request to the Binance REST API.

        Args:
            endpoint (str): The API endpoint path to send the request to.
            method (str): The HTTP method to use for the request (e.g. "GET", "POST", "PUT", "DELETE").
            query_params (Optional[dict]): The request payload as a dictionary, or None if no payload is required.
            body_params (Optional[dict]): The request body as a dictionary, or None if no body is required.
            time_unit (Optional[str]): The time unit to use for the request, or None to use the default.

        Returns:
            ApiResponse[T]: The API response, where T is the expected response type.
        """
        return send_request[T](
            self._session,
            self.configuration,
            method,
            endpoint,
            query_params,
            body_params,
            time_unit or self.configuration.time_unit,
        )

    def send_signed_request(
        self,
        endpoint: str,
        method: str,
        query_params: Optional[dict] = None,
        body_params: Optional[dict] = None,
        time_unit: Optional[str] = None,
    ) -> ApiResponse[T]:
        """
        Sends a signed request to the Binance REST API.

        Args:
            endpoint (str): The API endpoint path to send the request to.
            method (str): The HTTP method to use for the request (e.g. "GET", "POST", "PUT", "DELETE").
            query_params (Optional[dict]): The request payload as a dictionary, or None if no payload is required.
            body_params (Optional[dict]): The request body as a dictionary, or None if no body is required.
            time_unit (Optional[str]): The time unit to use for the request, or None to use the default.

        Returns:
            ApiResponse[T]: The API response, where T is the expected response type.
        """
        return send_request[T](
            self._session,
            self.configuration,
            method,
            endpoint,
            query_params,
            body_params,
            time_unit or self.configuration.time_unit,
            is_signed=True,
            signer=self._signer,
        )

    def account_commission(
        self,
        symbol: Union[str, None],
    ) -> ApiResponse[AccountCommissionResponse]:
        """
                Query Commission Rates

                Get current account commission rates.
        Weight: 20

                Args:
                    symbol (Union[str, None]):

                Returns:
                    ApiResponse[AccountCommissionResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.account_commission(symbol)

    def all_order_list(
        self,
        from_id: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[AllOrderListResponse]:
        """
                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

                Args:
                    from_id (Optional[int] = None): ID to get aggregate trades from INCLUSIVE.
                    start_time (Optional[int] = None): Timestamp in ms to get aggregate trades from INCLUSIVE.
                    end_time (Optional[int] = None): Timestamp in ms to get aggregate trades until INCLUSIVE.
                    limit (Optional[int] = None): Default: 500; Maximum: 1000.
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[AllOrderListResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.all_order_list(
            from_id, start_time, end_time, limit, recv_window
        )

    def all_orders(
        self,
        symbol: Union[str, None],
        order_id: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[AllOrdersResponse]:
        """
                All orders

                Get all account orders; active, canceled, or filled.
        Weight: 20

                Args:
                    symbol (Union[str, None]):
                    order_id (Optional[int] = None):
                    start_time (Optional[int] = None): Timestamp in ms to get aggregate trades from INCLUSIVE.
                    end_time (Optional[int] = None): Timestamp in ms to get aggregate trades until INCLUSIVE.
                    limit (Optional[int] = None): Default: 500; Maximum: 1000.
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[AllOrdersResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.all_orders(
            symbol, order_id, start_time, end_time, limit, recv_window
        )

    def get_account(
        self,
        omit_zero_balances: Optional[bool] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[GetAccountResponse]:
        """
                Account information

                Get current account information.
        Weight: 20

                Args:
                    omit_zero_balances (Optional[bool] = None): When set to `true`, emits only the non-zero balances of an account. <br>Default value: `false`
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[GetAccountResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_account(omit_zero_balances, recv_window)

    def get_open_orders(
        self,
        symbol: Optional[str] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[GetOpenOrdersResponse]:
        """
                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

                Args:
                    symbol (Optional[str] = None): Symbol to query
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[GetOpenOrdersResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_open_orders(symbol, recv_window)

    def get_order(
        self,
        symbol: Union[str, None],
        order_id: Optional[int] = None,
        orig_client_order_id: Optional[str] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[GetOrderResponse]:
        """
                Query order

                Check an order's status.
        Weight: 4

                Args:
                    symbol (Union[str, None]):
                    order_id (Optional[int] = None):
                    orig_client_order_id (Optional[str] = None):
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[GetOrderResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_order(
            symbol, order_id, orig_client_order_id, recv_window
        )

    def get_order_list(
        self,
        order_list_id: Optional[int] = None,
        orig_client_order_id: Optional[str] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[GetOrderListResponse]:
        """
                Query Order list

                Retrieves a specific order list based on provided optional parameters.
        Weight: 4

                Args:
                    order_list_id (Optional[int] = None): Either `orderListId` or `listClientOrderId` must be provided
                    orig_client_order_id (Optional[str] = None):
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[GetOrderListResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_order_list(
            order_list_id, orig_client_order_id, recv_window
        )

    def my_allocations(
        self,
        symbol: Union[str, None],
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        from_allocation_id: Optional[int] = None,
        limit: Optional[int] = None,
        order_id: Optional[int] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[MyAllocationsResponse]:
        """
                Query Allocations

                Retrieves allocations resulting from SOR order placement.
        Weight: 20

                Args:
                    symbol (Union[str, None]):
                    start_time (Optional[int] = None): Timestamp in ms to get aggregate trades from INCLUSIVE.
                    end_time (Optional[int] = None): Timestamp in ms to get aggregate trades until INCLUSIVE.
                    from_allocation_id (Optional[int] = None):
                    limit (Optional[int] = None): Default: 500; Maximum: 1000.
                    order_id (Optional[int] = None):
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[MyAllocationsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.my_allocations(
            symbol,
            start_time,
            end_time,
            from_allocation_id,
            limit,
            order_id,
            recv_window,
        )

    def my_filters(
        self,
        symbol: Union[str, None],
        recv_window: Optional[float] = None,
    ) -> ApiResponse[MyFiltersResponse]:
        """
                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

                Args:
                    symbol (Union[str, None]):
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[MyFiltersResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.my_filters(symbol, recv_window)

    def my_prevented_matches(
        self,
        symbol: Union[str, None],
        prevented_match_id: Optional[int] = None,
        order_id: Optional[int] = None,
        from_prevented_match_id: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[MyPreventedMatchesResponse]:
        """
                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

                Args:
                    symbol (Union[str, None]):
                    prevented_match_id (Optional[int] = None):
                    order_id (Optional[int] = None):
                    from_prevented_match_id (Optional[int] = None):
                    limit (Optional[int] = None): Default: 500; Maximum: 1000.
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[MyPreventedMatchesResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.my_prevented_matches(
            symbol,
            prevented_match_id,
            order_id,
            from_prevented_match_id,
            limit,
            recv_window,
        )

    def my_trades(
        self,
        symbol: Union[str, None],
        order_id: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        from_id: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[MyTradesResponse]:
        """
                Account trade list

                Get trades for a specific account and symbol.
        Weight: Condition| Weight|
        ---| ---
        |Without orderId|20|
        |With orderId|5|

                Args:
                    symbol (Union[str, None]):
                    order_id (Optional[int] = None):
                    start_time (Optional[int] = None): Timestamp in ms to get aggregate trades from INCLUSIVE.
                    end_time (Optional[int] = None): Timestamp in ms to get aggregate trades until INCLUSIVE.
                    from_id (Optional[int] = None): ID to get aggregate trades from INCLUSIVE.
                    limit (Optional[int] = None): Default: 500; Maximum: 1000.
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[MyTradesResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.my_trades(
            symbol, order_id, start_time, end_time, from_id, limit, recv_window
        )

    def open_order_list(
        self,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[OpenOrderListResponse]:
        """
                Query Open Order lists


        Weight: 6

                Args:
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[OpenOrderListResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.open_order_list(recv_window)

    def order_amendments(
        self,
        symbol: Union[str, None],
        order_id: Union[int, None],
        from_execution_id: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[OrderAmendmentsResponse]:
        """
                Query Order Amendments

                Queries all amendments of a single order.
        Weight: 4

                Args:
                    symbol (Union[str, None]):
                    order_id (Union[int, None]):
                    from_execution_id (Optional[int] = None):
                    limit (Optional[int] = None): Default:500; Maximum: 1000
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[OrderAmendmentsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.order_amendments(
            symbol, order_id, from_execution_id, limit, recv_window
        )

    def rate_limit_order(
        self,
        recv_window: Optional[float] = None,
    ) -> ApiResponse[RateLimitOrderResponse]:
        """
                Query Unfilled Order Count

                Displays the user's unfilled order count for all intervals.
        Weight: 40

                Args:
                    recv_window (Optional[float] = None): The value cannot be greater than `60000`. <br> Supports up to three decimal places of precision (e.g., 6000.346) so that microseconds may be specified.

                Returns:
                    ApiResponse[RateLimitOrderResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.rate_limit_order(recv_window)

    def exchange_info(
        self,
        symbol: Optional[str] = None,
        symbols: Optional[List[str]] = None,
        permissions: Optional[List[str]] = None,
        show_permission_sets: Optional[bool] = None,
        symbol_status: Optional[ExchangeInfoSymbolStatusEnum] = None,
    ) -> ApiResponse[ExchangeInfoResponse]:
        """
                Exchange information

                Current exchange trading rules and symbol information
        Weight: 20

                Args:
                    symbol (Optional[str] = None): Symbol to query
                    symbols (Optional[List[str]] = None): List of symbols to query
                    permissions (Optional[List[str]] = None): List of permissions to query
                    show_permission_sets (Optional[bool] = None): Controls whether the content of the `permissionSets` field is populated or not. Defaults to `true`
                    symbol_status (Optional[ExchangeInfoSymbolStatusEnum] = None):

                Returns:
                    ApiResponse[ExchangeInfoResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._generalApi.exchange_info(
            symbol, symbols, permissions, show_permission_sets, symbol_status
        )

    def ping(
        self,
    ) -> ApiResponse[None]:
        """
                Test connectivity

                Test connectivity to the Rest API.
        Weight: 1

                Args:

                Returns:
                    ApiResponse[None]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._generalApi.ping()

    def time(
        self,
    ) -> ApiResponse[TimeResponse]:
        """
                Check server time

                Test connectivity to the Rest API and get the current server time.
        Weight: 1

                Args:

                Returns:
                    ApiResponse[TimeResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._generalApi.time()

    def agg_trades(
        self,
        symbol: Union[str, None],
        from_id: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
    ) -> ApiResponse[AggTradesResponse]:
        """
                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

                Args:
                    symbol (Union[str, None]):
                    from_id (Optional[int] = None): ID to get aggregate trades from INCLUSIVE.
                    start_time (Optional[int] = None): Timestamp in ms to get aggregate trades from INCLUSIVE.
                    end_time (Optional[int] = None): Timestamp in ms to get aggregate trades until INCLUSIVE.
                    limit (Optional[int] = None): Default: 500; Maximum: 1000.

                Returns:
                    ApiResponse[AggTradesResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketApi.agg_trades(symbol, from_id, start_time, end_time, limit)

    def avg_price(
        self,
        symbol: Union[str, None],
    ) -> ApiResponse[AvgPriceResponse]:
        """
                Current average price

                Current average price for a symbol.
        Weight: 2

                Args:
                    symbol (Union[str, None]):

                Returns:
                    ApiResponse[AvgPriceResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketApi.avg_price(symbol)

    def depth(
        self,
        symbol: Union[str, None],
        limit: Optional[int] = None,
        symbol_status: Optional[DepthSymbolStatusEnum] = None,
    ) -> ApiResponse[DepthResponse]:
        """
                Order book


        Weight: Adjusted based on the limit:

        |Limit|Request Weight
        ------|-------
        1-100|  5
        101-500| 25
        501-1000| 50
