UNPKG

@binance/derivatives-trading-portfolio-margin

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 814 kB
{"version":3,"sources":["../src/derivatives-trading-portfolio-margin.ts","../package.json","../src/rest-api/index.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/index.ts"],"sourcesContent":["import {\n buildUserAgent,\n ConfigurationRestAPI,\n DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_PROD_URL,\n} from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\n\nexport interface ConfigurationDerivativesTradingPortfolioMargin {\n configurationRestAPI?: ConfigurationRestAPI;\n}\n\nexport class DerivativesTradingPortfolioMargin {\n public restAPI!: RestAPI;\n\n constructor(config: ConfigurationDerivativesTradingPortfolioMargin) {\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_PORTFOLIO_MARGIN_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 }\n}\n","{\n \"name\": \"@binance/derivatives-trading-portfolio-margin\",\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\": \"4.0.2\",\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.1.2\",\n \"@types/ws\": \"^8.5.5\",\n \"axios\": \"^1.7.4\",\n \"ws\": \"^8.17.1\"\n }\n}\n","/**\n * Binance Derivatives Trading Portfolio Margin REST API\n *\n * OpenAPI Specification for the Binance Derivatives Trading Portfolio Margin 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","/**\n * Binance Derivatives Trading Portfolio Margin REST API\n *\n * OpenAPI Specification for the Binance Derivatives Trading Portfolio Margin 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 AccountBalanceResponse,\n AccountInformationResponse,\n BnbTransferResponse,\n ChangeAutoRepayFuturesStatusResponse,\n ChangeCmInitialLeverageResponse,\n ChangeCmPositionModeResponse,\n ChangeUmInitialLeverageResponse,\n ChangeUmPositionModeResponse,\n CmNotionalAndLeverageBracketsResponse,\n FundAutoCollectionResponse,\n FundCollectionByAssetResponse,\n GetAutoRepayFuturesStatusResponse,\n GetCmAccountDetailResponse,\n GetCmCurrentPositionModeResponse,\n GetCmIncomeHistoryResponse,\n GetDownloadIdForUmFuturesOrderHistoryResponse,\n GetDownloadIdForUmFuturesTradeHistoryResponse,\n GetDownloadIdForUmFuturesTransactionHistoryResponse,\n GetMarginBorrowLoanInterestHistoryResponse,\n GetUmAccountDetailResponse,\n GetUmAccountDetailV2Response,\n GetUmCurrentPositionModeResponse,\n GetUmFuturesOrderDownloadLinkByIdResponse,\n GetUmFuturesTradeDownloadLinkByIdResponse,\n GetUmFuturesTransactionDownloadLinkByIdResponse,\n GetUmIncomeHistoryResponse,\n GetUserCommissionRateForCmResponse,\n GetUserCommissionRateForUmResponse,\n MarginMaxBorrowResponse,\n PortfolioMarginUmTradingQuantitativeRulesIndicatorsResponse,\n QueryCmPositionInformationResponse,\n QueryMarginLoanRecordResponse,\n QueryMarginMaxWithdrawResponse,\n QueryMarginRepayRecordResponse,\n QueryPortfolioMarginNegativeBalanceInterestHistoryResponse,\n QueryUmPositionInformationResponse,\n QueryUserNegativeBalanceAutoExchangeRecordResponse,\n QueryUserRateLimitResponse,\n RepayFuturesNegativeBalanceResponse,\n UmFuturesAccountConfigurationResponse,\n UmFuturesSymbolConfigurationResponse,\n UmNotionalAndLeverageBracketsResponse,\n} from '../types';\n\n/**\n * AccountApi - axios parameter creator\n */\nconst AccountApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Query account balance\n *\n * Weight: 20\n *\n * @summary Account Balance(USER_DATA)\n * @param {string} [asset]\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n accountBalance: async (asset?: string, recvWindow?: number): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (asset !== undefined && asset !== null) {\n localVarQueryParameter['asset'] = asset;\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: '/papi/v1/balance',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query account information\n *\n * Weight: 20\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: '/papi/v1/account',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Transfer BNB in and out of UM\n *\n * The endpoint can only be called 10 times per 10 minutes in a rolling manner\n *\n * Weight: 750\n *\n * @summary BNB transfer (TRADE)\n * @param {number} amount\n * @param {string} transferSide \"TO_UM\",\"FROM_UM\"\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n bnbTransfer: async (\n amount: number,\n transferSide: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'amount' is not null or undefined\n assertParamExists('bnbTransfer', 'amount', amount);\n // verify required parameter 'transferSide' is not null or undefined\n assertParamExists('bnbTransfer', 'transferSide', transferSide);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (amount !== undefined && amount !== null) {\n localVarQueryParameter['amount'] = amount;\n }\n\n if (transferSide !== undefined && transferSide !== null) {\n localVarQueryParameter['transferSide'] = transferSide;\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: '/papi/v1/bnb-transfer',\n method: 'POST',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Change Auto-repay-futures Status\n *\n * Weight: 750\n *\n * @summary Change Auto-repay-futures Status(TRADE)\n * @param {string} autoRepay Default: `true`; `false` for turn off the auto-repay futures negative balance function\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n changeAutoRepayFuturesStatus: async (\n autoRepay: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'autoRepay' is not null or undefined\n assertParamExists('changeAutoRepayFuturesStatus', 'autoRepay', autoRepay);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (autoRepay !== undefined && autoRepay !== null) {\n localVarQueryParameter['autoRepay'] = autoRepay;\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: '/papi/v1/repay-futures-switch',\n method: 'POST',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Change user's initial leverage of specific symbol in CM.\n *\n * Weight: 1\n *\n * @summary Change CM Initial Leverage (TRADE)\n * @param {string} symbol\n * @param {number} leverage target initial leverage: int from 1 to 125\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n changeCmInitialLeverage: async (\n symbol: string,\n leverage: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('changeCmInitialLeverage', 'symbol', symbol);\n // verify required parameter 'leverage' is not null or undefined\n assertParamExists('changeCmInitialLeverage', 'leverage', leverage);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (leverage !== undefined && leverage !== null) {\n localVarQueryParameter['leverage'] = leverage;\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: '/papi/v1/cm/leverage',\n method: 'POST',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in CM\n *\n * Weight: 1\n *\n * @summary Change CM Position Mode(TRADE)\n * @param {string} dualSidePosition \"true\": Hedge Mode; \"false\": One-way Mode\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n changeCmPositionMode: async (\n dualSidePosition: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'dualSidePosition' is not null or undefined\n assertParamExists('changeCmPositionMode', 'dualSidePosition', dualSidePosition);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (dualSidePosition !== undefined && dualSidePosition !== null) {\n localVarQueryParameter['dualSidePosition'] = dualSidePosition;\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: '/papi/v1/cm/positionSide/dual',\n method: 'POST',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Change user's initial leverage of specific symbol in UM.\n *\n * Weight: 1\n *\n * @summary Change UM Initial Leverage(TRADE)\n * @param {string} symbol\n * @param {number} leverage target initial leverage: int from 1 to 125\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n changeUmInitialLeverage: async (\n symbol: string,\n leverage: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('changeUmInitialLeverage', 'symbol', symbol);\n // verify required parameter 'leverage' is not null or undefined\n assertParamExists('changeUmInitialLeverage', 'leverage', leverage);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (leverage !== undefined && leverage !== null) {\n localVarQueryParameter['leverage'] = leverage;\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: '/papi/v1/um/leverage',\n method: 'POST',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol in UM\n *\n * Weight: 1\n *\n * @summary Change UM Position Mode(TRADE)\n * @param {string} dualSidePosition \"true\": Hedge Mode; \"false\": One-way Mode\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n changeUmPositionMode: async (\n dualSidePosition: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'dualSidePosition' is not null or undefined\n assertParamExists('changeUmPositionMode', 'dualSidePosition', dualSidePosition);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (dualSidePosition !== undefined && dualSidePosition !== null) {\n localVarQueryParameter['dualSidePosition'] = dualSidePosition;\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: '/papi/v1/um/positionSide/dual',\n method: 'POST',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query CM notional and leverage brackets\n *\n * Weight: 1\n *\n * @summary CM Notional and Leverage Brackets(USER_DATA)\n * @param {string} [symbol]\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n cmNotionalAndLeverageBrackets: 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: '/papi/v1/cm/leverageBracket',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Fund collection for Portfolio Margin\n *\n * The BNB would not be collected from UM-PM account to the Portfolio Margin account.\n * You can only use this function 500 times per hour in a rolling manner.\n *\n * Weight: 750\n *\n * @summary Fund Auto-collection(TRADE)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n fundAutoCollection: 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: '/papi/v1/auto-collection',\n method: 'POST',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Transfers specific asset from Futures Account to Margin account\n *\n * The BNB transfer is not be supported\n *\n * Weight: 30\n *\n * @summary Fund Collection by Asset(TRADE)\n * @param {string} asset\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n fundCollectionByAsset: async (asset: string, recvWindow?: number): Promise<RequestArgs> => {\n // verify required parameter 'asset' is not null or undefined\n assertParamExists('fundCollectionByAsset', 'asset', asset);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (asset !== undefined && asset !== null) {\n localVarQueryParameter['asset'] = asset;\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: '/papi/v1/asset-collection',\n method: 'POST',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query Auto-repay-futures Status\n *\n * Weight: 30\n *\n * @summary Get Auto-repay-futures Status(USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getAutoRepayFuturesStatus: 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: '/papi/v1/repay-futures-switch',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get current CM account asset and position information.\n *\n * Weight: 5\n *\n * @summary Get CM Account Detail(USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getCmAccountDetail: 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: '/papi/v1/cm/account',\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 in CM\n *\n * Weight: 30\n *\n * @summary Get CM Current Position Mode(USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getCmCurrentPositionMode: 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: '/papi/v1/cm/positionSide/dual',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get CM Income History\n *\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 interval between `startTime` and `endTime` can not exceed 200 days:\n * If `startTime` and `endTime` are not sent, the last 200 days will be returned\n *\n * Weight: 30\n *\n * @summary Get CM Income History(USER_DATA)\n * @param {string} [symbol]\n * @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\n * @param {number} [startTime] Timestamp in ms to get funding from INCLUSIVE.\n * @param {number} [endTime] Timestamp in ms to get funding until INCLUSIVE.\n * @param {number} [page]\n * @param {number} [limit] Default 100; max 1000\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getCmIncomeHistory: 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: '/papi/v1/cm/income',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get download id for UM 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: 1500\n *\n * @summary Get Download Id For UM Futures Order History (USER_DATA)\n * @param {number} startTime\n * @param {number} endTime\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForUmFuturesOrderHistory: 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('getDownloadIdForUmFuturesOrderHistory', 'startTime', startTime);\n // verify required parameter 'endTime' is not null or undefined\n assertParamExists('getDownloadIdForUmFuturesOrderHistory', '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: '/papi/v1/um/order/asyn',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get download id for UM 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: 1500\n *\n * @summary Get Download Id For UM Futures Trade History (USER_DATA)\n * @param {number} startTime\n * @param {number} endTime\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForUmFuturesTradeHistory: 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('getDownloadIdForUmFuturesTradeHistory', 'startTime', startTime);\n // verify required parameter 'endTime' is not null or undefined\n assertParamExists('getDownloadIdForUmFuturesTradeHistory', '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: '/papi/v1/um/trade/asyn',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get download id for UM 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: 1500\n *\n * @summary Get Download Id For UM Futures Transaction History (USER_DATA)\n * @param {number} startTime\n * @param {number} endTime\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForUmFuturesTransactionHistory: 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(\n 'getDownloadIdForUmFuturesTransactionHistory',\n 'startTime',\n startTime\n );\n // verify required parameter 'endTime' is not null or undefined\n assertParamExists('getDownloadIdForUmFuturesTransactionHistory', '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: '/papi/v1/um/income/asyn',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get Margin Borrow/Loan Interest History\n *\n *\n * Response in descending order\n * The max interval between startTime and endTime is 30 days. It is a MUST to ensure data correctness.\n * If `startTime` and `endTime` not sent, return records of the last 7 days by default\n * If `startTime` is sent and `endTime` is not sent, the records from `startTime` to the present will be returned; if `startTime` is more than 30 days ago, the records of the past 30 days will be returned.\n * If `startTime` is not sent and `endTime` is sent, the records of the 7 days before `endTime` is returned.\n * Type in response has 5 enums:\n * `PERIODIC` interest charged per hour\n * `ON_BORROW` first interest charged on borrow\n * `PERIODIC_CONVERTED` interest charged per hour converted into BNB\n * `ON_BORROW_CONVERTED` first interest charged on borrow converted into BNB\n * `PORTFOLIO` Portfolio Margin negative balance daily interest\n *\n * Weight: 1\n *\n * @summary Get Margin Borrow/Loan Interest History(USER_DATA)\n * @param {string} [asset]\n * @param {number} [startTime] Timestamp in ms to get funding from INCLUSIVE.\n * @param {number} [endTime] Timestamp in ms to get funding until INCLUSIVE.\n * @param {number} [current] Currently querying page. Start from 1. Default:1\n * @param {number} [size] Default:10 Max:100\n * @param {string} [archived] Default: `false`. Set to `true` for archived data from 6 months ago\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getMarginBorrowLoanInterestHistory: async (\n asset?: string,\n startTime?: number,\n endTime?: number,\n current?: number,\n size?: number,\n archived?: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (asset !== undefined && asset !== null) {\n localVarQueryParameter['asset'] = asset;\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 (current !== undefined && current !== null) {\n localVarQueryParameter['current'] = current;\n }\n\n if (size !== undefined && size !== null) {\n localVarQueryParameter['size'] = size;\n }\n\n if (archived !== undefined && archived !== null) {\n localVarQueryParameter['archived'] = archived;\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: '/papi/v1/margin/marginInterestHistory',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get current UM account asset and position information.\n *\n * Weight: 5\n *\n * @summary Get UM Account Detail(USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getUmAccountDetail: 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: '/papi/v1/um/account',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get current UM account asset and position information.\n *\n * Weight: 5\n *\n * @summary Get UM Account Detail V2(USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getUmAccountDetailV2: 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: '/papi/v2/um/account',\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 in UM\n *\n * Weight: 30\n *\n * @summary Get UM Current Position Mode(USER_DATA)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getUmCurrentPositionMode: 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: '/papi/v1/um/positionSide/dual',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get UM futures order download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 10\n *\n * @summary Get UM Futures Order 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 getUmFuturesOrderDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'downloadId' is not null or undefined\n assertParamExists('getUmFuturesOrderDownloadLinkById', '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: '/papi/v1/um/order/asyn/id',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get UM futures trade download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 10\n *\n * @summary Get UM 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 getUmFuturesTradeDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'downloadId' is not null or undefined\n assertParamExists('getUmFuturesTradeDownloadLinkById', '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: '/papi/v1/um/trade/asyn/id',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get UM futures Transaction download link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 10\n *\n * @summary Get UM Futures Transaction 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 getUmFuturesTransactionDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'downloadId' is not null or undefined\n assertParamExists('getUmFuturesTransactionDownloadLinkById', '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: '/papi/v1/um/income/asyn/id',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get UM Income History\n *\n * If neither `startTime` nor `endTime` is sent, the recent 7-day data will be returned.\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 * Income history only contains data for the last three months\n *\n * Weight: 30\n *\n * @summary Get UM Income History(USER_DATA)\n * @param {string} [symbol]\n * @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\n * @param {number} [startTime] Timestamp in ms to get funding from INCLUSIVE.\n * @param {number} [endTime] Timestamp in ms to get funding until INCLUSIVE.\n * @param {number} [page]\n * @param {number} [limit] Default 100; max 1000\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getUmIncomeHistory: 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: '/papi/v1/um/income',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get User Commission Rate for CM\n *\n * Weight: 20\n *\n * @summary Get User Commission Rate for CM(USER_DATA)\n * @param {string} symbol\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getUserCommissionRateForCm: async (\n symbol: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('getUserCommissionRateForCm', '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: '/papi/v1/cm/commissionRate',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get User Commission Rate for UM\n *\n * Weight: 20\n *\n * @summary Get User Commission Rate for UM(USER_DATA)\n * @param {string} symbol\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getUserCommissionRateForUm: async (\n symbol: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('getUserCommissionRateForUm', 'symbol', symbol);\n\n const localVarQueryParameter: Record<s