UNPKG

@binance/derivatives-trading-coin-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 lines 695 kB
{"version":3,"sources":["../src/derivatives-trading-coin-futures.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/types/modify-multiple-orders-batch-orders-parameter-inner.ts","../src/rest-api/modules/account-api.ts","../src/rest-api/modules/market-data-api.ts","../src/rest-api/modules/portfolio-margin-endpoints-api.ts","../src/rest-api/modules/trade-api.ts","../src/rest-api/modules/user-data-streams-api.ts","../src/rest-api/rest-api.ts","../src/websocket-api/index.ts","../src/websocket-api/modules/account-api.ts","../src/websocket-api/modules/trade-api.ts","../src/websocket-api/modules/user-data-streams-api.ts","../src/websocket-api/websocket-api.ts","../src/websocket-api/websocket-api-connection.ts","../src/websocket-streams/index.ts","../src/websocket-streams/modules/websocket-market-streams-api.ts","../src/websocket-streams/websocket-streams.ts","../src/websocket-streams/websocket-streams-connection.ts","../src/index.ts"],"sourcesContent":["import {\n buildUserAgent,\n ConfigurationRestAPI,\n ConfigurationWebsocketAPI,\n ConfigurationWebsocketStreams,\n DERIVATIVES_TRADING_COIN_FUTURES_REST_API_PROD_URL,\n DERIVATIVES_TRADING_COIN_FUTURES_WS_API_PROD_URL,\n DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_PROD_URL,\n} from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\nimport { WebsocketAPI } from './websocket-api';\nimport { WebsocketStreams } from './websocket-streams';\n\nexport interface ConfigurationDerivativesTradingCoinFutures {\n configurationRestAPI?: ConfigurationRestAPI;\n configurationWebsocketAPI?: ConfigurationWebsocketAPI;\n configurationWebsocketStreams?: ConfigurationWebsocketStreams;\n}\n\nexport class DerivativesTradingCoinFutures {\n public restAPI!: RestAPI;\n public websocketAPI!: WebsocketAPI;\n public websocketStreams!: WebsocketStreams;\n\n constructor(config: ConfigurationDerivativesTradingCoinFutures) {\n const userAgent = buildUserAgent(name, version);\n\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(\n config.configurationRestAPI\n ) as ConfigurationRestAPI & {\n baseOptions: Record<string, unknown>;\n };\n configRestAPI.basePath =\n configRestAPI.basePath || DERIVATIVES_TRADING_COIN_FUTURES_REST_API_PROD_URL;\n configRestAPI.baseOptions = configRestAPI.baseOptions || {};\n configRestAPI.baseOptions.headers = {\n ...(configRestAPI.baseOptions.headers || {}),\n 'User-Agent': userAgent,\n };\n this.restAPI = new RestAPI(configRestAPI);\n }\n if (config?.configurationWebsocketAPI) {\n const configWebsocketAPI = new ConfigurationWebsocketAPI(\n config.configurationWebsocketAPI\n ) as ConfigurationWebsocketAPI & {\n userAgent: string;\n };\n configWebsocketAPI.wsURL =\n configWebsocketAPI.wsURL || DERIVATIVES_TRADING_COIN_FUTURES_WS_API_PROD_URL;\n configWebsocketAPI.userAgent = userAgent;\n this.websocketAPI = new WebsocketAPI(configWebsocketAPI);\n }\n if (config?.configurationWebsocketStreams) {\n const configWebsocketStreams = new ConfigurationWebsocketStreams(\n config.configurationWebsocketStreams\n ) as ConfigurationWebsocketStreams & {\n userAgent: string;\n };\n configWebsocketStreams.wsURL =\n configWebsocketStreams.wsURL ||\n DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_PROD_URL;\n configWebsocketStreams.userAgent = userAgent;\n this.websocketStreams = new WebsocketStreams(configWebsocketStreams);\n }\n }\n}\n","{\n \"name\": \"@binance/derivatives-trading-coin-futures\",\n \"description\": \"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.\",\n \"version\": \"6.0.3\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"require\": \"./dist/index.js\",\n \"import\": \"./dist/index.mjs\"\n }\n },\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"npm run clean && tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"clean\": \"rm -rf dist\",\n \"test\": \"npx jest --maxWorkers=4 --bail\",\n \"test:watch\": \"npx jest --watch\",\n \"format\": \"npx prettier --ignore-path .prettierignore --write .\",\n \"lint\": \"npx eslint '**/*.ts' --fix\"\n },\n \"keywords\": [\n \"Binance\",\n \"API\",\n \"Derivatives\",\n \"Futures\",\n \"Coin-M\",\n \"Connector\",\n \"REST\",\n \"WebSocket\",\n \"Trading\"\n ],\n \"author\": \"Binance\",\n \"license\": \"MIT\",\n \"files\": [\n \"dist\"\n ],\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/node\": \"^20.17.24\",\n \"eslint\": \"8.57.0\",\n \"jest\": \"^29.6.4\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsup\": \"^8.4.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"1.2.3\",\n \"@types/ws\": \"^8.5.5\",\n \"axios\": \"^1.7.4\",\n \"ws\": \"^8.17.1\"\n }\n}\n","/**\n * Binance Derivatives Trading COIN Futures REST API\n *\n * OpenAPI Specification for the Binance Derivatives Trading COIN Futures REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nexport * from './types';\nexport * from './modules';\nexport * from './rest-api';\n","/* tslint:disable */\n\n/**\n * Binance Derivatives Trading COIN Futures REST API\n *\n * OpenAPI Specification for the Binance Derivatives Trading COIN Futures REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n/**\n *\n * @export\n * @interface ModifyMultipleOrdersBatchOrdersParameterInner\n */\nexport interface ModifyMultipleOrdersBatchOrdersParameterInner {\n /**\n *\n * @type {number}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n orderId?: number;\n /**\n *\n * @type {string}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n origClientOrderId?: string;\n /**\n *\n * @type {string}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n symbol?: string;\n /**\n *\n * @type {string}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n side?: ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum;\n /**\n *\n * @type {number}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n quantity?: number;\n /**\n *\n * @type {number}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n price?: number;\n /**\n *\n * @type {number}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n recvWindow?: number;\n}\n\nexport const ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum = {\n BUY: 'BUY',\n SELL: 'SELL',\n} as const;\n\nexport type ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum =\n (typeof ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum)[keyof typeof ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum];\n","/**\n * Binance Derivatives Trading COIN Futures REST API\n *\n * OpenAPI Specification for the Binance Derivatives Trading COIN Futures REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport {\n ConfigurationRestAPI,\n TimeUnit,\n RestApiResponse,\n assertParamExists,\n sendRequest,\n type RequestArgs,\n} from '@binance/common';\nimport type {\n AccountInformationResponse,\n FuturesAccountBalanceResponse,\n GetCurrentPositionModeResponse,\n GetDownloadIdForFuturesOrderHistoryResponse,\n GetDownloadIdForFuturesTradeHistoryResponse,\n GetDownloadIdForFuturesTransactionHistoryResponse,\n GetFuturesOrderHistoryDownloadLinkByIdResponse,\n GetFuturesTradeDownloadLinkByIdResponse,\n GetFuturesTransactionHistoryDownloadLinkByIdResponse,\n GetIncomeHistoryResponse,\n NotionalBracketForPairResponse,\n NotionalBracketForSymbolResponse,\n UserCommissionRateResponse,\n} from '../types';\n\n/**\n * AccountApi - axios parameter creator\n */\nconst AccountApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Get current account information.\n *\n * for One-way Mode user, the \"positions\" will only show the \"BOTH\" positions\n * for Hedge Mode user, the \"positions\" will show \"BOTH\", \"LONG\", and \"SHORT\" positions.\n *\n * Weight: 5\n *\n * @summary Account Information (USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n accountInformation: async (recvWindow?: number): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/account',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Check futures account balance\n *\n * Weight: 1\n *\n * @summary Futures Account Balance (USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n futuresAccountBalance: async (recvWindow?: number): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/balance',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol***\n *\n * Weight: 30\n *\n * @summary Get Current Position Mode(USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getCurrentPositionMode: async (recvWindow?: number): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/positionSide/dual',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get Download Id For Futures Order History\n *\n * Request Limitation is 10 times per month, shared by front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Futures Order History (USER_DATA)\n * @param {number} startTime Timestamp in ms\n * @param {number} endTime Timestamp in ms\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForFuturesOrderHistory: async (\n startTime: number,\n endTime: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'startTime' is not null or undefined\n assertParamExists('getDownloadIdForFuturesOrderHistory', 'startTime', startTime);\n // verify required parameter 'endTime' is not null or undefined\n assertParamExists('getDownloadIdForFuturesOrderHistory', 'endTime', endTime);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/order/asyn',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get download id for futures trade history\n *\n * Request Limitation is 5 times per month, shared by front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Futures Trade History (USER_DATA)\n * @param {number} startTime Timestamp in ms\n * @param {number} endTime Timestamp in ms\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForFuturesTradeHistory: async (\n startTime: number,\n endTime: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'startTime' is not null or undefined\n assertParamExists('getDownloadIdForFuturesTradeHistory', 'startTime', startTime);\n // verify required parameter 'endTime' is not null or undefined\n assertParamExists('getDownloadIdForFuturesTradeHistory', 'endTime', endTime);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/trade/asyn',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get download id for futures transaction history\n *\n * Request Limitation is 5 times per month, shared by front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Futures Transaction History(USER_DATA)\n * @param {number} startTime Timestamp in ms\n * @param {number} endTime Timestamp in ms\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForFuturesTransactionHistory: async (\n startTime: number,\n endTime: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'startTime' is not null or undefined\n assertParamExists('getDownloadIdForFuturesTransactionHistory', 'startTime', startTime);\n // verify required parameter 'endTime' is not null or undefined\n assertParamExists('getDownloadIdForFuturesTransactionHistory', 'endTime', endTime);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/income/asyn',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get futures order history download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Futures Order History Download Link by Id (USER_DATA)\n * @param {string} downloadId get by download id api\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getFuturesOrderHistoryDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'downloadId' is not null or undefined\n assertParamExists('getFuturesOrderHistoryDownloadLinkById', 'downloadId', downloadId);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (downloadId !== undefined && downloadId !== null) {\n localVarQueryParameter['downloadId'] = downloadId;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/order/asyn/id',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get futures trade download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Futures Trade Download Link by Id(USER_DATA)\n * @param {string} downloadId get by download id api\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getFuturesTradeDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'downloadId' is not null or undefined\n assertParamExists('getFuturesTradeDownloadLinkById', 'downloadId', downloadId);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (downloadId !== undefined && downloadId !== null) {\n localVarQueryParameter['downloadId'] = downloadId;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/trade/asyn/id',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get futures transaction history download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Futures Transaction History Download Link by Id (USER_DATA)\n * @param {string} downloadId get by download id api\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getFuturesTransactionHistoryDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'downloadId' is not null or undefined\n assertParamExists(\n 'getFuturesTransactionHistoryDownloadLinkById',\n 'downloadId',\n downloadId\n );\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (downloadId !== undefined && downloadId !== null) {\n localVarQueryParameter['downloadId'] = downloadId;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/income/asyn/id',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get income history\n *\n * If `incomeType ` is not sent, all kinds of flow will be returned\n * \"trandId\" is unique in the same \"incomeType\" for a user\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 20\n *\n * @summary Get Income History(USER_DATA)\n * @param {string} [symbol]\n * @param {string} [incomeType] \"TRANSFER\",\"WELCOME_BONUS\", \"FUNDING_FEE\", \"REALIZED_PNL\", \"COMMISSION\", \"INSURANCE_CLEAR\", and \"DELIVERED_SETTELMENT\"\n * @param {number} [startTime]\n * @param {number} [endTime]\n * @param {number} [page]\n * @param {number} [limit] Default 100; max 1000\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getIncomeHistory: async (\n symbol?: string,\n incomeType?: string,\n startTime?: number,\n endTime?: number,\n page?: number,\n limit?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (incomeType !== undefined && incomeType !== null) {\n localVarQueryParameter['incomeType'] = incomeType;\n }\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n\n if (limit !== undefined && limit !== null) {\n localVarQueryParameter['limit'] = limit;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/income',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * **Not recommended to continue using this v1 endpoint**\n *\n * 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.\n *\n * Weight: 1\n *\n * @summary Notional Bracket for Pair(USER_DATA)\n * @param {string} [pair]\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n notionalBracketForPair: async (\n pair?: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (pair !== undefined && pair !== null) {\n localVarQueryParameter['pair'] = pair;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/leverageBracket',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get the symbol's notional bracket list.\n *\n * Weight: 1\n *\n * @summary Notional Bracket for Symbol(USER_DATA)\n * @param {string} [symbol]\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n notionalBracketForSymbol: async (\n symbol?: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v2/leverageBracket',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query user commission rate\n *\n * Weight: 20\n *\n * @summary User Commission Rate (USER_DATA)\n * @param {string} symbol\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n userCommissionRate: async (symbol: string, recvWindow?: number): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('userCommissionRate', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/dapi/v1/commissionRate',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * AccountApi - interface\n * @interface AccountApi\n */\nexport interface AccountApiInterface {\n /**\n * Get current account information.\n *\n * for One-way Mode user, the \"positions\" will only show the \"BOTH\" positions\n * for Hedge Mode user, the \"positions\" will show \"BOTH\", \"LONG\", and \"SHORT\" positions.\n *\n * Weight: 5\n *\n * @summary Account Information (USER_DATA)\n * @param {AccountInformationRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n accountInformation(\n requestParameters?: AccountInformationRequest\n ): Promise<RestApiResponse<AccountInformationResponse>>;\n /**\n * Check futures account balance\n *\n * Weight: 1\n *\n * @summary Futures Account Balance (USER_DATA)\n * @param {FuturesAccountBalanceRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n futuresAccountBalance(\n requestParameters?: FuturesAccountBalanceRequest\n ): Promise<RestApiResponse<FuturesAccountBalanceResponse>>;\n /**\n * Get user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol***\n *\n * Weight: 30\n *\n * @summary Get Current Position Mode(USER_DATA)\n * @param {GetCurrentPositionModeRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getCurrentPositionMode(\n requestParameters?: GetCurrentPositionModeRequest\n ): Promise<RestApiResponse<GetCurrentPositionModeResponse>>;\n /**\n * Get Download Id For Futures Order History\n *\n * Request Limitation is 10 times per month, shared by front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Futures Order History (USER_DATA)\n * @param {GetDownloadIdForFuturesOrderHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getDownloadIdForFuturesOrderHistory(\n requestParameters: GetDownloadIdForFuturesOrderHistoryRequest\n ): Promise<RestApiResponse<GetDownloadIdForFuturesOrderHistoryResponse>>;\n /**\n * Get download id for futures trade history\n *\n * Request Limitation is 5 times per month, shared by front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Futures Trade History (USER_DATA)\n * @param {GetDownloadIdForFuturesTradeHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getDownloadIdForFuturesTradeHistory(\n requestParameters: GetDownloadIdForFuturesTradeHistoryRequest\n ): Promise<RestApiResponse<GetDownloadIdForFuturesTradeHistoryResponse>>;\n /**\n * Get download id for futures transaction history\n *\n * Request Limitation is 5 times per month, shared by front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Futures Transaction History(USER_DATA)\n * @param {GetDownloadIdForFuturesTransactionHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getDownloadIdForFuturesTransactionHistory(\n requestParameters: GetDownloadIdForFuturesTransactionHistoryRequest\n ): Promise<RestApiResponse<GetDownloadIdForFuturesTransactionHistoryResponse>>;\n /**\n * Get futures order history download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Futures Order History Download Link by Id (USER_DATA)\n * @param {GetFuturesOrderHistoryDownloadLinkByIdRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getFuturesOrderHistoryDownloadLinkById(\n requestParameters: GetFuturesOrderHistoryDownloadLinkByIdRequest\n ): Promise<RestApiResponse<GetFuturesOrderHistoryDownloadLinkByIdResponse>>;\n /**\n * Get futures trade download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Futures Trade Download Link by Id(USER_DATA)\n * @param {GetFuturesTradeDownloadLinkByIdRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getFuturesTradeDownloadLinkById(\n requestParameters: GetFuturesTradeDownloadLinkByIdRequest\n ): Promise<RestApiResponse<GetFuturesTradeDownloadLinkByIdResponse>>;\n /**\n * Get futures transaction history download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Futures Transaction History Download Link by Id (USER_DATA)\n * @param {GetFuturesTransactionHistoryDownloadLinkByIdRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getFuturesTransactionHistoryDownloadLinkById(\n requestParameters: GetFuturesTransactionHistoryDownloadLinkByIdRequest\n ): Promise<RestApiResponse<GetFuturesTransactionHistoryDownloadLinkByIdResponse>>;\n /**\n * Get income history\n *\n * If `incomeType ` is not sent, all kinds of flow will be returned\n * \"trandId\" is unique in the same \"incomeType\" for a user\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 20\n *\n * @summary Get Income History(USER_DATA)\n * @param {GetIncomeHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getIncomeHistory(\n requestParameters?: GetIncomeHistoryRequest\n ): Promise<RestApiResponse<GetIncomeHistoryResponse>>;\n /**\n * **Not recommended to continue using this v1 endpoint**\n *\n * 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.\n *\n * Weight: 1\n *\n * @summary Notional Bracket for Pair(USER_DATA)\n * @param {NotionalBracketForPairRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n notionalBracketForPair(\n requestParameters?: NotionalBracketForPairRequest\n ): Promise<RestApiResponse<NotionalBracketForPairResponse>>;\n /**\n * Get the symbol's notional bracket list.\n *\n * Weight: 1\n *\n * @summary Notional Bracket for Symbol(USER_DATA)\n * @param {NotionalBracketForSymbolRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n notionalBracketForSymbol(\n requestParameters?: NotionalBracketForSymbolRequest\n ): Promise<RestApiResponse<NotionalBracketForSymbolResponse>>;\n /**\n * Query user commission rate\n *\n * Weight: 20\n *\n * @summary User Commission Rate (USER_DATA)\n * @param {UserCommissionRateRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n userCommissionRate(\n requestParameters: UserCommissionRateRequest\n ): Promise<RestApiResponse<UserCommissionRateResponse>>;\n}\n\n/**\n * Request parameters for accountInformation operation in AccountApi.\n * @interface AccountInformationRequest\n */\nexport interface AccountInformationRequest {\n /**\n *\n * @type {number}\n * @memberof AccountApiAccountInformation\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for futuresAccountBalance operation in AccountApi.\n * @interface FuturesAccountBalanceRequest\n */\nexport interface FuturesAccountBalanceRequest {\n /**\n *\n * @type {number}\n * @memberof AccountApiFuturesAccountBalance\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getCurrentPositionMode operation in AccountApi.\n * @interface GetCurrentPositionModeRequest\n */\nexport interface GetCurrentPositionModeRequest {\n /**\n *\n * @type {number}\n * @memberof AccountApiGetCurrentPositionMode\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getDownloadIdForFuturesOrderHistory operation in AccountApi.\n * @interface GetDownloadIdForFuturesOrderHistoryRequest\n */\nexport interface GetDownloadIdForFuturesOrderHistoryRequest {\n /**\n * Timestamp in ms\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesOrderHistory\n */\n readonly startTime: number;\n\n /**\n * Timestamp in ms\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesOrderHistory\n */\n readonly endTime: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesOrderHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getDownloadIdForFuturesTradeHistory operation in AccountApi.\n * @interface GetDownloadIdForFuturesTradeHistoryRequest\n */\nexport interface GetDownloadIdForFuturesTradeHistoryRequest {\n /**\n * Timestamp in ms\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesTradeHistory\n */\n readonly startTime: number;\n\n /**\n * Timestamp in ms\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesTradeHistory\n */\n readonly endTime: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesTradeHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getDownloadIdForFuturesTransactionHistory operation in AccountApi.\n * @interface GetDownloadIdForFuturesTransactionHistoryRequest\n */\nexport interface GetDownloadIdForFuturesTransactionHistoryRequest {\n /**\n * Timestamp in ms\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesTransactionHistory\n */\n readonly startTime: number;\n\n /**\n * Timestamp in ms\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesTransactionHistory\n */\n readonly endTime: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetDownloadIdForFuturesTransactionHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getFuturesOrderHistoryDownloadLinkById operation in AccountApi.\n * @interface GetFuturesOrderHistoryDownloadLinkByIdRequest\n */\nexport interface GetFuturesOrderHistoryDownloadLinkByIdRequest {\n /**\n * get by download id api\n * @type {string}\n * @memberof AccountApiGetFuturesOrderHistoryDownloadLinkById\n */\n readonly downloadId: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetFuturesOrderHistoryDownloadLinkById\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getFuturesTradeDownloadLinkById operation in AccountApi.\n * @interface GetFuturesTradeDownloadLinkByIdRequest\n */\nexport interface GetFuturesTradeDownloadLinkByIdRequest {\n /**\n * get by download id api\n * @type {string}\n * @memberof AccountApiGetFuturesTradeDownloadLinkById\n */\n readonly downloadId: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetFuturesTradeDownloadLinkById\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getFuturesTransactionHistoryDownloadLinkById operation in AccountApi.\n * @interface GetFuturesTransactionHistoryDownloadLinkByIdRequest\n */\nexport interface GetFuturesTransactionHistoryDownloadLinkByIdRequest {\n /**\n * get by download id api\n * @type {string}\n * @memberof AccountApiGetFuturesTransactionHistoryDownloadLinkById\n */\n readonly downloadId: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetFuturesTransactionHistoryDownloadLinkById\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getIncomeHistory operation in AccountApi.\n * @interface GetIncomeHistoryRequest\n */\nexport interface GetIncomeHistoryRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiGetIncomeHistory\n */\n readonly symbol?: string;\n\n /**\n * \"TRANSFER\",\"WELCOME_BONUS\", \"FUNDING_FEE\", \"REALIZED_PNL\", \"COMMISSION\", \"INSURANCE_CLEAR\", and \"DELIVERED_SETTELMENT\"\n * @type {string}\n * @memberof AccountApiGetIncomeHistory\n */\n readonly incomeType?: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetIncomeHistory\n */\n readonly startTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetIncomeHistory\n */\n readonly endTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetIncomeHistory\n */\n readonly page?: number;\n\n /**\n * Default 100; max 1000\n * @type {number}\n * @memberof AccountApiGetIncomeHistory\n */\n readonly limit?: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetIncomeHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for notionalBracketForPair operation in AccountApi.\n * @interface NotionalBracketForPairRequest\n */\nexport interface NotionalBracketForPairRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiNotionalBracketForPair\n */\n readonly pair?: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiNotionalBracketForPair\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for notionalBracketForSymbol operation in AccountApi.\n * @interface NotionalBracketForSymbolRequest\n */\nexport interface NotionalBracketForSymbolRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiNotionalBracketForSymbol\n */\n readonly symbol?: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiNotionalBracketForSymbol\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for userCommissionRate operation in AccountApi.\n * @interface UserCommissionRateRequest\n */\nexport interface UserCommissionRateRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiUserCommissionRate\n */\n readonly symbol: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiUserCommissionRate\n */\n readonly recvWindow?: number;\n}\n\n/**\n * AccountApi - object-oriented interface\n * @class AccountApi\n */\nexport class AccountApi implements AccountApiInterface {\n private readonly configuration: ConfigurationRestAPI;\n private localVarAxiosParamCreator;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.localVarAxiosParamCreator = AccountApiAxiosParamCreator(configuration);\n }\n\n /**\n * Get current account information.\n *\n * for One-way Mode user, the \"positions\" will only show the \"BOTH\" positions\n * for Hedge Mode user, the \"positions\" will show \"BOTH\", \"LONG\", and \"SHORT\" positions.\n *\n * Weight: 5\n *\n * @summary Account Information (USER_DATA)\n * @param {AccountInformationRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<AccountInformationResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApi\n * @see {@link https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Account-Information Binance API Documentation}\n */\n public async accountInformation(\n requestParameters: AccountInformationRequest = {}\n ): Promise<RestApiResponse<AccountInformationResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountInformation(\n requestParameters?.recvWindow\n );\n return sendRequest<AccountInformationResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n\n /**\n * Check futures account balance\n *\n * Weight: 1\n *\n * @summary Futures Account Balance (USER_DATA)\n * @param {FuturesAccountBalanceRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<FuturesAccountBalanceResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApi\n * @see {@link https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Futures-Account-Balance Binance API Documentation}\n */\n public async futuresAccountBalance(\n requestParameters: FuturesAccountBalanceRequ