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 737 kB
{"version":3,"file":"index.mjs","names":["localVarQueryParameter: Record<string, unknown>","localVarBodyParameter: Record<string, unknown>","localVarHeaderParameter: Record<string, unknown>","_timeUnit: TimeUnit | undefined","AccountApi","localVarQueryParameter: Record<string, unknown>","localVarBodyParameter: Record<string, unknown>","localVarHeaderParameter: Record<string, unknown>","_timeUnit: TimeUnit | undefined","localVarQueryParameter: Record<string, unknown>","localVarBodyParameter: Record<string, unknown>","localVarHeaderParameter: Record<string, unknown>","_timeUnit: TimeUnit | undefined","TradeApi","ModifyOrderSideEnum","ModifyOrderPriceMatchEnum","NewOrderSideEnum","NewOrderTypeEnum","NewOrderPositionSideEnum","NewOrderReduceOnlyEnum","NewOrderTimeInForceEnum","NewOrderWorkingTypeEnum","NewOrderPriceProtectEnum","NewOrderNewOrderRespTypeEnum","NewOrderPriceMatchEnum","NewOrderSelfTradePreventionModeEnum","localVarQueryParameter: Record<string, unknown>","localVarBodyParameter: Record<string, unknown>","localVarHeaderParameter: Record<string, unknown>","_timeUnit: TimeUnit | undefined","UserDataStreamsApi","AccountApi","TradeApi","UserDataStreamsApi","DERIVATIVES_TRADING_COIN_FUTURES_REST_API_PROD_URL","DERIVATIVES_TRADING_COIN_FUTURES_WS_API_PROD_URL","DERIVATIVES_TRADING_COIN_FUTURES_WS_STREAMS_PROD_URL"],"sources":["../package.json","../src/rest-api/types/modify-multiple-orders-batch-orders-parameter-inner.ts","../src/rest-api/types/place-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/trade-api.ts","../src/rest-api/modules/user-data-streams-api.ts","../src/rest-api/rest-api.ts","../src/rest-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-connection.ts","../src/websocket-api/websocket-api.ts","../src/websocket-api/index.ts","../src/websocket-streams/modules/api.ts","../src/websocket-streams/websocket-streams-connection.ts","../src/websocket-streams/websocket-streams.ts","../src/websocket-streams/index.ts","../src/derivatives-trading-coin-futures.ts"],"sourcesContent":["{\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\": \"19.0.0\",\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 && tsdown\",\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 \"json-with-bigint\": \"^3.5.8\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsdown\": \"^0.16.5\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"2.4.5\",\n \"@types/ws\": \"^8.5.5\",\n \"axios\": \"^1.7.4\",\n \"ws\": \"^8.17.1\"\n }\n}\n","/* tslint:disable */\n\n/**\n * Futures (COIN-M) REST API\n *\n * Access market data, manage accounts, and trade COIN-M perpetual and delivery futures.\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 * Sub-order ID, required when clientOrderId is not sent.\n * @type {number | bigint}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n orderId?: number | bigint;\n /**\n * Client order ID, required when orderId is not sent. Only support letters, numbers and underscores, and must be unique within 24 hours.\n * @type {string}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n origClientOrderId?: string;\n /**\n * Trading symbol\n * @type {string}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n symbol: string;\n /**\n * Trading side\n * @type {string}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n side: ModifyMultipleOrdersBatchOrdersParameterInnerSideEnum;\n /**\n * Order quantity, cannot be sent with closePosition=true. **After CM migration, this parameter becomes mandatory** (each batch element must send both `price` and `quantity`).\n * @type {number}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n quantity?: number;\n /**\n * Latest token price. **After CM migration, this parameter becomes mandatory** (each batch element must send both `price` and `quantity`).\n * @type {number}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n price?: number;\n /**\n * User-defined modification identifier, returned as-is in the response. Optional; not validated for uniqueness.\n * @type {number | bigint}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n modifyId?: number | bigint;\n /**\n *\n * @type {number | bigint}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n recvWindow?: number | bigint;\n /**\n * Unix timestamp in milliseconds used to sign the request. The value must reflect the current client time and is validated by the server for signed endpoints.\n * @type {number | bigint}\n * @memberof ModifyMultipleOrdersBatchOrdersParameterInner\n */\n timestamp: number | bigint;\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","/* tslint:disable */\n\n/**\n * Futures (COIN-M) REST API\n *\n * Access market data, manage accounts, and trade COIN-M perpetual and delivery futures.\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 PlaceMultipleOrdersBatchOrdersParameterInner\n */\nexport interface PlaceMultipleOrdersBatchOrdersParameterInner {\n /**\n * Symbol\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n symbol: string;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n side: PlaceMultipleOrdersBatchOrdersParameterInnerSideEnum;\n /**\n * Default `BOTH` for One-way Mode ; `LONG` or `SHORT` for Hedge Mode. It must be sent with Hedge Mode.\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n positionSide?: PlaceMultipleOrdersBatchOrdersParameterInnerPositionSideEnum;\n /**\n * **After CM migration, stop-type values (`STOP`, `STOP_MARKET`, `TAKE_PROFIT`, `TAKE_PROFIT_MARKET`, `TRAILING_STOP_MARKET`) are no longer accepted on a per-element basis and will return element-level `-4120`. Use the new `/dapi/v1/algoOrder` endpoint instead.**\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n type: PlaceMultipleOrdersBatchOrdersParameterInnerTypeEnum;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n timeInForce?: PlaceMultipleOrdersBatchOrdersParameterInnerTimeInForceEnum;\n /**\n * quantity measured by contract number\n * @type {number}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n quantity: number;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n reduceOnly?: PlaceMultipleOrdersBatchOrdersParameterInnerReduceOnlyEnum;\n /**\n * Order price\n * @type {number}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n price?: number;\n /**\n * A unique id among open orders. Automatically generated if not sent. Can only be string following the rule: `^[\\\\.A-Z\\\\:/a-z0-9_-]{1,36}$`\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n newClientOrderId?: string;\n /**\n * Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders.\n * @type {number}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n stopPrice?: number;\n /**\n * Used with `TRAILING_STOP_MARKET` orders, default as the latest price(supporting different `workingType`)\n * @type {number}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n activationPrice?: number;\n /**\n * Used with `TRAILING_STOP_MARKET` orders, min 0.1, max 4 where 1 for 1%\n * @type {number}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n callbackRate?: number;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n workingType?: PlaceMultipleOrdersBatchOrdersParameterInnerWorkingTypeEnum;\n /**\n * Used with `STOP/STOP_MARKET` or `TAKE_PROFIT/TAKE_PROFIT_MARKET` orders.\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n priceProtect?: PlaceMultipleOrdersBatchOrdersParameterInnerPriceProtectEnum;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n newOrderRespType?: PlaceMultipleOrdersBatchOrdersParameterInnerNewOrderRespTypeEnum;\n /**\n * only avaliable for `LIMIT`/`STOP`/`TAKE_PROFIT` order; can\\'t be passed together with `price`\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n priceMatch?: PlaceMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum;\n /**\n * `EXPIRE_TAKER`:expire taker order when STP triggers/ `EXPIRE_MAKER`:expire taker order when STP triggers/ `EXPIRE_BOTH`:expire both orders when STP triggers\n * @type {string}\n * @memberof PlaceMultipleOrdersBatchOrdersParameterInner\n */\n selfTradePreventionMode?: PlaceMultipleOrdersBatchOrdersParameterInnerSelfTradePreventionModeEnum;\n}\n\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerSideEnum = {\n BUY: 'BUY',\n SELL: 'SELL',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerSideEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerSideEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerSideEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerPositionSideEnum = {\n BOTH: 'BOTH',\n LONG: 'LONG',\n SHORT: 'SHORT',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerPositionSideEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerPositionSideEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerPositionSideEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerTypeEnum = {\n LIMIT: 'LIMIT',\n MARKET: 'MARKET',\n STOP: 'STOP',\n STOP_MARKET: 'STOP_MARKET',\n TAKE_PROFIT: 'TAKE_PROFIT',\n TAKE_PROFIT_MARKET: 'TAKE_PROFIT_MARKET',\n TRAILING_STOP_MARKET: 'TRAILING_STOP_MARKET',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerTypeEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerTypeEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerTypeEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerTimeInForceEnum = {\n GTC: 'GTC',\n IOC: 'IOC',\n FOK: 'FOK',\n GTX: 'GTX',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerTimeInForceEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerTimeInForceEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerTimeInForceEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerReduceOnlyEnum = {\n TRUE: 'true',\n FALSE: 'false',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerReduceOnlyEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerReduceOnlyEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerReduceOnlyEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerWorkingTypeEnum = {\n MARK_PRICE: 'MARK_PRICE',\n CONTRACT_PRICE: 'CONTRACT_PRICE',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerWorkingTypeEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerWorkingTypeEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerWorkingTypeEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerPriceProtectEnum = {\n TRUE: 'true',\n FALSE: 'false',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerPriceProtectEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerPriceProtectEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerPriceProtectEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerNewOrderRespTypeEnum = {\n ACK: 'ACK',\n RESULT: 'RESULT',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerNewOrderRespTypeEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerNewOrderRespTypeEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerNewOrderRespTypeEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum = {\n OPPONENT: 'OPPONENT',\n OPPONENT_5: 'OPPONENT_5',\n OPPONENT_10: 'OPPONENT_10',\n OPPONENT_20: 'OPPONENT_20',\n QUEUE: 'QUEUE',\n QUEUE_5: 'QUEUE_5',\n QUEUE_10: 'QUEUE_10',\n QUEUE_20: 'QUEUE_20',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerPriceMatchEnum];\nexport const PlaceMultipleOrdersBatchOrdersParameterInnerSelfTradePreventionModeEnum = {\n EXPIRE_TAKER: 'EXPIRE_TAKER',\n EXPIRE_MAKER: 'EXPIRE_MAKER',\n EXPIRE_BOTH: 'EXPIRE_BOTH',\n} as const;\n\nexport type PlaceMultipleOrdersBatchOrdersParameterInnerSelfTradePreventionModeEnum =\n (typeof PlaceMultipleOrdersBatchOrdersParameterInnerSelfTradePreventionModeEnum)[keyof typeof PlaceMultipleOrdersBatchOrdersParameterInnerSelfTradePreventionModeEnum];\n","/**\n * Futures (COIN-M) REST API\n *\n * Access market data, manage accounts, and trade COIN-M perpetual and delivery futures.\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 */\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 * Weight(IP): 5\n *\n * Security Type: USER_DATA\n *\n * Notes:\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 * @summary Account Information (USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n accountInformation: async (recvWindow?: number | bigint): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: 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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Check futures account balance\n *\n * Weight(IP): 1\n *\n * Security Type: USER_DATA\n *\n * @summary Futures Account Balance (USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n futuresAccountBalance: async (recvWindow?: number | bigint): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: 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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get user's position mode (Hedge Mode or One-way Mode ) on ***EVERY symbol***\n *\n * Weight(IP): 30\n *\n * Security Type: USER_DATA\n *\n * @summary Get Current Position Mode (USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getCurrentPositionMode: async (recvWindow?: number | bigint): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: 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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get Download Id For Futures Order History\n *\n * Weight(IP): 1000\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Request Limitation is 8 times per month, shared by front end download page and rest api\n * - This endpoint uses the IP rate limit bucket and costs 1000 weight per call. The maximum is 2 calls per minute; the 3rd call within the same minute will trigger a ban.\n * - The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * @summary Get Download Id For Futures Order History (USER_DATA)\n * @param {number | bigint} startTime Timestamp in ms\n * @param {number | bigint} endTime Timestamp in ms\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForFuturesOrderHistory: async (\n startTime: number | bigint,\n endTime: number | bigint,\n recvWindow?: number | bigint\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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get download id for futures trade history\n *\n * Weight(IP): 1000\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Request Limitation is 8 times per month, shared by front end download page and rest api\n * - This endpoint uses the IP rate limit bucket and costs 1000 weight per call. The maximum is 2 calls per minute; the 3rd call within the same minute will trigger a ban.\n * - The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * @summary Get Download Id For Futures Trade History (USER_DATA)\n * @param {number | bigint} startTime Timestamp in ms\n * @param {number | bigint} endTime Timestamp in ms\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForFuturesTradeHistory: async (\n startTime: number | bigint,\n endTime: number | bigint,\n recvWindow?: number | bigint\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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get download id for futures transaction history\n *\n * Weight(IP): 1000\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Request Limitation is 8 times per month, shared by front end download page and rest api\n * - This endpoint uses the IP rate limit bucket and costs 1000 weight per call. The maximum is 2 calls per minute; the 3rd call within the same minute will trigger a ban.\n * - The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * @summary Get Download Id For Futures Transaction History (USER_DATA)\n * @param {number | bigint} startTime Timestamp in ms\n * @param {number | bigint} endTime Timestamp in ms\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForFuturesTransactionHistory: async (\n startTime: number | bigint,\n endTime: number | bigint,\n recvWindow?: number | bigint\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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get futures order history download link by Id\n *\n * Weight(IP): 5\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Download link expiration: 7 days\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 | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getFuturesOrderHistoryDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number | bigint\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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (downloadId !== undefined && downloadId !== null) {\n localVarQueryParameter['downloadId'] = downloadId;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get futures trade download link by Id\n *\n * Weight(IP): 5\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Download link expiration: 7 days\n *\n * @summary Get Futures Trade Download Link by Id (USER_DATA)\n * @param {string} downloadId get by download id api\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getFuturesTradeDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number | bigint\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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (downloadId !== undefined && downloadId !== null) {\n localVarQueryParameter['downloadId'] = downloadId;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get futures transaction history download link by Id\n *\n * Weight(IP): 5\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Download link expiration: 7 days\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 | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getFuturesTransactionHistoryDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number | bigint\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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (downloadId !== undefined && downloadId !== null) {\n localVarQueryParameter['downloadId'] = downloadId;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get income history\n *\n * Weight(IP): 20\n *\n * Security Type: USER_DATA\n *\n * Notes:\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 * @summary Get Income History (USER_DATA)\n * @param {string} [symbol] Symbol\n * @param {GetIncomeHistoryIncomeTypeEnum} [incomeType] Income type.\n * @param {number | bigint} [startTime] Timestamp in ms to get funding from INCLUSIVE.\n * @param {number | bigint} [endTime] Timestamp in ms to get funding until INCLUSIVE.\n * @param {number | bigint} [page] Page number\n * @param {number | bigint} [limit] Maximum number of records to return.\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getIncomeHistory: async (\n symbol?: string,\n incomeType?: GetIncomeHistoryIncomeTypeEnum,\n startTime?: number | bigint,\n endTime?: number | bigint,\n page?: number | bigint,\n limit?: number | bigint,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n if (incomeType !== undefined && incomeType !== null) {\n localVarQueryParameter['incomeType'] = incomeType;\n }\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n if (limit !== undefined && limit !== null) {\n localVarQueryParameter['limit'] = limit;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\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\n * values when there have been multiple different `symbol` brackets under\n * the `pair`, suggest using the following `GET /dapi/v2/leverageBracket`\n * query instead to get the specific `symbol` notional bracket list.\n *\n * Weight(IP): 1\n *\n * Security Type: USER_DATA\n *\n * @summary Notional Bracket for Pair (USER_DATA)\n * @param {string} [pair]\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n notionalBracketForPair: async (\n pair?: string,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (pair !== undefined && pair !== null) {\n localVarQueryParameter['pair'] = pair;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get the symbol's notional bracket list.\n *\n * Weight: 1 (after CM migration: 1 with `symbol` / 2 without `symbol`)\n *\n * Security Type: USER_DATA\n *\n * @summary Notional Bracket for Symbol (USER_DATA)\n * @param {string} [symbol]\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n notionalBracketForSymbol: async (\n symbol?: string,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query user commission rate\n *\n * Weight(IP): 20\n *\n * Security Type: USER_DATA\n *\n * @summary User Commission Rate (USER_DATA)\n * @param {string} symbol Symbol\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n userCommissionRate: async (\n symbol: string,\n recvWindow?: number | bigint\n ): 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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\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 queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\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 * Weight(IP): 5\n *\n * Security Type: USER_DATA\n *\n * Notes:\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 * @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(IP): 1\n *\n * Security Type: USER_DATA\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(IP): 30\n *\n * Security Type: USER_DATA\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 * Weight(IP): 1000\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Request Limitation is 8 times per month, shared by front end download page and rest api\n * - This endpoint uses the IP rate limit bucket and costs 1000 weight per call. The maximum is 2 calls per minute; the 3rd call within the same minute will trigger a ban.\n * - The time between `startTime` and `endTime` can not be longer than 1 year\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 * Weight(IP): 1000\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Request Limitation is 8 times per month, shared by front end download page and rest api\n * - This endpoint uses the IP rate limit bucket and costs 1000 weight per call. The maximum is 2 calls per minute; the 3rd call within the same minute will trigger a ban.\n * - The time between `startTime` and `endTime` can not be longer than 1 year\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 * Weight(IP): 1000\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Request Limitation is 8 times per month, shared by front end download page and rest api\n * - This endpoint uses the IP rate limit bucket and costs 1000 weight per call. The maximum is 2 calls per minute; the 3rd call within the same minute will trigger a ban.\n * - The time between `startTime` and `endTime` can not be longer than 1 year\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 * Weight(IP): 5\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Download link expiration: 7 days\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 * Weight(IP): 5\n *\n * Security Type: USER_DATA\n *\n * Notes:\n * - Download link expiration: 7 days\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 | NotFound