UNPKG

@binance/derivatives-trading-options

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 378 kB
{"version":3,"sources":["../src/derivatives-trading-options.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/types/place-multiple-orders-orders-parameter-inner.ts","../src/rest-api/modules/account-api.ts","../src/rest-api/modules/market-data-api.ts","../src/rest-api/modules/market-maker-block-trade-api.ts","../src/rest-api/modules/market-maker-endpoints-api.ts","../src/rest-api/modules/trade-api.ts","../src/rest-api/modules/user-data-streams-api.ts","../src/rest-api/rest-api.ts","../src/websocket-streams/index.ts","../src/websocket-streams/modules/websocket-market-streams-api.ts","../src/websocket-streams/websocket-streams.ts","../src/websocket-streams/websocket-streams-connection.ts","../src/index.ts"],"sourcesContent":["import { platform, arch } from 'os';\nimport {\n ConfigurationRestAPI,\n ConfigurationWebsocketStreams,\n DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL,\n DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL,\n} from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\n\nimport { WebsocketStreams } from './websocket-streams';\n\nexport interface ConfigurationDerivativesTradingOptions {\n configurationRestAPI?: ConfigurationRestAPI;\n\n configurationWebsocketStreams?: ConfigurationWebsocketStreams;\n}\n\nexport class DerivativesTradingOptions {\n public restAPI!: RestAPI;\n\n public websocketStreams!: WebsocketStreams;\n\n constructor(config: ConfigurationDerivativesTradingOptions) {\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(config.configurationRestAPI);\n configRestAPI.basePath =\n configRestAPI.basePath || DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL;\n configRestAPI.baseOptions = configRestAPI.baseOptions || {};\n configRestAPI.baseOptions.headers = {\n ...(configRestAPI.baseOptions.headers || {}),\n 'User-Agent': `${name}/${version} (Node.js/${process.version}; ${platform()}; ${arch()})`,\n };\n this.restAPI = new RestAPI(configRestAPI);\n }\n if (config?.configurationWebsocketStreams) {\n const configWebsocketStreams = new ConfigurationWebsocketStreams(\n config.configurationWebsocketStreams\n );\n configWebsocketStreams.wsURL =\n configWebsocketStreams.wsURL || DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL;\n this.websocketStreams = new WebsocketStreams(configWebsocketStreams);\n }\n }\n}\n","{\n \"name\": \"@binance/derivatives-trading-options\",\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\": \"1.0.0\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"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 \"@types/ws\": \"^8.5.5\",\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\": \"^7.2.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"1.0.0\",\n \"axios\": \"^1.7.4\",\n \"ws\": \"^8.17.1\"\n }\n}\n","/**\n * Binance Public Derivatives Trading Options REST API\n *\n * OpenAPI Specification for the Binance Public Derivatives Trading Options REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nexport * from './types';\nexport * from './modules';\nexport * from './rest-api';\n","/* tslint:disable */\n\n/**\n * Binance Public Derivatives Trading Options REST API\n *\n * OpenAPI Specification for the Binance Public Derivatives Trading Options REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n/**\n *\n * @export\n * @interface PlaceMultipleOrdersOrdersParameterInner\n */\nexport interface PlaceMultipleOrdersOrdersParameterInner {\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n symbol?: string;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n side?: PlaceMultipleOrdersOrdersParameterInnerSideEnum;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n type?: PlaceMultipleOrdersOrdersParameterInnerTypeEnum;\n /**\n *\n * @type {number}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n quantity?: number;\n /**\n *\n * @type {number}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n price?: number;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n timeInForce?: PlaceMultipleOrdersOrdersParameterInnerTimeInForceEnum;\n /**\n *\n * @type {boolean}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n reduceOnly?: boolean;\n /**\n *\n * @type {boolean}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n postOnly?: boolean;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n newOrderRespType?: PlaceMultipleOrdersOrdersParameterInnerNewOrderRespTypeEnum;\n /**\n *\n * @type {string}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n clientOrderId?: string;\n /**\n *\n * @type {boolean}\n * @memberof PlaceMultipleOrdersOrdersParameterInner\n */\n isMmp?: boolean;\n}\n\nexport const PlaceMultipleOrdersOrdersParameterInnerSideEnum = {\n BUY: 'BUY',\n SELL: 'SELL',\n} as const;\n\nexport type PlaceMultipleOrdersOrdersParameterInnerSideEnum =\n (typeof PlaceMultipleOrdersOrdersParameterInnerSideEnum)[keyof typeof PlaceMultipleOrdersOrdersParameterInnerSideEnum];\nexport const PlaceMultipleOrdersOrdersParameterInnerTypeEnum = {\n LIMIT: 'LIMIT',\n} as const;\n\nexport type PlaceMultipleOrdersOrdersParameterInnerTypeEnum =\n (typeof PlaceMultipleOrdersOrdersParameterInnerTypeEnum)[keyof typeof PlaceMultipleOrdersOrdersParameterInnerTypeEnum];\nexport const PlaceMultipleOrdersOrdersParameterInnerTimeInForceEnum = {\n GTC: 'GTC',\n IOC: 'IOC',\n FOK: 'FOK',\n} as const;\n\nexport type PlaceMultipleOrdersOrdersParameterInnerTimeInForceEnum =\n (typeof PlaceMultipleOrdersOrdersParameterInnerTimeInForceEnum)[keyof typeof PlaceMultipleOrdersOrdersParameterInnerTimeInForceEnum];\nexport const PlaceMultipleOrdersOrdersParameterInnerNewOrderRespTypeEnum = {\n ACK: 'ACK',\n RESULT: 'RESULT',\n} as const;\n\nexport type PlaceMultipleOrdersOrdersParameterInnerNewOrderRespTypeEnum =\n (typeof PlaceMultipleOrdersOrdersParameterInnerNewOrderRespTypeEnum)[keyof typeof PlaceMultipleOrdersOrdersParameterInnerNewOrderRespTypeEnum];\n","/**\n * Binance Public Derivatives Trading Options REST API\n *\n * OpenAPI Specification for the Binance Public Derivatives Trading Options 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 AccountFundingFlowResponse,\n GetDownloadIdForOptionTransactionHistoryResponse,\n GetOptionTransactionHistoryDownloadLinkByIdResponse,\n OptionAccountInformationResponse,\n} from '../types';\n\n/**\n * AccountApi - axios parameter creator\n */\nconst AccountApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Query account funding flows.\n *\n * Weight: 1\n *\n * @summary Account Funding Flow (USER_DATA)\n * @param {string} currency Asset type, only support USDT as of now\n * @param {number} [recordId] Return the recordId and subsequent data, the latest data is returned by default, e.g 100000\n * @param {number} [startTime] Start Time, e.g 1593511200000\n * @param {number} [endTime] End Time, e.g 1593512200000\n * @param {number} [limit] Number of result sets returned Default:100 Max:1000\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n accountFundingFlow: async (\n currency: string,\n recordId?: number,\n startTime?: number,\n endTime?: number,\n limit?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'currency' is not null or undefined\n assertParamExists('accountFundingFlow', 'currency', currency);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (currency !== undefined && currency !== null) {\n localVarQueryParameter['currency'] = currency;\n }\n\n if (recordId !== undefined && recordId !== null) {\n localVarQueryParameter['recordId'] = recordId;\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: '/eapi/v1/bill',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get download id for option transaction history\n *\n * Request Limitation is 5 times per month, shared by > front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Option Transaction History (USER_DATA)\n * @param {number} startTime Timestamp in ms\n * @param {number} endTime Timestamp in ms\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getDownloadIdForOptionTransactionHistory: 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('getDownloadIdForOptionTransactionHistory', 'startTime', startTime);\n // verify required parameter 'endTime' is not null or undefined\n assertParamExists('getDownloadIdForOptionTransactionHistory', '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: '/eapi/v1/income/asyn',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get option transaction history download Link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Option Transaction History Download Link by Id (USER_DATA)\n * @param {string} downloadId get by download id api\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getOptionTransactionHistoryDownloadLinkById: async (\n downloadId: string,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'downloadId' is not null or undefined\n assertParamExists(\n 'getOptionTransactionHistoryDownloadLinkById',\n 'downloadId',\n downloadId\n );\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (downloadId !== undefined && downloadId !== null) {\n localVarQueryParameter['downloadId'] = downloadId;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/income/asyn/id',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get current account information.\n *\n * Weight: 3\n *\n * @summary Option Account Information(TRADE)\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n optionAccountInformation: 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: '/eapi/v1/account',\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 * Query account funding flows.\n *\n * Weight: 1\n *\n * @summary Account Funding Flow (USER_DATA)\n * @param {AccountFundingFlowRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n accountFundingFlow(\n requestParameters: AccountFundingFlowRequest\n ): Promise<RestApiResponse<AccountFundingFlowResponse>>;\n /**\n * Get download id for option transaction history\n *\n * Request Limitation is 5 times per month, shared by > front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Option Transaction History (USER_DATA)\n * @param {GetDownloadIdForOptionTransactionHistoryRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getDownloadIdForOptionTransactionHistory(\n requestParameters: GetDownloadIdForOptionTransactionHistoryRequest\n ): Promise<RestApiResponse<GetDownloadIdForOptionTransactionHistoryResponse>>;\n /**\n * Get option transaction history download Link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Option Transaction History Download Link by Id (USER_DATA)\n * @param {GetOptionTransactionHistoryDownloadLinkByIdRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n getOptionTransactionHistoryDownloadLinkById(\n requestParameters: GetOptionTransactionHistoryDownloadLinkByIdRequest\n ): Promise<RestApiResponse<GetOptionTransactionHistoryDownloadLinkByIdResponse>>;\n /**\n * Get current account information.\n *\n * Weight: 3\n *\n * @summary Option Account Information(TRADE)\n * @param {OptionAccountInformationRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApiInterface\n */\n optionAccountInformation(\n requestParameters?: OptionAccountInformationRequest\n ): Promise<RestApiResponse<OptionAccountInformationResponse>>;\n}\n\n/**\n * Request parameters for accountFundingFlow operation in AccountApi.\n * @interface AccountFundingFlowRequest\n */\nexport interface AccountFundingFlowRequest {\n /**\n * Asset type, only support USDT as of now\n * @type {string}\n * @memberof AccountApiAccountFundingFlow\n */\n readonly currency: string;\n\n /**\n * Return the recordId and subsequent data, the latest data is returned by default, e.g 100000\n * @type {number}\n * @memberof AccountApiAccountFundingFlow\n */\n readonly recordId?: number;\n\n /**\n * Start Time, e.g 1593511200000\n * @type {number}\n * @memberof AccountApiAccountFundingFlow\n */\n readonly startTime?: number;\n\n /**\n * End Time, e.g 1593512200000\n * @type {number}\n * @memberof AccountApiAccountFundingFlow\n */\n readonly endTime?: number;\n\n /**\n * Number of result sets returned Default:100 Max:1000\n * @type {number}\n * @memberof AccountApiAccountFundingFlow\n */\n readonly limit?: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiAccountFundingFlow\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getDownloadIdForOptionTransactionHistory operation in AccountApi.\n * @interface GetDownloadIdForOptionTransactionHistoryRequest\n */\nexport interface GetDownloadIdForOptionTransactionHistoryRequest {\n /**\n * Timestamp in ms\n * @type {number}\n * @memberof AccountApiGetDownloadIdForOptionTransactionHistory\n */\n readonly startTime: number;\n\n /**\n * Timestamp in ms\n * @type {number}\n * @memberof AccountApiGetDownloadIdForOptionTransactionHistory\n */\n readonly endTime: number;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetDownloadIdForOptionTransactionHistory\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for getOptionTransactionHistoryDownloadLinkById operation in AccountApi.\n * @interface GetOptionTransactionHistoryDownloadLinkByIdRequest\n */\nexport interface GetOptionTransactionHistoryDownloadLinkByIdRequest {\n /**\n * get by download id api\n * @type {string}\n * @memberof AccountApiGetOptionTransactionHistoryDownloadLinkById\n */\n readonly downloadId: string;\n\n /**\n *\n * @type {number}\n * @memberof AccountApiGetOptionTransactionHistoryDownloadLinkById\n */\n readonly recvWindow?: number;\n}\n\n/**\n * Request parameters for optionAccountInformation operation in AccountApi.\n * @interface OptionAccountInformationRequest\n */\nexport interface OptionAccountInformationRequest {\n /**\n *\n * @type {number}\n * @memberof AccountApiOptionAccountInformation\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 * Query account funding flows.\n *\n * Weight: 1\n *\n * @summary Account Funding Flow (USER_DATA)\n * @param {AccountFundingFlowRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<AccountFundingFlowResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApi\n * @see {@link https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow Binance API Documentation}\n */\n public async accountFundingFlow(\n requestParameters: AccountFundingFlowRequest\n ): Promise<RestApiResponse<AccountFundingFlowResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountFundingFlow(\n requestParameters?.currency,\n requestParameters?.recordId,\n requestParameters?.startTime,\n requestParameters?.endTime,\n requestParameters?.limit,\n requestParameters?.recvWindow\n );\n return sendRequest<AccountFundingFlowResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n\n /**\n * Get download id for option transaction history\n *\n * Request Limitation is 5 times per month, shared by > front end download page and rest api\n * The time between `startTime` and `endTime` can not be longer than 1 year\n *\n * Weight: 5\n *\n * @summary Get Download Id For Option Transaction History (USER_DATA)\n * @param {GetDownloadIdForOptionTransactionHistoryRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetDownloadIdForOptionTransactionHistoryResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApi\n * @see {@link https://developers.binance.com/docs/derivatives/option/account/Get-Download-Id-For-Option-Transaction-History Binance API Documentation}\n */\n public async getDownloadIdForOptionTransactionHistory(\n requestParameters: GetDownloadIdForOptionTransactionHistoryRequest\n ): Promise<RestApiResponse<GetDownloadIdForOptionTransactionHistoryResponse>> {\n const localVarAxiosArgs =\n await this.localVarAxiosParamCreator.getDownloadIdForOptionTransactionHistory(\n requestParameters?.startTime,\n requestParameters?.endTime,\n requestParameters?.recvWindow\n );\n return sendRequest<GetDownloadIdForOptionTransactionHistoryResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n\n /**\n * Get option transaction history download Link by Id\n *\n * Download link expiration: 24h\n *\n * Weight: 5\n *\n * @summary Get Option Transaction History Download Link by Id (USER_DATA)\n * @param {GetOptionTransactionHistoryDownloadLinkByIdRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetOptionTransactionHistoryDownloadLinkByIdResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApi\n * @see {@link https://developers.binance.com/docs/derivatives/option/account/Get-Option-Transaction-History-Download-Link-by-Id Binance API Documentation}\n */\n public async getOptionTransactionHistoryDownloadLinkById(\n requestParameters: GetOptionTransactionHistoryDownloadLinkByIdRequest\n ): Promise<RestApiResponse<GetOptionTransactionHistoryDownloadLinkByIdResponse>> {\n const localVarAxiosArgs =\n await this.localVarAxiosParamCreator.getOptionTransactionHistoryDownloadLinkById(\n requestParameters?.downloadId,\n requestParameters?.recvWindow\n );\n return sendRequest<GetOptionTransactionHistoryDownloadLinkByIdResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n\n /**\n * Get current account information.\n *\n * Weight: 3\n *\n * @summary Option Account Information(TRADE)\n * @param {OptionAccountInformationRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<OptionAccountInformationResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof AccountApi\n * @see {@link https://developers.binance.com/docs/derivatives/option/account/Option-Account-Information Binance API Documentation}\n */\n public async optionAccountInformation(\n requestParameters: OptionAccountInformationRequest = {}\n ): Promise<RestApiResponse<OptionAccountInformationResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.optionAccountInformation(\n requestParameters?.recvWindow\n );\n return sendRequest<OptionAccountInformationResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n}\n","/**\n * Binance Public Derivatives Trading Options REST API\n *\n * OpenAPI Specification for the Binance Public Derivatives Trading Options 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 CheckServerTimeResponse,\n ExchangeInformationResponse,\n HistoricalExerciseRecordsResponse,\n KlineCandlestickDataResponse,\n OldTradesLookupResponse,\n OpenInterestResponse,\n OptionMarkPriceResponse,\n OrderBookResponse,\n RecentBlockTradesListResponse,\n RecentTradesListResponse,\n SymbolPriceTickerResponse,\n Ticker24hrPriceChangeStatisticsResponse,\n} from '../types';\n\n/**\n * MarketDataApi - axios parameter creator\n */\nconst MarketDataApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Test connectivity to the Rest API and get the current server time.\n *\n * Weight: 1\n *\n * @summary Check Server Time\n *\n * @throws {RequiredError}\n */\n checkServerTime: async (): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/time',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Current exchange trading rules and symbol information\n *\n * Weight: 1\n *\n * @summary Exchange Information\n *\n * @throws {RequiredError}\n */\n exchangeInformation: async (): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/exchangeInfo',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get historical exercise records.\n * REALISTIC_VALUE_STRICKEN -> Exercised\n * EXTRINSIC_VALUE_EXPIRED -> Expired OTM\n *\n * Weight: 3\n *\n * @summary Historical Exercise Records\n * @param {string} [underlying] underlying, e.g BTCUSDT\n * @param {number} [startTime] Start Time, e.g 1593511200000\n * @param {number} [endTime] End Time, e.g 1593512200000\n * @param {number} [limit] Number of result sets returned Default:100 Max:1000\n *\n * @throws {RequiredError}\n */\n historicalExerciseRecords: async (\n underlying?: string,\n startTime?: number,\n endTime?: number,\n limit?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (underlying !== undefined && underlying !== null) {\n localVarQueryParameter['underlying'] = underlying;\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 let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/exerciseHistory',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Kline/candlestick bars for an option symbol.\n * Klines are uniquely identified by their open time.\n *\n * If startTime and endTime are not sent, the most recent klines are returned.\n *\n * Weight: 1\n *\n * @summary Kline/Candlestick Data\n * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C\n * @param {string} interval Time interval\n * @param {number} [startTime] Start Time, e.g 1593511200000\n * @param {number} [endTime] End Time, e.g 1593512200000\n * @param {number} [limit] Number of result sets returned Default:100 Max:1000\n *\n * @throws {RequiredError}\n */\n klineCandlestickData: async (\n symbol: string,\n interval: string,\n startTime?: number,\n endTime?: number,\n limit?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('klineCandlestickData', 'symbol', symbol);\n // verify required parameter 'interval' is not null or undefined\n assertParamExists('klineCandlestickData', 'interval', interval);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (interval !== undefined && interval !== null) {\n localVarQueryParameter['interval'] = interval;\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 let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/klines',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get older market historical trades.\n *\n * Weight: 20\n *\n * @summary Old Trades Lookup (MARKET_DATA)\n * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C\n * @param {number} [fromId] The UniqueId ID from which to return. The latest deal record is returned by default\n * @param {number} [limit] Number of result sets returned Default:100 Max:1000\n *\n * @throws {RequiredError}\n */\n oldTradesLookup: async (\n symbol: string,\n fromId?: number,\n limit?: number\n ): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('oldTradesLookup', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\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 let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/historicalTrades',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get open interest for specific underlying asset on specific expiration date.\n *\n * Weight: 0\n *\n * @summary Open Interest\n * @param {string} underlyingAsset underlying asset, e.g ETH/BTC\n * @param {string} expiration expiration date, e.g 221225\n *\n * @throws {RequiredError}\n */\n openInterest: async (underlyingAsset: string, expiration: string): Promise<RequestArgs> => {\n // verify required parameter 'underlyingAsset' is not null or undefined\n assertParamExists('openInterest', 'underlyingAsset', underlyingAsset);\n // verify required parameter 'expiration' is not null or undefined\n assertParamExists('openInterest', 'expiration', expiration);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (underlyingAsset !== undefined && underlyingAsset !== null) {\n localVarQueryParameter['underlyingAsset'] = underlyingAsset;\n }\n\n if (expiration !== undefined && expiration !== null) {\n localVarQueryParameter['expiration'] = expiration;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/openInterest',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Option mark price and greek info.\n *\n * Weight: 5\n *\n * @summary Option Mark Price\n * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C\n *\n * @throws {RequiredError}\n */\n optionMarkPrice: async (symbol?: string): Promise<RequestArgs> => {\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: '/eapi/v1/mark',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Check orderbook depth on specific symbol\n *\n * Weight: limit | weight\n * ------------ | ------------\n * 5, 10, 20, 50 | 2\n * 100 | 5\n * 500 | 10\n * 1000 | 20\n *\n * @summary Order Book\n * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C\n * @param {number} [limit] Number of result sets returned Default:100 Max:1000\n *\n * @throws {RequiredError}\n */\n orderBook: async (symbol: string, limit?: number): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('orderBook', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (limit !== undefined && limit !== null) {\n localVarQueryParameter['limit'] = limit;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/depth',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get recent block trades\n *\n * Weight: 5\n *\n * @summary Recent Block Trades List\n * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C\n * @param {number} [limit] Number of result sets returned Default:100 Max:1000\n *\n * @throws {RequiredError}\n */\n recentBlockTradesList: async (symbol?: string, limit?: number): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (limit !== undefined && limit !== null) {\n localVarQueryParameter['limit'] = limit;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/blockTrades',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get recent market trades\n *\n * Weight: 5\n *\n * @summary Recent Trades List\n * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C\n * @param {number} [limit] Number of result sets returned Default:100 Max:1000\n *\n * @throws {RequiredError}\n */\n recentTradesList: async (symbol: string, limit?: number): Promise<RequestArgs> => {\n // verify required parameter 'symbol' is not null or undefined\n assertParamExists('recentTradesList', 'symbol', symbol);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (symbol !== undefined && symbol !== null) {\n localVarQueryParameter['symbol'] = symbol;\n }\n\n if (limit !== undefined && limit !== null) {\n localVarQueryParameter['limit'] = limit;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/trades',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Get spot index price for option underlying.\n *\n * Weight: 1\n *\n * @summary Symbol Price Ticker\n * @param {string} underlying Option underlying, e.g BTCUSDT\n *\n * @throws {RequiredError}\n */\n symbolPriceTicker: async (underlying: string): Promise<RequestArgs> => {\n // verify required parameter 'underlying' is not null or undefined\n assertParamExists('symbolPriceTicker', 'underlying', underlying);\n\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (underlying !== undefined && underlying !== null) {\n localVarQueryParameter['underlying'] = underlying;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/index',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * Test connectivity to the Rest API.\n *\n * Weight: 1\n *\n * @summary Test Connectivity\n *\n * @throws {RequiredError}\n */\n testConnectivity: async (): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/eapi/v1/ping',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n /**\n * 24 hour rolling window price change statistics.\n *\n * Weight: 5\n *\n * @summary 24hr Ticker Price Change Statistics\n * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C\n *\n * @throws {RequiredError}\n */\n ticker24hrPriceChangeStatistics: async (symbol?: string): Promise<RequestArgs> => {\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: '/eapi/v1/ticker',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * MarketDataApi - interface\n * @interface MarketDataApi\n */\nexport interface MarketDataApiInterface {\n /**\n * Test connectivity to the Rest API and get the current server time.\n *\n * Weight: 1\n *\n * @summary Check Server Time\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof MarketDataApiInterface\n */\n checkServerTime(): Promise<RestApiResponse<CheckServerTimeResponse>>;\n /**\n * Current exchange trading rules and symbol information\n *\n * Weight: 1\n *\n * @summary Exchange Information\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof MarketDataApiInterface\n */\n exchangeInformation(): Promise<RestApiResponse<ExchangeInformationResponse>>;\n /**\n * Get historical exercise records.\n * REALISTIC_VALUE_STRICKEN -> Exercised\n * EXTRINSIC_VALUE_EXPIRED -> Expired OTM\n *\n * Weight: 3\n *\n * @summary Historical Exercise Records\n * @param {HistoricalExerciseRecordsRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof MarketDataApiInterface\n */\n historicalExerciseRecords(\n requestParameters?: HistoricalExerciseRecordsRequest\n ): Promise<RestApiResponse<HistoricalExerciseRecordsResponse>>;\n /**\n * Kline/candlestick bars for an option symbol.\n * Klines are uniquely identified by their open time.\n *\n * If startTime and endTime are not sent, the most recent klines are returned.\n *\n * Weight: 1\n *\n * @summary Kline/Candlestick Data\n * @param {KlineCandlestickDataRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof MarketDataApiInterface\n */\n klineCandlestickData(\n requestParameters: KlineCandlestickDataRequest\n ): Promise<RestApiResponse<KlineCandlestickDataResponse>>;\n /**\n * Get older market historical trades.\n *\n * Weight: 20\n *\n * @summary Old Trades Lookup (MARKET_DATA)\n * @param {OldTradesLookupRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof MarketDataApiInterface\n */\n oldTradesLookup(\n requestParameters: OldTradesLookupRequest\n ): Promise<RestApiResponse<OldTradesLookupResponse>>;\n /**\n * Get open interest for specific underlying asset on specific expiration date.\n *\n * Weight: 0\n *\n * @summary Open Interest\n * @param {OpenInterestRequest} requestParameters Request par