@binance/derivatives-trading-portfolio-margin-pro
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 • 170 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":["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","DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_REST_API_PROD_URL","DERIVATIVES_TRADING_PORTFOLIO_MARGIN_PRO_WS_STREAMS_PROD_URL"],"sources":["../package.json","../src/rest-api/modules/account-api.ts","../src/rest-api/modules/market-data-api.ts","../src/rest-api/rest-api.ts","../src/rest-api/index.ts","../src/websocket-streams/websocket-streams-connection.ts","../src/websocket-streams/websocket-streams.ts","../src/websocket-streams/index.ts","../src/derivatives-trading-portfolio-margin-pro.ts"],"sourcesContent":["{\n \"name\": \"@binance/derivatives-trading-portfolio-margin-pro\",\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\": \"14.0.4\",\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.4.4\",\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.1\",\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 Pro REST API\n *\n * OpenAPI Specification for the Binance Derivatives Trading Portfolio Margin Pro 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 BnbTransferResponse,\n ChangeAutoRepayFuturesStatusResponse,\n DeleteMarginCallLevelResponse,\n FundAutoCollectionResponse,\n FundCollectionByAssetResponse,\n GetAutoRepayFuturesStatusResponse,\n GetDeltaModeStatusResponse,\n GetMarginCallLevelResponse,\n GetPortfolioMarginProAccountBalanceResponse,\n GetPortfolioMarginProAccountInfoResponse,\n GetPortfolioMarginProSpanAccountInfoResponse,\n GetTransferableEarnAssetBalanceForPortfolioMarginResponse,\n PortfolioMarginProBankruptcyLoanRepayResponse,\n QueryPortfolioMarginProBankruptcyLoanAmountResponse,\n QueryPortfolioMarginProBankruptcyLoanRepayHistoryResponse,\n QueryPortfolioMarginProNegativeBalanceInterestHistoryResponse,\n RepayFuturesNegativeBalanceResponse,\n SetMarginCallLevelResponse,\n SwitchDeltaModeResponse,\n TransferLdusdtRwusdForPortfolioMarginResponse,\n} from '../types';\n\n/**\n * AccountApi - axios parameter creator\n */\nconst AccountApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * BNB transfer can be between Margin Account and USDM Account\n *\n *\n * You can only use this function 2 times per 10 minutes in a rolling manner\n *\n * Weight: 1500\n *\n * @summary BNB transfer(USER_DATA)\n * @param {number} amount\n * @param {string} transferSide \"TO_UM\",\"FROM_UM\"\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n bnbTransfer: async (\n amount: number,\n transferSide: string,\n recvWindow?: number | bigint\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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (amount !== undefined && amount !== null) {\n localVarQueryParameter['amount'] = amount;\n }\n if (transferSide !== undefined && transferSide !== null) {\n localVarQueryParameter['transferSide'] = transferSide;\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: '/sapi/v1/portfolio/bnb-transfer',\n method: 'POST',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Change Auto-repay-futures Status\n *\n * Weight: 1500\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 | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n changeAutoRepayFuturesStatus: async (\n autoRepay: string,\n recvWindow?: number | bigint\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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (autoRepay !== undefined && autoRepay !== null) {\n localVarQueryParameter['autoRepay'] = autoRepay;\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: '/sapi/v1/portfolio/repay-futures-switch',\n method: 'POST',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Delete the margin call level for a Portfolio Margin account.\n *\n * Weight: 1500\n *\n * @summary Delete Margin Call Level (USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n deleteMarginCallLevel: 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: '/sapi/v1/portfolio/margin-call-level',\n method: 'DELETE',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Transfers all assets from Futures Account to Margin account\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: 1500\n *\n * @summary Fund Auto-collection(USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n fundAutoCollection: 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: '/sapi/v1/portfolio/auto-collection',\n method: 'POST',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\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: 60\n *\n * @summary Fund Collection by Asset(USER_DATA)\n * @param {string} asset `LDUSDT` and `RWUSD`\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n fundCollectionByAsset: async (\n asset: string,\n recvWindow?: number | bigint\n ): 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 const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (asset !== undefined && asset !== null) {\n localVarQueryParameter['asset'] = asset;\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: '/sapi/v1/portfolio/asset-collection',\n method: 'POST',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\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 | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getAutoRepayFuturesStatus: 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: '/sapi/v1/portfolio/repay-futures-switch',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query the Delta mode status of current account.\n *\n * Weight: 1500\n *\n * @summary Get Delta Mode Status(USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDeltaModeStatus: 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: '/sapi/v1/portfolio/delta-mode',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get the margin call level for a Portfolio Margin account.\n *\n * Weight: 1500\n *\n * @summary Get Margin Call Level (USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getMarginCallLevel: 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: '/sapi/v1/portfolio/margin-call-level',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query Portfolio Margin Pro account balance\n *\n * Weight: 20\n *\n * @summary Get Portfolio Margin Pro Account Balance(USER_DATA)\n * @param {string} [asset]\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getPortfolioMarginProAccountBalance: async (\n asset?: 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 (asset !== undefined && asset !== null) {\n localVarQueryParameter['asset'] = asset;\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: '/sapi/v1/portfolio/balance',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get Portfolio Margin Pro Account Info\n *\n * Weight: 5\n *\n * @summary Get Portfolio Margin Pro Account Info(USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getPortfolioMarginProAccountInfo: async (\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 (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: '/sapi/v1/portfolio/account',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get Portfolio Margin Pro SPAN Account Info (For Portfolio Margin Pro SPAN users only)\n *\n * Weight: 5\n *\n * @summary Get Portfolio Margin Pro SPAN Account Info(USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getPortfolioMarginProSpanAccountInfo: async (\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 (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: '/sapi/v2/portfolio/account',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get transferable earn asset balance for all types of Portfolio Margin account\n *\n * Weight: 1500\n *\n * @summary Get Transferable Earn Asset Balance for Portfolio Margin (USER_DATA)\n * @param {string} asset `LDUSDT` and `RWUSD`\n * @param {string} transferType `EARN_TO_FUTURE` /`FUTURE_TO_EARN`\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getTransferableEarnAssetBalanceForPortfolioMargin: async (\n asset: string,\n transferType: string,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n // verify required parameter 'asset' is not null or undefined\n assertParamExists('getTransferableEarnAssetBalanceForPortfolioMargin', 'asset', asset);\n // verify required parameter 'transferType' is not null or undefined\n assertParamExists(\n 'getTransferableEarnAssetBalanceForPortfolioMargin',\n 'transferType',\n transferType\n );\n\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (asset !== undefined && asset !== null) {\n localVarQueryParameter['asset'] = asset;\n }\n if (transferType !== undefined && transferType !== null) {\n localVarQueryParameter['transferType'] = transferType;\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: '/sapi/v1/portfolio/earn-asset-balance',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Repay Portfolio Margin Pro Bankruptcy Loan\n *\n * Please note that the API Key has enabled Spot & Margin Trading permissions to access this endpoint.\n *\n * Weight: 3000\n *\n * @summary Portfolio Margin Pro Bankruptcy Loan Repay\n * @param {string} [from] SPOT or MARGIN,default SPOT\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n portfolioMarginProBankruptcyLoanRepay: async (\n from?: 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 (from !== undefined && from !== null) {\n localVarQueryParameter['from'] = from;\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: '/sapi/v1/portfolio/repay',\n method: 'POST',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query Portfolio Margin Pro Bankruptcy Loan Amount\n *\n * If there’s no classic portfolio margin bankruptcy loan, the amount would be 0\n *\n * Weight: 500\n *\n * @summary Query Portfolio Margin Pro Bankruptcy Loan Amount(USER_DATA)\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n queryPortfolioMarginProBankruptcyLoanAmount: async (\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 (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: '/sapi/v1/portfolio/pmLoan',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query repay history of pmloan for portfolio margin pro.\n *\n * `startTime` and `endTime` cannot be longer than 360 days\n * If `startTime` and `endTime` not sent, return records of the last 30 days by default.\n * If `startTime`is sent and `endTime` is not sent, return records of [startTime, startTime+30d].\n * If `startTime` is not sent and `endTime` is sent, return records of [endTime-30d, endTime].\n *\n * Weight: 500\n *\n * @summary Query Portfolio Margin Pro Bankruptcy Loan Repay History(USER_DATA)\n * @param {number | bigint} [startTime]\n * @param {number | bigint} [endTime]\n * @param {number | bigint} [current] Currently querying page. Start from 1. Default:1\n * @param {number | bigint} [size] Default:10 Max:100\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n queryPortfolioMarginProBankruptcyLoanRepayHistory: async (\n startTime?: number | bigint,\n endTime?: number | bigint,\n current?: number | bigint,\n size?: 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 (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n if (current !== undefined && current !== null) {\n localVarQueryParameter['current'] = current;\n }\n if (size !== undefined && size !== null) {\n localVarQueryParameter['size'] = size;\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: '/sapi/v1/portfolio/pmloan-history',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Query interest history of negative balance for portfolio margin.\n *\n * Weight: 50\n *\n * @summary Query Portfolio Margin Pro Negative Balance Interest History(USER_DATA)\n * @param {string} [asset]\n * @param {number | bigint} [startTime]\n * @param {number | bigint} [endTime]\n * @param {number | bigint} [size] Default:10 Max:100\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n queryPortfolioMarginProNegativeBalanceInterestHistory: async (\n asset?: string,\n startTime?: number | bigint,\n endTime?: number | bigint,\n size?: 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 (asset !== undefined && asset !== null) {\n localVarQueryParameter['asset'] = asset;\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 (size !== undefined && size !== null) {\n localVarQueryParameter['size'] = size;\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: '/sapi/v1/portfolio/interest-history',\n method: 'GET',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Repay futures Negative Balance\n *\n * Weight: 1500\n *\n * @summary Repay futures Negative Balance(USER_DATA)\n * @param {string} [from] SPOT or MARGIN,default SPOT\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n repayFuturesNegativeBalance: async (\n from?: 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 (from !== undefined && from !== null) {\n localVarQueryParameter['from'] = from;\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: '/sapi/v1/portfolio/repay-futures-negative-balance',\n method: 'POST',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Set the margin call level for a Portfolio Margin account. When the account's uniMMR drops to the specified level, a notification will be sent via email and SMS.\n *\n * Weight: 1500\n *\n * @summary Set Margin Call Level (USER_DATA)\n * @param {number} marginCallLevel The value of marginCallLevel must be within the range [1.1, 2.0].\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n setMarginCallLevel: async (\n marginCallLevel: number,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n // verify required parameter 'marginCallLevel' is not null or undefined\n assertParamExists('setMarginCallLevel', 'marginCallLevel', marginCallLevel);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (marginCallLevel !== undefined && marginCallLevel !== null) {\n localVarQueryParameter['marginCallLevel'] = marginCallLevel;\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: '/sapi/v1/portfolio/margin-call-level',\n method: 'POST',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Switch the Delta mode for existing PM PRO / PM RETAIL accounts.\n *\n * Weight: 1500\n *\n * @summary Switch Delta Mode(TRADE)\n * @param {string} deltaEnabled `true` to enable Delta mode; `false` to disable Delta mode\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n switchDeltaMode: async (\n deltaEnabled: string,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n // verify required parameter 'deltaEnabled' is not null or undefined\n assertParamExists('switchDeltaMode', 'deltaEnabled', deltaEnabled);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (deltaEnabled !== undefined && deltaEnabled !== null) {\n localVarQueryParameter['deltaEnabled'] = deltaEnabled;\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: '/sapi/v1/portfolio/delta-mode',\n method: 'POST',\n queryParams: localVarQueryParameter,\n bodyParams: localVarBodyParameter,\n headerParams: localVarHeaderParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Transfer LDUSDT/RWUSD as collateral for all types of Portfolio Margin account\n *\n * Weight: 1500\n *\n * @summary Transfer LDUSDT/RWUSD for Portfolio Margin(TRADE)\n * @param {string} asset `LDUSDT` and `RWUSD`\n * @param {string} transferType `EARN_TO_FUTURE` /`FUTURE_TO_EARN`\n * @param {number} amount\n * @param {number | bigint} [recvWindow]\n *\n * @throws {RequiredError}\n */\n transferLdusdtRwusdForPortfolioMargin: async (\n asset: string,\n transferType: string,\n amount: number,\n recvWindow?: number | bigint\n ): Promise<RequestArgs> => {\n // verify required parameter 'asset' is not null or undefined\n assertParamExists('transferLdusdtRwusdForPortfolioMargin', 'asset', asset);\n // verify required parameter 'transferType' is not null or undefined\n assertParamExists(\n 'transferLdusdtRwusdForPortfolioMargin',\n 'transferType',\n transferType\n );\n // verify required parameter 'amount' is not null or undefined\n assertParamExists('transferLdusdtRwusdForPortfolioMargin', 'amount', amount);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n const localVarBodyParameter: Record<string, unknown> = {};\n const localVarHeaderParameter: Record<string, unknown> = {};\n\n if (asset !== undefined && asset !== null) {\n localVarQueryParameter['asset'] = asset;\n }\n if (transferType !== undefined && transferType !== null) {\n localVarQueryParameter['transferType'] = transferType;\n }\n if (amount !== undefined && amount !== null) {\n localVarQueryParameter['amount'] = amount;\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: '/sapi/v1/portfolio/earn-asset-transfer',\n method: 'POST',\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 * BNB transfer can be between Margin Account and USDM Account\n *\n *\n * You can only use this function 2 times per 10 minutes in a rolling manner\n *\n * Weight: 1500\n *\n * @summary BNB transfer(USER_DATA)\n * @param {BnbTransferRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n bnbTransfer(\n requestParameters: BnbTransferRequest\n ): Promise<RestApiResponse<BnbTransferResponse>>;\n /**\n * Change Auto-repay-futures Status\n *\n * Weight: 1500\n *\n * @summary Change Auto-repay-futures Status(TRADE)\n * @param {ChangeAutoRepayFuturesStatusRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n changeAutoRepayFuturesStatus(\n requestParameters: ChangeAutoRepayFuturesStatusRequest\n ): Promise<RestApiResponse<ChangeAutoRepayFuturesStatusResponse>>;\n /**\n * Delete the margin call level for a Portfolio Margin account.\n *\n * Weight: 1500\n *\n * @summary Delete Margin Call Level (USER_DATA)\n * @param {DeleteMarginCallLevelRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n deleteMarginCallLevel(\n requestParameters?: DeleteMarginCallLevelRequest\n ): Promise<RestApiResponse<DeleteMarginCallLevelResponse>>;\n /**\n * Transfers all assets from Futures Account to Margin account\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: 1500\n *\n * @summary Fund Auto-collection(USER_DATA)\n * @param {FundAutoCollectionRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n fundAutoCollection(\n requestParameters?: FundAutoCollectionRequest\n ): Promise<RestApiResponse<FundAutoCollectionResponse>>;\n /**\n * Transfers specific asset from Futures Account to Margin account\n *\n * The BNB transfer is not be supported\n *\n * Weight: 60\n *\n * @summary Fund Collection by Asset(USER_DATA)\n * @param {FundCollectionByAssetRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n fundCollectionByAsset(\n requestParameters: FundCollectionByAssetRequest\n ): Promise<RestApiResponse<FundCollectionByAssetResponse>>;\n /**\n * Query Auto-repay-futures Status\n *\n * Weight: 30\n *\n * @summary Get Auto-repay-futures Status(USER_DATA)\n * @param {GetAutoRepayFuturesStatusRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getAutoRepayFuturesStatus(\n requestParameters?: GetAutoRepayFuturesStatusRequest\n ): Promise<RestApiResponse<GetAutoRepayFuturesStatusResponse>>;\n /**\n * Query the Delta mode status of current account.\n *\n * Weight: 1500\n *\n * @summary Get Delta Mode Status(USER_DATA)\n * @param {GetDeltaModeStatusRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getDeltaModeStatus(\n requestParameters?: GetDeltaModeStatusRequest\n ): Promise<RestApiResponse<GetDeltaModeStatusResponse>>;\n /**\n * Get the margin call level for a Portfolio Margin account.\n *\n * Weight: 1500\n *\n * @summary Get Margin Call Level (USER_DATA)\n * @param {GetMarginCallLevelRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getMarginCallLevel(\n requestParameters?: GetMarginCallLevelRequest\n ): Promise<RestApiResponse<GetMarginCallLevelResponse>>;\n /**\n * Query Portfolio Margin Pro account balance\n *\n * Weight: 20\n *\n * @summary Get Portfolio Margin Pro Account Balance(USER_DATA)\n * @param {GetPortfolioMarginProAccountBalanceRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getPortfolioMarginProAccountBalance(\n requestParameters?: GetPortfolioMarginProAccountBalanceRequest\n ): Promise<RestApiResponse<GetPortfolioMarginProAccountBalanceResponse>>;\n /**\n * Get Portfolio Margin Pro Account Info\n *\n * Weight: 5\n *\n * @summary Get Portfolio Margin Pro Account Info(USER_DATA)\n * @param {GetPortfolioMarginProAccountInfoRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getPortfolioMarginProAccountInfo(\n requestParameters?: GetPortfolioMarginProAccountInfoRequest\n ): Promise<RestApiResponse<GetPortfolioMarginProAccountInfoResponse>>;\n /**\n * Get Portfolio Margin Pro SPAN Account Info (For Portfolio Margin Pro SPAN users only)\n *\n * Weight: 5\n *\n * @summary Get Portfolio Margin Pro SPAN Account Info(USER_DATA)\n * @param {GetPortfolioMarginProSpanAccountInfoRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getPortfolioMarginProSpanAccountInfo(\n requestParameters?: GetPortfolioMarginProSpanAccountInfoRequest\n ): Promise<RestApiResponse<GetPortfolioMarginProSpanAccountInfoResponse>>;\n /**\n * Get transferable earn asset balance for all types of Portfolio Margin account\n *\n * Weight: 1500\n *\n * @summary Get Transferable Earn Asset Balance for Portfolio Margin (USER_DATA)\n * @param {GetTransferableEarnAssetBalanceForPortfolioMarginRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getTransferableEarnAssetBalanceForPortfolioMargin(\n requestParameters: GetTransferableEarnAssetBalanceForPortfolioMarginRequest\n ): Promise<RestApiResponse<GetTransferableEarnAssetBalanceForPortfolioMarginResponse>>;\n /**\n * Repay Portfolio Margin Pro Bankruptcy Loan\n *\n * Please note that the API Key has enabled Spot & Margin Trading permissions to access this endpoint.\n *\n * Weight: 3000\n *\n * @summary Portfolio Margin Pro Bankruptcy Loan Repay\n * @param {PortfolioMarginProBankruptcyLoanRepayRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n portfolioMarginProBankruptcyLoanRepay(\n requestParameters?: PortfolioMarginProBankruptcyLoanRepayRequest\n ): Promise<RestApiResponse<PortfolioMarginProBankruptcyLoanRepayResponse>>;\n /**\n * Query Portfolio Margin Pro Bankruptcy Loan Amount\n *\n * If there’s no classic portfolio margin bankruptcy loan, the amount would be 0\n *\n * Weight: 500\n *\n * @summary Query Portfolio Margin Pro Bankruptcy Loan Amount(USER_DATA)\n * @param {QueryPortfolioMarginProBankruptcyLoanAmountRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n queryPortfolioMarginProBankruptcyLoanAmount(\n requestParameters?: QueryPortfolioMarginProBankruptcyLoanAmountRequest\n ): Promise<RestApiResponse<QueryPortfolioMarginProBankruptcyLoanAmountResponse>>;\n /**\n * Query repay history of pmloan for portfolio margin pro.\n *\n * `startTime` and `endTime` cannot be longer than 360 days\n * If `startTime` and `endTime` not sent, return records of the last 30 days by default.\n * If `startTime`is sent and `endTime` is not sent, return records of [startTime, startTime+30d].\n * If `startTime` is not sent and `endTime` is sent, return records of [endTime-30d, endTime].\n *\n * Weight: 500\n *\n * @summary Query Portfolio Margin Pro Bankruptcy Loan Repay History(USER_DATA)\n * @param {QueryPortfolioMarginProBankruptcyLoanRepayHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n queryPortfolioMarginProBankruptcyLoanRepayHistory(\n requestParameters?: QueryPortfolioMarginProBankruptcyL