"""
Binance Spot WebSocket API

OpenAPI Specifications for the Binance Spot WebSocket API

API documents:
  - [Github web-socket-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-api.md)
  - [General API information for web-socket-api on website](https://developers.binance.com/docs/binance-spot-api-docs/web-socket-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.
"""

from typing import Dict, Optional, List, TypeVar, Type, Union
from pydantic import BaseModel

from binance_common.configuration import ConfigurationWebSocketAPI
from binance_common.models import (
    WebsocketApiResponse,
    WebsocketApiUserDataEndpoints,
    WebsocketApiUserDataStreamResponse,
)
from binance_common.signature import Signers
from binance_common.websocket import (
    WebSocketAPIBase,
    WebSocketConnection,
    RequestStreamHandle,
    RequestStream,
)

from .api.account_api import AccountApi
from .api.auth_api import AuthApi
from .api.general_api import GeneralApi
from .api.market_api import MarketApi
from .api.trade_api import TradeApi
from .api.user_data_stream_api import UserDataStreamApi

from .models import AccountCommissionResponse
from .models import AccountRateLimitsOrdersResponse
from .models import AccountStatusResponse
from .models import AllOrderListsResponse
from .models import AllOrdersResponse
from .models import MyAllocationsResponse
from .models import MyFiltersResponse
from .models import MyPreventedMatchesResponse
from .models import MyTradesResponse
from .models import OpenOrderListsStatusResponse
from .models import OpenOrdersStatusResponse
from .models import OrderAmendmentsResponse
from .models import OrderListStatusResponse
from .models import OrderStatusResponse
from .models import SessionLogonResponse
from .models import SessionLogoutResponse
from .models import SessionStatusResponse
from .models import ExchangeInfoResponse
from .models import PingResponse
from .models import TimeResponse
from .models import AvgPriceResponse
from .models import DepthResponse
from .models import KlinesResponse
from .models import TickerResponse
from .models import Ticker24hrResponse
from .models import TickerBookResponse
from .models import TickerPriceResponse
from .models import TickerTradingDayResponse
from .models import TradesAggregateResponse
from .models import TradesHistoricalResponse
from .models import TradesRecentResponse
from .models import UiKlinesResponse
from .models import OpenOrdersCancelAllResponse
from .models import OrderAmendKeepPriorityResponse
from .models import OrderCancelResponse
from .models import OrderCancelReplaceResponse
from .models import OrderListCancelResponse
from .models import OrderListPlaceResponse
from .models import OrderListPlaceOcoResponse
from .models import OrderListPlaceOpoResponse
from .models import OrderListPlaceOpocoResponse
from .models import OrderListPlaceOtoResponse
from .models import OrderListPlaceOtocoResponse
from .models import OrderPlaceResponse
from .models import OrderTestResponse
from .models import SorOrderPlaceResponse
from .models import SorOrderTestResponse
from .models import SessionSubscriptionsResponse
from .models import UserDataStreamSubscribeResponse
from .models import UserDataStreamSubscribeSignatureResponse
from .models import UserDataStreamUnsubscribeResponse

from .models import UserDataStreamEventsResponse

from .models import ExchangeInfoSymbolStatusEnum
from .models import DepthSymbolStatusEnum
from .models import KlinesIntervalEnum
from .models import TickerTypeEnum
from .models import TickerWindowSizeEnum
from .models import TickerSymbolStatusEnum
from .models import Ticker24hrTypeEnum
from .models import Ticker24hrSymbolStatusEnum
from .models import TickerBookSymbolStatusEnum
from .models import TickerPriceSymbolStatusEnum
from .models import TickerTradingDayTypeEnum
from .models import TickerTradingDaySymbolStatusEnum
from .models import UiKlinesIntervalEnum
from .models import OrderCancelCancelRestrictionsEnum
from .models import OrderCancelReplaceCancelReplaceModeEnum
from .models import OrderCancelReplaceSideEnum
from .models import OrderCancelReplaceTypeEnum
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 OrderListPlaceSideEnum
from .models import OrderListPlaceStopLimitTimeInForceEnum
from .models import OrderListPlaceNewOrderRespTypeEnum
from .models import OrderListPlaceSelfTradePreventionModeEnum
from .models import OrderListPlaceOcoSideEnum
from .models import OrderListPlaceOcoAboveTypeEnum
from .models import OrderListPlaceOcoBelowTypeEnum
from .models import OrderListPlaceOcoAboveTimeInForceEnum
from .models import OrderListPlaceOcoAbovePegPriceTypeEnum
from .models import OrderListPlaceOcoAbovePegOffsetTypeEnum
from .models import OrderListPlaceOcoBelowTimeInForceEnum
from .models import OrderListPlaceOcoBelowPegPriceTypeEnum
from .models import OrderListPlaceOcoBelowPegOffsetTypeEnum
from .models import OrderListPlaceOcoNewOrderRespTypeEnum
from .models import OrderListPlaceOcoSelfTradePreventionModeEnum
from .models import OrderListPlaceOpoWorkingTypeEnum
from .models import OrderListPlaceOpoWorkingSideEnum
from .models import OrderListPlaceOpoPendingTypeEnum
from .models import OrderListPlaceOpoPendingSideEnum
from .models import OrderListPlaceOpoNewOrderRespTypeEnum
from .models import OrderListPlaceOpoSelfTradePreventionModeEnum
from .models import OrderListPlaceOpoWorkingTimeInForceEnum
from .models import OrderListPlaceOpoWorkingPegPriceTypeEnum
from .models import OrderListPlaceOpoWorkingPegOffsetTypeEnum
from .models import OrderListPlaceOpoPendingTimeInForceEnum
from .models import OrderListPlaceOpoPendingPegPriceTypeEnum
from .models import OrderListPlaceOpoPendingPegOffsetTypeEnum
from .models import OrderListPlaceOpocoWorkingTypeEnum
from .models import OrderListPlaceOpocoWorkingSideEnum
from .models import OrderListPlaceOpocoPendingSideEnum
from .models import OrderListPlaceOpocoPendingAboveTypeEnum
from .models import OrderListPlaceOpocoNewOrderRespTypeEnum
from .models import OrderListPlaceOpocoSelfTradePreventionModeEnum
from .models import OrderListPlaceOpocoWorkingTimeInForceEnum
from .models import OrderListPlaceOpocoWorkingPegPriceTypeEnum
from .models import OrderListPlaceOpocoWorkingPegOffsetTypeEnum
from .models import OrderListPlaceOpocoPendingAboveTimeInForceEnum
from .models import OrderListPlaceOpocoPendingAbovePegPriceTypeEnum
from .models import OrderListPlaceOpocoPendingAbovePegOffsetTypeEnum
from .models import OrderListPlaceOpocoPendingBelowTypeEnum
from .models import OrderListPlaceOpocoPendingBelowTimeInForceEnum
from .models import OrderListPlaceOpocoPendingBelowPegPriceTypeEnum
from .models import OrderListPlaceOpocoPendingBelowPegOffsetTypeEnum
from .models import OrderListPlaceOtoWorkingTypeEnum
from .models import OrderListPlaceOtoWorkingSideEnum
from .models import OrderListPlaceOtoPendingTypeEnum
from .models import OrderListPlaceOtoPendingSideEnum
from .models import OrderListPlaceOtoNewOrderRespTypeEnum
from .models import OrderListPlaceOtoSelfTradePreventionModeEnum
from .models import OrderListPlaceOtoWorkingTimeInForceEnum
from .models import OrderListPlaceOtoWorkingPegPriceTypeEnum
from .models import OrderListPlaceOtoWorkingPegOffsetTypeEnum
from .models import OrderListPlaceOtoPendingTimeInForceEnum
from .models import OrderListPlaceOtoPendingPegOffsetTypeEnum
from .models import OrderListPlaceOtoPendingPegPriceTypeEnum
from .models import OrderListPlaceOtocoWorkingTypeEnum
from .models import OrderListPlaceOtocoWorkingSideEnum
from .models import OrderListPlaceOtocoPendingSideEnum
from .models import OrderListPlaceOtocoPendingAboveTypeEnum
from .models import OrderListPlaceOtocoNewOrderRespTypeEnum
from .models import OrderListPlaceOtocoSelfTradePreventionModeEnum
from .models import OrderListPlaceOtocoWorkingTimeInForceEnum
from .models import OrderListPlaceOtocoWorkingPegPriceTypeEnum
from .models import OrderListPlaceOtocoWorkingPegOffsetTypeEnum
from .models import OrderListPlaceOtocoPendingAboveTimeInForceEnum
from .models import OrderListPlaceOtocoPendingAbovePegPriceTypeEnum
from .models import OrderListPlaceOtocoPendingAbovePegOffsetTypeEnum
from .models import OrderListPlaceOtocoPendingBelowTypeEnum
from .models import OrderListPlaceOtocoPendingBelowTimeInForceEnum
from .models import OrderListPlaceOtocoPendingBelowPegPriceTypeEnum
from .models import OrderListPlaceOtocoPendingBelowPegOffsetTypeEnum
from .models import OrderPlaceSideEnum
from .models import OrderPlaceTypeEnum
from .models import OrderPlaceTimeInForceEnum
from .models import OrderPlaceNewOrderRespTypeEnum
from .models import OrderPlaceSelfTradePreventionModeEnum
from .models import OrderPlacePegPriceTypeEnum
from .models import OrderPlacePegOffsetTypeEnum
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 SorOrderPlaceSideEnum
from .models import SorOrderPlaceTypeEnum
from .models import SorOrderPlaceTimeInForceEnum
from .models import SorOrderPlaceNewOrderRespTypeEnum
from .models import SorOrderPlaceSelfTradePreventionModeEnum
from .models import SorOrderTestSideEnum
from .models import SorOrderTestTypeEnum
from .models import SorOrderTestTimeInForceEnum
from .models import SorOrderTestNewOrderRespTypeEnum
from .models import SorOrderTestSelfTradePreventionModeEnum

T = TypeVar("T", bound=BaseModel)


class SpotWebSocketAPI(WebSocketAPIBase):
    def __init__(
        self,
        configuration: ConfigurationWebSocketAPI,
    ) -> None:
        self.user_data_endpoints = WebsocketApiUserDataEndpoints(
            user_data_stream_subscribe="userDataStream.subscribe",
            user_data_stream_logout="/session.logout".replace("/", "", 1),
        )
        super().__init__(configuration, self.user_data_endpoints)
        self.configuration = configuration
        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, self.signer)
        self._authApi = AuthApi(self, self.signer)
        self._generalApi = GeneralApi(self, self.signer)
        self._marketApi = MarketApi(self, self.signer)
        self._tradeApi = TradeApi(self, self.signer)
        self._userDataStreamApi = UserDataStreamApi(self, self.signer)

    async def ping_server(self, connection: WebSocketConnection):
        """Sends a ping message to the WebSocket server to check the connection status.

        Args:
            connection (WebSocketConnection): The WebSocket connection to send the ping message to.
        """
        if self.session:
            return await super().ping_ws_api(connection=connection)
        else:
            raise ValueError("WebSocket session is not initialized.")

    async def send_message(
        self,
        payload: Dict,
        promised: bool = True,
        response_model: Type[T] = None,
        api_key: Optional[bool] = False,
        session_logon: Optional[bool] = False,
        session_logout: Optional[bool] = False,
    ) -> WebsocketApiResponse[T]:
        """Sends a message to the WebSocket server.

        Args:
            payload (Dict): The message payload to send.
            promised (bool): Whether the message is promised or not.
            response_model (Type[T]): The expected response model type.
            api_key (Optional[bool]): Whether to include the API key in the request.
            session_logon (Optional[bool]): Whether the message is for session logon.
            session_logout (Optional[bool]): Whether the message is for session logout.
        Returns:
            WebsocketApiResponse[T]: The response from the WebSocket server.
        """

        return await super().send_message(
            payload, promised, response_model, api_key, session_logon, session_logout
        )

    async def send_signed_message(
        self,
        payload: Dict,
        signer: Optional[Signers] = None,
        promised: bool = True,
        response_model: Type[T] = None,
        api_key: Optional[bool] = False,
        session_logon: Optional[bool] = False,
        session_logout: Optional[bool] = False,
    ):
        """Sends a signed message to the WebSocket server.

        Args:
            payload (Dict): The message payload to send.
            signer (Optional[Signers]): The signer to use for signing the message.
            promised (bool): Whether the message is promised or not.
            response_model (Type[T]): The expected response model type.
            api_key (Optional[bool]): Whether to include the API key in the request.
            session_logon (Optional[bool]): Whether the message is for session logon.
            session_logout (Optional[bool]): Whether the message is for session logout.
        Returns:
            WebsocketApiResponse[T]: The response from the WebSocket server.
        """

        return await super().send_signed_message(
            payload,
            signer,
            promised,
            response_model,
            api_key=api_key,
            session_logon=session_logon,
            session_logout=session_logout,
        )

    async def close_connection(
        self, connection: WebSocketConnection = None, close_session: bool = True
    ):
        """Closes the WebSocket connection and optionally the session.

        Args:
            connection (WebSocketConnection, optional): The WebSocket connection to close. If None, the current session's connection is used.
            close_session (bool, optional): Whether to close the session after closing the connection. Defaults to True.
        """

        await super().close_connection(connection, close_session)

    async def account_commission(
        self,
        symbol: Union[str, None],
        id: Optional[str] = None,
    ) -> WebsocketApiResponse[AccountCommissionResponse]:
        """
                WebSocket Account Commission Rates

                Get current account commission rates.
        Weight: 20

                Args:
                    symbol (Union[str, None]):
                    id (Optional[str] = None): Unique WebSocket request ID.

                Returns:
                    WebsocketApiResponse[AccountCommissionResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return await self._accountApi.account_commission(symbol, id)

    async def account_rate_limits_orders(
        self,
        id: Optional[str] = None,
        recv_window: Optional[float] = None,
    ) -> WebsocketApiResponse[AccountRateLimitsOrdersResponse]:
        """
                WebSocket Unfilled Order Count

                Query your current unfilled order count for all intervals.
        Weight: 40

                Args:
                    id (Optional[str] = None): Unique WebSocket request ID.
                    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:
                    WebsocketApiResponse[AccountRateLimitsOrdersResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return await self._accountApi.account_rate_limits_orders(id, recv_window)

    async def account_status(
        self,
        id: Optional[str] = None,
        omit_zero_balances: Optional[bool] = None,
        recv_window: Optional[float] = None,
    ) -> WebsocketApiResponse[AccountStatusResponse]:
        """
                WebSocket Account information

                Query information about your account.
        Weight: 20

                Args:
                    id (Optional[str] = None): Unique WebSocket request ID.
                    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:
                    WebsocketApiResponse[AccountStatusResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return await self._accountApi.account_status(
            id, omit_zero_balances, recv_window
        )

    async def all_order_lists(
        self,
        id: Optional[str] = None,
        from_id: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[float] = None,
    ) -> WebsocketApiResponse[AllOrderListsResponse]:
        """
                WebSocket Account order list history

                Query information about all your order lists, filtered by time range.
        Weight: 20

                Args:
                    id (Optional[str] = None): Unique WebSocket request ID.
                    from_id (Optional[int] = None): Aggregate trade ID to begin at
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default: 100; Maximum: 5000
                    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:
                    WebsocketApiResponse[AllOrderListsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return await self._accountApi.all_order_lists(
            id, from_id, start_time, end_time, limit, recv_window
        )

    async def all_orders(
        self,
        symbol: Union[str, None],
        id: Optional[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,
    ) -> WebsocketApiResponse[AllOrdersResponse]:
        """
                WebSocket Account order history

                Query information about all your orders – active, canceled, filled – filtered by time range.
        Weight: 20

                Args:
                    symbol (Union[str, None]):
                    id (Optional[str] = None): Unique WebSocket request ID.
                    order_id (Optional[int] = None): `orderId`or`origClientOrderId`mustbesent
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default: 100; Maximum: 5000
                    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:
                    WebsocketApiResponse[AllOrdersResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

    async def my_allocations(
        self,
        symbol: Union[str, None],
        id: Optional[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,
    ) -> WebsocketApiResponse[MyAllocationsResponse]:
        """
                WebSocket Account allocations

                Retrieves allocations resulting from SOR order placement.
        Weight: 20

                Args:
                    symbol (Union[str, None]):
                    id (Optional[str] = None): Unique WebSocket request ID.
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    from_allocation_id (Optional[int] = None):
                    limit (Optional[int] = None): Default: 100; Maximum: 5000
                    order_id (Optional[int] = None): `orderId`or`origClientOrderId`mustbesent
                    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:
                    WebsocketApiResponse[MyAllocationsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

    async def my_filters(
        self,
        symbol: Union[str, None],
        id: Optional[str] = None,
        recv_window: Optional[float] = None,
    ) -> WebsocketApiResponse[MyFiltersResponse]:
        """
                WebSocket Query Relevant Filters

                Retrieves the list of [filters](filters.md) relevant to an account on a given symbol. This is the only method that shows if an account has `MAX_ASSET` filters applied to it.
        Weight: 40

                Args:
                    symbol (Union[str, None]):
                    id (Optional[str] = None): Unique WebSocket request ID.
                    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:
                    WebsocketApiResponse[MyFiltersResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return await self._accountApi.my_filters(symbol, id, recv_window)

    async def my_prevented_matches(
        self,
        symbol: Union[str, None],
        id: Optional[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,
    ) -> WebsocketApiResponse[MyPreventedMatchesResponse]:
        """
                WebSocket Account 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]):
                    id (Optional[str] = None): Unique WebSocket request ID.
                    prevented_match_id (Optional[int] = None):
                    order_id (Optional[int] = None): `orderId`or`origClientOrderId`mustbesent
                    from_prevented_match_id (Optional[int] = None):
                    limit (Optional[int] = None): Default: 100; Maximum: 5000
                    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:
                    WebsocketApiResponse[MyPreventedMatchesResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

    async def my_trades(
        self,
        symbol: Union[str, None],
        id: Optional[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,
    ) -> WebsocketApiResponse[MyTradesResponse]:
        """
                WebSocket Account trade history

                Query information about all your trades, filtered by time range.
        Weight: Condition| Weight|
        ---| ---
        |Without orderId|20|
        |With orderId|5|

                Args:
                    symbol (Union[str, None]):
                    id (Optional[str] = None): Unique WebSocket request ID.
                    order_id (Optional[int] = None): `orderId`or`origClientOrderId`mustbesent
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    from_id (Optional[int] = None): Aggregate trade ID to begin at
                    limit (Optional[int] = None): Default: 100; Maximum: 5000
                    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:
                    WebsocketApiResponse[MyTradesResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

    async def open_order_lists_status(
        self,
        id: Optional[str] = None,
        recv_window: Optional[float] = None,
    ) -> WebsocketApiResponse[OpenOrderListsStatusResponse]:
        """
                WebSocket Current open Order lists

                Query execution status of all open order lists.

        If you need to continuously monitor order status updates, please consider using WebSocket Streams:

        * `userDataStream.start` request
        * `executionReport` user data stream event
        Weight: 6

                Args:
                    id (Optional[str] = None): Unique WebSocket request ID.
                    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:
                    WebsocketApiResponse[OpenOrderListsStatusResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return await self._accountApi.open_order_lists_status(id, recv_window)

    async def open_orders_status(
        self,
        id: Optional[str] = None,
        symbol: Optional[str] = None,
        recv_window: Optional[float] = None,
    ) -> WebsocketApiResponse[OpenOrdersStatusResponse]:
        """
                WebSocket Current open orders

                Query execution status of all open orders.

        If you need to continuously monitor order status updates, please consider using WebSocket Streams:

        * `userDataStream.start` request
        * `executionReport` user data stream event
        Weight: Adjusted based on the number of requested symbols:

        | Parameter | Weight |
        | --------- | ------ |
        | `symbol`  |      6 |
        | none      |     80 |

                Args:
                    id (Optional[str] = None): Unique WebSocket request ID.
                    symbol (Optional[str] = None): Describe a single symbol
                    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:
                    WebsocketApiResponse[OpenOrdersStatusResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return await self._accountApi.open_orders_status(id, symbol, recv_window)

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

                Queries all amendments of a single order.
        Weight: 4

                Args:
                    symbol (Union[str, None]):
                    order_id (Union[int, None]):
                    id (Optional[str] = None): Unique WebSocket request ID.
                    from_execution_id (Optional[int] = None):
                    limit (Optional[int] = None): Default: 100; Maximum: 5000
                    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:
                    WebsocketApiResponse[OrderAmendmentsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

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

    async def order_list_status(
        self,
        id: Optional[str] = None,
        orig_client_order_id: Optional[str] = None,
        order_list_id: Optional[int] = None,
        recv_window: Optional[float] = None,
    ) -> WebsocketApiResponse[OrderListStatusResponse]:
        """
                WebSocket Query Order list

                Check execution status of an Order list.

        For execution status of individual orders, use `order.status`.
        Weight: 4

                Args:
                    id (Optional[str] = None): Unique WebSocket request ID.
                    orig_client_order_id (Optional[str] = None): `orderId`or`origClientOrderId`mustbesent
                    order_list_id (Optional[int] = None): Cancel order list by orderListId
                    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:
                    WebsocketApiResponse[OrderListStatusResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return await self._accountApi.order_list_status(
            id, orig_client_order_id, order_list_id, recv_window
        )

    async def order_status(
        self,
        symbol: Union[str, None],
        id: Optional[str] = None,
        order_id: Optional[int] = None,
        orig_client_order_id: Optional[str] = None,
        recv_window: Optional[float] = None,
    ) -> WebsocketApiResponse[OrderStatusResponse]:
        """
                WebSocket Query order

                Check execution status of an order.
        Weight: 4

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