UNPKG

@binance/spot

Version:

Official Binance Spot Connector - A lightweight library that provides a convenient interface to Binance's Spot REST API, WebSocket API and WebSocket Streams.

1 lines 848 kB
{"version":3,"sources":["../src/spot.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/modules/account-api.ts","../src/rest-api/modules/general-api.ts","../src/rest-api/modules/market-api.ts","../src/rest-api/modules/trade-api.ts","../src/rest-api/modules/user-data-stream-api.ts","../src/rest-api/rest-api.ts","../src/websocket-api/index.ts","../src/websocket-api/modules/account-api.ts","../src/websocket-api/modules/auth-api.ts","../src/websocket-api/modules/general-api.ts","../src/websocket-api/modules/market-api.ts","../src/websocket-api/modules/trade-api.ts","../src/websocket-api/modules/user-data-stream-api.ts","../src/websocket-api/websocket-api.ts","../src/websocket-api/websocket-api-connection.ts","../src/websocket-streams/index.ts","../src/websocket-streams/modules/web-socket-streams-api.ts","../src/websocket-streams/websocket-streams.ts","../src/websocket-streams/websocket-streams-connection.ts","../src/index.ts"],"sourcesContent":["import {\n buildUserAgent,\n ConfigurationRestAPI,\n ConfigurationWebsocketAPI,\n ConfigurationWebsocketStreams,\n SPOT_REST_API_PROD_URL,\n SPOT_WS_API_PROD_URL,\n SPOT_WS_STREAMS_PROD_URL,\n} from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\nimport { WebsocketAPI } from './websocket-api';\nimport { WebsocketStreams } from './websocket-streams';\n\nexport interface ConfigurationSpot {\n configurationRestAPI?: ConfigurationRestAPI;\n configurationWebsocketAPI?: ConfigurationWebsocketAPI;\n configurationWebsocketStreams?: ConfigurationWebsocketStreams;\n}\n\nexport class Spot {\n public restAPI!: RestAPI;\n public websocketAPI!: WebsocketAPI;\n public websocketStreams!: WebsocketStreams;\n\n constructor(config: ConfigurationSpot) {\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 = configRestAPI.basePath || SPOT_REST_API_PROD_URL;\n configRestAPI.baseOptions = configRestAPI.baseOptions || {};\n configRestAPI.baseOptions.headers = {\n ...(configRestAPI.baseOptions.headers || {}),\n 'User-Agent': userAgent,\n };\n this.restAPI = new RestAPI(configRestAPI);\n }\n if (config?.configurationWebsocketAPI) {\n const configWebsocketAPI = new ConfigurationWebsocketAPI(\n config.configurationWebsocketAPI\n ) as ConfigurationWebsocketAPI & {\n userAgent: string;\n };\n configWebsocketAPI.wsURL = configWebsocketAPI.wsURL || SPOT_WS_API_PROD_URL;\n configWebsocketAPI.userAgent = userAgent;\n this.websocketAPI = new WebsocketAPI(configWebsocketAPI);\n }\n if (config?.configurationWebsocketStreams) {\n const configWebsocketStreams = new ConfigurationWebsocketStreams(\n config.configurationWebsocketStreams\n ) as ConfigurationWebsocketStreams & {\n userAgent: string;\n };\n configWebsocketStreams.wsURL = configWebsocketStreams.wsURL || SPOT_WS_STREAMS_PROD_URL;\n configWebsocketStreams.userAgent = userAgent;\n this.websocketStreams = new WebsocketStreams(configWebsocketStreams);\n }\n }\n}\n","{\n \"name\": \"@binance/spot\",\n \"description\": \"Official Binance Spot Connector - A lightweight library that provides a convenient interface to Binance's Spot REST API, WebSocket API and WebSocket Streams.\",\n \"version\": \"16.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 && 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 \"Spot\",\n \"Connector\",\n \"REST\",\n \"WebSocket\",\n \"Trading\"\n ],\n \"author\": \"Binance\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/binance/binance-connector-js.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/binance/binance-connector-js/issues\"\n },\n \"homepage\": \"https://github.com/binance/binance-connector-js#readme\",\n \"files\": [\n \"dist\"\n ],\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/node\": \"^20.17.24\",\n \"eslint\": \"8.57.0\",\n \"jest\": \"^29.6.4\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsup\": \"^8.4.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"1.2.4\",\n \"@types/ws\": \"^8.5.5\",\n \"axios\": \"^1.7.4\",\n \"ws\": \"^8.17.1\"\n }\n}\n","/**\n * Binance Spot REST API\n *\n * OpenAPI Specifications for the Binance Spot REST API\n *\n * API documents:\n * - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md)\n * - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information)\n *\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 Spot REST API\n *\n * OpenAPI Specifications for the Binance Spot REST API\n *\n * API documents:\n * - [Github rest-api documentation file](https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md)\n * - [General API information for rest-api on website](https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-api-information)\n *\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 AccountCommissionResponse,\n AllOrderListResponse,\n AllOrdersResponse,\n GetAccountResponse,\n GetOpenOrdersResponse,\n GetOrderListResponse,\n GetOrderResponse,\n MyAllocationsResponse,\n MyPreventedMatchesResponse,\n MyTradesResponse,\n OpenOrderListResponse,\n OrderAmendmentsResponse,\n RateLimitOrderResponse,\n} from '../types';\n\n/**\n * AccountApi - axios parameter creator\n */\nconst AccountApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Get current account commission rates.\n * Weight: 20\n *\n * @summary Query Commission Rates\n * @param {string} symbol\n *\n * @throws {RequiredError}\n */\n accountCommission: async (symbol: string): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('accountCommission', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/api/v3/account/commission',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Retrieves all order lists based on provided optional parameters.\n *\n * Note that the time between `startTime` and `endTime` can't be longer than 24 hours.\n * Weight: 20\n *\n * @summary Query all Order lists\n * @param {number} [fromId] ID to get aggregate trades from INCLUSIVE.\n * @param {number} [startTime] Timestamp in ms to get aggregate trades from INCLUSIVE.\n * @param {number} [endTime] Timestamp in ms to get aggregate trades until INCLUSIVE.\n * @param {number} [limit] Default: 500; Maximum: 1000.\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n allOrderList: async (\n fromId?: number,\n startTime?: number,\n endTime?: number,\n limit?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (fromId !== undefined && fromId !== null) {\n localVarQueryParameter['fromId'] = fromId;\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 (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: '/api/v3/allOrderList',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get all account orders; active, canceled, or filled.\n * Weight: 20\n *\n * @summary All orders\n * @param {string} symbol\n * @param {number} [orderId]\n * @param {number} [startTime] Timestamp in ms to get aggregate trades from INCLUSIVE.\n * @param {number} [endTime] Timestamp in ms to get aggregate trades until INCLUSIVE.\n * @param {number} [limit] Default: 500; Maximum: 1000.\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n allOrders: async (\n symbol: string,\n orderId?: number,\n startTime?: number,\n endTime?: number,\n limit?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('allOrders', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (orderId !== undefined && orderId !== null) {\n localVarQueryParameter['orderId'] = orderId;\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 (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: '/api/v3/allOrders',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get current account information.\n * Weight: 20\n *\n * @summary Account information\n * @param {boolean} [omitZeroBalances] When set to `true`, emits only the non-zero balances of an account. <br>Default value: `false`\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n getAccount: async (\n omitZeroBalances?: boolean,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (omitZeroBalances !== undefined && omitZeroBalances !== null) {\n localVarQueryParameter['omitZeroBalances'] = omitZeroBalances;\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: '/api/v3/account',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get all open orders on a symbol. **Careful** when accessing this with no symbol.\n * Weight: 6 for a single symbol; **80** when the symbol parameter is omitted\n *\n * @summary Current open orders\n * @param {string} [symbol] Symbol to query\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n getOpenOrders: async (symbol?: string, recvWindow?: number): 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: '/api/v3/openOrders',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Check an order's status.\n * Weight: 4\n *\n * @summary Query order\n * @param {string} symbol\n * @param {number} [orderId]\n * @param {string} [origClientOrderId]\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n getOrder: async (\n symbol: string,\n orderId?: number,\n origClientOrderId?: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('getOrder', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (orderId !== undefined && orderId !== null) {\n localVarQueryParameter['orderId'] = orderId;\n }\n\n if (origClientOrderId !== undefined && origClientOrderId !== null) {\n localVarQueryParameter['origClientOrderId'] = origClientOrderId;\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: '/api/v3/order',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Retrieves a specific order list based on provided optional parameters.\n * Weight: 4\n *\n * @summary Query Order list\n * @param {number} [orderListId] Either `orderListId` or `listClientOrderId` must be provided\n * @param {string} [origClientOrderId]\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n getOrderList: async (\n orderListId?: number,\n origClientOrderId?: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (orderListId !== undefined && orderListId !== null) {\n localVarQueryParameter['orderListId'] = orderListId;\n }\n\n if (origClientOrderId !== undefined && origClientOrderId !== null) {\n localVarQueryParameter['origClientOrderId'] = origClientOrderId;\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: '/api/v3/orderList',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Retrieves allocations resulting from SOR order placement.\n * Weight: 20\n *\n * @summary Query Allocations\n * @param {string} symbol\n * @param {number} [startTime] Timestamp in ms to get aggregate trades from INCLUSIVE.\n * @param {number} [endTime] Timestamp in ms to get aggregate trades until INCLUSIVE.\n * @param {number} [fromAllocationId]\n * @param {number} [limit] Default: 500; Maximum: 1000.\n * @param {number} [orderId]\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n myAllocations: async (\n symbol: string,\n startTime?: number,\n endTime?: number,\n fromAllocationId?: number,\n limit?: number,\n orderId?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('myAllocations', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\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 (fromAllocationId !== undefined && fromAllocationId !== null) {\n localVarQueryParameter['fromAllocationId'] = fromAllocationId;\n }\n\n if (limit !== undefined && limit !== null) {\n localVarQueryParameter['limit'] = limit;\n }\n\n if (orderId !== undefined && orderId !== null) {\n localVarQueryParameter['orderId'] = orderId;\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: '/api/v3/myAllocations',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Displays the list of orders that were expired due to STP.\n *\n * These are the combinations supported:\n *\n * `symbol` + `preventedMatchId`\n * `symbol` + `orderId`\n * `symbol` + `orderId` + `fromPreventedMatchId` (`limit` will default to 500)\n * `symbol` + `orderId` + `fromPreventedMatchId` + `limit`\n * Weight: Case | Weight\n * ---- | -----\n * If `symbol` is invalid | 2\n * Querying by `preventedMatchId` | 2\n * Querying by `orderId` | 20\n *\n * @summary Query Prevented Matches\n * @param {string} symbol\n * @param {number} [preventedMatchId]\n * @param {number} [orderId]\n * @param {number} [fromPreventedMatchId]\n * @param {number} [limit] Default: 500; Maximum: 1000.\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n myPreventedMatches: async (\n symbol: string,\n preventedMatchId?: number,\n orderId?: number,\n fromPreventedMatchId?: number,\n limit?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('myPreventedMatches', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (preventedMatchId !== undefined && preventedMatchId !== null) {\n localVarQueryParameter['preventedMatchId'] = preventedMatchId;\n }\n\n if (orderId !== undefined && orderId !== null) {\n localVarQueryParameter['orderId'] = orderId;\n }\n\n if (fromPreventedMatchId !== undefined && fromPreventedMatchId !== null) {\n localVarQueryParameter['fromPreventedMatchId'] = fromPreventedMatchId;\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: '/api/v3/myPreventedMatches',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get trades for a specific account and symbol.\n * Weight: Condition| Weight|\n * ---| ---\n * |Without orderId|20|\n * |With orderId|5|\n *\n * @summary Account trade list\n * @param {string} symbol\n * @param {number} [orderId]\n * @param {number} [startTime] Timestamp in ms to get aggregate trades from INCLUSIVE.\n * @param {number} [endTime] Timestamp in ms to get aggregate trades until INCLUSIVE.\n * @param {number} [fromId] ID to get aggregate trades from INCLUSIVE.\n * @param {number} [limit] Default: 500; Maximum: 1000.\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n myTrades: async (\n symbol: string,\n orderId?: number,\n startTime?: number,\n endTime?: number,\n fromId?: number,\n limit?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('myTrades', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (orderId !== undefined && orderId !== null) {\n localVarQueryParameter['orderId'] = orderId;\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 (fromId !== undefined && fromId !== null) {\n localVarQueryParameter['fromId'] = fromId;\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: '/api/v3/myTrades',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n *\n * Weight: 6\n *\n * @summary Query Open Order lists\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n openOrderList: 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: '/api/v3/openOrderList',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Queries all amendments of a single order.\n * Weight: 4\n *\n * @summary Query Order Amendments\n * @param {string} symbol\n * @param {number} orderId\n * @param {number} [fromExecutionId]\n * @param {number} [limit] Default:500; Maximum: 1000\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n orderAmendments: async (\n symbol: string,\n orderId: number,\n fromExecutionId?: number,\n limit?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('orderAmendments', 'symbol', symbol);\n // verify required parameter 'orderId' is not null or undefined\n assertParamExists('orderAmendments', 'orderId', orderId);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (orderId !== undefined && orderId !== null) {\n localVarQueryParameter['orderId'] = orderId;\n }\n\n if (fromExecutionId !== undefined && fromExecutionId !== null) {\n localVarQueryParameter['fromExecutionId'] = fromExecutionId;\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: '/api/v3/order/amendments',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Displays the user's unfilled order count for all intervals.\n * Weight: 40\n *\n * @summary Query Unfilled Order Count\n * @param {number} [recvWindow] The value cannot be greater than `60000`\n *\n * @throws {RequiredError}\n */\n rateLimitOrder: 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: '/api/v3/rateLimit/order',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * AccountApi - interface\n * @interface AccountApi\n */\nexport interface AccountApiInterface {\n /**\n * Get current account commission rates.\n * Weight: 20\n *\n * @summary Query Commission Rates\n * @param {AccountCommissionRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n accountCommission(\n requestParameters: AccountCommissionRequest\n ): Promise<RestApiResponse<AccountCommissionResponse>>;\n /**\n * Retrieves all order lists based on provided optional parameters.\n *\n * Note that the time between `startTime` and `endTime` can't be longer than 24 hours.\n * Weight: 20\n *\n * @summary Query all Order lists\n * @param {AllOrderListRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n allOrderList(\n requestParameters?: AllOrderListRequest\n ): Promise<RestApiResponse<AllOrderListResponse>>;\n /**\n * Get all account orders; active, canceled, or filled.\n * Weight: 20\n *\n * @summary All orders\n * @param {AllOrdersRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n allOrders(requestParameters: AllOrdersRequest): Promise<RestApiResponse<AllOrdersResponse>>;\n /**\n * Get current account information.\n * Weight: 20\n *\n * @summary Account information\n * @param {GetAccountRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getAccount(requestParameters?: GetAccountRequest): Promise<RestApiResponse<GetAccountResponse>>;\n /**\n * Get all open orders on a symbol. **Careful** when accessing this with no symbol.\n * Weight: 6 for a single symbol; **80** when the symbol parameter is omitted\n *\n * @summary Current open orders\n * @param {GetOpenOrdersRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getOpenOrders(\n requestParameters?: GetOpenOrdersRequest\n ): Promise<RestApiResponse<GetOpenOrdersResponse>>;\n /**\n * Check an order's status.\n * Weight: 4\n *\n * @summary Query order\n * @param {GetOrderRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getOrder(requestParameters: GetOrderRequest): Promise<RestApiResponse<GetOrderResponse>>;\n /**\n * Retrieves a specific order list based on provided optional parameters.\n * Weight: 4\n *\n * @summary Query Order list\n * @param {GetOrderListRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getOrderList(\n requestParameters?: GetOrderListRequest\n ): Promise<RestApiResponse<GetOrderListResponse>>;\n /**\n * Retrieves allocations resulting from SOR order placement.\n * Weight: 20\n *\n * @summary Query Allocations\n * @param {MyAllocationsRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n myAllocations(\n requestParameters: MyAllocationsRequest\n ): Promise<RestApiResponse<MyAllocationsResponse>>;\n /**\n * Displays the list of orders that were expired due to STP.\n *\n * These are the combinations supported:\n *\n * `symbol` + `preventedMatchId`\n * `symbol` + `orderId`\n * `symbol` + `orderId` + `fromPreventedMatchId` (`limit` will default to 500)\n * `symbol` + `orderId` + `fromPreventedMatchId` + `limit`\n * Weight: Case | Weight\n * ---- | -----\n * If `symbol` is invalid | 2\n * Querying by `preventedMatchId` | 2\n * Querying by `orderId` | 20\n *\n * @summary Query Prevented Matches\n * @param {MyPreventedMatchesRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n myPreventedMatches(\n requestParameters: MyPreventedMatchesRequest\n ): Promise<RestApiResponse<MyPreventedMatchesResponse>>;\n /**\n * Get trades for a specific account and symbol.\n * Weight: Condition| Weight|\n * ---| ---\n * |Without orderId|20|\n * |With orderId|5|\n *\n * @summary Account trade list\n * @param {MyTradesRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n myTrades(requestParameters: MyTradesRequest): Promise<RestApiResponse<MyTradesResponse>>;\n /**\n *\n * Weight: 6\n *\n * @summary Query Open Order lists\n * @param {OpenOrderListRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n openOrderList(\n requestParameters?: OpenOrderListRequest\n ): Promise<RestApiResponse<OpenOrderListResponse>>;\n /**\n * Queries all amendments of a single order.\n * Weight: 4\n *\n * @summary Query Order Amendments\n * @param {OrderAmendmentsRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n orderAmendments(\n requestParameters: OrderAmendmentsRequest\n ): Promise<RestApiResponse<OrderAmendmentsResponse>>;\n /**\n * Displays the user's unfilled order count for all intervals.\n * Weight: 40\n *\n * @summary Query Unfilled Order Count\n * @param {RateLimitOrderRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n rateLimitOrder(\n requestParameters?: RateLimitOrderRequest\n ): Promise<RestApiResponse<RateLimitOrderResponse>>;\n}\n\n/**\n * Request parameters for accountCommission operation in AccountApi.\n * @interface AccountCommissionRequest\n */\nexport interface AccountCommissionRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiAccountCommission\n */\n readonly symbol: string;\n}\n\n/**\n * Request parameters for allOrderList operation in AccountApi.\n * @interface AllOrderListRequest\n */\nexport interface AllOrderListRequest {\n /**\n * ID to get aggregate trades from INCLUSIVE.\n * @type {number}\n * @memberof AccountApiAllOrderList\n */\n readonly fromId?: number;\n\n /**\n * Timestamp in ms to get aggregate trades from INCLUSIVE.\n * @type {number}\n * @memberof AccountApiAllOrderList\n */\n readonly startTime?: number;\n\n /**\n * Timestamp in ms to get aggregate trades until INCLUSIVE.\n * @type {number}\n * @memberof AccountApiAllOrderList\n */\n readonly endTime?: number;\n\n /**\n * Default: 500; Maximum: 1000.\n * @type {number}\n * @memberof AccountApiAllOrderList\n */\n readonly limit?: number;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiAllOrderList\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for allOrders operation in AccountApi.\n * @interface AllOrdersRequest\n */\nexport interface AllOrdersRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiAllOrders\n */\n readonly symbol: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiAllOrders\n */\n readonly orderId?: number;\n\n /**\n * Timestamp in ms to get aggregate trades from INCLUSIVE.\n * @type {number}\n * @memberof AccountApiAllOrders\n */\n readonly startTime?: number;\n\n /**\n * Timestamp in ms to get aggregate trades until INCLUSIVE.\n * @type {number}\n * @memberof AccountApiAllOrders\n */\n readonly endTime?: number;\n\n /**\n * Default: 500; Maximum: 1000.\n * @type {number}\n * @memberof AccountApiAllOrders\n */\n readonly limit?: number;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiAllOrders\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getAccount operation in AccountApi.\n * @interface GetAccountRequest\n */\nexport interface GetAccountRequest {\n /**\n * When set to `true`, emits only the non-zero balances of an account. <br>Default value: `false`\n * @type {boolean}\n * @memberof AccountApiGetAccount\n */\n readonly omitZeroBalances?: boolean;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiGetAccount\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getOpenOrders operation in AccountApi.\n * @interface GetOpenOrdersRequest\n */\nexport interface GetOpenOrdersRequest {\n /**\n * Symbol to query\n * @type {string}\n * @memberof AccountApiGetOpenOrders\n */\n readonly symbol?: string;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiGetOpenOrders\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getOrder operation in AccountApi.\n * @interface GetOrderRequest\n */\nexport interface GetOrderRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiGetOrder\n */\n readonly symbol: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetOrder\n */\n readonly orderId?: number;\n\n /**\n *\n * @type {string}\n * @memberof AccountApiGetOrder\n */\n readonly origClientOrderId?: string;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiGetOrder\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getOrderList operation in AccountApi.\n * @interface GetOrderListRequest\n */\nexport interface GetOrderListRequest {\n /**\n * Either `orderListId` or `listClientOrderId` must be provided\n * @type {number}\n * @memberof AccountApiGetOrderList\n */\n readonly orderListId?: number;\n\n /**\n *\n * @type {string}\n * @memberof AccountApiGetOrderList\n */\n readonly origClientOrderId?: string;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiGetOrderList\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for myAllocations operation in AccountApi.\n * @interface MyAllocationsRequest\n */\nexport interface MyAllocationsRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiMyAllocations\n */\n readonly symbol: string;\n\n /**\n * Timestamp in ms to get aggregate trades from INCLUSIVE.\n * @type {number}\n * @memberof AccountApiMyAllocations\n */\n readonly startTime?: number;\n\n /**\n * Timestamp in ms to get aggregate trades until INCLUSIVE.\n * @type {number}\n * @memberof AccountApiMyAllocations\n */\n readonly endTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiMyAllocations\n */\n readonly fromAllocationId?: number;\n\n /**\n * Default: 500; Maximum: 1000.\n * @type {number}\n * @memberof AccountApiMyAllocations\n */\n readonly limit?: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiMyAllocations\n */\n readonly orderId?: number;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiMyAllocations\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for myPreventedMatches operation in AccountApi.\n * @interface MyPreventedMatchesRequest\n */\nexport interface MyPreventedMatchesRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiMyPreventedMatches\n */\n readonly symbol: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiMyPreventedMatches\n */\n readonly preventedMatchId?: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiMyPreventedMatches\n */\n readonly orderId?: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiMyPreventedMatches\n */\n readonly fromPreventedMatchId?: number;\n\n /**\n * Default: 500; Maximum: 1000.\n * @type {number}\n * @memberof AccountApiMyPreventedMatches\n */\n readonly limit?: number;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiMyPreventedMatches\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for myTrades operation in AccountApi.\n * @interface MyTradesRequest\n */\nexport interface MyTradesRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiMyTrades\n */\n readonly symbol: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiMyTrades\n */\n readonly orderId?: number;\n\n /**\n * Timestamp in ms to get aggregate trades from INCLUSIVE.\n * @type {number}\n * @memberof AccountApiMyTrades\n */\n readonly startTime?: number;\n\n /**\n * Timestamp in ms to get aggregate trades until INCLUSIVE.\n * @type {number}\n * @memberof AccountApiMyTrades\n */\n readonly endTime?: number;\n\n /**\n * ID to get aggregate trades from INCLUSIVE.\n * @type {number}\n * @memberof AccountApiMyTrades\n */\n readonly fromId?: number;\n\n /**\n * Default: 500; Maximum: 1000.\n * @type {number}\n * @memberof AccountApiMyTrades\n */\n readonly limit?: number;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiMyTrades\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for openOrderList operation in AccountApi.\n * @interface OpenOrderListRequest\n */\nexport interface OpenOrderListRequest {\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiOpenOrderList\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for orderAmendments operation in AccountApi.\n * @interface OrderAmendmentsRequest\n */\nexport interface OrderAmendmentsRequest {\n /**\n *\n * @type {string}\n * @memberof AccountApiOrderAmendments\n */\n readonly symbol: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiOrderAmendments\n */\n readonly orderId: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiOrderAmendments\n */\n readonly fromExecutionId?: number;\n\n /**\n * Default:500; Maximum: 1000\n * @type {number}\n * @memberof AccountApiOrderAmendments\n */\n readonly limit?: number;\n\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiOrderAmendments\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for rateLimitOrder operation in AccountApi.\n * @interface RateLimitOrderRequest\n */\nexport interface RateLimitOrderRequest {\n /**\n * The value cannot be greater than `60000`\n * @type {number}\n * @memberof AccountApiRateLimitOrder\n */\n readonly recvWindow?: number;\n}\n\n/**\n * AccountApi - object-oriented interface\n * @class AccountApi\n */\nexport class AccountApi implements AccountApiInterface {\n private readonly configuration: ConfigurationRestAPI;\n private localVarAxiosParamCreator;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.localVarAxiosParamCreator = AccountApiAxiosParamCreator(configuration);\n }\n\n /**\n * Get current account commission rates.\n * Weight: 20\n *\n * @summary Query Commission Rates\n * @param {AccountCommiss