"""
Binance Margin Trading REST API

OpenAPI Specification for the Binance Margin Trading REST API
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.borrow_repay_api import BorrowRepayApi
from .api.market_data_api import MarketDataApi
from .api.risk_data_stream_api import RiskDataStreamApi
from .api.trade_api import TradeApi
from .api.transfer_api import TransferApi

from .models import AdjustCrossMarginMaxLeverageResponse
from .models import DisableIsolatedMarginAccountResponse
from .models import EnableIsolatedMarginAccountResponse
from .models import GetBnbBurnStatusResponse
from .models import GetSummaryOfMarginAccountResponse
from .models import QueryCrossIsolatedMarginCapitalFlowResponse
from .models import QueryCrossMarginAccountDetailsResponse
from .models import QueryCrossMarginFeeDataResponse
from .models import QueryEnabledIsolatedMarginAccountLimitResponse
from .models import QueryIsolatedMarginAccountInfoResponse
from .models import QueryIsolatedMarginFeeDataResponse
from .models import GetFutureHourlyInterestRateResponse
from .models import GetInterestHistoryResponse
from .models import MarginAccountBorrowRepayResponse
from .models import QueryBorrowRepayRecordsInMarginAccountResponse
from .models import QueryMarginInterestRateHistoryResponse
from .models import QueryMaxBorrowResponse
from .models import CrossMarginCollateralRatioResponse
from .models import GetAllCrossMarginPairsResponse
from .models import GetAllIsolatedMarginSymbolResponse
from .models import GetAllMarginAssetsResponse
from .models import GetDelistScheduleResponse
from .models import GetLimitPricePairsResponse
from .models import GetListScheduleResponse
from .models import QueryIsolatedMarginTierDataResponse
from .models import QueryLiabilityCoinLeverageBracketInCrossMarginProModeResponse
from .models import QueryMarginAvailableInventoryResponse
from .models import QueryMarginPriceindexResponse


from .models import StartUserDataStreamResponse
from .models import CreateSpecialKeyResponse


from .models import GetForceLiquidationRecordResponse
from .models import GetSmallLiabilityExchangeCoinListResponse
from .models import GetSmallLiabilityExchangeHistoryResponse
from .models import MarginAccountCancelAllOpenOrdersOnASymbolResponse
from .models import MarginAccountCancelOcoResponse
from .models import MarginAccountCancelOrderResponse
from .models import MarginAccountNewOcoResponse
from .models import MarginAccountNewOrderResponse
from .models import MarginAccountNewOtoResponse
from .models import MarginAccountNewOtocoResponse
from .models import MarginManualLiquidationResponse
from .models import QueryCurrentMarginOrderCountUsageResponse
from .models import QueryMarginAccountsAllOcoResponse
from .models import QueryMarginAccountsAllOrdersResponse
from .models import QueryMarginAccountsOcoResponse
from .models import QueryMarginAccountsOpenOcoResponse
from .models import QueryMarginAccountsOpenOrdersResponse
from .models import QueryMarginAccountsOrderResponse
from .models import QueryMarginAccountsTradeListResponse
from .models import QuerySpecialKeyResponse
from .models import QuerySpecialKeyListResponse

from .models import GetCrossMarginTransferHistoryResponse
from .models import QueryMaxTransferOutAmountResponse


from .models import MarginAccountNewOcoSideEnum
from .models import MarginAccountNewOcoNewOrderRespTypeEnum
from .models import MarginAccountNewOrderSideEnum
from .models import MarginAccountNewOrderNewOrderRespTypeEnum
from .models import MarginAccountNewOrderTimeInForceEnum
from .models import MarginAccountNewOtoNewOrderRespTypeEnum
from .models import MarginAccountNewOtocoNewOrderRespTypeEnum


T = TypeVar("T")


class MarginTradingRestAPI:
    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._borrowRepayApi = BorrowRepayApi(
            self.configuration, self._session, self._signer
        )
        self._marketDataApi = MarketDataApi(
            self.configuration, self._session, self._signer
        )
        self._riskDataStreamApi = RiskDataStreamApi(
            self.configuration, self._session, self._signer
        )
        self._tradeApi = TradeApi(self.configuration, self._session, self._signer)
        self._transferApi = TransferApi(self.configuration, self._session, self._signer)

    def send_request(
        self,
        endpoint: str,
        method: str,
        query_params: Optional[dict] = None,
        body_params: Optional[dict] = 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.

        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,
        )

    def send_signed_request(
        self,
        endpoint: str,
        method: str,
        query_params: Optional[dict] = None,
        body_params: Optional[dict] = 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.

        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,
            is_signed=True,
            signer=self._signer,
        )

    def adjust_cross_margin_max_leverage(
        self,
        max_leverage: Union[int, None],
    ) -> ApiResponse[AdjustCrossMarginMaxLeverageResponse]:
        """
                Adjust cross margin max leverage (USER_DATA)

                Adjust cross margin max leverage

        * The margin level need higher than the initial risk ratio of adjusted leverage, the initial risk ratio of 3x is 1.5 , the initial risk ratio of 5x is 1.25;  The detail conditions on how to switch between Cross Margin Classic and Cross Margin Pro can refer to [the FAQ](https://www.binance.com/en/support/faq/how-to-activate-the-cross-margin-pro-mode-on-binance-e27786da05e743a694b8c625b3bc475d).

        Weight: 3000

                Args:
                    max_leverage (Union[int, None]): Can only adjust 3 , 5 or 10，Example: maxLeverage = 5 or 3 for Cross Margin Classic; maxLeverage=10 for Cross Margin Pro 10x leverage or 20x if compliance allows.

                Returns:
                    ApiResponse[AdjustCrossMarginMaxLeverageResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.adjust_cross_margin_max_leverage(max_leverage)

    def disable_isolated_margin_account(
        self,
        symbol: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[DisableIsolatedMarginAccountResponse]:
        """
                Disable Isolated Margin Account (TRADE)

                Disable isolated margin account for a specific symbol. Each trading pair can only be deactivated once every 24
        hours.

        Weight: 300(UID)

                Args:
                    symbol (Union[str, None]):
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[DisableIsolatedMarginAccountResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.disable_isolated_margin_account(symbol, recv_window)

    def enable_isolated_margin_account(
        self,
        symbol: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[EnableIsolatedMarginAccountResponse]:
        """
                Enable Isolated Margin Account (TRADE)

                Enable isolated margin account for a specific symbol(Only supports activation of previously disabled accounts).

        Weight: 300(UID)

                Args:
                    symbol (Union[str, None]):
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[EnableIsolatedMarginAccountResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.enable_isolated_margin_account(symbol, recv_window)

    def get_bnb_burn_status(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetBnbBurnStatusResponse]:
        """
                Get BNB Burn Status (USER_DATA)

                Get BNB Burn Status

        Weight: 1(IP)

                Args:
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[GetBnbBurnStatusResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_bnb_burn_status(recv_window)

    def get_summary_of_margin_account(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetSummaryOfMarginAccountResponse]:
        """
                Get Summary of Margin account (USER_DATA)

                Get personal margin level information

        Weight: 10(IP)

                Args:
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[GetSummaryOfMarginAccountResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_summary_of_margin_account(recv_window)

    def query_cross_isolated_margin_capital_flow(
        self,
        asset: Optional[str] = None,
        symbol: Optional[str] = None,
        type: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        from_id: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryCrossIsolatedMarginCapitalFlowResponse]:
        """
                Query Cross Isolated Margin Capital Flow (USER_DATA)

                Query Cross Isolated Margin Capital Flow

        Weight: 100(IP)

                Args:
                    asset (Optional[str] = None):
                    symbol (Optional[str] = None): isolated margin pair
                    type (Optional[str] = None): Transfer Type: ROLL_IN, ROLL_OUT
                    start_time (Optional[int] = None): 只支持查询最近90天的数据
                    end_time (Optional[int] = None):
                    from_id (Optional[int] = None): 如设置fromId, 将返回id > fromId的数据。否则将返回最新数据
                    limit (Optional[int] = None): Default Value: 500; Max Value: 1000
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryCrossIsolatedMarginCapitalFlowResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.query_cross_isolated_margin_capital_flow(
            asset, symbol, type, start_time, end_time, from_id, limit, recv_window
        )

    def query_cross_margin_account_details(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryCrossMarginAccountDetailsResponse]:
        """
                Query Cross Margin Account Details (USER_DATA)

                Query Cross Margin Account Details

        Weight: 10(IP)

                Args:
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryCrossMarginAccountDetailsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.query_cross_margin_account_details(recv_window)

    def query_cross_margin_fee_data(
        self,
        vip_level: Optional[int] = None,
        coin: Optional[str] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryCrossMarginFeeDataResponse]:
        """
                Query Cross Margin Fee Data (USER_DATA)

                Get cross margin fee data collection with any vip level or user's current specific data as https://www.binance.com/en/margin-fee

        Weight: 1 when coin is specified;(IP)

                Args:
                    vip_level (Optional[int] = None): User's current specific margin data will be returned if vipLevel is omitted
                    coin (Optional[str] = None):
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryCrossMarginFeeDataResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.query_cross_margin_fee_data(
            vip_level, coin, recv_window
        )

    def query_enabled_isolated_margin_account_limit(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryEnabledIsolatedMarginAccountLimitResponse]:
        """
                Query Enabled Isolated Margin Account Limit (USER_DATA)

                Query enabled isolated margin account limit.

        Weight: 1(IP)

                Args:
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryEnabledIsolatedMarginAccountLimitResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.query_enabled_isolated_margin_account_limit(recv_window)

    def query_isolated_margin_account_info(
        self,
        symbols: Optional[str] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryIsolatedMarginAccountInfoResponse]:
        """
                Query Isolated Margin Account Info (USER_DATA)

                Query Isolated Margin Account Info

        * If "symbols" is not sent, all isolated assets will be returned.
        * If "symbols" is sent, only the isolated assets of the sent symbols will be returned.

        Weight: 10(IP)

                Args:
                    symbols (Optional[str] = None): Max 5 symbols can be sent; separated by ",". e.g. "BTCUSDT,BNBUSDT,ADAUSDT"
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryIsolatedMarginAccountInfoResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.query_isolated_margin_account_info(symbols, recv_window)

    def query_isolated_margin_fee_data(
        self,
        vip_level: Optional[int] = None,
        symbol: Optional[str] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryIsolatedMarginFeeDataResponse]:
        """
                Query Isolated Margin Fee Data (USER_DATA)

                Get isolated margin fee data collection with any vip level or user's current specific data as https://www.binance.com/en/margin-fee

        Weight: 1 when a single is specified;(IP)

                Args:
                    vip_level (Optional[int] = None): User's current specific margin data will be returned if vipLevel is omitted
                    symbol (Optional[str] = None): isolated margin pair
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryIsolatedMarginFeeDataResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.query_isolated_margin_fee_data(
            vip_level, symbol, recv_window
        )

    def get_future_hourly_interest_rate(
        self,
        assets: Union[str, None],
        is_isolated: Union[bool, None],
    ) -> ApiResponse[GetFutureHourlyInterestRateResponse]:
        """
                Get future hourly interest rate (USER_DATA)

                Get future hourly interest rate

        Weight: 100

                Args:
                    assets (Union[str, None]): List of assets, separated by commas, up to 20
                    is_isolated (Union[bool, None]): for isolated margin or not, "TRUE", "FALSE"

                Returns:
                    ApiResponse[GetFutureHourlyInterestRateResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._borrowRepayApi.get_future_hourly_interest_rate(assets, is_isolated)

    def get_interest_history(
        self,
        asset: Optional[str] = None,
        isolated_symbol: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetInterestHistoryResponse]:
        """
                Get Interest History (USER_DATA)

                Get Interest History

        * Response in descending order
        * If isolatedSymbol is not sent, crossed margin data will be returned
        * The max interval between `startTime` and `endTime` is 30 days.  It is a MUST to ensure data correctness.
        * If `startTime`and `endTime` not sent, return records of the last 7 days by default.
        * If `startTime` is sent and `endTime` is not sent, return records of [max(`startTime`, now-30d), now].
        * If `startTime` is not sent and `endTime` is sent, return records of [`endTime`-7, `endTime`]
        * `type` in response has 4 enums:
        * `PERIODIC` interest charged per hour
        * `ON_BORROW` first interest charged on borrow
        * `PERIODIC_CONVERTED` interest charged per hour converted into BNB
        * `ON_BORROW_CONVERTED` first interest charged on borrow converted into BNB
        * `PORTFOLIO` interest charged daily on the portfolio margin negative balance

        Weight: 1(IP)

                Args:
                    asset (Optional[str] = None):
                    isolated_symbol (Optional[str] = None): isolated symbol
                    start_time (Optional[int] = None): 只支持查询最近90天的数据
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Start from 1. Default:1
                    size (Optional[int] = None): Default:10 Max:100
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[GetInterestHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._borrowRepayApi.get_interest_history(
            asset, isolated_symbol, start_time, end_time, current, size, recv_window
        )

    def margin_account_borrow_repay(
        self,
        asset: Union[str, None],
        is_isolated: Union[str, None],
        symbol: Union[str, None],
        amount: Union[str, None],
        type: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[MarginAccountBorrowRepayResponse]:
        """
                Margin account borrow/repay(MARGIN)

                Margin account borrow/repay(MARGIN)

        Weight: 1500

                Args:
                    asset (Union[str, None]):
                    is_isolated (Union[str, None]): `TRUE` for Isolated Margin, `FALSE` for Cross Margin, Default `FALSE`
                    symbol (Union[str, None]):
                    amount (Union[str, None]):
                    type (Union[str, None]): `MARGIN`,`ISOLATED`
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[MarginAccountBorrowRepayResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._borrowRepayApi.margin_account_borrow_repay(
            asset, is_isolated, symbol, amount, type, recv_window
        )

    def query_borrow_repay_records_in_margin_account(
        self,
        type: Union[str, None],
        asset: Optional[str] = None,
        isolated_symbol: Optional[str] = None,
        tx_id: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        current: Optional[int] = None,
        size: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryBorrowRepayRecordsInMarginAccountResponse]:
        """
                Query borrow/repay records in Margin account(USER_DATA)

                Query borrow/repay records in Margin account

        * `txId` or `startTime` must be sent. `txId` takes precedence.
        * If an asset is sent, data within 30 days before `endTime`; If an asset is not sent, data within 7 days before `endTime`
        * If neither `startTime` nor `endTime` is sent, the recent 7-day data will be returned.
        * `startTime` set as `endTime` - 7days by default, `endTime` set as current time by default

        Weight: 10(IP)

                Args:
                    type (Union[str, None]): `MARGIN`,`ISOLATED`
                    asset (Optional[str] = None):
                    isolated_symbol (Optional[str] = None): isolated symbol
                    tx_id (Optional[int] = None): `tranId` in `POST /sapi/v1/margin/loan`
                    start_time (Optional[int] = None): 只支持查询最近90天的数据
                    end_time (Optional[int] = None):
                    current (Optional[int] = None): Currently querying page. Start from 1. Default:1
                    size (Optional[int] = None): Default:10 Max:100
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryBorrowRepayRecordsInMarginAccountResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._borrowRepayApi.query_borrow_repay_records_in_margin_account(
            type,
            asset,
            isolated_symbol,
            tx_id,
            start_time,
            end_time,
            current,
            size,
            recv_window,
        )

    def query_margin_interest_rate_history(
        self,
        asset: Union[str, None],
        vip_level: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryMarginInterestRateHistoryResponse]:
        """
                Query Margin Interest Rate History (USER_DATA)

                Query Margin Interest Rate History

        Weight: 1(IP)

                Args:
                    asset (Union[str, None]):
                    vip_level (Optional[int] = None): User's current specific margin data will be returned if vipLevel is omitted
                    start_time (Optional[int] = None): 只支持查询最近90天的数据
                    end_time (Optional[int] = None):
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryMarginInterestRateHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._borrowRepayApi.query_margin_interest_rate_history(
            asset, vip_level, start_time, end_time, recv_window
        )

    def query_max_borrow(
        self,
        asset: Union[str, None],
        isolated_symbol: Optional[str] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryMaxBorrowResponse]:
        """
                Query Max Borrow (USER_DATA)

                Query Max Borrow

        * If isolatedSymbol is not sent, crossed margin data will be sent.
        * `borrowLimit` is also available from [https://www.binance.com/en/margin-fee](https://www.binance.com/en/margin-fee)

        Weight: 50(IP)

                Args:
                    asset (Union[str, None]):
                    isolated_symbol (Optional[str] = None): isolated symbol
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryMaxBorrowResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._borrowRepayApi.query_max_borrow(
            asset, isolated_symbol, recv_window
        )

    def cross_margin_collateral_ratio(
        self,
    ) -> ApiResponse[CrossMarginCollateralRatioResponse]:
        """
                Cross margin collateral ratio (MARKET_DATA)

                Cross margin collateral ratio

        Weight: 100(IP)

                Args:

                Returns:
                    ApiResponse[CrossMarginCollateralRatioResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.cross_margin_collateral_ratio()

    def get_all_cross_margin_pairs(
        self,
        symbol: Optional[str] = None,
    ) -> ApiResponse[GetAllCrossMarginPairsResponse]:
        """
                Get All Cross Margin Pairs (MARKET_DATA)

                Get All Cross Margin Pairs

        Weight: 1(IP)

                Args:
                    symbol (Optional[str] = None): isolated margin pair

                Returns:
                    ApiResponse[GetAllCrossMarginPairsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.get_all_cross_margin_pairs(symbol)

    def get_all_isolated_margin_symbol(
        self,
        symbol: Optional[str] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetAllIsolatedMarginSymbolResponse]:
        """
                Get All Isolated Margin Symbol(MARKET_DATA)

                Get All Isolated Margin Symbol

        Weight: 10(IP)

                Args:
                    symbol (Optional[str] = None): isolated margin pair
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[GetAllIsolatedMarginSymbolResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.get_all_isolated_margin_symbol(symbol, recv_window)

    def get_all_margin_assets(
        self,
        asset: Optional[str] = None,
    ) -> ApiResponse[GetAllMarginAssetsResponse]:
        """
                Get All Margin Assets (MARKET_DATA)

                Get All Margin Assets.

        Weight: 1(IP)

                Args:
                    asset (Optional[str] = None):

                Returns:
                    ApiResponse[GetAllMarginAssetsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.get_all_margin_assets(asset)

    def get_delist_schedule(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetDelistScheduleResponse]:
        """
                Get Delist Schedule (MARKET_DATA)

                Get tokens or symbols delist schedule for cross margin and isolated margin

        Weight: 100

                Args:
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[GetDelistScheduleResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.get_delist_schedule(recv_window)

    def get_limit_price_pairs(
        self,
    ) -> ApiResponse[GetLimitPricePairsResponse]:
        """
                Get Limit Price Pairs(MARKET_DATA)

                Query trading pairs with restriction on limit price range.
        In margin trading, you can place orders with limit price. Limit price should be within (-15%, 15%) of current index price for a list of margin trading pairs. This rule only impacts limit sell orders with limit price that is lower than current index price and limit buy orders with limit price that is higher than current index price.

        - Buy order: Your order will be rejected with an error message notification if the limit price is 15% above the index price.
        - Sell order: Your order will be rejected with an error message notification if the limit price is 15% below the index price.
        Please review the limit price order placing strategy, backtest and calibrate the planned order size with the trading volume and order book depth to prevent trading loss.

        Weight: 1

                Args:

                Returns:
                    ApiResponse[GetLimitPricePairsResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.get_limit_price_pairs()

    def get_list_schedule(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetListScheduleResponse]:
        """
                Get list Schedule (MARKET_DATA)

                Get the upcoming tokens or symbols listing schedule for Cross Margin and Isolated Margin.

        Weight: 100

                Args:
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[GetListScheduleResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.get_list_schedule(recv_window)

    def query_isolated_margin_tier_data(
        self,
        symbol: Union[str, None],
        tier: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[QueryIsolatedMarginTierDataResponse]:
        """
                Query Isolated Margin Tier Data (USER_DATA)

                Get isolated margin tier data collection with any tier as https://www.binance.com/en/margin-data

        Weight: 1(IP)

                Args:
                    symbol (Union[str, None]):
                    tier (Optional[int] = None): All margin tier data will be returned if tier is omitted
                    recv_window (Optional[int] = None): No more than 60000

                Returns:
                    ApiResponse[QueryIsolatedMarginTierDataResponse]

