UNPKG

@binance/derivatives-trading-usds-futures

Version:

Official Binance Derivatives Trading (COIN-M Futures) Connector - A lightweight library that provides a convenient interface to Binance's COINN-M Futures REST API, WebSocket API and WebSocket Streams.

1,262 lines (1,256 loc) 436 kB
var __defProp = Object.defineProperty; var __export = (target, all) => { for (var name2 in all) __defProp(target, name2, { get: all[name2], enumerable: true }); }; // src/derivatives-trading-usds-futures.ts import { buildUserAgent, ConfigurationRestAPI as ConfigurationRestAPI8, ConfigurationWebsocketAPI as ConfigurationWebsocketAPI2, ConfigurationWebsocketStreams as ConfigurationWebsocketStreams2, DERIVATIVES_TRADING_USDS_FUTURES_REST_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_API_PROD_URL, DERIVATIVES_TRADING_USDS_FUTURES_WS_STREAMS_PROD_URL } from "@binance/common"; // package.json var name = "@binance/derivatives-trading-usds-futures"; var version = "10.0.2"; // src/rest-api/index.ts var rest_api_exports = {}; __export(rest_api_exports, { AccountApi: () => AccountApi, BasisContractTypeEnum: () => BasisContractTypeEnum, BasisPeriodEnum: () => BasisPeriodEnum, ChangeMarginTypeMarginTypeEnum: () => ChangeMarginTypeMarginTypeEnum, ContinuousContractKlineCandlestickDataContractTypeEnum: () => ContinuousContractKlineCandlestickDataContractTypeEnum, ContinuousContractKlineCandlestickDataIntervalEnum: () => ContinuousContractKlineCandlestickDataIntervalEnum, ConvertApi: () => ConvertApi, IndexPriceKlineCandlestickDataIntervalEnum: () => IndexPriceKlineCandlestickDataIntervalEnum, KlineCandlestickDataIntervalEnum: () => KlineCandlestickDataIntervalEnum, LongShortRatioPeriodEnum: () => LongShortRatioPeriodEnum, MarkPriceKlineCandlestickDataIntervalEnum: () => MarkPriceKlineCandlestickDataIntervalEnum, MarketDataApi: () => MarketDataApi, ModifyIsolatedPositionMarginPositionSideEnum: () => ModifyIsolatedPositionMarginPositionSideEnum, ModifyMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum: () => ModifyMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum, ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum: () => ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum, ModifyOrderPriceMatchEnum: () => ModifyOrderPriceMatchEnum, ModifyOrderSideEnum: () => ModifyOrderSideEnum, NewOrderNewOrderRespTypeEnum: () => NewOrderNewOrderRespTypeEnum, NewOrderPositionSideEnum: () => NewOrderPositionSideEnum, NewOrderPriceMatchEnum: () => NewOrderPriceMatchEnum, NewOrderSelfTradePreventionModeEnum: () => NewOrderSelfTradePreventionModeEnum, NewOrderSideEnum: () => NewOrderSideEnum, NewOrderTimeInForceEnum: () => NewOrderTimeInForceEnum, NewOrderWorkingTypeEnum: () => NewOrderWorkingTypeEnum, OpenInterestStatisticsPeriodEnum: () => OpenInterestStatisticsPeriodEnum, PlaceMultipleOrdersBatchOrdersParameterInnerNewOrderRespTypeEnum: () => PlaceMultipleOrdersBatchOrdersParameterInnerNewOrderRespTypeEnum, PlaceMultipleOrdersBatchOrdersParameterInnerPositionSideEnum: () => PlaceMultipleOrdersBatchOrdersParameterInnerPositionSideEnum, PlaceMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum: () => PlaceMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum, PlaceMultipleOrdersBatchOrdersParameterInnerSelfTradePreventionModeEnum: () => PlaceMultipleOrdersBatchOrdersParameterInnerSelfTradePreventionModeEnum, PlaceMultipleOrdersBatchOrdersParameterInnerSideEnum: () => PlaceMultipleOrdersBatchOrdersParameterInnerSideEnum, PlaceMultipleOrdersBatchOrdersParameterInnerTimeInForceEnum: () => PlaceMultipleOrdersBatchOrdersParameterInnerTimeInForceEnum, PlaceMultipleOrdersBatchOrdersParameterInnerWorkingTypeEnum: () => PlaceMultipleOrdersBatchOrdersParameterInnerWorkingTypeEnum, PortfolioMarginEndpointsApi: () => PortfolioMarginEndpointsApi, PremiumIndexKlineDataIntervalEnum: () => PremiumIndexKlineDataIntervalEnum, RestAPI: () => RestAPI, TakerBuySellVolumePeriodEnum: () => TakerBuySellVolumePeriodEnum, TestOrderNewOrderRespTypeEnum: () => TestOrderNewOrderRespTypeEnum, TestOrderPositionSideEnum: () => TestOrderPositionSideEnum, TestOrderPriceMatchEnum: () => TestOrderPriceMatchEnum, TestOrderSelfTradePreventionModeEnum: () => TestOrderSelfTradePreventionModeEnum, TestOrderSideEnum: () => TestOrderSideEnum, TestOrderTimeInForceEnum: () => TestOrderTimeInForceEnum, TestOrderWorkingTypeEnum: () => TestOrderWorkingTypeEnum, TopTraderLongShortRatioAccountsPeriodEnum: () => TopTraderLongShortRatioAccountsPeriodEnum, TopTraderLongShortRatioPositionsPeriodEnum: () => TopTraderLongShortRatioPositionsPeriodEnum, TradeApi: () => TradeApi, UserDataStreamsApi: () => UserDataStreamsApi, UsersForceOrdersAutoCloseTypeEnum: () => UsersForceOrdersAutoCloseTypeEnum }); // src/rest-api/types/modify-multiple-orders-batch-orders-parameter-inner.ts var ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum = { BUY: "BUY", SELL: "SELL" }; var ModifyMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum = { NONE: "NONE", OPPONENT: "OPPONENT", OPPONENT_5: "OPPONENT_5", OPPONENT_10: "OPPONENT_10", OPPONENT_20: "OPPONENT_20", QUEUE: "QUEUE", QUEUE_5: "QUEUE_5", QUEUE_10: "QUEUE_10", QUEUE_20: "QUEUE_20" }; // src/rest-api/types/place-multiple-orders-batch-orders-parameter-inner.ts var PlaceMultipleOrdersBatchOrdersParameterInnerSideEnum = { BUY: "BUY", SELL: "SELL" }; var PlaceMultipleOrdersBatchOrdersParameterInnerPositionSideEnum = { BOTH: "BOTH", LONG: "LONG", SHORT: "SHORT" }; var PlaceMultipleOrdersBatchOrdersParameterInnerTimeInForceEnum = { GTC: "GTC", IOC: "IOC", FOK: "FOK", GTX: "GTX", GTD: "GTD" }; var PlaceMultipleOrdersBatchOrdersParameterInnerWorkingTypeEnum = { MARK_PRICE: "MARK_PRICE", CONTRACT_PRICE: "CONTRACT_PRICE" }; var PlaceMultipleOrdersBatchOrdersParameterInnerNewOrderRespTypeEnum = { ACK: "ACK", RESULT: "RESULT" }; var PlaceMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum = { NONE: "NONE", OPPONENT: "OPPONENT", OPPONENT_5: "OPPONENT_5", OPPONENT_10: "OPPONENT_10", OPPONENT_20: "OPPONENT_20", QUEUE: "QUEUE", QUEUE_5: "QUEUE_5", QUEUE_10: "QUEUE_10", QUEUE_20: "QUEUE_20" }; var PlaceMultipleOrdersBatchOrdersParameterInnerSelfTradePreventionModeEnum = { EXPIRE_TAKER: "EXPIRE_TAKER", EXPIRE_BOTH: "EXPIRE_BOTH", EXPIRE_MAKER: "EXPIRE_MAKER" }; // src/rest-api/modules/account-api.ts import { assertParamExists, sendRequest } from "@binance/common"; var AccountApiAxiosParamCreator = function(configuration) { return { /** * Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. * * Weight: 5 * * @summary Account Information V2(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ accountInformationV2: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v2/account", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. * * Weight: 5 * * @summary Account Information V3(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ accountInformationV3: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v3/account", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Query account balance info * * Weight: 5 * * @summary Futures Account Balance V2 (USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ futuresAccountBalanceV2: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v2/balance", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Query account balance info * * Weight: 5 * * @summary Futures Account Balance V3 (USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ futuresAccountBalanceV3: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v3/balance", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Query account configuration * * Weight: 5 * * @summary Futures Account Configuration(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ futuresAccountConfiguration: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/accountConfig", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Futures trading quantitative rules indicators, for more information on this, please refer to the [Futures Trading Quantitative Rules](https://www.binance.com/en/support/faq/4f462ebe6ff445d4a170be7d9e897272) * * Weight: - 1 for a single symbol * - 10 when the symbol parameter is omitted * * @summary Futures Trading Quantitative Rules Indicators (USER_DATA) * @param {string} [symbol] * @param {number} [recvWindow] * * @throws {RequiredError} */ futuresTradingQuantitativeRulesIndicators: async (symbol, recvWindow) => { const localVarQueryParameter = {}; if (symbol !== void 0 && symbol !== null) { localVarQueryParameter["symbol"] = symbol; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/apiTradingStatus", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get user's BNB Fee Discount (Fee Discount On or Fee Discount Off ) * * Weight: 30 * * @summary Get BNB Burn Status (USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ getBnbBurnStatus: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/feeBurn", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on ***Every symbol*** * * Weight: 30 * * @summary Get Current Multi-Assets Mode (USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ getCurrentMultiAssetsMode: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/multiAssetsMargin", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol*** * * Weight: 30 * * @summary Get Current Position Mode(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ getCurrentPositionMode: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/positionSide/dual", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * 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: 1000 * * @summary Get Download Id For Futures Order History (USER_DATA) * @param {number} startTime Timestamp in ms * @param {number} endTime Timestamp in ms * @param {number} [recvWindow] * * @throws {RequiredError} */ getDownloadIdForFuturesOrderHistory: async (startTime, endTime, recvWindow) => { assertParamExists("getDownloadIdForFuturesOrderHistory", "startTime", startTime); assertParamExists("getDownloadIdForFuturesOrderHistory", "endTime", endTime); const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/order/asyn", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * 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: 1000 * * @summary Get Download Id For Futures Trade History (USER_DATA) * @param {number} startTime Timestamp in ms * @param {number} endTime Timestamp in ms * @param {number} [recvWindow] * * @throws {RequiredError} */ getDownloadIdForFuturesTradeHistory: async (startTime, endTime, recvWindow) => { assertParamExists("getDownloadIdForFuturesTradeHistory", "startTime", startTime); assertParamExists("getDownloadIdForFuturesTradeHistory", "endTime", endTime); const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/trade/asyn", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * 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: 1000 * * @summary Get Download Id For Futures Transaction History(USER_DATA) * @param {number} startTime Timestamp in ms * @param {number} endTime Timestamp in ms * @param {number} [recvWindow] * * @throws {RequiredError} */ getDownloadIdForFuturesTransactionHistory: async (startTime, endTime, recvWindow) => { assertParamExists("getDownloadIdForFuturesTransactionHistory", "startTime", startTime); assertParamExists("getDownloadIdForFuturesTransactionHistory", "endTime", endTime); const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/income/asyn", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get futures order history download link by Id * * Download link expiration: 24h * * Weight: 10 * * @summary Get Futures Order History Download Link by Id (USER_DATA) * @param {string} downloadId get by download id api * @param {number} [recvWindow] * * @throws {RequiredError} */ getFuturesOrderHistoryDownloadLinkById: async (downloadId, recvWindow) => { assertParamExists("getFuturesOrderHistoryDownloadLinkById", "downloadId", downloadId); const localVarQueryParameter = {}; if (downloadId !== void 0 && downloadId !== null) { localVarQueryParameter["downloadId"] = downloadId; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/order/asyn/id", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get futures trade download link by Id * * Download link expiration: 24h * * Weight: 10 * * @summary Get Futures Trade Download Link by Id(USER_DATA) * @param {string} downloadId get by download id api * @param {number} [recvWindow] * * @throws {RequiredError} */ getFuturesTradeDownloadLinkById: async (downloadId, recvWindow) => { assertParamExists("getFuturesTradeDownloadLinkById", "downloadId", downloadId); const localVarQueryParameter = {}; if (downloadId !== void 0 && downloadId !== null) { localVarQueryParameter["downloadId"] = downloadId; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/trade/asyn/id", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get futures transaction history download link by Id * * Download link expiration: 24h * * Weight: 10 * * @summary Get Futures Transaction History Download Link by Id (USER_DATA) * @param {string} downloadId get by download id api * @param {number} [recvWindow] * * @throws {RequiredError} */ getFuturesTransactionHistoryDownloadLinkById: async (downloadId, recvWindow) => { assertParamExists( "getFuturesTransactionHistoryDownloadLinkById", "downloadId", downloadId ); const localVarQueryParameter = {}; if (downloadId !== void 0 && downloadId !== null) { localVarQueryParameter["downloadId"] = downloadId; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/income/asyn/id", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Query income history * * If neither `startTime` nor `endTime` is sent, the recent 7-day data will be returned. * If `incomeType ` is not sent, all kinds of flow will be returned * "trandId" is unique in the same incomeType for a user * Income history only contains data for the last three months * * Weight: 30 * * @summary Get Income History (USER_DATA) * @param {string} [symbol] * @param {string} [incomeType] TRANSFER, WELCOME_BONUS, REALIZED_PNL, FUNDING_FEE, COMMISSION, INSURANCE_CLEAR, REFERRAL_KICKBACK, COMMISSION_REBATE, API_REBATE, CONTEST_REWARD, CROSS_COLLATERAL_TRANSFER, OPTIONS_PREMIUM_FEE, OPTIONS_SETTLE_PROFIT, INTERNAL_TRANSFER, AUTO_EXCHANGE, DELIVERED_SETTELMENT, COIN_SWAP_DEPOSIT, COIN_SWAP_WITHDRAW, POSITION_LIMIT_INCREASE_FEE, STRATEGY_UMFUTURES_TRANSFER,FEE_RETURN,BFUSD_REWARD * @param {number} [startTime] * @param {number} [endTime] * @param {number} [page] * @param {number} [limit] Default 100; max 1000 * @param {number} [recvWindow] * * @throws {RequiredError} */ getIncomeHistory: async (symbol, incomeType, startTime, endTime, page, limit, recvWindow) => { const localVarQueryParameter = {}; if (symbol !== void 0 && symbol !== null) { localVarQueryParameter["symbol"] = symbol; } if (incomeType !== void 0 && incomeType !== null) { localVarQueryParameter["incomeType"] = incomeType; } if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (page !== void 0 && page !== null) { localVarQueryParameter["page"] = page; } if (limit !== void 0 && limit !== null) { localVarQueryParameter["limit"] = limit; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/income", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Query user notional and leverage bracket on speicfic symbol * * Weight: 1 * * @summary Notional and Leverage Brackets (USER_DATA) * @param {string} [symbol] * @param {number} [recvWindow] * * @throws {RequiredError} */ notionalAndLeverageBrackets: async (symbol, recvWindow) => { const localVarQueryParameter = {}; if (symbol !== void 0 && symbol !== null) { localVarQueryParameter["symbol"] = symbol; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/leverageBracket", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Query User Rate Limit * * Weight: 1 * * @summary Query User Rate Limit (USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ queryUserRateLimit: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/rateLimit/order", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get current account symbol configuration. * * Weight: 5 * * @summary Symbol Configuration(USER_DATA) * @param {string} [symbol] * @param {number} [recvWindow] * * @throws {RequiredError} */ symbolConfiguration: async (symbol, recvWindow) => { const localVarQueryParameter = {}; if (symbol !== void 0 && symbol !== null) { localVarQueryParameter["symbol"] = symbol; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/symbolConfig", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Change user's BNB Fee Discount (Fee Discount On or Fee Discount Off ) on ***EVERY symbol*** * * Weight: 1 * * @summary Toggle BNB Burn On Futures Trade (TRADE) * @param {string} feeBurn "true": Fee Discount On; "false": Fee Discount Off * @param {number} [recvWindow] * * @throws {RequiredError} */ toggleBnbBurnOnFuturesTrade: async (feeBurn, recvWindow) => { assertParamExists("toggleBnbBurnOnFuturesTrade", "feeBurn", feeBurn); const localVarQueryParameter = {}; if (feeBurn !== void 0 && feeBurn !== null) { localVarQueryParameter["feeBurn"] = feeBurn; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/feeBurn", method: "POST", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get User Commission Rate * * Weight: 20 * * @summary User Commission Rate (USER_DATA) * @param {string} symbol * @param {number} [recvWindow] * * @throws {RequiredError} */ userCommissionRate: async (symbol, recvWindow) => { assertParamExists("userCommissionRate", "symbol", symbol); const localVarQueryParameter = {}; if (symbol !== void 0 && symbol !== null) { localVarQueryParameter["symbol"] = symbol; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/fapi/v1/commissionRate", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; } }; }; var AccountApi = class { constructor(configuration) { this.configuration = configuration; this.localVarAxiosParamCreator = AccountApiAxiosParamCreator(configuration); } /** * Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. * * Weight: 5 * * @summary Account Information V2(USER_DATA) * @param {AccountInformationV2Request} requestParameters Request parameters. * @returns {Promise<RestApiResponse<AccountInformationV2Response>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V2 Binance API Documentation} */ async accountInformationV2(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountInformationV2( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get current account information. User in single-asset/ multi-assets mode will see different value, see comments in response section for detail. * * Weight: 5 * * @summary Account Information V3(USER_DATA) * @param {AccountInformationV3Request} requestParameters Request parameters. * @returns {Promise<RestApiResponse<AccountInformationV3Response>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Information-V3 Binance API Documentation} */ async accountInformationV3(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountInformationV3( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Query account balance info * * Weight: 5 * * @summary Futures Account Balance V2 (USER_DATA) * @param {FuturesAccountBalanceV2Request} requestParameters Request parameters. * @returns {Promise<RestApiResponse<FuturesAccountBalanceV2Response>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Futures-Account-Balance-V2 Binance API Documentation} */ async futuresAccountBalanceV2(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.futuresAccountBalanceV2( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Query account balance info * * Weight: 5 * * @summary Futures Account Balance V3 (USER_DATA) * @param {FuturesAccountBalanceV3Request} requestParameters Request parameters. * @returns {Promise<RestApiResponse<FuturesAccountBalanceV3Response>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Futures-Account-Balance-V3 Binance API Documentation} */ async futuresAccountBalanceV3(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.futuresAccountBalanceV3( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Query account configuration * * Weight: 5 * * @summary Futures Account Configuration(USER_DATA) * @param {FuturesAccountConfigurationRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<FuturesAccountConfigurationResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Account-Config Binance API Documentation} */ async futuresAccountConfiguration(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.futuresAccountConfiguration( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Futures trading quantitative rules indicators, for more information on this, please refer to the [Futures Trading Quantitative Rules](https://www.binance.com/en/support/faq/4f462ebe6ff445d4a170be7d9e897272) * * Weight: - 1 for a single symbol * - 10 when the symbol parameter is omitted * * @summary Futures Trading Quantitative Rules Indicators (USER_DATA) * @param {FuturesTradingQuantitativeRulesIndicatorsRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<FuturesTradingQuantitativeRulesIndicatorsResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Futures-Trading-Quantitative-Rules-Indicators Binance API Documentation} */ async futuresTradingQuantitativeRulesIndicators(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.futuresTradingQuantitativeRulesIndicators( requestParameters?.symbol, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get user's BNB Fee Discount (Fee Discount On or Fee Discount Off ) * * Weight: 30 * * @summary Get BNB Burn Status (USER_DATA) * @param {GetBnbBurnStatusRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetBnbBurnStatusResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-BNB-Burn-Status Binance API Documentation} */ async getBnbBurnStatus(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getBnbBurnStatus( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get user's Multi-Assets mode (Multi-Assets Mode or Single-Asset Mode) on ***Every symbol*** * * Weight: 30 * * @summary Get Current Multi-Assets Mode (USER_DATA) * @param {GetCurrentMultiAssetsModeRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetCurrentMultiAssetsModeResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Current-Multi-Assets-Mode Binance API Documentation} */ async getCurrentMultiAssetsMode(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getCurrentMultiAssetsMode( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol*** * * Weight: 30 * * @summary Get Current Position Mode(USER_DATA) * @param {GetCurrentPositionModeRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetCurrentPositionModeResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Current-Position-Mode Binance API Documentation} */ async getCurrentPositionMode(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getCurrentPositionMode( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * 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: 1000 * * @summary Get Download Id For Futures Order History (USER_DATA) * @param {GetDownloadIdForFuturesOrderHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetDownloadIdForFuturesOrderHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Download-Id-For-Futures-Order-History Binance API Documentation} */ async getDownloadIdForFuturesOrderHistory(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getDownloadIdForFuturesOrderHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * 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: 1000 * * @summary Get Download Id For Futures Trade History (USER_DATA) * @param {GetDownloadIdForFuturesTradeHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetDownloadIdForFuturesTradeHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Download-Id-For-Futures-Trade-History Binance API Documentation} */ async getDownloadIdForFuturesTradeHistory(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getDownloadIdForFuturesTradeHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * 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: 1000 * * @summary Get Download Id For Futures Transaction History(USER_DATA) * @param {GetDownloadIdForFuturesTransactionHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetDownloadIdForFuturesTransactionHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Download-Id-For-Futures-Transaction-History Binance API Documentation} */ async getDownloadIdForFuturesTransactionHistory(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getDownloadIdForFuturesTransactionHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get futures order history download link by Id * * Download link expiration: 24h * * Weight: 10 * * @summary Get Futures Order History Download Link by Id (USER_DATA) * @param {GetFuturesOrderHistoryDownloadLinkByIdRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetFuturesOrderHistoryDownloadLinkByIdResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Futures-Order-History-Download-Link-by-Id Binance API Documentation} */ async getFuturesOrderHistoryDownloadLinkById(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFuturesOrderHistoryDownloadLinkById( requestParameters?.downloadId, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get futures trade download link by Id * * Download link expiration: 24h * * Weight: 10 * * @summary Get Futures Trade Download Link by Id(USER_DATA) * @param {GetFuturesTradeDownloadLinkByIdRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetFuturesTradeDownloadLinkByIdResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Futures-Trade-Download-Link-by-Id Binance API Documentation} */ async getFuturesTradeDownloadLinkById(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFuturesTradeDownloadLinkById( requestParameters?.downloadId, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get futures transaction history download link by Id * * Download link expiration: 24h * * Weight: 10 * * @summary Get Futures Transaction History Download Link by Id (USER_DATA) * @param {GetFuturesTransactionHistoryDownloadLinkByIdRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetFuturesTransactionHistoryDownloadLinkByIdResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Futures-Transaction-History-Download-Link-by-Id Binance API Documentation} */ async getFuturesTransactionHistoryDownloadLinkById(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getFuturesTransactionHistoryDownloadLinkById( requestParameters?.downloadId, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Query income history * * If neither `startTime` nor `endTime` is sent, the recent 7-day data will be returned. * If `incomeType ` is not sent, all kinds of flow will be returned * "trandId" is unique in the same incomeType for a user * Income history only contains data for the last three months * * Weight: 30 * * @summary Get Income History (USER_DATA) * @param {GetIncomeHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetIncomeHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-Income-History Binance API Documentation} */ async getIncomeHistory(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getIncomeHistory( requestParameters?.symbol, requestParameters?.incomeType, requestParameters?.startTime, requestParameters?.endTime, requestParameters?.page, requestParameters?.limit, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Query user notional and leverage bracket on speicfic symbol * * Weight: 1 * * @summary Notional and Leverage Brackets (USER_DATA) * @param {NotionalAndLeverageBracketsRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<NotionalAndLeverageBracketsResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Notional-and-Leverage-Brackets Binance API Documentation} */ async notionalAndLeverageBrackets(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.notionalAndLeverageBrackets( requestParameters?.symbol, requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Query User Rate Limit * * Weight: 1 * * @summary Query User Rate Limit (USER_DATA) * @param {QueryUserRateLimitRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<QueryUserRateLimitResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof AccountApi * @see {@link https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Query-Rate-Limit Binance API Documentation} */ async queryUserRateLimit(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryUserRateLimit( requestParameters?.recvWindow ); return sendRequest( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get current account symbol configuration. * * Weight: 5 * * @summary Symbol Configuration(USER_DATA) * @param {SymbolConfigurationRequest} requestParameters Request