"""
Binance Derivatives Trading COIN Futures REST API

OpenAPI Specification for the Binance Derivatives Trading COIN Futures 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.market_data_api import MarketDataApi
from .api.portfolio_margin_endpoints_api import PortfolioMarginEndpointsApi
from .api.trade_api import TradeApi
from .api.user_data_streams_api import UserDataStreamsApi

from .models import AccountInformationResponse
from .models import FuturesAccountBalanceResponse
from .models import GetCurrentPositionModeResponse
from .models import GetDownloadIdForFuturesOrderHistoryResponse
from .models import GetDownloadIdForFuturesTradeHistoryResponse
from .models import GetDownloadIdForFuturesTransactionHistoryResponse
from .models import GetFuturesOrderHistoryDownloadLinkByIdResponse
from .models import GetFuturesTradeDownloadLinkByIdResponse
from .models import GetFuturesTransactionHistoryDownloadLinkByIdResponse
from .models import GetIncomeHistoryResponse
from .models import NotionalBracketForPairResponse
from .models import NotionalBracketForSymbolResponse
from .models import UserCommissionRateResponse
from .models import BasisResponse
from .models import CheckServerTimeResponse
from .models import CompressedAggregateTradesListResponse
from .models import ContinuousContractKlineCandlestickDataResponse
from .models import ExchangeInformationResponse
from .models import GetFundingRateHistoryOfPerpetualFuturesResponse
from .models import GetFundingRateInfoResponse
from .models import IndexPriceAndMarkPriceResponse
from .models import IndexPriceKlineCandlestickDataResponse
from .models import KlineCandlestickDataResponse
from .models import LongShortRatioResponse
from .models import MarkPriceKlineCandlestickDataResponse
from .models import OldTradesLookupResponse
from .models import OpenInterestResponse
from .models import OpenInterestStatisticsResponse
from .models import OrderBookResponse
from .models import PremiumIndexKlineDataResponse
from .models import QueryIndexPriceConstituentsResponse
from .models import RecentTradesListResponse
from .models import SymbolOrderBookTickerResponse
from .models import SymbolPriceTickerResponse
from .models import TakerBuySellVolumeResponse

from .models import Ticker24hrPriceChangeStatisticsResponse
from .models import TopTraderLongShortRatioAccountsResponse
from .models import TopTraderLongShortRatioPositionsResponse
from .models import ClassicPortfolioMarginAccountInformationResponse
from .models import AccountTradeListResponse
from .models import AllOrdersResponse

from .models import CancelAllOpenOrdersResponse
from .models import CancelMultipleOrdersResponse
from .models import CancelOrderResponse
from .models import ChangeInitialLeverageResponse
from .models import ChangeMarginTypeResponse
from .models import ChangePositionModeResponse
from .models import CurrentAllOpenOrdersResponse
from .models import GetOrderModifyHistoryResponse
from .models import GetPositionMarginChangeHistoryResponse
from .models import ModifyIsolatedPositionMarginResponse
from .models import ModifyMultipleOrdersResponse
from .models import ModifyOrderResponse
from .models import NewOrderResponse
from .models import PositionAdlQuantileEstimationResponse
from .models import PositionInformationResponse
from .models import QueryCurrentOpenOrderResponse
from .models import QueryOrderResponse
from .models import UsersForceOrdersResponse


from .models import StartUserDataStreamResponse


from .models import BasisContractTypeEnum
from .models import BasisPeriodEnum
from .models import ContinuousContractKlineCandlestickDataContractTypeEnum
from .models import ContinuousContractKlineCandlestickDataIntervalEnum
from .models import IndexPriceKlineCandlestickDataIntervalEnum
from .models import KlineCandlestickDataIntervalEnum
from .models import LongShortRatioPeriodEnum
from .models import MarkPriceKlineCandlestickDataIntervalEnum
from .models import OpenInterestStatisticsContractTypeEnum
from .models import OpenInterestStatisticsPeriodEnum
from .models import PremiumIndexKlineDataIntervalEnum
from .models import TakerBuySellVolumeContractTypeEnum
from .models import TakerBuySellVolumePeriodEnum
from .models import TopTraderLongShortRatioAccountsPeriodEnum
from .models import TopTraderLongShortRatioPositionsPeriodEnum
from .models import ChangeMarginTypeMarginTypeEnum
from .models import ModifyIsolatedPositionMarginTypeEnum
from .models import ModifyIsolatedPositionMarginPositionSideEnum
from .models import ModifyOrderSideEnum
from .models import ModifyOrderPriceMatchEnum
from .models import NewOrderSideEnum
from .models import NewOrderTypeEnum
from .models import NewOrderPositionSideEnum
from .models import NewOrderTimeInForceEnum
from .models import NewOrderWorkingTypeEnum
from .models import NewOrderNewOrderRespTypeEnum
from .models import NewOrderPriceMatchEnum
from .models import NewOrderSelfTradePreventionModeEnum
from .models import UsersForceOrdersAutoCloseTypeEnum


from .models import ModifyMultipleOrdersBatchOrdersParameterInner

T = TypeVar("T")


class DerivativesTradingCoinFuturesRestAPI:
    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._marketDataApi = MarketDataApi(
            self.configuration, self._session, self._signer
        )
        self._portfolioMarginEndpointsApi = PortfolioMarginEndpointsApi(
            self.configuration, self._session, self._signer
        )
        self._tradeApi = TradeApi(self.configuration, self._session, self._signer)
        self._userDataStreamsApi = UserDataStreamsApi(
            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 account_information(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[AccountInformationResponse]:
        """
                Account Information (USER_DATA)

                Get current account information.

        * for One-way Mode user, the "positions" will only show the "BOTH" positions
        * for Hedge Mode user, the "positions" will show "BOTH", "LONG", and "SHORT" positions.

        Weight: 5

                Args:
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[AccountInformationResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.account_information(recv_window)

    def futures_account_balance(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[FuturesAccountBalanceResponse]:
        """
                Futures Account Balance (USER_DATA)

                Check futures account balance

        Weight: 1

                Args:
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[FuturesAccountBalanceResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.futures_account_balance(recv_window)

    def get_current_position_mode(
        self,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetCurrentPositionModeResponse]:
        """
                Get Current Position Mode(USER_DATA)

                Get user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol***

        Weight: 30

                Args:
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetCurrentPositionModeResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_current_position_mode(recv_window)

    def get_download_id_for_futures_order_history(
        self,
        start_time: Union[int, None],
        end_time: Union[int, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetDownloadIdForFuturesOrderHistoryResponse]:
        """
                Get Download Id For Futures Order History (USER_DATA)

                Get Download Id For Futures Order History

        * Request Limitation is 10 times per month, shared by front end download page and rest api
        * The time between `startTime` and `endTime` can not be longer than 1 year

        Weight: 5

                Args:
                    start_time (Union[int, None]): Timestamp in ms
                    end_time (Union[int, None]): Timestamp in ms
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetDownloadIdForFuturesOrderHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_download_id_for_futures_order_history(
            start_time, end_time, recv_window
        )

    def get_download_id_for_futures_trade_history(
        self,
        start_time: Union[int, None],
        end_time: Union[int, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetDownloadIdForFuturesTradeHistoryResponse]:
        """
                Get Download Id For Futures Trade History (USER_DATA)

                Get download id for futures trade history

        * Request Limitation is 5 times per month, shared by front end download page and rest api
        * The time between `startTime` and `endTime` can not be longer than 1 year

        Weight: 5

                Args:
                    start_time (Union[int, None]): Timestamp in ms
                    end_time (Union[int, None]): Timestamp in ms
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetDownloadIdForFuturesTradeHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_download_id_for_futures_trade_history(
            start_time, end_time, recv_window
        )

    def get_download_id_for_futures_transaction_history(
        self,
        start_time: Union[int, None],
        end_time: Union[int, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetDownloadIdForFuturesTransactionHistoryResponse]:
        """
                Get Download Id For Futures Transaction History(USER_DATA)

                Get download id for futures transaction history

        * Request Limitation is 5 times per month, shared by front end download page and rest api
        * The time between `startTime` and `endTime` can not be longer than 1 year

        Weight: 5

                Args:
                    start_time (Union[int, None]): Timestamp in ms
                    end_time (Union[int, None]): Timestamp in ms
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetDownloadIdForFuturesTransactionHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_download_id_for_futures_transaction_history(
            start_time, end_time, recv_window
        )

    def get_futures_order_history_download_link_by_id(
        self,
        download_id: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFuturesOrderHistoryDownloadLinkByIdResponse]:
        """
                Get Futures Order History Download Link by Id (USER_DATA)

                Get futures order history download link by Id

        * Download link expiration: 24h

        Weight: 5

                Args:
                    download_id (Union[str, None]): get by download id api
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetFuturesOrderHistoryDownloadLinkByIdResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_futures_order_history_download_link_by_id(
            download_id, recv_window
        )

    def get_futures_trade_download_link_by_id(
        self,
        download_id: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFuturesTradeDownloadLinkByIdResponse]:
        """
                Get Futures Trade Download Link by Id(USER_DATA)

                Get futures trade download link by Id

        * Download link expiration: 24h

        Weight: 5

                Args:
                    download_id (Union[str, None]): get by download id api
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetFuturesTradeDownloadLinkByIdResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_futures_trade_download_link_by_id(
            download_id, recv_window
        )

    def get_futures_transaction_history_download_link_by_id(
        self,
        download_id: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetFuturesTransactionHistoryDownloadLinkByIdResponse]:
        """
                Get Futures Transaction History Download Link by Id (USER_DATA)

                Get futures transaction history download link by Id

        * Download link expiration: 24h

        Weight: 5

                Args:
                    download_id (Union[str, None]): get by download id api
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetFuturesTransactionHistoryDownloadLinkByIdResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_futures_transaction_history_download_link_by_id(
            download_id, recv_window
        )

    def get_income_history(
        self,
        symbol: Optional[str] = None,
        income_type: Optional[str] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        page: Optional[int] = None,
        limit: Optional[int] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[GetIncomeHistoryResponse]:
        """
                Get Income History(USER_DATA)

                Get income history

        * If `incomeType ` is not sent, all kinds of flow will be returned
        * "trandId" is unique in the same "incomeType" for a user
        * The time between `startTime` and `endTime` can not be longer than 1 year

        Weight: 20

                Args:
                    symbol (Optional[str] = None):
                    income_type (Optional[str] = None): "TRANSFER","WELCOME_BONUS", "FUNDING_FEE", "REALIZED_PNL", "COMMISSION", "INSURANCE_CLEAR", and "DELIVERED_SETTELMENT"
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    page (Optional[int] = None):
                    limit (Optional[int] = None): Default 100; max 1000
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[GetIncomeHistoryResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.get_income_history(
            symbol, income_type, start_time, end_time, page, limit, recv_window
        )

    def notional_bracket_for_pair(
        self,
        pair: Optional[str] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[NotionalBracketForPairResponse]:
        """
                Notional Bracket for Pair(USER_DATA)

                **Not recommended to continue using this v1 endpoint**

        Get the pair's default notional bracket list, may return ambiguous values when there have been multiple different `symbol` brackets under the `pair`, suggest using the following `GET /dapi/v2/leverageBracket` query instead to get the specific `symbol` notional bracket list.

        Weight: 1

                Args:
                    pair (Optional[str] = None):
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[NotionalBracketForPairResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.notional_bracket_for_pair(pair, recv_window)

    def notional_bracket_for_symbol(
        self,
        symbol: Optional[str] = None,
        recv_window: Optional[int] = None,
    ) -> ApiResponse[NotionalBracketForSymbolResponse]:
        """
                Notional Bracket for Symbol(USER_DATA)

                Get the symbol's notional bracket list.

        Weight: 1

                Args:
                    symbol (Optional[str] = None):
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[NotionalBracketForSymbolResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.notional_bracket_for_symbol(symbol, recv_window)

    def user_commission_rate(
        self,
        symbol: Union[str, None],
        recv_window: Optional[int] = None,
    ) -> ApiResponse[UserCommissionRateResponse]:
        """
                User Commission Rate (USER_DATA)

                Query user commission rate

        Weight: 20

                Args:
                    symbol (Union[str, None]):
                    recv_window (Optional[int] = None):

                Returns:
                    ApiResponse[UserCommissionRateResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._accountApi.user_commission_rate(symbol, recv_window)

    def basis(
        self,
        pair: Union[str, None],
        contract_type: Union[BasisContractTypeEnum, None],
        period: Union[BasisPeriodEnum, None],
        limit: Optional[int] = None,
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
    ) -> ApiResponse[BasisResponse]:
        """
                Basis

                Query basis

        * If startTime and endTime are not sent, the most recent data is returned.
        * Only the data of the latest 30 days is available.

        Weight: 1

                Args:
                    pair (Union[str, None]): BTCUSD
                    contract_type (Union[BasisContractTypeEnum, None]): ALL, CURRENT_QUARTER, NEXT_QUARTER, PERPETUAL
                    period (Union[BasisPeriodEnum, None]): "5m","15m","30m","1h","2h","4h","6h","12h","1d"
                    limit (Optional[int] = None): Default 100; max 1000
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):

                Returns:
                    ApiResponse[BasisResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.basis(
            pair, contract_type, period, limit, start_time, end_time
        )

    def check_server_time(
        self,
    ) -> ApiResponse[CheckServerTimeResponse]:
        """
                Check Server time

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

        Weight: 1

                Args:

                Returns:
                    ApiResponse[CheckServerTimeResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.check_server_time()

    def compressed_aggregate_trades_list(
        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[CompressedAggregateTradesListResponse]:
        """
                Compressed/Aggregate Trades List

                Get compressed, aggregate trades. Market trades that fill in 100ms with the same price and the same taking side will have the quantity aggregated.

        * support querying futures trade histories that are not older than one year
        * If both `startTime` and `endTime` are sent, time between `startTime` and `endTime` must be less than 1 hour.
        * If `fromId`, `startTime`, and `endTime` are not sent, the most recent aggregate trades will be returned.
        * Only market trades will be aggregated and returned, which means the insurance fund trades and ADL trades won't be aggregated.
        * Sending both `startTime`/`endTime` and `fromId` might cause response timeout, please send either `fromId` or `startTime`/`endTime`

        Weight: 20

                Args:
                    symbol (Union[str, None]):
                    from_id (Optional[int] = None): ID to get aggregate trades from INCLUSIVE.
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default 100; max 1000

                Returns:
                    ApiResponse[CompressedAggregateTradesListResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.compressed_aggregate_trades_list(
            symbol, from_id, start_time, end_time, limit
        )

    def continuous_contract_kline_candlestick_data(
        self,
        pair: Union[str, None],
        contract_type: Union[
            ContinuousContractKlineCandlestickDataContractTypeEnum, None
        ],
        interval: Union[ContinuousContractKlineCandlestickDataIntervalEnum, None],
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
    ) -> ApiResponse[ContinuousContractKlineCandlestickDataResponse]:
        """
                Continuous Contract Kline/Candlestick Data

                Kline/candlestick bars for a specific contract type.
        Klines are uniquely identified by their open time.

        * Contract type:
        * PERPETUAL
        * CURRENT_QUARTER
        * NEXT_QUARTER


        1000 | 10
        * The difference between `startTime` and `endTime` can only be up to 200 days
        * Between `startTime` and `endTime`, the most recent `limit` data from `endTime` will be returned:
        * If `startTime` and `endTime` are not sent, current timestamp will be set as `endTime`, and the most recent data will be returned.
        * If `startTime` is sent only, the timestamp of 200 days after `startTime` will be set as `endTime`(up to the current time)
        * If `endTime` is sent only, the timestamp of 200 days before `endTime` will be set as `startTime`

        Weight: based on parameter LIMIT
        LIMIT | weight
        ---|---
        [1,100) | 1
        [100, 500) | 2
        [500, 1000] | 5
        > 1000 | 10

                Args:
                    pair (Union[str, None]): BTCUSD
                    contract_type (Union[ContinuousContractKlineCandlestickDataContractTypeEnum, None]): ALL, CURRENT_QUARTER, NEXT_QUARTER, PERPETUAL
                    interval (Union[ContinuousContractKlineCandlestickDataIntervalEnum, None]):
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default 100; max 1000

                Returns:
                    ApiResponse[ContinuousContractKlineCandlestickDataResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.continuous_contract_kline_candlestick_data(
            pair, contract_type, interval, start_time, end_time, limit
        )

    def exchange_information(
        self,
    ) -> ApiResponse[ExchangeInformationResponse]:
        """
                Exchange Information

                Current exchange trading rules and symbol information

        Weight: 1

                Args:

                Returns:
                    ApiResponse[ExchangeInformationResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.exchange_information()

    def get_funding_rate_history_of_perpetual_futures(
        self,
        symbol: Union[str, None],
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
    ) -> ApiResponse[GetFundingRateHistoryOfPerpetualFuturesResponse]:
        """
                Get Funding Rate History of Perpetual Futures

                Get Funding Rate History of Perpetual Futures

        * empty array will be returned for delivery symbols.

        Weight: 1

                Args:
                    symbol (Union[str, None]):
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default 100; max 1000

                Returns:
                    ApiResponse[GetFundingRateHistoryOfPerpetualFuturesResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.get_funding_rate_history_of_perpetual_futures(
            symbol, start_time, end_time, limit
        )

    def get_funding_rate_info(
        self,
    ) -> ApiResponse[GetFundingRateInfoResponse]:
        """
                Get Funding Rate Info

                Query funding rate info for symbols that had FundingRateCap/ FundingRateFloor / fundingIntervalHours adjustment

        Weight: 0

                Args:

                Returns:
                    ApiResponse[GetFundingRateInfoResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.get_funding_rate_info()

    def index_price_and_mark_price(
        self,
        symbol: Optional[str] = None,
        pair: Optional[str] = None,
    ) -> ApiResponse[IndexPriceAndMarkPriceResponse]:
        """
                Index Price and Mark Price

                Query index price and mark price

        Weight: 10

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

                Returns:
                    ApiResponse[IndexPriceAndMarkPriceResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.index_price_and_mark_price(symbol, pair)

    def index_price_kline_candlestick_data(
        self,
        pair: Union[str, None],
        interval: Union[IndexPriceKlineCandlestickDataIntervalEnum, None],
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
    ) -> ApiResponse[IndexPriceKlineCandlestickDataResponse]:
        """
                Index Price Kline/Candlestick Data

                Kline/candlestick bars for the index price of a pair. Klines are uniquely identified by their open time.


        1000 | 10
        * The difference between `startTime` and `endTime` can only be up to 200 days
        * Between `startTime` and `endTime`, the most recent `limit` data from `endTime` will be returned:
        * If `startTime` and `endTime` are not sent, current timestamp will be set as `endTime`, and the most recent data will be returned.
        * If `startTime` is sent only, the timestamp of 200 days after `startTime` will be set as `endTime`(up to the current time)
        * If `endTime` is sent only, the timestamp of 200 days before `endTime` will be set as `startTime`

        Weight: based on parameter LIMIT
        LIMIT | weight
        ---|---
        [1,100) | 1
        [100, 500) | 2
        [500, 1000] | 5
        > 1000 | 10

                Args:
                    pair (Union[str, None]): BTCUSD
                    interval (Union[IndexPriceKlineCandlestickDataIntervalEnum, None]):
                    start_time (Optional[int] = None):
                    end_time (Optional[int] = None):
                    limit (Optional[int] = None): Default 100; max 1000

                Returns:
                    ApiResponse[IndexPriceKlineCandlestickDataResponse]

                Raises:
                    RequiredError: If a required parameter is missing.

        """

        return self._marketDataApi.index_price_kline_candlestick_data(
            pair, interval, start_time, end_time, limit
        )

    def kline_candlestick_data(
        self,
        symbol: Union[str, None],
        interval: Union[KlineCandlestickDataIntervalEnum, None],
        start_time: Optional[int] = None,
        end_time: Optional[int] = None,
        limit: Optional[int] = None,
    ) -> ApiResponse[KlineCandlestickDataResponse]:
        """
                Kline/Candlestick Data

                Kline/candlestick bars for a symbol.
        Klines are uniquely identified by their open time.

        1000 | 10
        * The difference between `startTime` and `endTime` can only be up to 200 days
        * Between `startTime` and `endTime`, the most recent `limit` data from `endTime` will be returned:
        * If `startTime` and `endTime` are not sent, current timestamp will be set as `endTime`, and the most recent data will be returned.
