@binance/derivatives-trading-options 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,4448 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name2 in all)
8
+ __defProp(target, name2, { get: all[name2], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ BadRequestError: () => import_common12.BadRequestError,
24
+ ConnectorClientError: () => import_common12.ConnectorClientError,
25
+ DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL: () => import_common12.DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL,
26
+ DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL: () => import_common12.DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL,
27
+ DerivativesTradingOptions: () => DerivativesTradingOptions,
28
+ DerivativesTradingOptionsRestAPI: () => rest_api_exports,
29
+ DerivativesTradingOptionsWebsocketStreams: () => websocket_streams_exports,
30
+ ForbiddenError: () => import_common12.ForbiddenError,
31
+ NetworkError: () => import_common12.NetworkError,
32
+ NotFoundError: () => import_common12.NotFoundError,
33
+ RateLimitBanError: () => import_common12.RateLimitBanError,
34
+ RequiredError: () => import_common12.RequiredError,
35
+ ServerError: () => import_common12.ServerError,
36
+ TooManyRequestsError: () => import_common12.TooManyRequestsError,
37
+ UnauthorizedError: () => import_common12.UnauthorizedError
38
+ });
39
+ module.exports = __toCommonJS(src_exports);
40
+
41
+ // src/derivatives-trading-options.ts
42
+ var import_os = require("os");
43
+ var import_common11 = require("@binance/common");
44
+
45
+ // package.json
46
+ var name = "@binance/derivatives-trading-options";
47
+ var version = "1.0.0";
48
+
49
+ // src/rest-api/index.ts
50
+ var rest_api_exports = {};
51
+ __export(rest_api_exports, {
52
+ AccountApi: () => AccountApi,
53
+ MarketDataApi: () => MarketDataApi,
54
+ MarketMakerBlockTradeApi: () => MarketMakerBlockTradeApi,
55
+ MarketMakerEndpointsApi: () => MarketMakerEndpointsApi,
56
+ NewBlockTradeOrderSideEnum: () => NewBlockTradeOrderSideEnum,
57
+ NewOrderNewOrderRespTypeEnum: () => NewOrderNewOrderRespTypeEnum,
58
+ NewOrderSideEnum: () => NewOrderSideEnum,
59
+ NewOrderTimeInForceEnum: () => NewOrderTimeInForceEnum,
60
+ NewOrderTypeEnum: () => NewOrderTypeEnum,
61
+ PlaceMultipleOrdersOrdersParameterInnerNewOrderRespTypeEnum: () => PlaceMultipleOrdersOrdersParameterInnerNewOrderRespTypeEnum,
62
+ PlaceMultipleOrdersOrdersParameterInnerSideEnum: () => PlaceMultipleOrdersOrdersParameterInnerSideEnum,
63
+ PlaceMultipleOrdersOrdersParameterInnerTimeInForceEnum: () => PlaceMultipleOrdersOrdersParameterInnerTimeInForceEnum,
64
+ PlaceMultipleOrdersOrdersParameterInnerTypeEnum: () => PlaceMultipleOrdersOrdersParameterInnerTypeEnum,
65
+ RestAPI: () => RestAPI,
66
+ TradeApi: () => TradeApi,
67
+ UserDataStreamsApi: () => UserDataStreamsApi
68
+ });
69
+
70
+ // src/rest-api/types/place-multiple-orders-orders-parameter-inner.ts
71
+ var PlaceMultipleOrdersOrdersParameterInnerSideEnum = {
72
+ BUY: "BUY",
73
+ SELL: "SELL"
74
+ };
75
+ var PlaceMultipleOrdersOrdersParameterInnerTypeEnum = {
76
+ LIMIT: "LIMIT"
77
+ };
78
+ var PlaceMultipleOrdersOrdersParameterInnerTimeInForceEnum = {
79
+ GTC: "GTC",
80
+ IOC: "IOC",
81
+ FOK: "FOK"
82
+ };
83
+ var PlaceMultipleOrdersOrdersParameterInnerNewOrderRespTypeEnum = {
84
+ ACK: "ACK",
85
+ RESULT: "RESULT"
86
+ };
87
+
88
+ // src/rest-api/modules/account-api.ts
89
+ var import_common = require("@binance/common");
90
+ var AccountApiAxiosParamCreator = function(configuration) {
91
+ return {
92
+ /**
93
+ * Query account funding flows.
94
+ *
95
+ * Weight: 1
96
+ *
97
+ * @summary Account Funding Flow (USER_DATA)
98
+ * @param {string} currency Asset type, only support USDT as of now
99
+ * @param {number} [recordId] Return the recordId and subsequent data, the latest data is returned by default, e.g 100000
100
+ * @param {number} [startTime] Start Time, e.g 1593511200000
101
+ * @param {number} [endTime] End Time, e.g 1593512200000
102
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
103
+ * @param {number} [recvWindow]
104
+ *
105
+ * @throws {RequiredError}
106
+ */
107
+ accountFundingFlow: async (currency, recordId, startTime, endTime, limit, recvWindow) => {
108
+ (0, import_common.assertParamExists)("accountFundingFlow", "currency", currency);
109
+ const localVarQueryParameter = {};
110
+ if (currency !== void 0 && currency !== null) {
111
+ localVarQueryParameter["currency"] = currency;
112
+ }
113
+ if (recordId !== void 0 && recordId !== null) {
114
+ localVarQueryParameter["recordId"] = recordId;
115
+ }
116
+ if (startTime !== void 0 && startTime !== null) {
117
+ localVarQueryParameter["startTime"] = startTime;
118
+ }
119
+ if (endTime !== void 0 && endTime !== null) {
120
+ localVarQueryParameter["endTime"] = endTime;
121
+ }
122
+ if (limit !== void 0 && limit !== null) {
123
+ localVarQueryParameter["limit"] = limit;
124
+ }
125
+ if (recvWindow !== void 0 && recvWindow !== null) {
126
+ localVarQueryParameter["recvWindow"] = recvWindow;
127
+ }
128
+ let _timeUnit;
129
+ if ("timeUnit" in configuration)
130
+ _timeUnit = configuration.timeUnit;
131
+ return {
132
+ endpoint: "/eapi/v1/bill",
133
+ method: "GET",
134
+ params: localVarQueryParameter,
135
+ timeUnit: _timeUnit
136
+ };
137
+ },
138
+ /**
139
+ * Get download id for option transaction history
140
+ *
141
+ * Request Limitation is 5 times per month, shared by > front end download page and rest api
142
+ * The time between `startTime` and `endTime` can not be longer than 1 year
143
+ *
144
+ * Weight: 5
145
+ *
146
+ * @summary Get Download Id For Option Transaction History (USER_DATA)
147
+ * @param {number} startTime Timestamp in ms
148
+ * @param {number} endTime Timestamp in ms
149
+ * @param {number} [recvWindow]
150
+ *
151
+ * @throws {RequiredError}
152
+ */
153
+ getDownloadIdForOptionTransactionHistory: async (startTime, endTime, recvWindow) => {
154
+ (0, import_common.assertParamExists)("getDownloadIdForOptionTransactionHistory", "startTime", startTime);
155
+ (0, import_common.assertParamExists)("getDownloadIdForOptionTransactionHistory", "endTime", endTime);
156
+ const localVarQueryParameter = {};
157
+ if (startTime !== void 0 && startTime !== null) {
158
+ localVarQueryParameter["startTime"] = startTime;
159
+ }
160
+ if (endTime !== void 0 && endTime !== null) {
161
+ localVarQueryParameter["endTime"] = endTime;
162
+ }
163
+ if (recvWindow !== void 0 && recvWindow !== null) {
164
+ localVarQueryParameter["recvWindow"] = recvWindow;
165
+ }
166
+ let _timeUnit;
167
+ if ("timeUnit" in configuration)
168
+ _timeUnit = configuration.timeUnit;
169
+ return {
170
+ endpoint: "/eapi/v1/income/asyn",
171
+ method: "GET",
172
+ params: localVarQueryParameter,
173
+ timeUnit: _timeUnit
174
+ };
175
+ },
176
+ /**
177
+ * Get option transaction history download Link by Id
178
+ *
179
+ * Download link expiration: 24h
180
+ *
181
+ * Weight: 5
182
+ *
183
+ * @summary Get Option Transaction History Download Link by Id (USER_DATA)
184
+ * @param {string} downloadId get by download id api
185
+ * @param {number} [recvWindow]
186
+ *
187
+ * @throws {RequiredError}
188
+ */
189
+ getOptionTransactionHistoryDownloadLinkById: async (downloadId, recvWindow) => {
190
+ (0, import_common.assertParamExists)(
191
+ "getOptionTransactionHistoryDownloadLinkById",
192
+ "downloadId",
193
+ downloadId
194
+ );
195
+ const localVarQueryParameter = {};
196
+ if (downloadId !== void 0 && downloadId !== null) {
197
+ localVarQueryParameter["downloadId"] = downloadId;
198
+ }
199
+ if (recvWindow !== void 0 && recvWindow !== null) {
200
+ localVarQueryParameter["recvWindow"] = recvWindow;
201
+ }
202
+ let _timeUnit;
203
+ if ("timeUnit" in configuration)
204
+ _timeUnit = configuration.timeUnit;
205
+ return {
206
+ endpoint: "/eapi/v1/income/asyn/id",
207
+ method: "GET",
208
+ params: localVarQueryParameter,
209
+ timeUnit: _timeUnit
210
+ };
211
+ },
212
+ /**
213
+ * Get current account information.
214
+ *
215
+ * Weight: 3
216
+ *
217
+ * @summary Option Account Information(TRADE)
218
+ * @param {number} [recvWindow]
219
+ *
220
+ * @throws {RequiredError}
221
+ */
222
+ optionAccountInformation: async (recvWindow) => {
223
+ const localVarQueryParameter = {};
224
+ if (recvWindow !== void 0 && recvWindow !== null) {
225
+ localVarQueryParameter["recvWindow"] = recvWindow;
226
+ }
227
+ let _timeUnit;
228
+ if ("timeUnit" in configuration)
229
+ _timeUnit = configuration.timeUnit;
230
+ return {
231
+ endpoint: "/eapi/v1/account",
232
+ method: "GET",
233
+ params: localVarQueryParameter,
234
+ timeUnit: _timeUnit
235
+ };
236
+ }
237
+ };
238
+ };
239
+ var AccountApi = class {
240
+ constructor(configuration) {
241
+ this.configuration = configuration;
242
+ this.localVarAxiosParamCreator = AccountApiAxiosParamCreator(configuration);
243
+ }
244
+ /**
245
+ * Query account funding flows.
246
+ *
247
+ * Weight: 1
248
+ *
249
+ * @summary Account Funding Flow (USER_DATA)
250
+ * @param {AccountFundingFlowRequest} requestParameters Request parameters.
251
+ * @returns {Promise<RestApiResponse<AccountFundingFlowResponse>>}
252
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
253
+ * @memberof AccountApi
254
+ * @see {@link https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow Binance API Documentation}
255
+ */
256
+ async accountFundingFlow(requestParameters) {
257
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountFundingFlow(
258
+ requestParameters?.currency,
259
+ requestParameters?.recordId,
260
+ requestParameters?.startTime,
261
+ requestParameters?.endTime,
262
+ requestParameters?.limit,
263
+ requestParameters?.recvWindow
264
+ );
265
+ return (0, import_common.sendRequest)(
266
+ this.configuration,
267
+ localVarAxiosArgs.endpoint,
268
+ localVarAxiosArgs.method,
269
+ localVarAxiosArgs.params,
270
+ localVarAxiosArgs?.timeUnit,
271
+ { isSigned: true }
272
+ );
273
+ }
274
+ /**
275
+ * Get download id for option transaction history
276
+ *
277
+ * Request Limitation is 5 times per month, shared by > front end download page and rest api
278
+ * The time between `startTime` and `endTime` can not be longer than 1 year
279
+ *
280
+ * Weight: 5
281
+ *
282
+ * @summary Get Download Id For Option Transaction History (USER_DATA)
283
+ * @param {GetDownloadIdForOptionTransactionHistoryRequest} requestParameters Request parameters.
284
+ * @returns {Promise<RestApiResponse<GetDownloadIdForOptionTransactionHistoryResponse>>}
285
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
286
+ * @memberof AccountApi
287
+ * @see {@link https://developers.binance.com/docs/derivatives/option/account/Get-Download-Id-For-Option-Transaction-History Binance API Documentation}
288
+ */
289
+ async getDownloadIdForOptionTransactionHistory(requestParameters) {
290
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getDownloadIdForOptionTransactionHistory(
291
+ requestParameters?.startTime,
292
+ requestParameters?.endTime,
293
+ requestParameters?.recvWindow
294
+ );
295
+ return (0, import_common.sendRequest)(
296
+ this.configuration,
297
+ localVarAxiosArgs.endpoint,
298
+ localVarAxiosArgs.method,
299
+ localVarAxiosArgs.params,
300
+ localVarAxiosArgs?.timeUnit,
301
+ { isSigned: true }
302
+ );
303
+ }
304
+ /**
305
+ * Get option transaction history download Link by Id
306
+ *
307
+ * Download link expiration: 24h
308
+ *
309
+ * Weight: 5
310
+ *
311
+ * @summary Get Option Transaction History Download Link by Id (USER_DATA)
312
+ * @param {GetOptionTransactionHistoryDownloadLinkByIdRequest} requestParameters Request parameters.
313
+ * @returns {Promise<RestApiResponse<GetOptionTransactionHistoryDownloadLinkByIdResponse>>}
314
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
315
+ * @memberof AccountApi
316
+ * @see {@link https://developers.binance.com/docs/derivatives/option/account/Get-Option-Transaction-History-Download-Link-by-Id Binance API Documentation}
317
+ */
318
+ async getOptionTransactionHistoryDownloadLinkById(requestParameters) {
319
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getOptionTransactionHistoryDownloadLinkById(
320
+ requestParameters?.downloadId,
321
+ requestParameters?.recvWindow
322
+ );
323
+ return (0, import_common.sendRequest)(
324
+ this.configuration,
325
+ localVarAxiosArgs.endpoint,
326
+ localVarAxiosArgs.method,
327
+ localVarAxiosArgs.params,
328
+ localVarAxiosArgs?.timeUnit,
329
+ { isSigned: true }
330
+ );
331
+ }
332
+ /**
333
+ * Get current account information.
334
+ *
335
+ * Weight: 3
336
+ *
337
+ * @summary Option Account Information(TRADE)
338
+ * @param {OptionAccountInformationRequest} requestParameters Request parameters.
339
+ * @returns {Promise<RestApiResponse<OptionAccountInformationResponse>>}
340
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
341
+ * @memberof AccountApi
342
+ * @see {@link https://developers.binance.com/docs/derivatives/option/account/Option-Account-Information Binance API Documentation}
343
+ */
344
+ async optionAccountInformation(requestParameters = {}) {
345
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.optionAccountInformation(
346
+ requestParameters?.recvWindow
347
+ );
348
+ return (0, import_common.sendRequest)(
349
+ this.configuration,
350
+ localVarAxiosArgs.endpoint,
351
+ localVarAxiosArgs.method,
352
+ localVarAxiosArgs.params,
353
+ localVarAxiosArgs?.timeUnit,
354
+ { isSigned: true }
355
+ );
356
+ }
357
+ };
358
+
359
+ // src/rest-api/modules/market-data-api.ts
360
+ var import_common2 = require("@binance/common");
361
+ var MarketDataApiAxiosParamCreator = function(configuration) {
362
+ return {
363
+ /**
364
+ * Test connectivity to the Rest API and get the current server time.
365
+ *
366
+ * Weight: 1
367
+ *
368
+ * @summary Check Server Time
369
+ *
370
+ * @throws {RequiredError}
371
+ */
372
+ checkServerTime: async () => {
373
+ const localVarQueryParameter = {};
374
+ let _timeUnit;
375
+ if ("timeUnit" in configuration)
376
+ _timeUnit = configuration.timeUnit;
377
+ return {
378
+ endpoint: "/eapi/v1/time",
379
+ method: "GET",
380
+ params: localVarQueryParameter,
381
+ timeUnit: _timeUnit
382
+ };
383
+ },
384
+ /**
385
+ * Current exchange trading rules and symbol information
386
+ *
387
+ * Weight: 1
388
+ *
389
+ * @summary Exchange Information
390
+ *
391
+ * @throws {RequiredError}
392
+ */
393
+ exchangeInformation: async () => {
394
+ const localVarQueryParameter = {};
395
+ let _timeUnit;
396
+ if ("timeUnit" in configuration)
397
+ _timeUnit = configuration.timeUnit;
398
+ return {
399
+ endpoint: "/eapi/v1/exchangeInfo",
400
+ method: "GET",
401
+ params: localVarQueryParameter,
402
+ timeUnit: _timeUnit
403
+ };
404
+ },
405
+ /**
406
+ * Get historical exercise records.
407
+ * REALISTIC_VALUE_STRICKEN -> Exercised
408
+ * EXTRINSIC_VALUE_EXPIRED -> Expired OTM
409
+ *
410
+ * Weight: 3
411
+ *
412
+ * @summary Historical Exercise Records
413
+ * @param {string} [underlying] underlying, e.g BTCUSDT
414
+ * @param {number} [startTime] Start Time, e.g 1593511200000
415
+ * @param {number} [endTime] End Time, e.g 1593512200000
416
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
417
+ *
418
+ * @throws {RequiredError}
419
+ */
420
+ historicalExerciseRecords: async (underlying, startTime, endTime, limit) => {
421
+ const localVarQueryParameter = {};
422
+ if (underlying !== void 0 && underlying !== null) {
423
+ localVarQueryParameter["underlying"] = underlying;
424
+ }
425
+ if (startTime !== void 0 && startTime !== null) {
426
+ localVarQueryParameter["startTime"] = startTime;
427
+ }
428
+ if (endTime !== void 0 && endTime !== null) {
429
+ localVarQueryParameter["endTime"] = endTime;
430
+ }
431
+ if (limit !== void 0 && limit !== null) {
432
+ localVarQueryParameter["limit"] = limit;
433
+ }
434
+ let _timeUnit;
435
+ if ("timeUnit" in configuration)
436
+ _timeUnit = configuration.timeUnit;
437
+ return {
438
+ endpoint: "/eapi/v1/exerciseHistory",
439
+ method: "GET",
440
+ params: localVarQueryParameter,
441
+ timeUnit: _timeUnit
442
+ };
443
+ },
444
+ /**
445
+ * Kline/candlestick bars for an option symbol.
446
+ * Klines are uniquely identified by their open time.
447
+ *
448
+ * If startTime and endTime are not sent, the most recent klines are returned.
449
+ *
450
+ * Weight: 1
451
+ *
452
+ * @summary Kline/Candlestick Data
453
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
454
+ * @param {string} interval Time interval
455
+ * @param {number} [startTime] Start Time, e.g 1593511200000
456
+ * @param {number} [endTime] End Time, e.g 1593512200000
457
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
458
+ *
459
+ * @throws {RequiredError}
460
+ */
461
+ klineCandlestickData: async (symbol, interval, startTime, endTime, limit) => {
462
+ (0, import_common2.assertParamExists)("klineCandlestickData", "symbol", symbol);
463
+ (0, import_common2.assertParamExists)("klineCandlestickData", "interval", interval);
464
+ const localVarQueryParameter = {};
465
+ if (symbol !== void 0 && symbol !== null) {
466
+ localVarQueryParameter["symbol"] = symbol;
467
+ }
468
+ if (interval !== void 0 && interval !== null) {
469
+ localVarQueryParameter["interval"] = interval;
470
+ }
471
+ if (startTime !== void 0 && startTime !== null) {
472
+ localVarQueryParameter["startTime"] = startTime;
473
+ }
474
+ if (endTime !== void 0 && endTime !== null) {
475
+ localVarQueryParameter["endTime"] = endTime;
476
+ }
477
+ if (limit !== void 0 && limit !== null) {
478
+ localVarQueryParameter["limit"] = limit;
479
+ }
480
+ let _timeUnit;
481
+ if ("timeUnit" in configuration)
482
+ _timeUnit = configuration.timeUnit;
483
+ return {
484
+ endpoint: "/eapi/v1/klines",
485
+ method: "GET",
486
+ params: localVarQueryParameter,
487
+ timeUnit: _timeUnit
488
+ };
489
+ },
490
+ /**
491
+ * Get older market historical trades.
492
+ *
493
+ * Weight: 20
494
+ *
495
+ * @summary Old Trades Lookup (MARKET_DATA)
496
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
497
+ * @param {number} [fromId] The UniqueId ID from which to return. The latest deal record is returned by default
498
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
499
+ *
500
+ * @throws {RequiredError}
501
+ */
502
+ oldTradesLookup: async (symbol, fromId, limit) => {
503
+ (0, import_common2.assertParamExists)("oldTradesLookup", "symbol", symbol);
504
+ const localVarQueryParameter = {};
505
+ if (symbol !== void 0 && symbol !== null) {
506
+ localVarQueryParameter["symbol"] = symbol;
507
+ }
508
+ if (fromId !== void 0 && fromId !== null) {
509
+ localVarQueryParameter["fromId"] = fromId;
510
+ }
511
+ if (limit !== void 0 && limit !== null) {
512
+ localVarQueryParameter["limit"] = limit;
513
+ }
514
+ let _timeUnit;
515
+ if ("timeUnit" in configuration)
516
+ _timeUnit = configuration.timeUnit;
517
+ return {
518
+ endpoint: "/eapi/v1/historicalTrades",
519
+ method: "GET",
520
+ params: localVarQueryParameter,
521
+ timeUnit: _timeUnit
522
+ };
523
+ },
524
+ /**
525
+ * Get open interest for specific underlying asset on specific expiration date.
526
+ *
527
+ * Weight: 0
528
+ *
529
+ * @summary Open Interest
530
+ * @param {string} underlyingAsset underlying asset, e.g ETH/BTC
531
+ * @param {string} expiration expiration date, e.g 221225
532
+ *
533
+ * @throws {RequiredError}
534
+ */
535
+ openInterest: async (underlyingAsset, expiration) => {
536
+ (0, import_common2.assertParamExists)("openInterest", "underlyingAsset", underlyingAsset);
537
+ (0, import_common2.assertParamExists)("openInterest", "expiration", expiration);
538
+ const localVarQueryParameter = {};
539
+ if (underlyingAsset !== void 0 && underlyingAsset !== null) {
540
+ localVarQueryParameter["underlyingAsset"] = underlyingAsset;
541
+ }
542
+ if (expiration !== void 0 && expiration !== null) {
543
+ localVarQueryParameter["expiration"] = expiration;
544
+ }
545
+ let _timeUnit;
546
+ if ("timeUnit" in configuration)
547
+ _timeUnit = configuration.timeUnit;
548
+ return {
549
+ endpoint: "/eapi/v1/openInterest",
550
+ method: "GET",
551
+ params: localVarQueryParameter,
552
+ timeUnit: _timeUnit
553
+ };
554
+ },
555
+ /**
556
+ * Option mark price and greek info.
557
+ *
558
+ * Weight: 5
559
+ *
560
+ * @summary Option Mark Price
561
+ * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C
562
+ *
563
+ * @throws {RequiredError}
564
+ */
565
+ optionMarkPrice: async (symbol) => {
566
+ const localVarQueryParameter = {};
567
+ if (symbol !== void 0 && symbol !== null) {
568
+ localVarQueryParameter["symbol"] = symbol;
569
+ }
570
+ let _timeUnit;
571
+ if ("timeUnit" in configuration)
572
+ _timeUnit = configuration.timeUnit;
573
+ return {
574
+ endpoint: "/eapi/v1/mark",
575
+ method: "GET",
576
+ params: localVarQueryParameter,
577
+ timeUnit: _timeUnit
578
+ };
579
+ },
580
+ /**
581
+ * Check orderbook depth on specific symbol
582
+ *
583
+ * Weight: limit | weight
584
+ * ------------ | ------------
585
+ * 5, 10, 20, 50 | 2
586
+ * 100 | 5
587
+ * 500 | 10
588
+ * 1000 | 20
589
+ *
590
+ * @summary Order Book
591
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
592
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
593
+ *
594
+ * @throws {RequiredError}
595
+ */
596
+ orderBook: async (symbol, limit) => {
597
+ (0, import_common2.assertParamExists)("orderBook", "symbol", symbol);
598
+ const localVarQueryParameter = {};
599
+ if (symbol !== void 0 && symbol !== null) {
600
+ localVarQueryParameter["symbol"] = symbol;
601
+ }
602
+ if (limit !== void 0 && limit !== null) {
603
+ localVarQueryParameter["limit"] = limit;
604
+ }
605
+ let _timeUnit;
606
+ if ("timeUnit" in configuration)
607
+ _timeUnit = configuration.timeUnit;
608
+ return {
609
+ endpoint: "/eapi/v1/depth",
610
+ method: "GET",
611
+ params: localVarQueryParameter,
612
+ timeUnit: _timeUnit
613
+ };
614
+ },
615
+ /**
616
+ * Get recent block trades
617
+ *
618
+ * Weight: 5
619
+ *
620
+ * @summary Recent Block Trades List
621
+ * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C
622
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
623
+ *
624
+ * @throws {RequiredError}
625
+ */
626
+ recentBlockTradesList: async (symbol, limit) => {
627
+ const localVarQueryParameter = {};
628
+ if (symbol !== void 0 && symbol !== null) {
629
+ localVarQueryParameter["symbol"] = symbol;
630
+ }
631
+ if (limit !== void 0 && limit !== null) {
632
+ localVarQueryParameter["limit"] = limit;
633
+ }
634
+ let _timeUnit;
635
+ if ("timeUnit" in configuration)
636
+ _timeUnit = configuration.timeUnit;
637
+ return {
638
+ endpoint: "/eapi/v1/blockTrades",
639
+ method: "GET",
640
+ params: localVarQueryParameter,
641
+ timeUnit: _timeUnit
642
+ };
643
+ },
644
+ /**
645
+ * Get recent market trades
646
+ *
647
+ * Weight: 5
648
+ *
649
+ * @summary Recent Trades List
650
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
651
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
652
+ *
653
+ * @throws {RequiredError}
654
+ */
655
+ recentTradesList: async (symbol, limit) => {
656
+ (0, import_common2.assertParamExists)("recentTradesList", "symbol", symbol);
657
+ const localVarQueryParameter = {};
658
+ if (symbol !== void 0 && symbol !== null) {
659
+ localVarQueryParameter["symbol"] = symbol;
660
+ }
661
+ if (limit !== void 0 && limit !== null) {
662
+ localVarQueryParameter["limit"] = limit;
663
+ }
664
+ let _timeUnit;
665
+ if ("timeUnit" in configuration)
666
+ _timeUnit = configuration.timeUnit;
667
+ return {
668
+ endpoint: "/eapi/v1/trades",
669
+ method: "GET",
670
+ params: localVarQueryParameter,
671
+ timeUnit: _timeUnit
672
+ };
673
+ },
674
+ /**
675
+ * Get spot index price for option underlying.
676
+ *
677
+ * Weight: 1
678
+ *
679
+ * @summary Symbol Price Ticker
680
+ * @param {string} underlying Option underlying, e.g BTCUSDT
681
+ *
682
+ * @throws {RequiredError}
683
+ */
684
+ symbolPriceTicker: async (underlying) => {
685
+ (0, import_common2.assertParamExists)("symbolPriceTicker", "underlying", underlying);
686
+ const localVarQueryParameter = {};
687
+ if (underlying !== void 0 && underlying !== null) {
688
+ localVarQueryParameter["underlying"] = underlying;
689
+ }
690
+ let _timeUnit;
691
+ if ("timeUnit" in configuration)
692
+ _timeUnit = configuration.timeUnit;
693
+ return {
694
+ endpoint: "/eapi/v1/index",
695
+ method: "GET",
696
+ params: localVarQueryParameter,
697
+ timeUnit: _timeUnit
698
+ };
699
+ },
700
+ /**
701
+ * Test connectivity to the Rest API.
702
+ *
703
+ * Weight: 1
704
+ *
705
+ * @summary Test Connectivity
706
+ *
707
+ * @throws {RequiredError}
708
+ */
709
+ testConnectivity: async () => {
710
+ const localVarQueryParameter = {};
711
+ let _timeUnit;
712
+ if ("timeUnit" in configuration)
713
+ _timeUnit = configuration.timeUnit;
714
+ return {
715
+ endpoint: "/eapi/v1/ping",
716
+ method: "GET",
717
+ params: localVarQueryParameter,
718
+ timeUnit: _timeUnit
719
+ };
720
+ },
721
+ /**
722
+ * 24 hour rolling window price change statistics.
723
+ *
724
+ * Weight: 5
725
+ *
726
+ * @summary 24hr Ticker Price Change Statistics
727
+ * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C
728
+ *
729
+ * @throws {RequiredError}
730
+ */
731
+ ticker24hrPriceChangeStatistics: async (symbol) => {
732
+ const localVarQueryParameter = {};
733
+ if (symbol !== void 0 && symbol !== null) {
734
+ localVarQueryParameter["symbol"] = symbol;
735
+ }
736
+ let _timeUnit;
737
+ if ("timeUnit" in configuration)
738
+ _timeUnit = configuration.timeUnit;
739
+ return {
740
+ endpoint: "/eapi/v1/ticker",
741
+ method: "GET",
742
+ params: localVarQueryParameter,
743
+ timeUnit: _timeUnit
744
+ };
745
+ }
746
+ };
747
+ };
748
+ var MarketDataApi = class {
749
+ constructor(configuration) {
750
+ this.configuration = configuration;
751
+ this.localVarAxiosParamCreator = MarketDataApiAxiosParamCreator(configuration);
752
+ }
753
+ /**
754
+ * Test connectivity to the Rest API and get the current server time.
755
+ *
756
+ * Weight: 1
757
+ *
758
+ * @summary Check Server Time
759
+ * @returns {Promise<RestApiResponse<CheckServerTimeResponse>>}
760
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
761
+ * @memberof MarketDataApi
762
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Check-Server-Time Binance API Documentation}
763
+ */
764
+ async checkServerTime() {
765
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.checkServerTime();
766
+ return (0, import_common2.sendRequest)(
767
+ this.configuration,
768
+ localVarAxiosArgs.endpoint,
769
+ localVarAxiosArgs.method,
770
+ localVarAxiosArgs.params,
771
+ localVarAxiosArgs?.timeUnit,
772
+ { isSigned: false }
773
+ );
774
+ }
775
+ /**
776
+ * Current exchange trading rules and symbol information
777
+ *
778
+ * Weight: 1
779
+ *
780
+ * @summary Exchange Information
781
+ * @returns {Promise<RestApiResponse<ExchangeInformationResponse>>}
782
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
783
+ * @memberof MarketDataApi
784
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Exchange-Information Binance API Documentation}
785
+ */
786
+ async exchangeInformation() {
787
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.exchangeInformation();
788
+ return (0, import_common2.sendRequest)(
789
+ this.configuration,
790
+ localVarAxiosArgs.endpoint,
791
+ localVarAxiosArgs.method,
792
+ localVarAxiosArgs.params,
793
+ localVarAxiosArgs?.timeUnit,
794
+ { isSigned: false }
795
+ );
796
+ }
797
+ /**
798
+ * Get historical exercise records.
799
+ * REALISTIC_VALUE_STRICKEN -> Exercised
800
+ * EXTRINSIC_VALUE_EXPIRED -> Expired OTM
801
+ *
802
+ * Weight: 3
803
+ *
804
+ * @summary Historical Exercise Records
805
+ * @param {HistoricalExerciseRecordsRequest} requestParameters Request parameters.
806
+ * @returns {Promise<RestApiResponse<HistoricalExerciseRecordsResponse>>}
807
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
808
+ * @memberof MarketDataApi
809
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Historical-Exercise-Records Binance API Documentation}
810
+ */
811
+ async historicalExerciseRecords(requestParameters = {}) {
812
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.historicalExerciseRecords(
813
+ requestParameters?.underlying,
814
+ requestParameters?.startTime,
815
+ requestParameters?.endTime,
816
+ requestParameters?.limit
817
+ );
818
+ return (0, import_common2.sendRequest)(
819
+ this.configuration,
820
+ localVarAxiosArgs.endpoint,
821
+ localVarAxiosArgs.method,
822
+ localVarAxiosArgs.params,
823
+ localVarAxiosArgs?.timeUnit,
824
+ { isSigned: false }
825
+ );
826
+ }
827
+ /**
828
+ * Kline/candlestick bars for an option symbol.
829
+ * Klines are uniquely identified by their open time.
830
+ *
831
+ * If startTime and endTime are not sent, the most recent klines are returned.
832
+ *
833
+ * Weight: 1
834
+ *
835
+ * @summary Kline/Candlestick Data
836
+ * @param {KlineCandlestickDataRequest} requestParameters Request parameters.
837
+ * @returns {Promise<RestApiResponse<KlineCandlestickDataResponse>>}
838
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
839
+ * @memberof MarketDataApi
840
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data Binance API Documentation}
841
+ */
842
+ async klineCandlestickData(requestParameters) {
843
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.klineCandlestickData(
844
+ requestParameters?.symbol,
845
+ requestParameters?.interval,
846
+ requestParameters?.startTime,
847
+ requestParameters?.endTime,
848
+ requestParameters?.limit
849
+ );
850
+ return (0, import_common2.sendRequest)(
851
+ this.configuration,
852
+ localVarAxiosArgs.endpoint,
853
+ localVarAxiosArgs.method,
854
+ localVarAxiosArgs.params,
855
+ localVarAxiosArgs?.timeUnit,
856
+ { isSigned: false }
857
+ );
858
+ }
859
+ /**
860
+ * Get older market historical trades.
861
+ *
862
+ * Weight: 20
863
+ *
864
+ * @summary Old Trades Lookup (MARKET_DATA)
865
+ * @param {OldTradesLookupRequest} requestParameters Request parameters.
866
+ * @returns {Promise<RestApiResponse<OldTradesLookupResponse>>}
867
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
868
+ * @memberof MarketDataApi
869
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Old-Trades-Lookup Binance API Documentation}
870
+ */
871
+ async oldTradesLookup(requestParameters) {
872
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.oldTradesLookup(
873
+ requestParameters?.symbol,
874
+ requestParameters?.fromId,
875
+ requestParameters?.limit
876
+ );
877
+ return (0, import_common2.sendRequest)(
878
+ this.configuration,
879
+ localVarAxiosArgs.endpoint,
880
+ localVarAxiosArgs.method,
881
+ localVarAxiosArgs.params,
882
+ localVarAxiosArgs?.timeUnit,
883
+ { isSigned: false }
884
+ );
885
+ }
886
+ /**
887
+ * Get open interest for specific underlying asset on specific expiration date.
888
+ *
889
+ * Weight: 0
890
+ *
891
+ * @summary Open Interest
892
+ * @param {OpenInterestRequest} requestParameters Request parameters.
893
+ * @returns {Promise<RestApiResponse<OpenInterestResponse>>}
894
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
895
+ * @memberof MarketDataApi
896
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Open-Interest Binance API Documentation}
897
+ */
898
+ async openInterest(requestParameters) {
899
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.openInterest(
900
+ requestParameters?.underlyingAsset,
901
+ requestParameters?.expiration
902
+ );
903
+ return (0, import_common2.sendRequest)(
904
+ this.configuration,
905
+ localVarAxiosArgs.endpoint,
906
+ localVarAxiosArgs.method,
907
+ localVarAxiosArgs.params,
908
+ localVarAxiosArgs?.timeUnit,
909
+ { isSigned: false }
910
+ );
911
+ }
912
+ /**
913
+ * Option mark price and greek info.
914
+ *
915
+ * Weight: 5
916
+ *
917
+ * @summary Option Mark Price
918
+ * @param {OptionMarkPriceRequest} requestParameters Request parameters.
919
+ * @returns {Promise<RestApiResponse<OptionMarkPriceResponse>>}
920
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
921
+ * @memberof MarketDataApi
922
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price Binance API Documentation}
923
+ */
924
+ async optionMarkPrice(requestParameters = {}) {
925
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.optionMarkPrice(
926
+ requestParameters?.symbol
927
+ );
928
+ return (0, import_common2.sendRequest)(
929
+ this.configuration,
930
+ localVarAxiosArgs.endpoint,
931
+ localVarAxiosArgs.method,
932
+ localVarAxiosArgs.params,
933
+ localVarAxiosArgs?.timeUnit,
934
+ { isSigned: false }
935
+ );
936
+ }
937
+ /**
938
+ * Check orderbook depth on specific symbol
939
+ *
940
+ * Weight: limit | weight
941
+ * ------------ | ------------
942
+ * 5, 10, 20, 50 | 2
943
+ * 100 | 5
944
+ * 500 | 10
945
+ * 1000 | 20
946
+ *
947
+ * @summary Order Book
948
+ * @param {OrderBookRequest} requestParameters Request parameters.
949
+ * @returns {Promise<RestApiResponse<OrderBookResponse>>}
950
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
951
+ * @memberof MarketDataApi
952
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Order-Book Binance API Documentation}
953
+ */
954
+ async orderBook(requestParameters) {
955
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.orderBook(
956
+ requestParameters?.symbol,
957
+ requestParameters?.limit
958
+ );
959
+ return (0, import_common2.sendRequest)(
960
+ this.configuration,
961
+ localVarAxiosArgs.endpoint,
962
+ localVarAxiosArgs.method,
963
+ localVarAxiosArgs.params,
964
+ localVarAxiosArgs?.timeUnit,
965
+ { isSigned: false }
966
+ );
967
+ }
968
+ /**
969
+ * Get recent block trades
970
+ *
971
+ * Weight: 5
972
+ *
973
+ * @summary Recent Block Trades List
974
+ * @param {RecentBlockTradesListRequest} requestParameters Request parameters.
975
+ * @returns {Promise<RestApiResponse<RecentBlockTradesListResponse>>}
976
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
977
+ * @memberof MarketDataApi
978
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Recent-Block-Trade-List Binance API Documentation}
979
+ */
980
+ async recentBlockTradesList(requestParameters = {}) {
981
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.recentBlockTradesList(
982
+ requestParameters?.symbol,
983
+ requestParameters?.limit
984
+ );
985
+ return (0, import_common2.sendRequest)(
986
+ this.configuration,
987
+ localVarAxiosArgs.endpoint,
988
+ localVarAxiosArgs.method,
989
+ localVarAxiosArgs.params,
990
+ localVarAxiosArgs?.timeUnit,
991
+ { isSigned: false }
992
+ );
993
+ }
994
+ /**
995
+ * Get recent market trades
996
+ *
997
+ * Weight: 5
998
+ *
999
+ * @summary Recent Trades List
1000
+ * @param {RecentTradesListRequest} requestParameters Request parameters.
1001
+ * @returns {Promise<RestApiResponse<RecentTradesListResponse>>}
1002
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1003
+ * @memberof MarketDataApi
1004
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Recent-Trades-List Binance API Documentation}
1005
+ */
1006
+ async recentTradesList(requestParameters) {
1007
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.recentTradesList(
1008
+ requestParameters?.symbol,
1009
+ requestParameters?.limit
1010
+ );
1011
+ return (0, import_common2.sendRequest)(
1012
+ this.configuration,
1013
+ localVarAxiosArgs.endpoint,
1014
+ localVarAxiosArgs.method,
1015
+ localVarAxiosArgs.params,
1016
+ localVarAxiosArgs?.timeUnit,
1017
+ { isSigned: false }
1018
+ );
1019
+ }
1020
+ /**
1021
+ * Get spot index price for option underlying.
1022
+ *
1023
+ * Weight: 1
1024
+ *
1025
+ * @summary Symbol Price Ticker
1026
+ * @param {SymbolPriceTickerRequest} requestParameters Request parameters.
1027
+ * @returns {Promise<RestApiResponse<SymbolPriceTickerResponse>>}
1028
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1029
+ * @memberof MarketDataApi
1030
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Symbol-Price-Ticker Binance API Documentation}
1031
+ */
1032
+ async symbolPriceTicker(requestParameters) {
1033
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.symbolPriceTicker(
1034
+ requestParameters?.underlying
1035
+ );
1036
+ return (0, import_common2.sendRequest)(
1037
+ this.configuration,
1038
+ localVarAxiosArgs.endpoint,
1039
+ localVarAxiosArgs.method,
1040
+ localVarAxiosArgs.params,
1041
+ localVarAxiosArgs?.timeUnit,
1042
+ { isSigned: false }
1043
+ );
1044
+ }
1045
+ /**
1046
+ * Test connectivity to the Rest API.
1047
+ *
1048
+ * Weight: 1
1049
+ *
1050
+ * @summary Test Connectivity
1051
+ * @returns {Promise<RestApiResponse<void>>}
1052
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1053
+ * @memberof MarketDataApi
1054
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Test-Connectivity Binance API Documentation}
1055
+ */
1056
+ async testConnectivity() {
1057
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.testConnectivity();
1058
+ return (0, import_common2.sendRequest)(
1059
+ this.configuration,
1060
+ localVarAxiosArgs.endpoint,
1061
+ localVarAxiosArgs.method,
1062
+ localVarAxiosArgs.params,
1063
+ localVarAxiosArgs?.timeUnit,
1064
+ { isSigned: false }
1065
+ );
1066
+ }
1067
+ /**
1068
+ * 24 hour rolling window price change statistics.
1069
+ *
1070
+ * Weight: 5
1071
+ *
1072
+ * @summary 24hr Ticker Price Change Statistics
1073
+ * @param {Ticker24hrPriceChangeStatisticsRequest} requestParameters Request parameters.
1074
+ * @returns {Promise<RestApiResponse<Ticker24hrPriceChangeStatisticsResponse>>}
1075
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1076
+ * @memberof MarketDataApi
1077
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/24hr-Ticker-Price-Change-Statistics Binance API Documentation}
1078
+ */
1079
+ async ticker24hrPriceChangeStatistics(requestParameters = {}) {
1080
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.ticker24hrPriceChangeStatistics(
1081
+ requestParameters?.symbol
1082
+ );
1083
+ return (0, import_common2.sendRequest)(
1084
+ this.configuration,
1085
+ localVarAxiosArgs.endpoint,
1086
+ localVarAxiosArgs.method,
1087
+ localVarAxiosArgs.params,
1088
+ localVarAxiosArgs?.timeUnit,
1089
+ { isSigned: false }
1090
+ );
1091
+ }
1092
+ };
1093
+
1094
+ // src/rest-api/modules/market-maker-block-trade-api.ts
1095
+ var import_common3 = require("@binance/common");
1096
+ var MarketMakerBlockTradeApiAxiosParamCreator = function(configuration) {
1097
+ return {
1098
+ /**
1099
+ * Accept a block trade order
1100
+ *
1101
+ * Weight: 5
1102
+ *
1103
+ * @summary Accept Block Trade Order (TRADE)
1104
+ * @param {string} blockOrderMatchingKey
1105
+ * @param {number} [recvWindow]
1106
+ *
1107
+ * @throws {RequiredError}
1108
+ */
1109
+ acceptBlockTradeOrder: async (blockOrderMatchingKey, recvWindow) => {
1110
+ (0, import_common3.assertParamExists)(
1111
+ "acceptBlockTradeOrder",
1112
+ "blockOrderMatchingKey",
1113
+ blockOrderMatchingKey
1114
+ );
1115
+ const localVarQueryParameter = {};
1116
+ if (blockOrderMatchingKey !== void 0 && blockOrderMatchingKey !== null) {
1117
+ localVarQueryParameter["blockOrderMatchingKey"] = blockOrderMatchingKey;
1118
+ }
1119
+ if (recvWindow !== void 0 && recvWindow !== null) {
1120
+ localVarQueryParameter["recvWindow"] = recvWindow;
1121
+ }
1122
+ let _timeUnit;
1123
+ if ("timeUnit" in configuration)
1124
+ _timeUnit = configuration.timeUnit;
1125
+ return {
1126
+ endpoint: "/eapi/v1/block/order/execute",
1127
+ method: "POST",
1128
+ params: localVarQueryParameter,
1129
+ timeUnit: _timeUnit
1130
+ };
1131
+ },
1132
+ /**
1133
+ * Gets block trades for a specific account.
1134
+ *
1135
+ * Weight: 5
1136
+ *
1137
+ * @summary Account Block Trade List (USER_DATA)
1138
+ * @param {number} [endTime] End Time, e.g 1593512200000
1139
+ * @param {number} [startTime] Start Time, e.g 1593511200000
1140
+ * @param {string} [underlying] underlying, e.g BTCUSDT
1141
+ * @param {number} [recvWindow]
1142
+ *
1143
+ * @throws {RequiredError}
1144
+ */
1145
+ accountBlockTradeList: async (endTime, startTime, underlying, recvWindow) => {
1146
+ const localVarQueryParameter = {};
1147
+ if (endTime !== void 0 && endTime !== null) {
1148
+ localVarQueryParameter["endTime"] = endTime;
1149
+ }
1150
+ if (startTime !== void 0 && startTime !== null) {
1151
+ localVarQueryParameter["startTime"] = startTime;
1152
+ }
1153
+ if (underlying !== void 0 && underlying !== null) {
1154
+ localVarQueryParameter["underlying"] = underlying;
1155
+ }
1156
+ if (recvWindow !== void 0 && recvWindow !== null) {
1157
+ localVarQueryParameter["recvWindow"] = recvWindow;
1158
+ }
1159
+ let _timeUnit;
1160
+ if ("timeUnit" in configuration)
1161
+ _timeUnit = configuration.timeUnit;
1162
+ return {
1163
+ endpoint: "/eapi/v1/block/user-trades",
1164
+ method: "GET",
1165
+ params: localVarQueryParameter,
1166
+ timeUnit: _timeUnit
1167
+ };
1168
+ },
1169
+ /**
1170
+ * Cancel a block trade order.
1171
+ *
1172
+ * Weight: 5
1173
+ *
1174
+ * @summary Cancel Block Trade Order (TRADE)
1175
+ * @param {string} blockOrderMatchingKey
1176
+ * @param {number} [recvWindow]
1177
+ *
1178
+ * @throws {RequiredError}
1179
+ */
1180
+ cancelBlockTradeOrder: async (blockOrderMatchingKey, recvWindow) => {
1181
+ (0, import_common3.assertParamExists)(
1182
+ "cancelBlockTradeOrder",
1183
+ "blockOrderMatchingKey",
1184
+ blockOrderMatchingKey
1185
+ );
1186
+ const localVarQueryParameter = {};
1187
+ if (blockOrderMatchingKey !== void 0 && blockOrderMatchingKey !== null) {
1188
+ localVarQueryParameter["blockOrderMatchingKey"] = blockOrderMatchingKey;
1189
+ }
1190
+ if (recvWindow !== void 0 && recvWindow !== null) {
1191
+ localVarQueryParameter["recvWindow"] = recvWindow;
1192
+ }
1193
+ let _timeUnit;
1194
+ if ("timeUnit" in configuration)
1195
+ _timeUnit = configuration.timeUnit;
1196
+ return {
1197
+ endpoint: "/eapi/v1/block/order/create",
1198
+ method: "DELETE",
1199
+ params: localVarQueryParameter,
1200
+ timeUnit: _timeUnit
1201
+ };
1202
+ },
1203
+ /**
1204
+ * Extends a block trade expire time by 30 mins from the current time.
1205
+ *
1206
+ * Weight: 5
1207
+ *
1208
+ * @summary Extend Block Trade Order (TRADE)
1209
+ * @param {string} blockOrderMatchingKey
1210
+ * @param {number} [recvWindow]
1211
+ *
1212
+ * @throws {RequiredError}
1213
+ */
1214
+ extendBlockTradeOrder: async (blockOrderMatchingKey, recvWindow) => {
1215
+ (0, import_common3.assertParamExists)(
1216
+ "extendBlockTradeOrder",
1217
+ "blockOrderMatchingKey",
1218
+ blockOrderMatchingKey
1219
+ );
1220
+ const localVarQueryParameter = {};
1221
+ if (blockOrderMatchingKey !== void 0 && blockOrderMatchingKey !== null) {
1222
+ localVarQueryParameter["blockOrderMatchingKey"] = blockOrderMatchingKey;
1223
+ }
1224
+ if (recvWindow !== void 0 && recvWindow !== null) {
1225
+ localVarQueryParameter["recvWindow"] = recvWindow;
1226
+ }
1227
+ let _timeUnit;
1228
+ if ("timeUnit" in configuration)
1229
+ _timeUnit = configuration.timeUnit;
1230
+ return {
1231
+ endpoint: "/eapi/v1/block/order/create",
1232
+ method: "PUT",
1233
+ params: localVarQueryParameter,
1234
+ timeUnit: _timeUnit
1235
+ };
1236
+ },
1237
+ /**
1238
+ * Send in a new block trade order.
1239
+ *
1240
+ * Weight: 5
1241
+ *
1242
+ * @summary New Block Trade Order (TRADE)
1243
+ * @param {string} liquidity Taker or Maker
1244
+ * @param {Array<object>} legs Max 1 (only single leg supported), list of legs parameters in JSON; example: eapi/v1/block/order/create?orders=[{"symbol":"BTC-210115-35000-C", "price":"100","quantity":"0.0002","side":"BUY","type":"LIMIT"}]
1245
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
1246
+ * @param {NewBlockTradeOrderSideEnum} side BUY or SELL
1247
+ * @param {number} price Order Price
1248
+ * @param {number} quantity Order Quantity
1249
+ * @param {number} [recvWindow]
1250
+ *
1251
+ * @throws {RequiredError}
1252
+ */
1253
+ newBlockTradeOrder: async (liquidity, legs, symbol, side, price, quantity, recvWindow) => {
1254
+ (0, import_common3.assertParamExists)("newBlockTradeOrder", "liquidity", liquidity);
1255
+ (0, import_common3.assertParamExists)("newBlockTradeOrder", "legs", legs);
1256
+ (0, import_common3.assertParamExists)("newBlockTradeOrder", "symbol", symbol);
1257
+ (0, import_common3.assertParamExists)("newBlockTradeOrder", "side", side);
1258
+ (0, import_common3.assertParamExists)("newBlockTradeOrder", "price", price);
1259
+ (0, import_common3.assertParamExists)("newBlockTradeOrder", "quantity", quantity);
1260
+ const localVarQueryParameter = {};
1261
+ if (liquidity !== void 0 && liquidity !== null) {
1262
+ localVarQueryParameter["liquidity"] = liquidity;
1263
+ }
1264
+ if (legs) {
1265
+ localVarQueryParameter["legs"] = legs;
1266
+ }
1267
+ if (symbol !== void 0 && symbol !== null) {
1268
+ localVarQueryParameter["symbol"] = symbol;
1269
+ }
1270
+ if (side !== void 0 && side !== null) {
1271
+ localVarQueryParameter["side"] = side;
1272
+ }
1273
+ if (price !== void 0 && price !== null) {
1274
+ localVarQueryParameter["price"] = price;
1275
+ }
1276
+ if (quantity !== void 0 && quantity !== null) {
1277
+ localVarQueryParameter["quantity"] = quantity;
1278
+ }
1279
+ if (recvWindow !== void 0 && recvWindow !== null) {
1280
+ localVarQueryParameter["recvWindow"] = recvWindow;
1281
+ }
1282
+ let _timeUnit;
1283
+ if ("timeUnit" in configuration)
1284
+ _timeUnit = configuration.timeUnit;
1285
+ return {
1286
+ endpoint: "/eapi/v1/block/order/create",
1287
+ method: "POST",
1288
+ params: localVarQueryParameter,
1289
+ timeUnit: _timeUnit
1290
+ };
1291
+ },
1292
+ /**
1293
+ * Query block trade details; returns block trade details from counterparty's perspective.
1294
+ *
1295
+ * Weight: 5
1296
+ *
1297
+ * @summary Query Block Trade Details (USER_DATA)
1298
+ * @param {string} blockOrderMatchingKey
1299
+ * @param {number} [recvWindow]
1300
+ *
1301
+ * @throws {RequiredError}
1302
+ */
1303
+ queryBlockTradeDetails: async (blockOrderMatchingKey, recvWindow) => {
1304
+ (0, import_common3.assertParamExists)(
1305
+ "queryBlockTradeDetails",
1306
+ "blockOrderMatchingKey",
1307
+ blockOrderMatchingKey
1308
+ );
1309
+ const localVarQueryParameter = {};
1310
+ if (blockOrderMatchingKey !== void 0 && blockOrderMatchingKey !== null) {
1311
+ localVarQueryParameter["blockOrderMatchingKey"] = blockOrderMatchingKey;
1312
+ }
1313
+ if (recvWindow !== void 0 && recvWindow !== null) {
1314
+ localVarQueryParameter["recvWindow"] = recvWindow;
1315
+ }
1316
+ let _timeUnit;
1317
+ if ("timeUnit" in configuration)
1318
+ _timeUnit = configuration.timeUnit;
1319
+ return {
1320
+ endpoint: "/eapi/v1/block/order/execute",
1321
+ method: "GET",
1322
+ params: localVarQueryParameter,
1323
+ timeUnit: _timeUnit
1324
+ };
1325
+ },
1326
+ /**
1327
+ * Check block trade order status.
1328
+ *
1329
+ * Weight: 5
1330
+ *
1331
+ * @summary Query Block Trade Order (TRADE)
1332
+ * @param {string} [blockOrderMatchingKey] If specified, returns the specific block trade associated with the blockOrderMatchingKey
1333
+ * @param {number} [endTime] End Time, e.g 1593512200000
1334
+ * @param {number} [startTime] Start Time, e.g 1593511200000
1335
+ * @param {string} [underlying] underlying, e.g BTCUSDT
1336
+ * @param {number} [recvWindow]
1337
+ *
1338
+ * @throws {RequiredError}
1339
+ */
1340
+ queryBlockTradeOrder: async (blockOrderMatchingKey, endTime, startTime, underlying, recvWindow) => {
1341
+ const localVarQueryParameter = {};
1342
+ if (blockOrderMatchingKey !== void 0 && blockOrderMatchingKey !== null) {
1343
+ localVarQueryParameter["blockOrderMatchingKey"] = blockOrderMatchingKey;
1344
+ }
1345
+ if (endTime !== void 0 && endTime !== null) {
1346
+ localVarQueryParameter["endTime"] = endTime;
1347
+ }
1348
+ if (startTime !== void 0 && startTime !== null) {
1349
+ localVarQueryParameter["startTime"] = startTime;
1350
+ }
1351
+ if (underlying !== void 0 && underlying !== null) {
1352
+ localVarQueryParameter["underlying"] = underlying;
1353
+ }
1354
+ if (recvWindow !== void 0 && recvWindow !== null) {
1355
+ localVarQueryParameter["recvWindow"] = recvWindow;
1356
+ }
1357
+ let _timeUnit;
1358
+ if ("timeUnit" in configuration)
1359
+ _timeUnit = configuration.timeUnit;
1360
+ return {
1361
+ endpoint: "/eapi/v1/block/order/orders",
1362
+ method: "GET",
1363
+ params: localVarQueryParameter,
1364
+ timeUnit: _timeUnit
1365
+ };
1366
+ }
1367
+ };
1368
+ };
1369
+ var MarketMakerBlockTradeApi = class {
1370
+ constructor(configuration) {
1371
+ this.configuration = configuration;
1372
+ this.localVarAxiosParamCreator = MarketMakerBlockTradeApiAxiosParamCreator(configuration);
1373
+ }
1374
+ /**
1375
+ * Accept a block trade order
1376
+ *
1377
+ * Weight: 5
1378
+ *
1379
+ * @summary Accept Block Trade Order (TRADE)
1380
+ * @param {AcceptBlockTradeOrderRequest} requestParameters Request parameters.
1381
+ * @returns {Promise<RestApiResponse<AcceptBlockTradeOrderResponse>>}
1382
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1383
+ * @memberof MarketMakerBlockTradeApi
1384
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Accept-Block-Trade-Order Binance API Documentation}
1385
+ */
1386
+ async acceptBlockTradeOrder(requestParameters) {
1387
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.acceptBlockTradeOrder(
1388
+ requestParameters?.blockOrderMatchingKey,
1389
+ requestParameters?.recvWindow
1390
+ );
1391
+ return (0, import_common3.sendRequest)(
1392
+ this.configuration,
1393
+ localVarAxiosArgs.endpoint,
1394
+ localVarAxiosArgs.method,
1395
+ localVarAxiosArgs.params,
1396
+ localVarAxiosArgs?.timeUnit,
1397
+ { isSigned: true }
1398
+ );
1399
+ }
1400
+ /**
1401
+ * Gets block trades for a specific account.
1402
+ *
1403
+ * Weight: 5
1404
+ *
1405
+ * @summary Account Block Trade List (USER_DATA)
1406
+ * @param {AccountBlockTradeListRequest} requestParameters Request parameters.
1407
+ * @returns {Promise<RestApiResponse<AccountBlockTradeListResponse>>}
1408
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1409
+ * @memberof MarketMakerBlockTradeApi
1410
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Account-Block-Trade-List Binance API Documentation}
1411
+ */
1412
+ async accountBlockTradeList(requestParameters = {}) {
1413
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountBlockTradeList(
1414
+ requestParameters?.endTime,
1415
+ requestParameters?.startTime,
1416
+ requestParameters?.underlying,
1417
+ requestParameters?.recvWindow
1418
+ );
1419
+ return (0, import_common3.sendRequest)(
1420
+ this.configuration,
1421
+ localVarAxiosArgs.endpoint,
1422
+ localVarAxiosArgs.method,
1423
+ localVarAxiosArgs.params,
1424
+ localVarAxiosArgs?.timeUnit,
1425
+ { isSigned: true }
1426
+ );
1427
+ }
1428
+ /**
1429
+ * Cancel a block trade order.
1430
+ *
1431
+ * Weight: 5
1432
+ *
1433
+ * @summary Cancel Block Trade Order (TRADE)
1434
+ * @param {CancelBlockTradeOrderRequest} requestParameters Request parameters.
1435
+ * @returns {Promise<RestApiResponse<void>>}
1436
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1437
+ * @memberof MarketMakerBlockTradeApi
1438
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Cancel-Block-Trade-Order Binance API Documentation}
1439
+ */
1440
+ async cancelBlockTradeOrder(requestParameters) {
1441
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cancelBlockTradeOrder(
1442
+ requestParameters?.blockOrderMatchingKey,
1443
+ requestParameters?.recvWindow
1444
+ );
1445
+ return (0, import_common3.sendRequest)(
1446
+ this.configuration,
1447
+ localVarAxiosArgs.endpoint,
1448
+ localVarAxiosArgs.method,
1449
+ localVarAxiosArgs.params,
1450
+ localVarAxiosArgs?.timeUnit,
1451
+ { isSigned: true }
1452
+ );
1453
+ }
1454
+ /**
1455
+ * Extends a block trade expire time by 30 mins from the current time.
1456
+ *
1457
+ * Weight: 5
1458
+ *
1459
+ * @summary Extend Block Trade Order (TRADE)
1460
+ * @param {ExtendBlockTradeOrderRequest} requestParameters Request parameters.
1461
+ * @returns {Promise<RestApiResponse<ExtendBlockTradeOrderResponse>>}
1462
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1463
+ * @memberof MarketMakerBlockTradeApi
1464
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Extend-Block-Trade-Order Binance API Documentation}
1465
+ */
1466
+ async extendBlockTradeOrder(requestParameters) {
1467
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.extendBlockTradeOrder(
1468
+ requestParameters?.blockOrderMatchingKey,
1469
+ requestParameters?.recvWindow
1470
+ );
1471
+ return (0, import_common3.sendRequest)(
1472
+ this.configuration,
1473
+ localVarAxiosArgs.endpoint,
1474
+ localVarAxiosArgs.method,
1475
+ localVarAxiosArgs.params,
1476
+ localVarAxiosArgs?.timeUnit,
1477
+ { isSigned: true }
1478
+ );
1479
+ }
1480
+ /**
1481
+ * Send in a new block trade order.
1482
+ *
1483
+ * Weight: 5
1484
+ *
1485
+ * @summary New Block Trade Order (TRADE)
1486
+ * @param {NewBlockTradeOrderRequest} requestParameters Request parameters.
1487
+ * @returns {Promise<RestApiResponse<NewBlockTradeOrderResponse>>}
1488
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1489
+ * @memberof MarketMakerBlockTradeApi
1490
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/New-Block-Trade-Order Binance API Documentation}
1491
+ */
1492
+ async newBlockTradeOrder(requestParameters) {
1493
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.newBlockTradeOrder(
1494
+ requestParameters?.liquidity,
1495
+ requestParameters?.legs,
1496
+ requestParameters?.symbol,
1497
+ requestParameters?.side,
1498
+ requestParameters?.price,
1499
+ requestParameters?.quantity,
1500
+ requestParameters?.recvWindow
1501
+ );
1502
+ return (0, import_common3.sendRequest)(
1503
+ this.configuration,
1504
+ localVarAxiosArgs.endpoint,
1505
+ localVarAxiosArgs.method,
1506
+ localVarAxiosArgs.params,
1507
+ localVarAxiosArgs?.timeUnit,
1508
+ { isSigned: true }
1509
+ );
1510
+ }
1511
+ /**
1512
+ * Query block trade details; returns block trade details from counterparty's perspective.
1513
+ *
1514
+ * Weight: 5
1515
+ *
1516
+ * @summary Query Block Trade Details (USER_DATA)
1517
+ * @param {QueryBlockTradeDetailsRequest} requestParameters Request parameters.
1518
+ * @returns {Promise<RestApiResponse<QueryBlockTradeDetailsResponse>>}
1519
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1520
+ * @memberof MarketMakerBlockTradeApi
1521
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Query-Block-Trade-Detail Binance API Documentation}
1522
+ */
1523
+ async queryBlockTradeDetails(requestParameters) {
1524
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryBlockTradeDetails(
1525
+ requestParameters?.blockOrderMatchingKey,
1526
+ requestParameters?.recvWindow
1527
+ );
1528
+ return (0, import_common3.sendRequest)(
1529
+ this.configuration,
1530
+ localVarAxiosArgs.endpoint,
1531
+ localVarAxiosArgs.method,
1532
+ localVarAxiosArgs.params,
1533
+ localVarAxiosArgs?.timeUnit,
1534
+ { isSigned: true }
1535
+ );
1536
+ }
1537
+ /**
1538
+ * Check block trade order status.
1539
+ *
1540
+ * Weight: 5
1541
+ *
1542
+ * @summary Query Block Trade Order (TRADE)
1543
+ * @param {QueryBlockTradeOrderRequest} requestParameters Request parameters.
1544
+ * @returns {Promise<RestApiResponse<QueryBlockTradeOrderResponse>>}
1545
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1546
+ * @memberof MarketMakerBlockTradeApi
1547
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Query-Block-Trade-Order Binance API Documentation}
1548
+ */
1549
+ async queryBlockTradeOrder(requestParameters = {}) {
1550
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryBlockTradeOrder(
1551
+ requestParameters?.blockOrderMatchingKey,
1552
+ requestParameters?.endTime,
1553
+ requestParameters?.startTime,
1554
+ requestParameters?.underlying,
1555
+ requestParameters?.recvWindow
1556
+ );
1557
+ return (0, import_common3.sendRequest)(
1558
+ this.configuration,
1559
+ localVarAxiosArgs.endpoint,
1560
+ localVarAxiosArgs.method,
1561
+ localVarAxiosArgs.params,
1562
+ localVarAxiosArgs?.timeUnit,
1563
+ { isSigned: true }
1564
+ );
1565
+ }
1566
+ };
1567
+ var NewBlockTradeOrderSideEnum = {
1568
+ BUY: "BUY",
1569
+ SELL: "SELL"
1570
+ };
1571
+
1572
+ // src/rest-api/modules/market-maker-endpoints-api.ts
1573
+ var import_common4 = require("@binance/common");
1574
+ var MarketMakerEndpointsApiAxiosParamCreator = function(configuration) {
1575
+ return {
1576
+ /**
1577
+ * This endpoint resets the time from which the countdown will begin to the time this messaged is received. It should be called repeatedly as heartbeats. Multiple heartbeats can be updated at once by specifying the underlying symbols as a list (ex. BTCUSDT,ETHUSDT) in the underlyings parameter.
1578
+ *
1579
+ * The response will only include underlying symbols where the heartbeat has been successfully updated.
1580
+ *
1581
+ * Weight: 10
1582
+ *
1583
+ * @summary Auto-Cancel All Open Orders (Kill-Switch) Heartbeat (TRADE)
1584
+ * @param {string} underlyings Option Underlying Symbols, e.g BTCUSDT,ETHUSDT
1585
+ * @param {number} [recvWindow]
1586
+ *
1587
+ * @throws {RequiredError}
1588
+ */
1589
+ autoCancelAllOpenOrders: async (underlyings, recvWindow) => {
1590
+ (0, import_common4.assertParamExists)("autoCancelAllOpenOrders", "underlyings", underlyings);
1591
+ const localVarQueryParameter = {};
1592
+ if (underlyings !== void 0 && underlyings !== null) {
1593
+ localVarQueryParameter["underlyings"] = underlyings;
1594
+ }
1595
+ if (recvWindow !== void 0 && recvWindow !== null) {
1596
+ localVarQueryParameter["recvWindow"] = recvWindow;
1597
+ }
1598
+ let _timeUnit;
1599
+ if ("timeUnit" in configuration)
1600
+ _timeUnit = configuration.timeUnit;
1601
+ return {
1602
+ endpoint: "/eapi/v1/countdownCancelAllHeartBeat",
1603
+ method: "POST",
1604
+ params: localVarQueryParameter,
1605
+ timeUnit: _timeUnit
1606
+ };
1607
+ },
1608
+ /**
1609
+ * This endpoint returns the auto-cancel parameters for each underlying symbol. Note only active auto-cancel parameters will be returned, if countdownTime is set to 0 (ie. countdownTime has been turned off), the underlying symbol and corresponding countdownTime parameter will not be returned in the response.
1610
+ *
1611
+ * countdownTime = 0 means the function is disabled.
1612
+ *
1613
+ * Weight: 1
1614
+ *
1615
+ * @summary Get Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)
1616
+ * @param {string} [underlying] underlying, e.g BTCUSDT
1617
+ * @param {number} [recvWindow]
1618
+ *
1619
+ * @throws {RequiredError}
1620
+ */
1621
+ getAutoCancelAllOpenOrders: async (underlying, recvWindow) => {
1622
+ const localVarQueryParameter = {};
1623
+ if (underlying !== void 0 && underlying !== null) {
1624
+ localVarQueryParameter["underlying"] = underlying;
1625
+ }
1626
+ if (recvWindow !== void 0 && recvWindow !== null) {
1627
+ localVarQueryParameter["recvWindow"] = recvWindow;
1628
+ }
1629
+ let _timeUnit;
1630
+ if ("timeUnit" in configuration)
1631
+ _timeUnit = configuration.timeUnit;
1632
+ return {
1633
+ endpoint: "/eapi/v1/countdownCancelAll",
1634
+ method: "GET",
1635
+ params: localVarQueryParameter,
1636
+ timeUnit: _timeUnit
1637
+ };
1638
+ },
1639
+ /**
1640
+ * Get config for MMP.
1641
+ *
1642
+ * Weight: 1
1643
+ *
1644
+ * @summary Get Market Maker Protection Config (TRADE)
1645
+ * @param {string} [underlying] underlying, e.g BTCUSDT
1646
+ * @param {number} [recvWindow]
1647
+ *
1648
+ * @throws {RequiredError}
1649
+ */
1650
+ getMarketMakerProtectionConfig: async (underlying, recvWindow) => {
1651
+ const localVarQueryParameter = {};
1652
+ if (underlying !== void 0 && underlying !== null) {
1653
+ localVarQueryParameter["underlying"] = underlying;
1654
+ }
1655
+ if (recvWindow !== void 0 && recvWindow !== null) {
1656
+ localVarQueryParameter["recvWindow"] = recvWindow;
1657
+ }
1658
+ let _timeUnit;
1659
+ if ("timeUnit" in configuration)
1660
+ _timeUnit = configuration.timeUnit;
1661
+ return {
1662
+ endpoint: "/eapi/v1/mmp",
1663
+ method: "GET",
1664
+ params: localVarQueryParameter,
1665
+ timeUnit: _timeUnit
1666
+ };
1667
+ },
1668
+ /**
1669
+ * Get current account information.
1670
+ *
1671
+ * Weight: 3
1672
+ *
1673
+ * @summary Option Margin Account Information (USER_DATA)
1674
+ * @param {number} [recvWindow]
1675
+ *
1676
+ * @throws {RequiredError}
1677
+ */
1678
+ optionMarginAccountInformation: async (recvWindow) => {
1679
+ const localVarQueryParameter = {};
1680
+ if (recvWindow !== void 0 && recvWindow !== null) {
1681
+ localVarQueryParameter["recvWindow"] = recvWindow;
1682
+ }
1683
+ let _timeUnit;
1684
+ if ("timeUnit" in configuration)
1685
+ _timeUnit = configuration.timeUnit;
1686
+ return {
1687
+ endpoint: "/eapi/v1/marginAccount",
1688
+ method: "GET",
1689
+ params: localVarQueryParameter,
1690
+ timeUnit: _timeUnit
1691
+ };
1692
+ },
1693
+ /**
1694
+ * Reset MMP, start MMP order again.
1695
+ *
1696
+ * Weight: 1
1697
+ *
1698
+ * @summary Reset Market Maker Protection Config (TRADE)
1699
+ * @param {string} [underlying] underlying, e.g BTCUSDT
1700
+ * @param {number} [recvWindow]
1701
+ *
1702
+ * @throws {RequiredError}
1703
+ */
1704
+ resetMarketMakerProtectionConfig: async (underlying, recvWindow) => {
1705
+ const localVarQueryParameter = {};
1706
+ if (underlying !== void 0 && underlying !== null) {
1707
+ localVarQueryParameter["underlying"] = underlying;
1708
+ }
1709
+ if (recvWindow !== void 0 && recvWindow !== null) {
1710
+ localVarQueryParameter["recvWindow"] = recvWindow;
1711
+ }
1712
+ let _timeUnit;
1713
+ if ("timeUnit" in configuration)
1714
+ _timeUnit = configuration.timeUnit;
1715
+ return {
1716
+ endpoint: "/eapi/v1/mmpReset",
1717
+ method: "POST",
1718
+ params: localVarQueryParameter,
1719
+ timeUnit: _timeUnit
1720
+ };
1721
+ },
1722
+ /**
1723
+ * This endpoint sets the parameters of the auto-cancel feature which cancels all open orders (both market maker protection and non market maker protection order types) of the underlying symbol at the end of the specified countdown time period if no heartbeat message is sent. After the countdown time period, all open orders will be cancelled and new orders will be rejected with error code -2010 until either a heartbeat message is sent or the auto-cancel feature is turned off by setting countdownTime to 0.
1724
+ *
1725
+ *
1726
+ * This rest endpoint sets up the parameters to cancel your open orders in case of an outage or disconnection.
1727
+ * Example usage:
1728
+ * Call this endpoint with a countdownTime value of 10000 (10 seconds) to turn on the auto-cancel feature. If the corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the specified underlying symbol, all open orders of the specified symbol will be automatically canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped.
1729
+ * The system will check all countdowns approximately every 1000 milliseconds, **please note that sufficient redundancy should be considered when using this function**. We do not recommend setting the countdown time to be too precise or too small.
1730
+ *
1731
+ * Weight: 1
1732
+ *
1733
+ * @summary Set Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)
1734
+ * @param {string} underlying Option underlying, e.g BTCUSDT
1735
+ * @param {number} countdownTime Countdown time in milliseconds (ex. 1,000 for 1 second). 0 to disable the timer. Negative values (ex. -10000) are not accepted. Minimum acceptable value is 5,000
1736
+ * @param {number} [recvWindow]
1737
+ *
1738
+ * @throws {RequiredError}
1739
+ */
1740
+ setAutoCancelAllOpenOrders: async (underlying, countdownTime, recvWindow) => {
1741
+ (0, import_common4.assertParamExists)("setAutoCancelAllOpenOrders", "underlying", underlying);
1742
+ (0, import_common4.assertParamExists)("setAutoCancelAllOpenOrders", "countdownTime", countdownTime);
1743
+ const localVarQueryParameter = {};
1744
+ if (underlying !== void 0 && underlying !== null) {
1745
+ localVarQueryParameter["underlying"] = underlying;
1746
+ }
1747
+ if (countdownTime !== void 0 && countdownTime !== null) {
1748
+ localVarQueryParameter["countdownTime"] = countdownTime;
1749
+ }
1750
+ if (recvWindow !== void 0 && recvWindow !== null) {
1751
+ localVarQueryParameter["recvWindow"] = recvWindow;
1752
+ }
1753
+ let _timeUnit;
1754
+ if ("timeUnit" in configuration)
1755
+ _timeUnit = configuration.timeUnit;
1756
+ return {
1757
+ endpoint: "/eapi/v1/countdownCancelAll",
1758
+ method: "POST",
1759
+ params: localVarQueryParameter,
1760
+ timeUnit: _timeUnit
1761
+ };
1762
+ },
1763
+ /**
1764
+ * Set config for MMP.
1765
+ * Market Maker Protection(MMP) is a set of protection mechanism for option market maker, this mechanism is able to prevent mass trading in short period time. Once market maker's account branches the threshold, the Market Maker Protection will be triggered. When Market Maker Protection triggers, all the current MMP orders will be canceled, new MMP orders will be rejected. Market maker can use this time to reevaluate market and modify order price.
1766
+ *
1767
+ * Weight: 1
1768
+ *
1769
+ * @summary Set Market Maker Protection Config (TRADE)
1770
+ * @param {string} [underlying] underlying, e.g BTCUSDT
1771
+ * @param {number} [windowTimeInMilliseconds] MMP Interval in milliseconds; Range (0,5000]
1772
+ * @param {number} [frozenTimeInMilliseconds] MMP frozen time in milliseconds, if set to 0 manual reset is required
1773
+ * @param {number} [qtyLimit] quantity limit
1774
+ * @param {number} [deltaLimit] net delta limit
1775
+ * @param {number} [recvWindow]
1776
+ *
1777
+ * @throws {RequiredError}
1778
+ */
1779
+ setMarketMakerProtectionConfig: async (underlying, windowTimeInMilliseconds, frozenTimeInMilliseconds, qtyLimit, deltaLimit, recvWindow) => {
1780
+ const localVarQueryParameter = {};
1781
+ if (underlying !== void 0 && underlying !== null) {
1782
+ localVarQueryParameter["underlying"] = underlying;
1783
+ }
1784
+ if (windowTimeInMilliseconds !== void 0 && windowTimeInMilliseconds !== null) {
1785
+ localVarQueryParameter["windowTimeInMilliseconds"] = windowTimeInMilliseconds;
1786
+ }
1787
+ if (frozenTimeInMilliseconds !== void 0 && frozenTimeInMilliseconds !== null) {
1788
+ localVarQueryParameter["frozenTimeInMilliseconds"] = frozenTimeInMilliseconds;
1789
+ }
1790
+ if (qtyLimit !== void 0 && qtyLimit !== null) {
1791
+ localVarQueryParameter["qtyLimit"] = qtyLimit;
1792
+ }
1793
+ if (deltaLimit !== void 0 && deltaLimit !== null) {
1794
+ localVarQueryParameter["deltaLimit"] = deltaLimit;
1795
+ }
1796
+ if (recvWindow !== void 0 && recvWindow !== null) {
1797
+ localVarQueryParameter["recvWindow"] = recvWindow;
1798
+ }
1799
+ let _timeUnit;
1800
+ if ("timeUnit" in configuration)
1801
+ _timeUnit = configuration.timeUnit;
1802
+ return {
1803
+ endpoint: "/eapi/v1/mmpSet",
1804
+ method: "POST",
1805
+ params: localVarQueryParameter,
1806
+ timeUnit: _timeUnit
1807
+ };
1808
+ }
1809
+ };
1810
+ };
1811
+ var MarketMakerEndpointsApi = class {
1812
+ constructor(configuration) {
1813
+ this.configuration = configuration;
1814
+ this.localVarAxiosParamCreator = MarketMakerEndpointsApiAxiosParamCreator(configuration);
1815
+ }
1816
+ /**
1817
+ * This endpoint resets the time from which the countdown will begin to the time this messaged is received. It should be called repeatedly as heartbeats. Multiple heartbeats can be updated at once by specifying the underlying symbols as a list (ex. BTCUSDT,ETHUSDT) in the underlyings parameter.
1818
+ *
1819
+ * The response will only include underlying symbols where the heartbeat has been successfully updated.
1820
+ *
1821
+ * Weight: 10
1822
+ *
1823
+ * @summary Auto-Cancel All Open Orders (Kill-Switch) Heartbeat (TRADE)
1824
+ * @param {AutoCancelAllOpenOrdersRequest} requestParameters Request parameters.
1825
+ * @returns {Promise<RestApiResponse<AutoCancelAllOpenOrdersResponse>>}
1826
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1827
+ * @memberof MarketMakerEndpointsApi
1828
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Auto-Cancel-All-Open-Orders-Heartbeat Binance API Documentation}
1829
+ */
1830
+ async autoCancelAllOpenOrders(requestParameters) {
1831
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.autoCancelAllOpenOrders(
1832
+ requestParameters?.underlyings,
1833
+ requestParameters?.recvWindow
1834
+ );
1835
+ return (0, import_common4.sendRequest)(
1836
+ this.configuration,
1837
+ localVarAxiosArgs.endpoint,
1838
+ localVarAxiosArgs.method,
1839
+ localVarAxiosArgs.params,
1840
+ localVarAxiosArgs?.timeUnit,
1841
+ { isSigned: true }
1842
+ );
1843
+ }
1844
+ /**
1845
+ * This endpoint returns the auto-cancel parameters for each underlying symbol. Note only active auto-cancel parameters will be returned, if countdownTime is set to 0 (ie. countdownTime has been turned off), the underlying symbol and corresponding countdownTime parameter will not be returned in the response.
1846
+ *
1847
+ * countdownTime = 0 means the function is disabled.
1848
+ *
1849
+ * Weight: 1
1850
+ *
1851
+ * @summary Get Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)
1852
+ * @param {GetAutoCancelAllOpenOrdersRequest} requestParameters Request parameters.
1853
+ * @returns {Promise<RestApiResponse<GetAutoCancelAllOpenOrdersResponse>>}
1854
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1855
+ * @memberof MarketMakerEndpointsApi
1856
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Get-Auto-Cancel-All-Open-Orders-Config Binance API Documentation}
1857
+ */
1858
+ async getAutoCancelAllOpenOrders(requestParameters = {}) {
1859
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getAutoCancelAllOpenOrders(
1860
+ requestParameters?.underlying,
1861
+ requestParameters?.recvWindow
1862
+ );
1863
+ return (0, import_common4.sendRequest)(
1864
+ this.configuration,
1865
+ localVarAxiosArgs.endpoint,
1866
+ localVarAxiosArgs.method,
1867
+ localVarAxiosArgs.params,
1868
+ localVarAxiosArgs?.timeUnit,
1869
+ { isSigned: true }
1870
+ );
1871
+ }
1872
+ /**
1873
+ * Get config for MMP.
1874
+ *
1875
+ * Weight: 1
1876
+ *
1877
+ * @summary Get Market Maker Protection Config (TRADE)
1878
+ * @param {GetMarketMakerProtectionConfigRequest} requestParameters Request parameters.
1879
+ * @returns {Promise<RestApiResponse<GetMarketMakerProtectionConfigResponse>>}
1880
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1881
+ * @memberof MarketMakerEndpointsApi
1882
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Get-Market-Maker-Protection-Config Binance API Documentation}
1883
+ */
1884
+ async getMarketMakerProtectionConfig(requestParameters = {}) {
1885
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getMarketMakerProtectionConfig(
1886
+ requestParameters?.underlying,
1887
+ requestParameters?.recvWindow
1888
+ );
1889
+ return (0, import_common4.sendRequest)(
1890
+ this.configuration,
1891
+ localVarAxiosArgs.endpoint,
1892
+ localVarAxiosArgs.method,
1893
+ localVarAxiosArgs.params,
1894
+ localVarAxiosArgs?.timeUnit,
1895
+ { isSigned: true }
1896
+ );
1897
+ }
1898
+ /**
1899
+ * Get current account information.
1900
+ *
1901
+ * Weight: 3
1902
+ *
1903
+ * @summary Option Margin Account Information (USER_DATA)
1904
+ * @param {OptionMarginAccountInformationRequest} requestParameters Request parameters.
1905
+ * @returns {Promise<RestApiResponse<OptionMarginAccountInformationResponse>>}
1906
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1907
+ * @memberof MarketMakerEndpointsApi
1908
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Option-Margin-Account-Information Binance API Documentation}
1909
+ */
1910
+ async optionMarginAccountInformation(requestParameters = {}) {
1911
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.optionMarginAccountInformation(
1912
+ requestParameters?.recvWindow
1913
+ );
1914
+ return (0, import_common4.sendRequest)(
1915
+ this.configuration,
1916
+ localVarAxiosArgs.endpoint,
1917
+ localVarAxiosArgs.method,
1918
+ localVarAxiosArgs.params,
1919
+ localVarAxiosArgs?.timeUnit,
1920
+ { isSigned: true }
1921
+ );
1922
+ }
1923
+ /**
1924
+ * Reset MMP, start MMP order again.
1925
+ *
1926
+ * Weight: 1
1927
+ *
1928
+ * @summary Reset Market Maker Protection Config (TRADE)
1929
+ * @param {ResetMarketMakerProtectionConfigRequest} requestParameters Request parameters.
1930
+ * @returns {Promise<RestApiResponse<ResetMarketMakerProtectionConfigResponse>>}
1931
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1932
+ * @memberof MarketMakerEndpointsApi
1933
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Reset-Market-Maker-Protection-Config Binance API Documentation}
1934
+ */
1935
+ async resetMarketMakerProtectionConfig(requestParameters = {}) {
1936
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.resetMarketMakerProtectionConfig(
1937
+ requestParameters?.underlying,
1938
+ requestParameters?.recvWindow
1939
+ );
1940
+ return (0, import_common4.sendRequest)(
1941
+ this.configuration,
1942
+ localVarAxiosArgs.endpoint,
1943
+ localVarAxiosArgs.method,
1944
+ localVarAxiosArgs.params,
1945
+ localVarAxiosArgs?.timeUnit,
1946
+ { isSigned: true }
1947
+ );
1948
+ }
1949
+ /**
1950
+ * This endpoint sets the parameters of the auto-cancel feature which cancels all open orders (both market maker protection and non market maker protection order types) of the underlying symbol at the end of the specified countdown time period if no heartbeat message is sent. After the countdown time period, all open orders will be cancelled and new orders will be rejected with error code -2010 until either a heartbeat message is sent or the auto-cancel feature is turned off by setting countdownTime to 0.
1951
+ *
1952
+ *
1953
+ * This rest endpoint sets up the parameters to cancel your open orders in case of an outage or disconnection.
1954
+ * Example usage:
1955
+ * Call this endpoint with a countdownTime value of 10000 (10 seconds) to turn on the auto-cancel feature. If the corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the specified underlying symbol, all open orders of the specified symbol will be automatically canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped.
1956
+ * The system will check all countdowns approximately every 1000 milliseconds, **please note that sufficient redundancy should be considered when using this function**. We do not recommend setting the countdown time to be too precise or too small.
1957
+ *
1958
+ * Weight: 1
1959
+ *
1960
+ * @summary Set Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)
1961
+ * @param {SetAutoCancelAllOpenOrdersRequest} requestParameters Request parameters.
1962
+ * @returns {Promise<RestApiResponse<SetAutoCancelAllOpenOrdersResponse>>}
1963
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1964
+ * @memberof MarketMakerEndpointsApi
1965
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Set-Auto-Cancel-All-Open-Orders-Config Binance API Documentation}
1966
+ */
1967
+ async setAutoCancelAllOpenOrders(requestParameters) {
1968
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.setAutoCancelAllOpenOrders(
1969
+ requestParameters?.underlying,
1970
+ requestParameters?.countdownTime,
1971
+ requestParameters?.recvWindow
1972
+ );
1973
+ return (0, import_common4.sendRequest)(
1974
+ this.configuration,
1975
+ localVarAxiosArgs.endpoint,
1976
+ localVarAxiosArgs.method,
1977
+ localVarAxiosArgs.params,
1978
+ localVarAxiosArgs?.timeUnit,
1979
+ { isSigned: true }
1980
+ );
1981
+ }
1982
+ /**
1983
+ * Set config for MMP.
1984
+ * Market Maker Protection(MMP) is a set of protection mechanism for option market maker, this mechanism is able to prevent mass trading in short period time. Once market maker's account branches the threshold, the Market Maker Protection will be triggered. When Market Maker Protection triggers, all the current MMP orders will be canceled, new MMP orders will be rejected. Market maker can use this time to reevaluate market and modify order price.
1985
+ *
1986
+ * Weight: 1
1987
+ *
1988
+ * @summary Set Market Maker Protection Config (TRADE)
1989
+ * @param {SetMarketMakerProtectionConfigRequest} requestParameters Request parameters.
1990
+ * @returns {Promise<RestApiResponse<SetMarketMakerProtectionConfigResponse>>}
1991
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
1992
+ * @memberof MarketMakerEndpointsApi
1993
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Set-Market-Maker-Protection-Config Binance API Documentation}
1994
+ */
1995
+ async setMarketMakerProtectionConfig(requestParameters = {}) {
1996
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.setMarketMakerProtectionConfig(
1997
+ requestParameters?.underlying,
1998
+ requestParameters?.windowTimeInMilliseconds,
1999
+ requestParameters?.frozenTimeInMilliseconds,
2000
+ requestParameters?.qtyLimit,
2001
+ requestParameters?.deltaLimit,
2002
+ requestParameters?.recvWindow
2003
+ );
2004
+ return (0, import_common4.sendRequest)(
2005
+ this.configuration,
2006
+ localVarAxiosArgs.endpoint,
2007
+ localVarAxiosArgs.method,
2008
+ localVarAxiosArgs.params,
2009
+ localVarAxiosArgs?.timeUnit,
2010
+ { isSigned: true }
2011
+ );
2012
+ }
2013
+ };
2014
+
2015
+ // src/rest-api/modules/trade-api.ts
2016
+ var import_common5 = require("@binance/common");
2017
+ var TradeApiAxiosParamCreator = function(configuration) {
2018
+ return {
2019
+ /**
2020
+ * Get trades for a specific account and symbol.
2021
+ *
2022
+ * Weight: 5
2023
+ *
2024
+ * @summary Account Trade List (USER_DATA)
2025
+ * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C
2026
+ * @param {number} [fromId] The UniqueId ID from which to return. The latest deal record is returned by default
2027
+ * @param {number} [startTime] Start Time, e.g 1593511200000
2028
+ * @param {number} [endTime] End Time, e.g 1593512200000
2029
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
2030
+ * @param {number} [recvWindow]
2031
+ *
2032
+ * @throws {RequiredError}
2033
+ */
2034
+ accountTradeList: async (symbol, fromId, startTime, endTime, limit, recvWindow) => {
2035
+ const localVarQueryParameter = {};
2036
+ if (symbol !== void 0 && symbol !== null) {
2037
+ localVarQueryParameter["symbol"] = symbol;
2038
+ }
2039
+ if (fromId !== void 0 && fromId !== null) {
2040
+ localVarQueryParameter["fromId"] = fromId;
2041
+ }
2042
+ if (startTime !== void 0 && startTime !== null) {
2043
+ localVarQueryParameter["startTime"] = startTime;
2044
+ }
2045
+ if (endTime !== void 0 && endTime !== null) {
2046
+ localVarQueryParameter["endTime"] = endTime;
2047
+ }
2048
+ if (limit !== void 0 && limit !== null) {
2049
+ localVarQueryParameter["limit"] = limit;
2050
+ }
2051
+ if (recvWindow !== void 0 && recvWindow !== null) {
2052
+ localVarQueryParameter["recvWindow"] = recvWindow;
2053
+ }
2054
+ let _timeUnit;
2055
+ if ("timeUnit" in configuration)
2056
+ _timeUnit = configuration.timeUnit;
2057
+ return {
2058
+ endpoint: "/eapi/v1/userTrades",
2059
+ method: "GET",
2060
+ params: localVarQueryParameter,
2061
+ timeUnit: _timeUnit
2062
+ };
2063
+ },
2064
+ /**
2065
+ * Cancel all active orders on specified underlying.
2066
+ *
2067
+ * Weight: 1
2068
+ *
2069
+ * @summary Cancel All Option Orders By Underlying (TRADE)
2070
+ * @param {string} underlying Option underlying, e.g BTCUSDT
2071
+ * @param {number} [recvWindow]
2072
+ *
2073
+ * @throws {RequiredError}
2074
+ */
2075
+ cancelAllOptionOrdersByUnderlying: async (underlying, recvWindow) => {
2076
+ (0, import_common5.assertParamExists)("cancelAllOptionOrdersByUnderlying", "underlying", underlying);
2077
+ const localVarQueryParameter = {};
2078
+ if (underlying !== void 0 && underlying !== null) {
2079
+ localVarQueryParameter["underlying"] = underlying;
2080
+ }
2081
+ if (recvWindow !== void 0 && recvWindow !== null) {
2082
+ localVarQueryParameter["recvWindow"] = recvWindow;
2083
+ }
2084
+ let _timeUnit;
2085
+ if ("timeUnit" in configuration)
2086
+ _timeUnit = configuration.timeUnit;
2087
+ return {
2088
+ endpoint: "/eapi/v1/allOpenOrdersByUnderlying",
2089
+ method: "DELETE",
2090
+ params: localVarQueryParameter,
2091
+ timeUnit: _timeUnit
2092
+ };
2093
+ },
2094
+ /**
2095
+ * Cancel all active order on a symbol.
2096
+ *
2097
+ * Weight: 1
2098
+ *
2099
+ * @summary Cancel all Option orders on specific symbol (TRADE)
2100
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
2101
+ * @param {number} [recvWindow]
2102
+ *
2103
+ * @throws {RequiredError}
2104
+ */
2105
+ cancelAllOptionOrdersOnSpecificSymbol: async (symbol, recvWindow) => {
2106
+ (0, import_common5.assertParamExists)("cancelAllOptionOrdersOnSpecificSymbol", "symbol", symbol);
2107
+ const localVarQueryParameter = {};
2108
+ if (symbol !== void 0 && symbol !== null) {
2109
+ localVarQueryParameter["symbol"] = symbol;
2110
+ }
2111
+ if (recvWindow !== void 0 && recvWindow !== null) {
2112
+ localVarQueryParameter["recvWindow"] = recvWindow;
2113
+ }
2114
+ let _timeUnit;
2115
+ if ("timeUnit" in configuration)
2116
+ _timeUnit = configuration.timeUnit;
2117
+ return {
2118
+ endpoint: "/eapi/v1/allOpenOrders",
2119
+ method: "DELETE",
2120
+ params: localVarQueryParameter,
2121
+ timeUnit: _timeUnit
2122
+ };
2123
+ },
2124
+ /**
2125
+ * Cancel multiple orders.
2126
+ *
2127
+ * At least one instance of `orderId` and `clientOrderId` must be sent.
2128
+ *
2129
+ * Weight: 1
2130
+ *
2131
+ * @summary Cancel Multiple Option Orders (TRADE)
2132
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
2133
+ * @param {Array<number>} [orderIds] Order ID, e.g [4611875134427365377,4611875134427365378]
2134
+ * @param {Array<string>} [clientOrderIds] User-defined order ID, e.g ["my_id_1","my_id_2"]
2135
+ * @param {number} [recvWindow]
2136
+ *
2137
+ * @throws {RequiredError}
2138
+ */
2139
+ cancelMultipleOptionOrders: async (symbol, orderIds, clientOrderIds, recvWindow) => {
2140
+ (0, import_common5.assertParamExists)("cancelMultipleOptionOrders", "symbol", symbol);
2141
+ const localVarQueryParameter = {};
2142
+ if (symbol !== void 0 && symbol !== null) {
2143
+ localVarQueryParameter["symbol"] = symbol;
2144
+ }
2145
+ if (orderIds) {
2146
+ localVarQueryParameter["orderIds"] = orderIds;
2147
+ }
2148
+ if (clientOrderIds) {
2149
+ localVarQueryParameter["clientOrderIds"] = clientOrderIds;
2150
+ }
2151
+ if (recvWindow !== void 0 && recvWindow !== null) {
2152
+ localVarQueryParameter["recvWindow"] = recvWindow;
2153
+ }
2154
+ let _timeUnit;
2155
+ if ("timeUnit" in configuration)
2156
+ _timeUnit = configuration.timeUnit;
2157
+ return {
2158
+ endpoint: "/eapi/v1/batchOrders",
2159
+ method: "DELETE",
2160
+ params: localVarQueryParameter,
2161
+ timeUnit: _timeUnit
2162
+ };
2163
+ },
2164
+ /**
2165
+ * Cancel an active order.
2166
+ *
2167
+ * At least one instance of `orderId` and `clientOrderId` must be sent.
2168
+ *
2169
+ * Weight: 1
2170
+ *
2171
+ * @summary Cancel Option Order (TRADE)
2172
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
2173
+ * @param {number} [orderId] Order ID, e.g 4611875134427365377
2174
+ * @param {string} [clientOrderId] User-defined order ID, e.g 10000
2175
+ * @param {number} [recvWindow]
2176
+ *
2177
+ * @throws {RequiredError}
2178
+ */
2179
+ cancelOptionOrder: async (symbol, orderId, clientOrderId, recvWindow) => {
2180
+ (0, import_common5.assertParamExists)("cancelOptionOrder", "symbol", symbol);
2181
+ const localVarQueryParameter = {};
2182
+ if (symbol !== void 0 && symbol !== null) {
2183
+ localVarQueryParameter["symbol"] = symbol;
2184
+ }
2185
+ if (orderId !== void 0 && orderId !== null) {
2186
+ localVarQueryParameter["orderId"] = orderId;
2187
+ }
2188
+ if (clientOrderId !== void 0 && clientOrderId !== null) {
2189
+ localVarQueryParameter["clientOrderId"] = clientOrderId;
2190
+ }
2191
+ if (recvWindow !== void 0 && recvWindow !== null) {
2192
+ localVarQueryParameter["recvWindow"] = recvWindow;
2193
+ }
2194
+ let _timeUnit;
2195
+ if ("timeUnit" in configuration)
2196
+ _timeUnit = configuration.timeUnit;
2197
+ return {
2198
+ endpoint: "/eapi/v1/order",
2199
+ method: "DELETE",
2200
+ params: localVarQueryParameter,
2201
+ timeUnit: _timeUnit
2202
+ };
2203
+ },
2204
+ /**
2205
+ * Send a new order.
2206
+ *
2207
+ * Weight: 0
2208
+ *
2209
+ * @summary New Order (TRADE)
2210
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
2211
+ * @param {NewOrderSideEnum} side BUY or SELL
2212
+ * @param {NewOrderTypeEnum} type Order Type: LIMIT(only support limit)
2213
+ * @param {number} quantity Order Quantity
2214
+ * @param {number} [price] Order Price
2215
+ * @param {NewOrderTimeInForceEnum} [timeInForce] Time in force method(Default GTC)
2216
+ * @param {boolean} [reduceOnly] Reduce Only(Default false)
2217
+ * @param {boolean} [postOnly] Post Only(Default false)
2218
+ * @param {NewOrderNewOrderRespTypeEnum} [newOrderRespType] "ACK", "RESULT", Default "ACK"
2219
+ * @param {string} [clientOrderId] User-defined order ID, e.g 10000
2220
+ * @param {boolean} [isMmp] is market maker protection order, true/false
2221
+ * @param {number} [recvWindow]
2222
+ *
2223
+ * @throws {RequiredError}
2224
+ */
2225
+ newOrder: async (symbol, side, type, quantity, price, timeInForce, reduceOnly, postOnly, newOrderRespType, clientOrderId, isMmp, recvWindow) => {
2226
+ (0, import_common5.assertParamExists)("newOrder", "symbol", symbol);
2227
+ (0, import_common5.assertParamExists)("newOrder", "side", side);
2228
+ (0, import_common5.assertParamExists)("newOrder", "type", type);
2229
+ (0, import_common5.assertParamExists)("newOrder", "quantity", quantity);
2230
+ const localVarQueryParameter = {};
2231
+ if (symbol !== void 0 && symbol !== null) {
2232
+ localVarQueryParameter["symbol"] = symbol;
2233
+ }
2234
+ if (side !== void 0 && side !== null) {
2235
+ localVarQueryParameter["side"] = side;
2236
+ }
2237
+ if (type !== void 0 && type !== null) {
2238
+ localVarQueryParameter["type"] = type;
2239
+ }
2240
+ if (quantity !== void 0 && quantity !== null) {
2241
+ localVarQueryParameter["quantity"] = quantity;
2242
+ }
2243
+ if (price !== void 0 && price !== null) {
2244
+ localVarQueryParameter["price"] = price;
2245
+ }
2246
+ if (timeInForce !== void 0 && timeInForce !== null) {
2247
+ localVarQueryParameter["timeInForce"] = timeInForce;
2248
+ }
2249
+ if (reduceOnly !== void 0 && reduceOnly !== null) {
2250
+ localVarQueryParameter["reduceOnly"] = reduceOnly;
2251
+ }
2252
+ if (postOnly !== void 0 && postOnly !== null) {
2253
+ localVarQueryParameter["postOnly"] = postOnly;
2254
+ }
2255
+ if (newOrderRespType !== void 0 && newOrderRespType !== null) {
2256
+ localVarQueryParameter["newOrderRespType"] = newOrderRespType;
2257
+ }
2258
+ if (clientOrderId !== void 0 && clientOrderId !== null) {
2259
+ localVarQueryParameter["clientOrderId"] = clientOrderId;
2260
+ }
2261
+ if (isMmp !== void 0 && isMmp !== null) {
2262
+ localVarQueryParameter["isMmp"] = isMmp;
2263
+ }
2264
+ if (recvWindow !== void 0 && recvWindow !== null) {
2265
+ localVarQueryParameter["recvWindow"] = recvWindow;
2266
+ }
2267
+ let _timeUnit;
2268
+ if ("timeUnit" in configuration)
2269
+ _timeUnit = configuration.timeUnit;
2270
+ return {
2271
+ endpoint: "/eapi/v1/order",
2272
+ method: "POST",
2273
+ params: localVarQueryParameter,
2274
+ timeUnit: _timeUnit
2275
+ };
2276
+ },
2277
+ /**
2278
+ * Get current position information.
2279
+ *
2280
+ * Weight: 5
2281
+ *
2282
+ * @summary Option Position Information (USER_DATA)
2283
+ * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C
2284
+ * @param {number} [recvWindow]
2285
+ *
2286
+ * @throws {RequiredError}
2287
+ */
2288
+ optionPositionInformation: async (symbol, recvWindow) => {
2289
+ const localVarQueryParameter = {};
2290
+ if (symbol !== void 0 && symbol !== null) {
2291
+ localVarQueryParameter["symbol"] = symbol;
2292
+ }
2293
+ if (recvWindow !== void 0 && recvWindow !== null) {
2294
+ localVarQueryParameter["recvWindow"] = recvWindow;
2295
+ }
2296
+ let _timeUnit;
2297
+ if ("timeUnit" in configuration)
2298
+ _timeUnit = configuration.timeUnit;
2299
+ return {
2300
+ endpoint: "/eapi/v1/position",
2301
+ method: "GET",
2302
+ params: localVarQueryParameter,
2303
+ timeUnit: _timeUnit
2304
+ };
2305
+ },
2306
+ /**
2307
+ * Send multiple option orders.
2308
+ *
2309
+ * Parameter rules are same with New Order
2310
+ * Batch orders are processed concurrently, and the order of matching is not guaranteed.
2311
+ *
2312
+ * Weight: 5
2313
+ *
2314
+ * @summary Place Multiple Orders(TRADE)
2315
+ * @param {Array<PlaceMultipleOrdersOrdersParameterInner>} orders order list. Max 5 orders
2316
+ * @param {number} [recvWindow]
2317
+ *
2318
+ * @throws {RequiredError}
2319
+ */
2320
+ placeMultipleOrders: async (orders, recvWindow) => {
2321
+ (0, import_common5.assertParamExists)("placeMultipleOrders", "orders", orders);
2322
+ const localVarQueryParameter = {};
2323
+ if (orders) {
2324
+ localVarQueryParameter["orders"] = orders;
2325
+ }
2326
+ if (recvWindow !== void 0 && recvWindow !== null) {
2327
+ localVarQueryParameter["recvWindow"] = recvWindow;
2328
+ }
2329
+ let _timeUnit;
2330
+ if ("timeUnit" in configuration)
2331
+ _timeUnit = configuration.timeUnit;
2332
+ return {
2333
+ endpoint: "/eapi/v1/batchOrders",
2334
+ method: "POST",
2335
+ params: localVarQueryParameter,
2336
+ timeUnit: _timeUnit
2337
+ };
2338
+ },
2339
+ /**
2340
+ * Query current all open orders, status: ACCEPTED PARTIALLY_FILLED
2341
+ *
2342
+ * Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
2343
+ *
2344
+ * @summary Query Current Open Option Orders (USER_DATA)
2345
+ * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C
2346
+ * @param {number} [orderId] Order ID, e.g 4611875134427365377
2347
+ * @param {number} [startTime] Start Time, e.g 1593511200000
2348
+ * @param {number} [endTime] End Time, e.g 1593512200000
2349
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
2350
+ * @param {number} [recvWindow]
2351
+ *
2352
+ * @throws {RequiredError}
2353
+ */
2354
+ queryCurrentOpenOptionOrders: async (symbol, orderId, startTime, endTime, limit, recvWindow) => {
2355
+ const localVarQueryParameter = {};
2356
+ if (symbol !== void 0 && symbol !== null) {
2357
+ localVarQueryParameter["symbol"] = symbol;
2358
+ }
2359
+ if (orderId !== void 0 && orderId !== null) {
2360
+ localVarQueryParameter["orderId"] = orderId;
2361
+ }
2362
+ if (startTime !== void 0 && startTime !== null) {
2363
+ localVarQueryParameter["startTime"] = startTime;
2364
+ }
2365
+ if (endTime !== void 0 && endTime !== null) {
2366
+ localVarQueryParameter["endTime"] = endTime;
2367
+ }
2368
+ if (limit !== void 0 && limit !== null) {
2369
+ localVarQueryParameter["limit"] = limit;
2370
+ }
2371
+ if (recvWindow !== void 0 && recvWindow !== null) {
2372
+ localVarQueryParameter["recvWindow"] = recvWindow;
2373
+ }
2374
+ let _timeUnit;
2375
+ if ("timeUnit" in configuration)
2376
+ _timeUnit = configuration.timeUnit;
2377
+ return {
2378
+ endpoint: "/eapi/v1/openOrders",
2379
+ method: "GET",
2380
+ params: localVarQueryParameter,
2381
+ timeUnit: _timeUnit
2382
+ };
2383
+ },
2384
+ /**
2385
+ * Query all finished orders within 5 days, finished status: CANCELLED FILLED REJECTED.
2386
+ *
2387
+ * Weight: 3
2388
+ *
2389
+ * @summary Query Option Order History (TRADE)
2390
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
2391
+ * @param {number} [orderId] Order ID, e.g 4611875134427365377
2392
+ * @param {number} [startTime] Start Time, e.g 1593511200000
2393
+ * @param {number} [endTime] End Time, e.g 1593512200000
2394
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
2395
+ * @param {number} [recvWindow]
2396
+ *
2397
+ * @throws {RequiredError}
2398
+ */
2399
+ queryOptionOrderHistory: async (symbol, orderId, startTime, endTime, limit, recvWindow) => {
2400
+ (0, import_common5.assertParamExists)("queryOptionOrderHistory", "symbol", symbol);
2401
+ const localVarQueryParameter = {};
2402
+ if (symbol !== void 0 && symbol !== null) {
2403
+ localVarQueryParameter["symbol"] = symbol;
2404
+ }
2405
+ if (orderId !== void 0 && orderId !== null) {
2406
+ localVarQueryParameter["orderId"] = orderId;
2407
+ }
2408
+ if (startTime !== void 0 && startTime !== null) {
2409
+ localVarQueryParameter["startTime"] = startTime;
2410
+ }
2411
+ if (endTime !== void 0 && endTime !== null) {
2412
+ localVarQueryParameter["endTime"] = endTime;
2413
+ }
2414
+ if (limit !== void 0 && limit !== null) {
2415
+ localVarQueryParameter["limit"] = limit;
2416
+ }
2417
+ if (recvWindow !== void 0 && recvWindow !== null) {
2418
+ localVarQueryParameter["recvWindow"] = recvWindow;
2419
+ }
2420
+ let _timeUnit;
2421
+ if ("timeUnit" in configuration)
2422
+ _timeUnit = configuration.timeUnit;
2423
+ return {
2424
+ endpoint: "/eapi/v1/historyOrders",
2425
+ method: "GET",
2426
+ params: localVarQueryParameter,
2427
+ timeUnit: _timeUnit
2428
+ };
2429
+ },
2430
+ /**
2431
+ * Check an order status.
2432
+ *
2433
+ * These orders will not be found:
2434
+ * order status is `CANCELED` or `REJECTED`, **AND**
2435
+ * order has NO filled trade, **AND**
2436
+ * created time + 3 days < current time
2437
+ *
2438
+ *
2439
+ * Either `orderId` or `clientOrderId ` must be sent.
2440
+ *
2441
+ * Weight: 1
2442
+ *
2443
+ * @summary Query Single Order (TRADE)
2444
+ * @param {string} symbol Option trading pair, e.g BTC-200730-9000-C
2445
+ * @param {number} [orderId] Order ID, e.g 4611875134427365377
2446
+ * @param {string} [clientOrderId] User-defined order ID, e.g 10000
2447
+ * @param {number} [recvWindow]
2448
+ *
2449
+ * @throws {RequiredError}
2450
+ */
2451
+ querySingleOrder: async (symbol, orderId, clientOrderId, recvWindow) => {
2452
+ (0, import_common5.assertParamExists)("querySingleOrder", "symbol", symbol);
2453
+ const localVarQueryParameter = {};
2454
+ if (symbol !== void 0 && symbol !== null) {
2455
+ localVarQueryParameter["symbol"] = symbol;
2456
+ }
2457
+ if (orderId !== void 0 && orderId !== null) {
2458
+ localVarQueryParameter["orderId"] = orderId;
2459
+ }
2460
+ if (clientOrderId !== void 0 && clientOrderId !== null) {
2461
+ localVarQueryParameter["clientOrderId"] = clientOrderId;
2462
+ }
2463
+ if (recvWindow !== void 0 && recvWindow !== null) {
2464
+ localVarQueryParameter["recvWindow"] = recvWindow;
2465
+ }
2466
+ let _timeUnit;
2467
+ if ("timeUnit" in configuration)
2468
+ _timeUnit = configuration.timeUnit;
2469
+ return {
2470
+ endpoint: "/eapi/v1/order",
2471
+ method: "GET",
2472
+ params: localVarQueryParameter,
2473
+ timeUnit: _timeUnit
2474
+ };
2475
+ },
2476
+ /**
2477
+ * Get account exercise records.
2478
+ *
2479
+ * Weight: 5
2480
+ *
2481
+ * @summary User Exercise Record (USER_DATA)
2482
+ * @param {string} [symbol] Option trading pair, e.g BTC-200730-9000-C
2483
+ * @param {number} [startTime] Start Time, e.g 1593511200000
2484
+ * @param {number} [endTime] End Time, e.g 1593512200000
2485
+ * @param {number} [limit] Number of result sets returned Default:100 Max:1000
2486
+ * @param {number} [recvWindow]
2487
+ *
2488
+ * @throws {RequiredError}
2489
+ */
2490
+ userExerciseRecord: async (symbol, startTime, endTime, limit, recvWindow) => {
2491
+ const localVarQueryParameter = {};
2492
+ if (symbol !== void 0 && symbol !== null) {
2493
+ localVarQueryParameter["symbol"] = symbol;
2494
+ }
2495
+ if (startTime !== void 0 && startTime !== null) {
2496
+ localVarQueryParameter["startTime"] = startTime;
2497
+ }
2498
+ if (endTime !== void 0 && endTime !== null) {
2499
+ localVarQueryParameter["endTime"] = endTime;
2500
+ }
2501
+ if (limit !== void 0 && limit !== null) {
2502
+ localVarQueryParameter["limit"] = limit;
2503
+ }
2504
+ if (recvWindow !== void 0 && recvWindow !== null) {
2505
+ localVarQueryParameter["recvWindow"] = recvWindow;
2506
+ }
2507
+ let _timeUnit;
2508
+ if ("timeUnit" in configuration)
2509
+ _timeUnit = configuration.timeUnit;
2510
+ return {
2511
+ endpoint: "/eapi/v1/exerciseRecord",
2512
+ method: "GET",
2513
+ params: localVarQueryParameter,
2514
+ timeUnit: _timeUnit
2515
+ };
2516
+ }
2517
+ };
2518
+ };
2519
+ var TradeApi = class {
2520
+ constructor(configuration) {
2521
+ this.configuration = configuration;
2522
+ this.localVarAxiosParamCreator = TradeApiAxiosParamCreator(configuration);
2523
+ }
2524
+ /**
2525
+ * Get trades for a specific account and symbol.
2526
+ *
2527
+ * Weight: 5
2528
+ *
2529
+ * @summary Account Trade List (USER_DATA)
2530
+ * @param {AccountTradeListRequest} requestParameters Request parameters.
2531
+ * @returns {Promise<RestApiResponse<AccountTradeListResponse>>}
2532
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2533
+ * @memberof TradeApi
2534
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Account-Trade-List Binance API Documentation}
2535
+ */
2536
+ async accountTradeList(requestParameters = {}) {
2537
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountTradeList(
2538
+ requestParameters?.symbol,
2539
+ requestParameters?.fromId,
2540
+ requestParameters?.startTime,
2541
+ requestParameters?.endTime,
2542
+ requestParameters?.limit,
2543
+ requestParameters?.recvWindow
2544
+ );
2545
+ return (0, import_common5.sendRequest)(
2546
+ this.configuration,
2547
+ localVarAxiosArgs.endpoint,
2548
+ localVarAxiosArgs.method,
2549
+ localVarAxiosArgs.params,
2550
+ localVarAxiosArgs?.timeUnit,
2551
+ { isSigned: true }
2552
+ );
2553
+ }
2554
+ /**
2555
+ * Cancel all active orders on specified underlying.
2556
+ *
2557
+ * Weight: 1
2558
+ *
2559
+ * @summary Cancel All Option Orders By Underlying (TRADE)
2560
+ * @param {CancelAllOptionOrdersByUnderlyingRequest} requestParameters Request parameters.
2561
+ * @returns {Promise<RestApiResponse<CancelAllOptionOrdersByUnderlyingResponse>>}
2562
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2563
+ * @memberof TradeApi
2564
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Cancel-All-Option-Orders-By-Underlying Binance API Documentation}
2565
+ */
2566
+ async cancelAllOptionOrdersByUnderlying(requestParameters) {
2567
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cancelAllOptionOrdersByUnderlying(
2568
+ requestParameters?.underlying,
2569
+ requestParameters?.recvWindow
2570
+ );
2571
+ return (0, import_common5.sendRequest)(
2572
+ this.configuration,
2573
+ localVarAxiosArgs.endpoint,
2574
+ localVarAxiosArgs.method,
2575
+ localVarAxiosArgs.params,
2576
+ localVarAxiosArgs?.timeUnit,
2577
+ { isSigned: true }
2578
+ );
2579
+ }
2580
+ /**
2581
+ * Cancel all active order on a symbol.
2582
+ *
2583
+ * Weight: 1
2584
+ *
2585
+ * @summary Cancel all Option orders on specific symbol (TRADE)
2586
+ * @param {CancelAllOptionOrdersOnSpecificSymbolRequest} requestParameters Request parameters.
2587
+ * @returns {Promise<RestApiResponse<CancelAllOptionOrdersOnSpecificSymbolResponse>>}
2588
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2589
+ * @memberof TradeApi
2590
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Cancel-all-Option-orders-on-specific-symbol Binance API Documentation}
2591
+ */
2592
+ async cancelAllOptionOrdersOnSpecificSymbol(requestParameters) {
2593
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cancelAllOptionOrdersOnSpecificSymbol(
2594
+ requestParameters?.symbol,
2595
+ requestParameters?.recvWindow
2596
+ );
2597
+ return (0, import_common5.sendRequest)(
2598
+ this.configuration,
2599
+ localVarAxiosArgs.endpoint,
2600
+ localVarAxiosArgs.method,
2601
+ localVarAxiosArgs.params,
2602
+ localVarAxiosArgs?.timeUnit,
2603
+ { isSigned: true }
2604
+ );
2605
+ }
2606
+ /**
2607
+ * Cancel multiple orders.
2608
+ *
2609
+ * At least one instance of `orderId` and `clientOrderId` must be sent.
2610
+ *
2611
+ * Weight: 1
2612
+ *
2613
+ * @summary Cancel Multiple Option Orders (TRADE)
2614
+ * @param {CancelMultipleOptionOrdersRequest} requestParameters Request parameters.
2615
+ * @returns {Promise<RestApiResponse<CancelMultipleOptionOrdersResponse>>}
2616
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2617
+ * @memberof TradeApi
2618
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Cancel-Multiple-Option-Orders Binance API Documentation}
2619
+ */
2620
+ async cancelMultipleOptionOrders(requestParameters) {
2621
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cancelMultipleOptionOrders(
2622
+ requestParameters?.symbol,
2623
+ requestParameters?.orderIds,
2624
+ requestParameters?.clientOrderIds,
2625
+ requestParameters?.recvWindow
2626
+ );
2627
+ return (0, import_common5.sendRequest)(
2628
+ this.configuration,
2629
+ localVarAxiosArgs.endpoint,
2630
+ localVarAxiosArgs.method,
2631
+ localVarAxiosArgs.params,
2632
+ localVarAxiosArgs?.timeUnit,
2633
+ { isSigned: true }
2634
+ );
2635
+ }
2636
+ /**
2637
+ * Cancel an active order.
2638
+ *
2639
+ * At least one instance of `orderId` and `clientOrderId` must be sent.
2640
+ *
2641
+ * Weight: 1
2642
+ *
2643
+ * @summary Cancel Option Order (TRADE)
2644
+ * @param {CancelOptionOrderRequest} requestParameters Request parameters.
2645
+ * @returns {Promise<RestApiResponse<CancelOptionOrderResponse>>}
2646
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2647
+ * @memberof TradeApi
2648
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Cancel-Option-Order Binance API Documentation}
2649
+ */
2650
+ async cancelOptionOrder(requestParameters) {
2651
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.cancelOptionOrder(
2652
+ requestParameters?.symbol,
2653
+ requestParameters?.orderId,
2654
+ requestParameters?.clientOrderId,
2655
+ requestParameters?.recvWindow
2656
+ );
2657
+ return (0, import_common5.sendRequest)(
2658
+ this.configuration,
2659
+ localVarAxiosArgs.endpoint,
2660
+ localVarAxiosArgs.method,
2661
+ localVarAxiosArgs.params,
2662
+ localVarAxiosArgs?.timeUnit,
2663
+ { isSigned: true }
2664
+ );
2665
+ }
2666
+ /**
2667
+ * Send a new order.
2668
+ *
2669
+ * Weight: 0
2670
+ *
2671
+ * @summary New Order (TRADE)
2672
+ * @param {NewOrderRequest} requestParameters Request parameters.
2673
+ * @returns {Promise<RestApiResponse<NewOrderResponse>>}
2674
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2675
+ * @memberof TradeApi
2676
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/New-Order Binance API Documentation}
2677
+ */
2678
+ async newOrder(requestParameters) {
2679
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.newOrder(
2680
+ requestParameters?.symbol,
2681
+ requestParameters?.side,
2682
+ requestParameters?.type,
2683
+ requestParameters?.quantity,
2684
+ requestParameters?.price,
2685
+ requestParameters?.timeInForce,
2686
+ requestParameters?.reduceOnly,
2687
+ requestParameters?.postOnly,
2688
+ requestParameters?.newOrderRespType,
2689
+ requestParameters?.clientOrderId,
2690
+ requestParameters?.isMmp,
2691
+ requestParameters?.recvWindow
2692
+ );
2693
+ return (0, import_common5.sendRequest)(
2694
+ this.configuration,
2695
+ localVarAxiosArgs.endpoint,
2696
+ localVarAxiosArgs.method,
2697
+ localVarAxiosArgs.params,
2698
+ localVarAxiosArgs?.timeUnit,
2699
+ { isSigned: true }
2700
+ );
2701
+ }
2702
+ /**
2703
+ * Get current position information.
2704
+ *
2705
+ * Weight: 5
2706
+ *
2707
+ * @summary Option Position Information (USER_DATA)
2708
+ * @param {OptionPositionInformationRequest} requestParameters Request parameters.
2709
+ * @returns {Promise<RestApiResponse<OptionPositionInformationResponse>>}
2710
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2711
+ * @memberof TradeApi
2712
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information Binance API Documentation}
2713
+ */
2714
+ async optionPositionInformation(requestParameters = {}) {
2715
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.optionPositionInformation(
2716
+ requestParameters?.symbol,
2717
+ requestParameters?.recvWindow
2718
+ );
2719
+ return (0, import_common5.sendRequest)(
2720
+ this.configuration,
2721
+ localVarAxiosArgs.endpoint,
2722
+ localVarAxiosArgs.method,
2723
+ localVarAxiosArgs.params,
2724
+ localVarAxiosArgs?.timeUnit,
2725
+ { isSigned: true }
2726
+ );
2727
+ }
2728
+ /**
2729
+ * Send multiple option orders.
2730
+ *
2731
+ * Parameter rules are same with New Order
2732
+ * Batch orders are processed concurrently, and the order of matching is not guaranteed.
2733
+ *
2734
+ * Weight: 5
2735
+ *
2736
+ * @summary Place Multiple Orders(TRADE)
2737
+ * @param {PlaceMultipleOrdersRequest} requestParameters Request parameters.
2738
+ * @returns {Promise<RestApiResponse<PlaceMultipleOrdersResponse>>}
2739
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2740
+ * @memberof TradeApi
2741
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Place-Multiple-Orders Binance API Documentation}
2742
+ */
2743
+ async placeMultipleOrders(requestParameters) {
2744
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.placeMultipleOrders(
2745
+ requestParameters?.orders,
2746
+ requestParameters?.recvWindow
2747
+ );
2748
+ return (0, import_common5.sendRequest)(
2749
+ this.configuration,
2750
+ localVarAxiosArgs.endpoint,
2751
+ localVarAxiosArgs.method,
2752
+ localVarAxiosArgs.params,
2753
+ localVarAxiosArgs?.timeUnit,
2754
+ { isSigned: true }
2755
+ );
2756
+ }
2757
+ /**
2758
+ * Query current all open orders, status: ACCEPTED PARTIALLY_FILLED
2759
+ *
2760
+ * Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
2761
+ *
2762
+ * @summary Query Current Open Option Orders (USER_DATA)
2763
+ * @param {QueryCurrentOpenOptionOrdersRequest} requestParameters Request parameters.
2764
+ * @returns {Promise<RestApiResponse<QueryCurrentOpenOptionOrdersResponse>>}
2765
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2766
+ * @memberof TradeApi
2767
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Query-Current-Open-Option-Orders Binance API Documentation}
2768
+ */
2769
+ async queryCurrentOpenOptionOrders(requestParameters = {}) {
2770
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryCurrentOpenOptionOrders(
2771
+ requestParameters?.symbol,
2772
+ requestParameters?.orderId,
2773
+ requestParameters?.startTime,
2774
+ requestParameters?.endTime,
2775
+ requestParameters?.limit,
2776
+ requestParameters?.recvWindow
2777
+ );
2778
+ return (0, import_common5.sendRequest)(
2779
+ this.configuration,
2780
+ localVarAxiosArgs.endpoint,
2781
+ localVarAxiosArgs.method,
2782
+ localVarAxiosArgs.params,
2783
+ localVarAxiosArgs?.timeUnit,
2784
+ { isSigned: true }
2785
+ );
2786
+ }
2787
+ /**
2788
+ * Query all finished orders within 5 days, finished status: CANCELLED FILLED REJECTED.
2789
+ *
2790
+ * Weight: 3
2791
+ *
2792
+ * @summary Query Option Order History (TRADE)
2793
+ * @param {QueryOptionOrderHistoryRequest} requestParameters Request parameters.
2794
+ * @returns {Promise<RestApiResponse<QueryOptionOrderHistoryResponse>>}
2795
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2796
+ * @memberof TradeApi
2797
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History Binance API Documentation}
2798
+ */
2799
+ async queryOptionOrderHistory(requestParameters) {
2800
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryOptionOrderHistory(
2801
+ requestParameters?.symbol,
2802
+ requestParameters?.orderId,
2803
+ requestParameters?.startTime,
2804
+ requestParameters?.endTime,
2805
+ requestParameters?.limit,
2806
+ requestParameters?.recvWindow
2807
+ );
2808
+ return (0, import_common5.sendRequest)(
2809
+ this.configuration,
2810
+ localVarAxiosArgs.endpoint,
2811
+ localVarAxiosArgs.method,
2812
+ localVarAxiosArgs.params,
2813
+ localVarAxiosArgs?.timeUnit,
2814
+ { isSigned: true }
2815
+ );
2816
+ }
2817
+ /**
2818
+ * Check an order status.
2819
+ *
2820
+ * These orders will not be found:
2821
+ * order status is `CANCELED` or `REJECTED`, **AND**
2822
+ * order has NO filled trade, **AND**
2823
+ * created time + 3 days < current time
2824
+ *
2825
+ *
2826
+ * Either `orderId` or `clientOrderId ` must be sent.
2827
+ *
2828
+ * Weight: 1
2829
+ *
2830
+ * @summary Query Single Order (TRADE)
2831
+ * @param {QuerySingleOrderRequest} requestParameters Request parameters.
2832
+ * @returns {Promise<RestApiResponse<QuerySingleOrderResponse>>}
2833
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2834
+ * @memberof TradeApi
2835
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Query-Single-Order Binance API Documentation}
2836
+ */
2837
+ async querySingleOrder(requestParameters) {
2838
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.querySingleOrder(
2839
+ requestParameters?.symbol,
2840
+ requestParameters?.orderId,
2841
+ requestParameters?.clientOrderId,
2842
+ requestParameters?.recvWindow
2843
+ );
2844
+ return (0, import_common5.sendRequest)(
2845
+ this.configuration,
2846
+ localVarAxiosArgs.endpoint,
2847
+ localVarAxiosArgs.method,
2848
+ localVarAxiosArgs.params,
2849
+ localVarAxiosArgs?.timeUnit,
2850
+ { isSigned: true }
2851
+ );
2852
+ }
2853
+ /**
2854
+ * Get account exercise records.
2855
+ *
2856
+ * Weight: 5
2857
+ *
2858
+ * @summary User Exercise Record (USER_DATA)
2859
+ * @param {UserExerciseRecordRequest} requestParameters Request parameters.
2860
+ * @returns {Promise<RestApiResponse<UserExerciseRecordResponse>>}
2861
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2862
+ * @memberof TradeApi
2863
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/User-Exercise-Record Binance API Documentation}
2864
+ */
2865
+ async userExerciseRecord(requestParameters = {}) {
2866
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.userExerciseRecord(
2867
+ requestParameters?.symbol,
2868
+ requestParameters?.startTime,
2869
+ requestParameters?.endTime,
2870
+ requestParameters?.limit,
2871
+ requestParameters?.recvWindow
2872
+ );
2873
+ return (0, import_common5.sendRequest)(
2874
+ this.configuration,
2875
+ localVarAxiosArgs.endpoint,
2876
+ localVarAxiosArgs.method,
2877
+ localVarAxiosArgs.params,
2878
+ localVarAxiosArgs?.timeUnit,
2879
+ { isSigned: true }
2880
+ );
2881
+ }
2882
+ };
2883
+ var NewOrderSideEnum = {
2884
+ BUY: "BUY",
2885
+ SELL: "SELL"
2886
+ };
2887
+ var NewOrderTypeEnum = {
2888
+ LIMIT: "LIMIT"
2889
+ };
2890
+ var NewOrderTimeInForceEnum = {
2891
+ GTC: "GTC",
2892
+ IOC: "IOC",
2893
+ FOK: "FOK"
2894
+ };
2895
+ var NewOrderNewOrderRespTypeEnum = {
2896
+ ACK: "ACK",
2897
+ RESULT: "RESULT"
2898
+ };
2899
+
2900
+ // src/rest-api/modules/user-data-streams-api.ts
2901
+ var import_common6 = require("@binance/common");
2902
+ var UserDataStreamsApiAxiosParamCreator = function(configuration) {
2903
+ return {
2904
+ /**
2905
+ * Close out a user data stream.
2906
+ *
2907
+ * Weight: 1
2908
+ *
2909
+ * @summary Close User Data Stream (USER_STREAM)
2910
+ *
2911
+ * @throws {RequiredError}
2912
+ */
2913
+ closeUserDataStream: async () => {
2914
+ const localVarQueryParameter = {};
2915
+ let _timeUnit;
2916
+ if ("timeUnit" in configuration)
2917
+ _timeUnit = configuration.timeUnit;
2918
+ return {
2919
+ endpoint: "/eapi/v1/listenKey",
2920
+ method: "DELETE",
2921
+ params: localVarQueryParameter,
2922
+ timeUnit: _timeUnit
2923
+ };
2924
+ },
2925
+ /**
2926
+ * Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes.
2927
+ *
2928
+ * Weight: 1
2929
+ *
2930
+ * @summary Keepalive User Data Stream (USER_STREAM)
2931
+ *
2932
+ * @throws {RequiredError}
2933
+ */
2934
+ keepaliveUserDataStream: async () => {
2935
+ const localVarQueryParameter = {};
2936
+ let _timeUnit;
2937
+ if ("timeUnit" in configuration)
2938
+ _timeUnit = configuration.timeUnit;
2939
+ return {
2940
+ endpoint: "/eapi/v1/listenKey",
2941
+ method: "PUT",
2942
+ params: localVarQueryParameter,
2943
+ timeUnit: _timeUnit
2944
+ };
2945
+ },
2946
+ /**
2947
+ * Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes.
2948
+ *
2949
+ * Weight: 1
2950
+ *
2951
+ * @summary Start User Data Stream (USER_STREAM)
2952
+ *
2953
+ * @throws {RequiredError}
2954
+ */
2955
+ startUserDataStream: async () => {
2956
+ const localVarQueryParameter = {};
2957
+ let _timeUnit;
2958
+ if ("timeUnit" in configuration)
2959
+ _timeUnit = configuration.timeUnit;
2960
+ return {
2961
+ endpoint: "/eapi/v1/listenKey",
2962
+ method: "POST",
2963
+ params: localVarQueryParameter,
2964
+ timeUnit: _timeUnit
2965
+ };
2966
+ }
2967
+ };
2968
+ };
2969
+ var UserDataStreamsApi = class {
2970
+ constructor(configuration) {
2971
+ this.configuration = configuration;
2972
+ this.localVarAxiosParamCreator = UserDataStreamsApiAxiosParamCreator(configuration);
2973
+ }
2974
+ /**
2975
+ * Close out a user data stream.
2976
+ *
2977
+ * Weight: 1
2978
+ *
2979
+ * @summary Close User Data Stream (USER_STREAM)
2980
+ * @returns {Promise<RestApiResponse<void>>}
2981
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
2982
+ * @memberof UserDataStreamsApi
2983
+ * @see {@link https://developers.binance.com/docs/derivatives/option/user-data-streams/Close-User-Data-Stream Binance API Documentation}
2984
+ */
2985
+ async closeUserDataStream() {
2986
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.closeUserDataStream();
2987
+ return (0, import_common6.sendRequest)(
2988
+ this.configuration,
2989
+ localVarAxiosArgs.endpoint,
2990
+ localVarAxiosArgs.method,
2991
+ localVarAxiosArgs.params,
2992
+ localVarAxiosArgs?.timeUnit,
2993
+ { isSigned: false }
2994
+ );
2995
+ }
2996
+ /**
2997
+ * Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes.
2998
+ *
2999
+ * Weight: 1
3000
+ *
3001
+ * @summary Keepalive User Data Stream (USER_STREAM)
3002
+ * @returns {Promise<RestApiResponse<void>>}
3003
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3004
+ * @memberof UserDataStreamsApi
3005
+ * @see {@link https://developers.binance.com/docs/derivatives/option/user-data-streams/Keepalive-User-Data-Stream Binance API Documentation}
3006
+ */
3007
+ async keepaliveUserDataStream() {
3008
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.keepaliveUserDataStream();
3009
+ return (0, import_common6.sendRequest)(
3010
+ this.configuration,
3011
+ localVarAxiosArgs.endpoint,
3012
+ localVarAxiosArgs.method,
3013
+ localVarAxiosArgs.params,
3014
+ localVarAxiosArgs?.timeUnit,
3015
+ { isSigned: false }
3016
+ );
3017
+ }
3018
+ /**
3019
+ * Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes.
3020
+ *
3021
+ * Weight: 1
3022
+ *
3023
+ * @summary Start User Data Stream (USER_STREAM)
3024
+ * @returns {Promise<RestApiResponse<StartUserDataStreamResponse>>}
3025
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3026
+ * @memberof UserDataStreamsApi
3027
+ * @see {@link https://developers.binance.com/docs/derivatives/option/user-data-streams/Start-User-Data-Stream Binance API Documentation}
3028
+ */
3029
+ async startUserDataStream() {
3030
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.startUserDataStream();
3031
+ return (0, import_common6.sendRequest)(
3032
+ this.configuration,
3033
+ localVarAxiosArgs.endpoint,
3034
+ localVarAxiosArgs.method,
3035
+ localVarAxiosArgs.params,
3036
+ localVarAxiosArgs?.timeUnit,
3037
+ { isSigned: false }
3038
+ );
3039
+ }
3040
+ };
3041
+
3042
+ // src/rest-api/rest-api.ts
3043
+ var import_common7 = require("@binance/common");
3044
+ var RestAPI = class {
3045
+ constructor(configuration) {
3046
+ this.configuration = configuration;
3047
+ this.accountApi = new AccountApi(configuration);
3048
+ this.marketDataApi = new MarketDataApi(configuration);
3049
+ this.marketMakerBlockTradeApi = new MarketMakerBlockTradeApi(configuration);
3050
+ this.marketMakerEndpointsApi = new MarketMakerEndpointsApi(configuration);
3051
+ this.tradeApi = new TradeApi(configuration);
3052
+ this.userDataStreamsApi = new UserDataStreamsApi(configuration);
3053
+ }
3054
+ /**
3055
+ * Generic function to send a request.
3056
+ * @param endpoint - The API endpoint to call.
3057
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
3058
+ * @param params - Query parameters for the request.
3059
+ *
3060
+ * @returns A promise resolving to the response data object.
3061
+ */
3062
+ sendRequest(endpoint, method, params = {}) {
3063
+ return (0, import_common7.sendRequest)(this.configuration, endpoint, method, params, void 0);
3064
+ }
3065
+ /**
3066
+ * Generic function to send a signed request.
3067
+ * @param endpoint - The API endpoint to call.
3068
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
3069
+ * @param params - Query parameters for the request.
3070
+ *
3071
+ * @returns A promise resolving to the response data object.
3072
+ */
3073
+ sendSignedRequest(endpoint, method, params = {}) {
3074
+ return (0, import_common7.sendRequest)(this.configuration, endpoint, method, params, void 0, {
3075
+ isSigned: true
3076
+ });
3077
+ }
3078
+ /**
3079
+ * Query account funding flows.
3080
+ *
3081
+ * Weight: 1
3082
+ *
3083
+ * @summary Account Funding Flow (USER_DATA)
3084
+ * @param {AccountFundingFlowRequest} requestParameters Request parameters.
3085
+ * @returns {Promise<RestApiResponse<AccountFundingFlowResponse>>}
3086
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3087
+ * @see {@link https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow Binance API Documentation}
3088
+ */
3089
+ accountFundingFlow(requestParameters) {
3090
+ return this.accountApi.accountFundingFlow(requestParameters);
3091
+ }
3092
+ /**
3093
+ * Get download id for option transaction history
3094
+ *
3095
+ * Request Limitation is 5 times per month, shared by > front end download page and rest api
3096
+ * The time between `startTime` and `endTime` can not be longer than 1 year
3097
+ *
3098
+ * Weight: 5
3099
+ *
3100
+ * @summary Get Download Id For Option Transaction History (USER_DATA)
3101
+ * @param {GetDownloadIdForOptionTransactionHistoryRequest} requestParameters Request parameters.
3102
+ * @returns {Promise<RestApiResponse<GetDownloadIdForOptionTransactionHistoryResponse>>}
3103
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3104
+ * @see {@link https://developers.binance.com/docs/derivatives/option/account/Get-Download-Id-For-Option-Transaction-History Binance API Documentation}
3105
+ */
3106
+ getDownloadIdForOptionTransactionHistory(requestParameters) {
3107
+ return this.accountApi.getDownloadIdForOptionTransactionHistory(requestParameters);
3108
+ }
3109
+ /**
3110
+ * Get option transaction history download Link by Id
3111
+ *
3112
+ * Download link expiration: 24h
3113
+ *
3114
+ * Weight: 5
3115
+ *
3116
+ * @summary Get Option Transaction History Download Link by Id (USER_DATA)
3117
+ * @param {GetOptionTransactionHistoryDownloadLinkByIdRequest} requestParameters Request parameters.
3118
+ * @returns {Promise<RestApiResponse<GetOptionTransactionHistoryDownloadLinkByIdResponse>>}
3119
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3120
+ * @see {@link https://developers.binance.com/docs/derivatives/option/account/Get-Option-Transaction-History-Download-Link-by-Id Binance API Documentation}
3121
+ */
3122
+ getOptionTransactionHistoryDownloadLinkById(requestParameters) {
3123
+ return this.accountApi.getOptionTransactionHistoryDownloadLinkById(requestParameters);
3124
+ }
3125
+ /**
3126
+ * Get current account information.
3127
+ *
3128
+ * Weight: 3
3129
+ *
3130
+ * @summary Option Account Information(TRADE)
3131
+ * @param {OptionAccountInformationRequest} requestParameters Request parameters.
3132
+ * @returns {Promise<RestApiResponse<OptionAccountInformationResponse>>}
3133
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3134
+ * @see {@link https://developers.binance.com/docs/derivatives/option/account/Option-Account-Information Binance API Documentation}
3135
+ */
3136
+ optionAccountInformation(requestParameters = {}) {
3137
+ return this.accountApi.optionAccountInformation(requestParameters);
3138
+ }
3139
+ /**
3140
+ * Test connectivity to the Rest API and get the current server time.
3141
+ *
3142
+ * Weight: 1
3143
+ *
3144
+ * @summary Check Server Time
3145
+ * @returns {Promise<RestApiResponse<CheckServerTimeResponse>>}
3146
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3147
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Check-Server-Time Binance API Documentation}
3148
+ */
3149
+ checkServerTime() {
3150
+ return this.marketDataApi.checkServerTime();
3151
+ }
3152
+ /**
3153
+ * Current exchange trading rules and symbol information
3154
+ *
3155
+ * Weight: 1
3156
+ *
3157
+ * @summary Exchange Information
3158
+ * @returns {Promise<RestApiResponse<ExchangeInformationResponse>>}
3159
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3160
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Exchange-Information Binance API Documentation}
3161
+ */
3162
+ exchangeInformation() {
3163
+ return this.marketDataApi.exchangeInformation();
3164
+ }
3165
+ /**
3166
+ * Get historical exercise records.
3167
+ * REALISTIC_VALUE_STRICKEN -> Exercised
3168
+ * EXTRINSIC_VALUE_EXPIRED -> Expired OTM
3169
+ *
3170
+ * Weight: 3
3171
+ *
3172
+ * @summary Historical Exercise Records
3173
+ * @param {HistoricalExerciseRecordsRequest} requestParameters Request parameters.
3174
+ * @returns {Promise<RestApiResponse<HistoricalExerciseRecordsResponse>>}
3175
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3176
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Historical-Exercise-Records Binance API Documentation}
3177
+ */
3178
+ historicalExerciseRecords(requestParameters = {}) {
3179
+ return this.marketDataApi.historicalExerciseRecords(requestParameters);
3180
+ }
3181
+ /**
3182
+ * Kline/candlestick bars for an option symbol.
3183
+ * Klines are uniquely identified by their open time.
3184
+ *
3185
+ * If startTime and endTime are not sent, the most recent klines are returned.
3186
+ *
3187
+ * Weight: 1
3188
+ *
3189
+ * @summary Kline/Candlestick Data
3190
+ * @param {KlineCandlestickDataRequest} requestParameters Request parameters.
3191
+ * @returns {Promise<RestApiResponse<KlineCandlestickDataResponse>>}
3192
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3193
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data Binance API Documentation}
3194
+ */
3195
+ klineCandlestickData(requestParameters) {
3196
+ return this.marketDataApi.klineCandlestickData(requestParameters);
3197
+ }
3198
+ /**
3199
+ * Get older market historical trades.
3200
+ *
3201
+ * Weight: 20
3202
+ *
3203
+ * @summary Old Trades Lookup (MARKET_DATA)
3204
+ * @param {OldTradesLookupRequest} requestParameters Request parameters.
3205
+ * @returns {Promise<RestApiResponse<OldTradesLookupResponse>>}
3206
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3207
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Old-Trades-Lookup Binance API Documentation}
3208
+ */
3209
+ oldTradesLookup(requestParameters) {
3210
+ return this.marketDataApi.oldTradesLookup(requestParameters);
3211
+ }
3212
+ /**
3213
+ * Get open interest for specific underlying asset on specific expiration date.
3214
+ *
3215
+ * Weight: 0
3216
+ *
3217
+ * @summary Open Interest
3218
+ * @param {OpenInterestRequest} requestParameters Request parameters.
3219
+ * @returns {Promise<RestApiResponse<OpenInterestResponse>>}
3220
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3221
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Open-Interest Binance API Documentation}
3222
+ */
3223
+ openInterest(requestParameters) {
3224
+ return this.marketDataApi.openInterest(requestParameters);
3225
+ }
3226
+ /**
3227
+ * Option mark price and greek info.
3228
+ *
3229
+ * Weight: 5
3230
+ *
3231
+ * @summary Option Mark Price
3232
+ * @param {OptionMarkPriceRequest} requestParameters Request parameters.
3233
+ * @returns {Promise<RestApiResponse<OptionMarkPriceResponse>>}
3234
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3235
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Option-Mark-Price Binance API Documentation}
3236
+ */
3237
+ optionMarkPrice(requestParameters = {}) {
3238
+ return this.marketDataApi.optionMarkPrice(requestParameters);
3239
+ }
3240
+ /**
3241
+ * Check orderbook depth on specific symbol
3242
+ *
3243
+ * Weight: limit | weight
3244
+ * ------------ | ------------
3245
+ * 5, 10, 20, 50 | 2
3246
+ * 100 | 5
3247
+ * 500 | 10
3248
+ * 1000 | 20
3249
+ *
3250
+ * @summary Order Book
3251
+ * @param {OrderBookRequest} requestParameters Request parameters.
3252
+ * @returns {Promise<RestApiResponse<OrderBookResponse>>}
3253
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3254
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Order-Book Binance API Documentation}
3255
+ */
3256
+ orderBook(requestParameters) {
3257
+ return this.marketDataApi.orderBook(requestParameters);
3258
+ }
3259
+ /**
3260
+ * Get recent block trades
3261
+ *
3262
+ * Weight: 5
3263
+ *
3264
+ * @summary Recent Block Trades List
3265
+ * @param {RecentBlockTradesListRequest} requestParameters Request parameters.
3266
+ * @returns {Promise<RestApiResponse<RecentBlockTradesListResponse>>}
3267
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3268
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Recent-Block-Trade-List Binance API Documentation}
3269
+ */
3270
+ recentBlockTradesList(requestParameters = {}) {
3271
+ return this.marketDataApi.recentBlockTradesList(requestParameters);
3272
+ }
3273
+ /**
3274
+ * Get recent market trades
3275
+ *
3276
+ * Weight: 5
3277
+ *
3278
+ * @summary Recent Trades List
3279
+ * @param {RecentTradesListRequest} requestParameters Request parameters.
3280
+ * @returns {Promise<RestApiResponse<RecentTradesListResponse>>}
3281
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3282
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Recent-Trades-List Binance API Documentation}
3283
+ */
3284
+ recentTradesList(requestParameters) {
3285
+ return this.marketDataApi.recentTradesList(requestParameters);
3286
+ }
3287
+ /**
3288
+ * Get spot index price for option underlying.
3289
+ *
3290
+ * Weight: 1
3291
+ *
3292
+ * @summary Symbol Price Ticker
3293
+ * @param {SymbolPriceTickerRequest} requestParameters Request parameters.
3294
+ * @returns {Promise<RestApiResponse<SymbolPriceTickerResponse>>}
3295
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3296
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Symbol-Price-Ticker Binance API Documentation}
3297
+ */
3298
+ symbolPriceTicker(requestParameters) {
3299
+ return this.marketDataApi.symbolPriceTicker(requestParameters);
3300
+ }
3301
+ /**
3302
+ * Test connectivity to the Rest API.
3303
+ *
3304
+ * Weight: 1
3305
+ *
3306
+ * @summary Test Connectivity
3307
+ * @returns {Promise<RestApiResponse<void>>}
3308
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3309
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/Test-Connectivity Binance API Documentation}
3310
+ */
3311
+ testConnectivity() {
3312
+ return this.marketDataApi.testConnectivity();
3313
+ }
3314
+ /**
3315
+ * 24 hour rolling window price change statistics.
3316
+ *
3317
+ * Weight: 5
3318
+ *
3319
+ * @summary 24hr Ticker Price Change Statistics
3320
+ * @param {Ticker24hrPriceChangeStatisticsRequest} requestParameters Request parameters.
3321
+ * @returns {Promise<RestApiResponse<Ticker24hrPriceChangeStatisticsResponse>>}
3322
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3323
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-data/24hr-Ticker-Price-Change-Statistics Binance API Documentation}
3324
+ */
3325
+ ticker24hrPriceChangeStatistics(requestParameters = {}) {
3326
+ return this.marketDataApi.ticker24hrPriceChangeStatistics(requestParameters);
3327
+ }
3328
+ /**
3329
+ * Accept a block trade order
3330
+ *
3331
+ * Weight: 5
3332
+ *
3333
+ * @summary Accept Block Trade Order (TRADE)
3334
+ * @param {AcceptBlockTradeOrderRequest} requestParameters Request parameters.
3335
+ * @returns {Promise<RestApiResponse<AcceptBlockTradeOrderResponse>>}
3336
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3337
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Accept-Block-Trade-Order Binance API Documentation}
3338
+ */
3339
+ acceptBlockTradeOrder(requestParameters) {
3340
+ return this.marketMakerBlockTradeApi.acceptBlockTradeOrder(requestParameters);
3341
+ }
3342
+ /**
3343
+ * Gets block trades for a specific account.
3344
+ *
3345
+ * Weight: 5
3346
+ *
3347
+ * @summary Account Block Trade List (USER_DATA)
3348
+ * @param {AccountBlockTradeListRequest} requestParameters Request parameters.
3349
+ * @returns {Promise<RestApiResponse<AccountBlockTradeListResponse>>}
3350
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3351
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Account-Block-Trade-List Binance API Documentation}
3352
+ */
3353
+ accountBlockTradeList(requestParameters = {}) {
3354
+ return this.marketMakerBlockTradeApi.accountBlockTradeList(requestParameters);
3355
+ }
3356
+ /**
3357
+ * Cancel a block trade order.
3358
+ *
3359
+ * Weight: 5
3360
+ *
3361
+ * @summary Cancel Block Trade Order (TRADE)
3362
+ * @param {CancelBlockTradeOrderRequest} requestParameters Request parameters.
3363
+ * @returns {Promise<RestApiResponse<void>>}
3364
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3365
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Cancel-Block-Trade-Order Binance API Documentation}
3366
+ */
3367
+ cancelBlockTradeOrder(requestParameters) {
3368
+ return this.marketMakerBlockTradeApi.cancelBlockTradeOrder(requestParameters);
3369
+ }
3370
+ /**
3371
+ * Extends a block trade expire time by 30 mins from the current time.
3372
+ *
3373
+ * Weight: 5
3374
+ *
3375
+ * @summary Extend Block Trade Order (TRADE)
3376
+ * @param {ExtendBlockTradeOrderRequest} requestParameters Request parameters.
3377
+ * @returns {Promise<RestApiResponse<ExtendBlockTradeOrderResponse>>}
3378
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3379
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Extend-Block-Trade-Order Binance API Documentation}
3380
+ */
3381
+ extendBlockTradeOrder(requestParameters) {
3382
+ return this.marketMakerBlockTradeApi.extendBlockTradeOrder(requestParameters);
3383
+ }
3384
+ /**
3385
+ * Send in a new block trade order.
3386
+ *
3387
+ * Weight: 5
3388
+ *
3389
+ * @summary New Block Trade Order (TRADE)
3390
+ * @param {NewBlockTradeOrderRequest} requestParameters Request parameters.
3391
+ * @returns {Promise<RestApiResponse<NewBlockTradeOrderResponse>>}
3392
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3393
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/New-Block-Trade-Order Binance API Documentation}
3394
+ */
3395
+ newBlockTradeOrder(requestParameters) {
3396
+ return this.marketMakerBlockTradeApi.newBlockTradeOrder(requestParameters);
3397
+ }
3398
+ /**
3399
+ * Query block trade details; returns block trade details from counterparty's perspective.
3400
+ *
3401
+ * Weight: 5
3402
+ *
3403
+ * @summary Query Block Trade Details (USER_DATA)
3404
+ * @param {QueryBlockTradeDetailsRequest} requestParameters Request parameters.
3405
+ * @returns {Promise<RestApiResponse<QueryBlockTradeDetailsResponse>>}
3406
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3407
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Query-Block-Trade-Detail Binance API Documentation}
3408
+ */
3409
+ queryBlockTradeDetails(requestParameters) {
3410
+ return this.marketMakerBlockTradeApi.queryBlockTradeDetails(requestParameters);
3411
+ }
3412
+ /**
3413
+ * Check block trade order status.
3414
+ *
3415
+ * Weight: 5
3416
+ *
3417
+ * @summary Query Block Trade Order (TRADE)
3418
+ * @param {QueryBlockTradeOrderRequest} requestParameters Request parameters.
3419
+ * @returns {Promise<RestApiResponse<QueryBlockTradeOrderResponse>>}
3420
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3421
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-block-trade/Query-Block-Trade-Order Binance API Documentation}
3422
+ */
3423
+ queryBlockTradeOrder(requestParameters = {}) {
3424
+ return this.marketMakerBlockTradeApi.queryBlockTradeOrder(requestParameters);
3425
+ }
3426
+ /**
3427
+ * This endpoint resets the time from which the countdown will begin to the time this messaged is received. It should be called repeatedly as heartbeats. Multiple heartbeats can be updated at once by specifying the underlying symbols as a list (ex. BTCUSDT,ETHUSDT) in the underlyings parameter.
3428
+ *
3429
+ * The response will only include underlying symbols where the heartbeat has been successfully updated.
3430
+ *
3431
+ * Weight: 10
3432
+ *
3433
+ * @summary Auto-Cancel All Open Orders (Kill-Switch) Heartbeat (TRADE)
3434
+ * @param {AutoCancelAllOpenOrdersRequest} requestParameters Request parameters.
3435
+ * @returns {Promise<RestApiResponse<AutoCancelAllOpenOrdersResponse>>}
3436
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3437
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Auto-Cancel-All-Open-Orders-Heartbeat Binance API Documentation}
3438
+ */
3439
+ autoCancelAllOpenOrders(requestParameters) {
3440
+ return this.marketMakerEndpointsApi.autoCancelAllOpenOrders(requestParameters);
3441
+ }
3442
+ /**
3443
+ * This endpoint returns the auto-cancel parameters for each underlying symbol. Note only active auto-cancel parameters will be returned, if countdownTime is set to 0 (ie. countdownTime has been turned off), the underlying symbol and corresponding countdownTime parameter will not be returned in the response.
3444
+ *
3445
+ * countdownTime = 0 means the function is disabled.
3446
+ *
3447
+ * Weight: 1
3448
+ *
3449
+ * @summary Get Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)
3450
+ * @param {GetAutoCancelAllOpenOrdersRequest} requestParameters Request parameters.
3451
+ * @returns {Promise<RestApiResponse<GetAutoCancelAllOpenOrdersResponse>>}
3452
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3453
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Get-Auto-Cancel-All-Open-Orders-Config Binance API Documentation}
3454
+ */
3455
+ getAutoCancelAllOpenOrders(requestParameters = {}) {
3456
+ return this.marketMakerEndpointsApi.getAutoCancelAllOpenOrders(requestParameters);
3457
+ }
3458
+ /**
3459
+ * Get config for MMP.
3460
+ *
3461
+ * Weight: 1
3462
+ *
3463
+ * @summary Get Market Maker Protection Config (TRADE)
3464
+ * @param {GetMarketMakerProtectionConfigRequest} requestParameters Request parameters.
3465
+ * @returns {Promise<RestApiResponse<GetMarketMakerProtectionConfigResponse>>}
3466
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3467
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Get-Market-Maker-Protection-Config Binance API Documentation}
3468
+ */
3469
+ getMarketMakerProtectionConfig(requestParameters = {}) {
3470
+ return this.marketMakerEndpointsApi.getMarketMakerProtectionConfig(requestParameters);
3471
+ }
3472
+ /**
3473
+ * Get current account information.
3474
+ *
3475
+ * Weight: 3
3476
+ *
3477
+ * @summary Option Margin Account Information (USER_DATA)
3478
+ * @param {OptionMarginAccountInformationRequest} requestParameters Request parameters.
3479
+ * @returns {Promise<RestApiResponse<OptionMarginAccountInformationResponse>>}
3480
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3481
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Option-Margin-Account-Information Binance API Documentation}
3482
+ */
3483
+ optionMarginAccountInformation(requestParameters = {}) {
3484
+ return this.marketMakerEndpointsApi.optionMarginAccountInformation(requestParameters);
3485
+ }
3486
+ /**
3487
+ * Reset MMP, start MMP order again.
3488
+ *
3489
+ * Weight: 1
3490
+ *
3491
+ * @summary Reset Market Maker Protection Config (TRADE)
3492
+ * @param {ResetMarketMakerProtectionConfigRequest} requestParameters Request parameters.
3493
+ * @returns {Promise<RestApiResponse<ResetMarketMakerProtectionConfigResponse>>}
3494
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3495
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Reset-Market-Maker-Protection-Config Binance API Documentation}
3496
+ */
3497
+ resetMarketMakerProtectionConfig(requestParameters = {}) {
3498
+ return this.marketMakerEndpointsApi.resetMarketMakerProtectionConfig(requestParameters);
3499
+ }
3500
+ /**
3501
+ * This endpoint sets the parameters of the auto-cancel feature which cancels all open orders (both market maker protection and non market maker protection order types) of the underlying symbol at the end of the specified countdown time period if no heartbeat message is sent. After the countdown time period, all open orders will be cancelled and new orders will be rejected with error code -2010 until either a heartbeat message is sent or the auto-cancel feature is turned off by setting countdownTime to 0.
3502
+ *
3503
+ *
3504
+ * This rest endpoint sets up the parameters to cancel your open orders in case of an outage or disconnection.
3505
+ * Example usage:
3506
+ * Call this endpoint with a countdownTime value of 10000 (10 seconds) to turn on the auto-cancel feature. If the corresponding countdownCancelAllHeartBeat endpoint is not called within 10 seconds with the specified underlying symbol, all open orders of the specified symbol will be automatically canceled. If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped.
3507
+ * The system will check all countdowns approximately every 1000 milliseconds, **please note that sufficient redundancy should be considered when using this function**. We do not recommend setting the countdown time to be too precise or too small.
3508
+ *
3509
+ * Weight: 1
3510
+ *
3511
+ * @summary Set Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)
3512
+ * @param {SetAutoCancelAllOpenOrdersRequest} requestParameters Request parameters.
3513
+ * @returns {Promise<RestApiResponse<SetAutoCancelAllOpenOrdersResponse>>}
3514
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3515
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Set-Auto-Cancel-All-Open-Orders-Config Binance API Documentation}
3516
+ */
3517
+ setAutoCancelAllOpenOrders(requestParameters) {
3518
+ return this.marketMakerEndpointsApi.setAutoCancelAllOpenOrders(requestParameters);
3519
+ }
3520
+ /**
3521
+ * Set config for MMP.
3522
+ * Market Maker Protection(MMP) is a set of protection mechanism for option market maker, this mechanism is able to prevent mass trading in short period time. Once market maker's account branches the threshold, the Market Maker Protection will be triggered. When Market Maker Protection triggers, all the current MMP orders will be canceled, new MMP orders will be rejected. Market maker can use this time to reevaluate market and modify order price.
3523
+ *
3524
+ * Weight: 1
3525
+ *
3526
+ * @summary Set Market Maker Protection Config (TRADE)
3527
+ * @param {SetMarketMakerProtectionConfigRequest} requestParameters Request parameters.
3528
+ * @returns {Promise<RestApiResponse<SetMarketMakerProtectionConfigResponse>>}
3529
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3530
+ * @see {@link https://developers.binance.com/docs/derivatives/option/market-maker-endpoints/Set-Market-Maker-Protection-Config Binance API Documentation}
3531
+ */
3532
+ setMarketMakerProtectionConfig(requestParameters = {}) {
3533
+ return this.marketMakerEndpointsApi.setMarketMakerProtectionConfig(requestParameters);
3534
+ }
3535
+ /**
3536
+ * Get trades for a specific account and symbol.
3537
+ *
3538
+ * Weight: 5
3539
+ *
3540
+ * @summary Account Trade List (USER_DATA)
3541
+ * @param {AccountTradeListRequest} requestParameters Request parameters.
3542
+ * @returns {Promise<RestApiResponse<AccountTradeListResponse>>}
3543
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3544
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Account-Trade-List Binance API Documentation}
3545
+ */
3546
+ accountTradeList(requestParameters = {}) {
3547
+ return this.tradeApi.accountTradeList(requestParameters);
3548
+ }
3549
+ /**
3550
+ * Cancel all active orders on specified underlying.
3551
+ *
3552
+ * Weight: 1
3553
+ *
3554
+ * @summary Cancel All Option Orders By Underlying (TRADE)
3555
+ * @param {CancelAllOptionOrdersByUnderlyingRequest} requestParameters Request parameters.
3556
+ * @returns {Promise<RestApiResponse<CancelAllOptionOrdersByUnderlyingResponse>>}
3557
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3558
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Cancel-All-Option-Orders-By-Underlying Binance API Documentation}
3559
+ */
3560
+ cancelAllOptionOrdersByUnderlying(requestParameters) {
3561
+ return this.tradeApi.cancelAllOptionOrdersByUnderlying(requestParameters);
3562
+ }
3563
+ /**
3564
+ * Cancel all active order on a symbol.
3565
+ *
3566
+ * Weight: 1
3567
+ *
3568
+ * @summary Cancel all Option orders on specific symbol (TRADE)
3569
+ * @param {CancelAllOptionOrdersOnSpecificSymbolRequest} requestParameters Request parameters.
3570
+ * @returns {Promise<RestApiResponse<CancelAllOptionOrdersOnSpecificSymbolResponse>>}
3571
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3572
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Cancel-all-Option-orders-on-specific-symbol Binance API Documentation}
3573
+ */
3574
+ cancelAllOptionOrdersOnSpecificSymbol(requestParameters) {
3575
+ return this.tradeApi.cancelAllOptionOrdersOnSpecificSymbol(requestParameters);
3576
+ }
3577
+ /**
3578
+ * Cancel multiple orders.
3579
+ *
3580
+ * At least one instance of `orderId` and `clientOrderId` must be sent.
3581
+ *
3582
+ * Weight: 1
3583
+ *
3584
+ * @summary Cancel Multiple Option Orders (TRADE)
3585
+ * @param {CancelMultipleOptionOrdersRequest} requestParameters Request parameters.
3586
+ * @returns {Promise<RestApiResponse<CancelMultipleOptionOrdersResponse>>}
3587
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3588
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Cancel-Multiple-Option-Orders Binance API Documentation}
3589
+ */
3590
+ cancelMultipleOptionOrders(requestParameters) {
3591
+ return this.tradeApi.cancelMultipleOptionOrders(requestParameters);
3592
+ }
3593
+ /**
3594
+ * Cancel an active order.
3595
+ *
3596
+ * At least one instance of `orderId` and `clientOrderId` must be sent.
3597
+ *
3598
+ * Weight: 1
3599
+ *
3600
+ * @summary Cancel Option Order (TRADE)
3601
+ * @param {CancelOptionOrderRequest} requestParameters Request parameters.
3602
+ * @returns {Promise<RestApiResponse<CancelOptionOrderResponse>>}
3603
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3604
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Cancel-Option-Order Binance API Documentation}
3605
+ */
3606
+ cancelOptionOrder(requestParameters) {
3607
+ return this.tradeApi.cancelOptionOrder(requestParameters);
3608
+ }
3609
+ /**
3610
+ * Send a new order.
3611
+ *
3612
+ * Weight: 0
3613
+ *
3614
+ * @summary New Order (TRADE)
3615
+ * @param {NewOrderRequest} requestParameters Request parameters.
3616
+ * @returns {Promise<RestApiResponse<NewOrderResponse>>}
3617
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3618
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/New-Order Binance API Documentation}
3619
+ */
3620
+ newOrder(requestParameters) {
3621
+ return this.tradeApi.newOrder(requestParameters);
3622
+ }
3623
+ /**
3624
+ * Get current position information.
3625
+ *
3626
+ * Weight: 5
3627
+ *
3628
+ * @summary Option Position Information (USER_DATA)
3629
+ * @param {OptionPositionInformationRequest} requestParameters Request parameters.
3630
+ * @returns {Promise<RestApiResponse<OptionPositionInformationResponse>>}
3631
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3632
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Option-Position-Information Binance API Documentation}
3633
+ */
3634
+ optionPositionInformation(requestParameters = {}) {
3635
+ return this.tradeApi.optionPositionInformation(requestParameters);
3636
+ }
3637
+ /**
3638
+ * Send multiple option orders.
3639
+ *
3640
+ * Parameter rules are same with New Order
3641
+ * Batch orders are processed concurrently, and the order of matching is not guaranteed.
3642
+ *
3643
+ * Weight: 5
3644
+ *
3645
+ * @summary Place Multiple Orders(TRADE)
3646
+ * @param {PlaceMultipleOrdersRequest} requestParameters Request parameters.
3647
+ * @returns {Promise<RestApiResponse<PlaceMultipleOrdersResponse>>}
3648
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3649
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Place-Multiple-Orders Binance API Documentation}
3650
+ */
3651
+ placeMultipleOrders(requestParameters) {
3652
+ return this.tradeApi.placeMultipleOrders(requestParameters);
3653
+ }
3654
+ /**
3655
+ * Query current all open orders, status: ACCEPTED PARTIALLY_FILLED
3656
+ *
3657
+ * Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
3658
+ *
3659
+ * @summary Query Current Open Option Orders (USER_DATA)
3660
+ * @param {QueryCurrentOpenOptionOrdersRequest} requestParameters Request parameters.
3661
+ * @returns {Promise<RestApiResponse<QueryCurrentOpenOptionOrdersResponse>>}
3662
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3663
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Query-Current-Open-Option-Orders Binance API Documentation}
3664
+ */
3665
+ queryCurrentOpenOptionOrders(requestParameters = {}) {
3666
+ return this.tradeApi.queryCurrentOpenOptionOrders(requestParameters);
3667
+ }
3668
+ /**
3669
+ * Query all finished orders within 5 days, finished status: CANCELLED FILLED REJECTED.
3670
+ *
3671
+ * Weight: 3
3672
+ *
3673
+ * @summary Query Option Order History (TRADE)
3674
+ * @param {QueryOptionOrderHistoryRequest} requestParameters Request parameters.
3675
+ * @returns {Promise<RestApiResponse<QueryOptionOrderHistoryResponse>>}
3676
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3677
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History Binance API Documentation}
3678
+ */
3679
+ queryOptionOrderHistory(requestParameters) {
3680
+ return this.tradeApi.queryOptionOrderHistory(requestParameters);
3681
+ }
3682
+ /**
3683
+ * Check an order status.
3684
+ *
3685
+ * These orders will not be found:
3686
+ * order status is `CANCELED` or `REJECTED`, **AND**
3687
+ * order has NO filled trade, **AND**
3688
+ * created time + 3 days < current time
3689
+ *
3690
+ *
3691
+ * Either `orderId` or `clientOrderId ` must be sent.
3692
+ *
3693
+ * Weight: 1
3694
+ *
3695
+ * @summary Query Single Order (TRADE)
3696
+ * @param {QuerySingleOrderRequest} requestParameters Request parameters.
3697
+ * @returns {Promise<RestApiResponse<QuerySingleOrderResponse>>}
3698
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3699
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/Query-Single-Order Binance API Documentation}
3700
+ */
3701
+ querySingleOrder(requestParameters) {
3702
+ return this.tradeApi.querySingleOrder(requestParameters);
3703
+ }
3704
+ /**
3705
+ * Get account exercise records.
3706
+ *
3707
+ * Weight: 5
3708
+ *
3709
+ * @summary User Exercise Record (USER_DATA)
3710
+ * @param {UserExerciseRecordRequest} requestParameters Request parameters.
3711
+ * @returns {Promise<RestApiResponse<UserExerciseRecordResponse>>}
3712
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3713
+ * @see {@link https://developers.binance.com/docs/derivatives/option/trade/User-Exercise-Record Binance API Documentation}
3714
+ */
3715
+ userExerciseRecord(requestParameters = {}) {
3716
+ return this.tradeApi.userExerciseRecord(requestParameters);
3717
+ }
3718
+ /**
3719
+ * Close out a user data stream.
3720
+ *
3721
+ * Weight: 1
3722
+ *
3723
+ * @summary Close User Data Stream (USER_STREAM)
3724
+ * @returns {Promise<RestApiResponse<void>>}
3725
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3726
+ * @see {@link https://developers.binance.com/docs/derivatives/option/user-data-streams/Close-User-Data-Stream Binance API Documentation}
3727
+ */
3728
+ closeUserDataStream() {
3729
+ return this.userDataStreamsApi.closeUserDataStream();
3730
+ }
3731
+ /**
3732
+ * Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 60 minutes.
3733
+ *
3734
+ * Weight: 1
3735
+ *
3736
+ * @summary Keepalive User Data Stream (USER_STREAM)
3737
+ * @returns {Promise<RestApiResponse<void>>}
3738
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3739
+ * @see {@link https://developers.binance.com/docs/derivatives/option/user-data-streams/Keepalive-User-Data-Stream Binance API Documentation}
3740
+ */
3741
+ keepaliveUserDataStream() {
3742
+ return this.userDataStreamsApi.keepaliveUserDataStream();
3743
+ }
3744
+ /**
3745
+ * Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes.
3746
+ *
3747
+ * Weight: 1
3748
+ *
3749
+ * @summary Start User Data Stream (USER_STREAM)
3750
+ * @returns {Promise<RestApiResponse<StartUserDataStreamResponse>>}
3751
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
3752
+ * @see {@link https://developers.binance.com/docs/derivatives/option/user-data-streams/Start-User-Data-Stream Binance API Documentation}
3753
+ */
3754
+ startUserDataStream() {
3755
+ return this.userDataStreamsApi.startUserDataStream();
3756
+ }
3757
+ };
3758
+
3759
+ // src/websocket-streams/index.ts
3760
+ var websocket_streams_exports = {};
3761
+ __export(websocket_streams_exports, {
3762
+ WebsocketMarketStreamsApi: () => WebsocketMarketStreamsApi,
3763
+ WebsocketStreams: () => WebsocketStreams,
3764
+ WebsocketStreamsConnection: () => WebsocketStreamsConnection
3765
+ });
3766
+
3767
+ // src/websocket-streams/modules/websocket-market-streams-api.ts
3768
+ var import_common8 = require("@binance/common");
3769
+ var WebsocketMarketStreamsApiParamCreator = function() {
3770
+ return {
3771
+ /**
3772
+ * Underlying(e.g ETHUSDT) index stream.
3773
+ *
3774
+ * Update Speed: 1000ms
3775
+ *
3776
+ * @summary Index Price Streams
3777
+ * @param {string} symbol The symbol parameter
3778
+ * @param {string} [id] Unique WebSocket request ID.
3779
+ *
3780
+ * @throws {RequiredError}
3781
+ */
3782
+ indexPriceStreams: (symbol, id) => {
3783
+ (0, import_common8.assertParamExists)("indexPriceStreams", "symbol", symbol);
3784
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)("/<symbol>@index".slice(1), { symbol, id });
3785
+ },
3786
+ /**
3787
+ * The Kline/Candlestick Stream push updates to the current klines/candlestick every 1000 milliseconds (if existing).
3788
+ *
3789
+ * Update Speed: 1000ms
3790
+ *
3791
+ * @summary Kline/Candlestick Streams
3792
+ * @param {string} symbol The symbol parameter
3793
+ * @param {string} interval The interval parameter
3794
+ * @param {string} [id] Unique WebSocket request ID.
3795
+ *
3796
+ * @throws {RequiredError}
3797
+ */
3798
+ klineCandlestickStreams: (symbol, interval, id) => {
3799
+ (0, import_common8.assertParamExists)("klineCandlestickStreams", "symbol", symbol);
3800
+ (0, import_common8.assertParamExists)("klineCandlestickStreams", "interval", interval);
3801
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)("/<symbol>@kline_<interval>".slice(1), {
3802
+ symbol,
3803
+ interval,
3804
+ id
3805
+ });
3806
+ },
3807
+ /**
3808
+ * The mark price for all option symbols on specific underlying asset. E.g.[ETH@markPrice](wss://nbstream.binance.com/eoptions/stream?streams=ETH@markPrice)
3809
+ *
3810
+ * Update Speed: 1000ms
3811
+ *
3812
+ * @summary Mark Price
3813
+ * @param {string} underlyingAsset The underlyingAsset parameter
3814
+ * @param {string} [id] Unique WebSocket request ID.
3815
+ *
3816
+ * @throws {RequiredError}
3817
+ */
3818
+ markPrice: (underlyingAsset, id) => {
3819
+ (0, import_common8.assertParamExists)("markPrice", "underlyingAsset", underlyingAsset);
3820
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)("/<underlyingAsset>@markPrice".slice(1), {
3821
+ underlyingAsset,
3822
+ id
3823
+ });
3824
+ },
3825
+ /**
3826
+ * New symbol listing stream.
3827
+ *
3828
+ * Update Speed: 50ms
3829
+ *
3830
+ * @summary New Symbol Info
3831
+ * @param {string} [id] Unique WebSocket request ID.
3832
+ *
3833
+ * @throws {RequiredError}
3834
+ */
3835
+ newSymbolInfo: (id) => {
3836
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)("/option_pair".slice(1), { id });
3837
+ },
3838
+ /**
3839
+ * Option open interest for specific underlying asset on specific expiration date. E.g.[ETH@openInterest@221125](wss://nbstream.binance.com/eoptions/stream?streams=ETH@openInterest@221125)
3840
+ *
3841
+ * Update Speed: 60s
3842
+ *
3843
+ * @summary Open Interest
3844
+ * @param {string} underlyingAsset The underlyingAsset parameter
3845
+ * @param {string} expirationDate The expirationDate parameter
3846
+ * @param {string} [id] Unique WebSocket request ID.
3847
+ *
3848
+ * @throws {RequiredError}
3849
+ */
3850
+ openInterest: (underlyingAsset, expirationDate, id) => {
3851
+ (0, import_common8.assertParamExists)("openInterest", "underlyingAsset", underlyingAsset);
3852
+ (0, import_common8.assertParamExists)("openInterest", "expirationDate", expirationDate);
3853
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)(
3854
+ "/<underlyingAsset>@openInterest@<expirationDate>".slice(1),
3855
+ { underlyingAsset, expirationDate, id }
3856
+ );
3857
+ },
3858
+ /**
3859
+ * Top **<levels\>** bids and asks, Valid levels are **<levels\>** are 10, 20, 50, 100.
3860
+ *
3861
+ * Update Speed: 100ms or 1000ms, 500ms(default when update speed isn't used)
3862
+ *
3863
+ * @summary Partial Book Depth Streams
3864
+ * @param {string} symbol The symbol parameter
3865
+ * @param {number} levels The levels parameter
3866
+ * @param {string} [id] Unique WebSocket request ID.
3867
+ * @param {string} [updateSpeed] WebSocket stream update speed
3868
+ *
3869
+ * @throws {RequiredError}
3870
+ */
3871
+ partialBookDepthStreams: (symbol, levels, id, updateSpeed) => {
3872
+ (0, import_common8.assertParamExists)("partialBookDepthStreams", "symbol", symbol);
3873
+ (0, import_common8.assertParamExists)("partialBookDepthStreams", "levels", levels);
3874
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)(
3875
+ "/<symbol>@depth<levels><updateSpeed>".slice(1),
3876
+ { symbol, levels, id, updateSpeed }
3877
+ );
3878
+ },
3879
+ /**
3880
+ * 24hr ticker info for all symbols. Only symbols whose ticker info changed will be sent.
3881
+ *
3882
+ * Update Speed: 1000ms
3883
+ *
3884
+ * @summary 24-hour TICKER
3885
+ * @param {string} symbol The symbol parameter
3886
+ * @param {string} [id] Unique WebSocket request ID.
3887
+ *
3888
+ * @throws {RequiredError}
3889
+ */
3890
+ ticker24Hour: (symbol, id) => {
3891
+ (0, import_common8.assertParamExists)("ticker24Hour", "symbol", symbol);
3892
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)("/<symbol>@ticker".slice(1), { symbol, id });
3893
+ },
3894
+ /**
3895
+ * 24hr ticker info by underlying asset and expiration date. E.g.[ETH@ticker@220930](wss://nbstream.binance.com/eoptions/stream?streams=ETH@ticker@220930)
3896
+ *
3897
+ * Update Speed: 1000ms
3898
+ *
3899
+ * @summary 24-hour TICKER by underlying asset and expiration data
3900
+ * @param {string} underlyingAsset The underlyingAsset parameter
3901
+ * @param {string} expirationDate The expirationDate parameter
3902
+ * @param {string} [id] Unique WebSocket request ID.
3903
+ *
3904
+ * @throws {RequiredError}
3905
+ */
3906
+ ticker24HourByUnderlyingAssetAndExpirationData: (underlyingAsset, expirationDate, id) => {
3907
+ (0, import_common8.assertParamExists)(
3908
+ "ticker24HourByUnderlyingAssetAndExpirationData",
3909
+ "underlyingAsset",
3910
+ underlyingAsset
3911
+ );
3912
+ (0, import_common8.assertParamExists)(
3913
+ "ticker24HourByUnderlyingAssetAndExpirationData",
3914
+ "expirationDate",
3915
+ expirationDate
3916
+ );
3917
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)(
3918
+ "/<underlyingAsset>@ticker@<expirationDate>".slice(1),
3919
+ { underlyingAsset, expirationDate, id }
3920
+ );
3921
+ },
3922
+ /**
3923
+ * The Trade Streams push raw trade information for specific symbol or underlying asset. E.g.[ETH@trade](wss://nbstream.binance.com/eoptions/stream?streams=ETH@trade)
3924
+ *
3925
+ * Update Speed: 50ms
3926
+ *
3927
+ * @summary Trade Streams
3928
+ * @param {string} symbol The symbol parameter
3929
+ * @param {string} [id] Unique WebSocket request ID.
3930
+ *
3931
+ * @throws {RequiredError}
3932
+ */
3933
+ tradeStreams: (symbol, id) => {
3934
+ (0, import_common8.assertParamExists)("tradeStreams", "symbol", symbol);
3935
+ return (0, import_common8.replaceWebsocketStreamsPlaceholders)("/<symbol>@trade".slice(1), { symbol, id });
3936
+ }
3937
+ };
3938
+ };
3939
+ var WebsocketMarketStreamsApi = class {
3940
+ constructor(websocketBase) {
3941
+ this.websocketBase = websocketBase;
3942
+ this.localVarParamCreator = WebsocketMarketStreamsApiParamCreator();
3943
+ }
3944
+ /**
3945
+ * Underlying(e.g ETHUSDT) index stream.
3946
+ *
3947
+ * Update Speed: 1000ms
3948
+ *
3949
+ * @summary Index Price Streams
3950
+ * @param {IndexPriceStreamsRequest} requestParameters Request parameters.
3951
+ * @returns {WebsocketStream<IndexPriceStreamsResponse>}
3952
+ * @throws {RequiredError}
3953
+ * @memberof WebsocketMarketStreamsApi
3954
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Index-Price-Streams Binance API Documentation}
3955
+ */
3956
+ indexPriceStreams(requestParameters) {
3957
+ const stream = this.localVarParamCreator.indexPriceStreams(
3958
+ requestParameters?.symbol,
3959
+ requestParameters?.id
3960
+ );
3961
+ return (0, import_common8.createStreamHandler)(
3962
+ this.websocketBase,
3963
+ stream,
3964
+ requestParameters?.id
3965
+ );
3966
+ }
3967
+ /**
3968
+ * The Kline/Candlestick Stream push updates to the current klines/candlestick every 1000 milliseconds (if existing).
3969
+ *
3970
+ * Update Speed: 1000ms
3971
+ *
3972
+ * @summary Kline/Candlestick Streams
3973
+ * @param {KlineCandlestickStreamsRequest} requestParameters Request parameters.
3974
+ * @returns {WebsocketStream<KlineCandlestickStreamsResponse>}
3975
+ * @throws {RequiredError}
3976
+ * @memberof WebsocketMarketStreamsApi
3977
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Kline-Candlestick-Streams Binance API Documentation}
3978
+ */
3979
+ klineCandlestickStreams(requestParameters) {
3980
+ const stream = this.localVarParamCreator.klineCandlestickStreams(
3981
+ requestParameters?.symbol,
3982
+ requestParameters?.interval,
3983
+ requestParameters?.id
3984
+ );
3985
+ return (0, import_common8.createStreamHandler)(
3986
+ this.websocketBase,
3987
+ stream,
3988
+ requestParameters?.id
3989
+ );
3990
+ }
3991
+ /**
3992
+ * The mark price for all option symbols on specific underlying asset. E.g.[ETH@markPrice](wss://nbstream.binance.com/eoptions/stream?streams=ETH@markPrice)
3993
+ *
3994
+ * Update Speed: 1000ms
3995
+ *
3996
+ * @summary Mark Price
3997
+ * @param {MarkPriceRequest} requestParameters Request parameters.
3998
+ * @returns {WebsocketStream<MarkPriceResponse>}
3999
+ * @throws {RequiredError}
4000
+ * @memberof WebsocketMarketStreamsApi
4001
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Mark-Price Binance API Documentation}
4002
+ */
4003
+ markPrice(requestParameters) {
4004
+ const stream = this.localVarParamCreator.markPrice(
4005
+ requestParameters?.underlyingAsset,
4006
+ requestParameters?.id
4007
+ );
4008
+ return (0, import_common8.createStreamHandler)(
4009
+ this.websocketBase,
4010
+ stream,
4011
+ requestParameters?.id
4012
+ );
4013
+ }
4014
+ /**
4015
+ * New symbol listing stream.
4016
+ *
4017
+ * Update Speed: 50ms
4018
+ *
4019
+ * @summary New Symbol Info
4020
+ * @param {NewSymbolInfoRequest} requestParameters Request parameters.
4021
+ * @returns {WebsocketStream<NewSymbolInfoResponse>}
4022
+ * @throws {RequiredError}
4023
+ * @memberof WebsocketMarketStreamsApi
4024
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/New-Symbol-Info Binance API Documentation}
4025
+ */
4026
+ newSymbolInfo(requestParameters = {}) {
4027
+ const stream = this.localVarParamCreator.newSymbolInfo(requestParameters?.id);
4028
+ return (0, import_common8.createStreamHandler)(
4029
+ this.websocketBase,
4030
+ stream,
4031
+ requestParameters?.id
4032
+ );
4033
+ }
4034
+ /**
4035
+ * Option open interest for specific underlying asset on specific expiration date. E.g.[ETH@openInterest@221125](wss://nbstream.binance.com/eoptions/stream?streams=ETH@openInterest@221125)
4036
+ *
4037
+ * Update Speed: 60s
4038
+ *
4039
+ * @summary Open Interest
4040
+ * @param {OpenInterestRequest} requestParameters Request parameters.
4041
+ * @returns {WebsocketStream<OpenInterestResponse>}
4042
+ * @throws {RequiredError}
4043
+ * @memberof WebsocketMarketStreamsApi
4044
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Open-Interest Binance API Documentation}
4045
+ */
4046
+ openInterest(requestParameters) {
4047
+ const stream = this.localVarParamCreator.openInterest(
4048
+ requestParameters?.underlyingAsset,
4049
+ requestParameters?.expirationDate,
4050
+ requestParameters?.id
4051
+ );
4052
+ return (0, import_common8.createStreamHandler)(
4053
+ this.websocketBase,
4054
+ stream,
4055
+ requestParameters?.id
4056
+ );
4057
+ }
4058
+ /**
4059
+ * Top **<levels\>** bids and asks, Valid levels are **<levels\>** are 10, 20, 50, 100.
4060
+ *
4061
+ * Update Speed: 100ms or 1000ms, 500ms(default when update speed isn't used)
4062
+ *
4063
+ * @summary Partial Book Depth Streams
4064
+ * @param {PartialBookDepthStreamsRequest} requestParameters Request parameters.
4065
+ * @returns {WebsocketStream<PartialBookDepthStreamsResponse>}
4066
+ * @throws {RequiredError}
4067
+ * @memberof WebsocketMarketStreamsApi
4068
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Partial-Book-Depth-Streams Binance API Documentation}
4069
+ */
4070
+ partialBookDepthStreams(requestParameters) {
4071
+ const stream = this.localVarParamCreator.partialBookDepthStreams(
4072
+ requestParameters?.symbol,
4073
+ requestParameters?.levels,
4074
+ requestParameters?.id,
4075
+ requestParameters?.updateSpeed
4076
+ );
4077
+ return (0, import_common8.createStreamHandler)(
4078
+ this.websocketBase,
4079
+ stream,
4080
+ requestParameters?.id
4081
+ );
4082
+ }
4083
+ /**
4084
+ * 24hr ticker info for all symbols. Only symbols whose ticker info changed will be sent.
4085
+ *
4086
+ * Update Speed: 1000ms
4087
+ *
4088
+ * @summary 24-hour TICKER
4089
+ * @param {Ticker24HourRequest} requestParameters Request parameters.
4090
+ * @returns {WebsocketStream<Ticker24HourResponse>}
4091
+ * @throws {RequiredError}
4092
+ * @memberof WebsocketMarketStreamsApi
4093
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/24-hour-TICKER Binance API Documentation}
4094
+ */
4095
+ ticker24Hour(requestParameters) {
4096
+ const stream = this.localVarParamCreator.ticker24Hour(
4097
+ requestParameters?.symbol,
4098
+ requestParameters?.id
4099
+ );
4100
+ return (0, import_common8.createStreamHandler)(
4101
+ this.websocketBase,
4102
+ stream,
4103
+ requestParameters?.id
4104
+ );
4105
+ }
4106
+ /**
4107
+ * 24hr ticker info by underlying asset and expiration date. E.g.[ETH@ticker@220930](wss://nbstream.binance.com/eoptions/stream?streams=ETH@ticker@220930)
4108
+ *
4109
+ * Update Speed: 1000ms
4110
+ *
4111
+ * @summary 24-hour TICKER by underlying asset and expiration data
4112
+ * @param {Ticker24HourByUnderlyingAssetAndExpirationDataRequest} requestParameters Request parameters.
4113
+ * @returns {WebsocketStream<Ticker24HourByUnderlyingAssetAndExpirationDataResponse>}
4114
+ * @throws {RequiredError}
4115
+ * @memberof WebsocketMarketStreamsApi
4116
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/24-hour-TICKER-by-underlying-asset-and-expiration-data Binance API Documentation}
4117
+ */
4118
+ ticker24HourByUnderlyingAssetAndExpirationData(requestParameters) {
4119
+ const stream = this.localVarParamCreator.ticker24HourByUnderlyingAssetAndExpirationData(
4120
+ requestParameters?.underlyingAsset,
4121
+ requestParameters?.expirationDate,
4122
+ requestParameters?.id
4123
+ );
4124
+ return (0, import_common8.createStreamHandler)(
4125
+ this.websocketBase,
4126
+ stream,
4127
+ requestParameters?.id
4128
+ );
4129
+ }
4130
+ /**
4131
+ * The Trade Streams push raw trade information for specific symbol or underlying asset. E.g.[ETH@trade](wss://nbstream.binance.com/eoptions/stream?streams=ETH@trade)
4132
+ *
4133
+ * Update Speed: 50ms
4134
+ *
4135
+ * @summary Trade Streams
4136
+ * @param {TradeStreamsRequest} requestParameters Request parameters.
4137
+ * @returns {WebsocketStream<TradeStreamsResponse>}
4138
+ * @throws {RequiredError}
4139
+ * @memberof WebsocketMarketStreamsApi
4140
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Trade-Streams Binance API Documentation}
4141
+ */
4142
+ tradeStreams(requestParameters) {
4143
+ const stream = this.localVarParamCreator.tradeStreams(
4144
+ requestParameters?.symbol,
4145
+ requestParameters?.id
4146
+ );
4147
+ return (0, import_common8.createStreamHandler)(
4148
+ this.websocketBase,
4149
+ stream,
4150
+ requestParameters?.id
4151
+ );
4152
+ }
4153
+ };
4154
+
4155
+ // src/websocket-streams/websocket-streams.ts
4156
+ var import_common10 = require("@binance/common");
4157
+
4158
+ // src/websocket-streams/websocket-streams-connection.ts
4159
+ var import_common9 = require("@binance/common");
4160
+ var WebsocketStreamsConnection = class {
4161
+ constructor(websocketBase) {
4162
+ this.websocketBase = websocketBase;
4163
+ this.websocketMarketStreamsApi = new WebsocketMarketStreamsApi(websocketBase);
4164
+ }
4165
+ /**
4166
+ * Adds an event listener for the specified WebSocket event.
4167
+ * @param event - The WebSocket event to listen for, such as 'open', 'message', 'error', 'close', 'ping', or 'pong'.
4168
+ * @param listener - The callback function to be executed when the event is triggered. The function can accept any number of arguments.
4169
+ */
4170
+ on(event, listener) {
4171
+ this.websocketBase.on(event, listener);
4172
+ }
4173
+ /**
4174
+ * Removes an event listener for the specified WebSocket event.
4175
+ * @param event - The WebSocket event to stop listening for, such as 'open', 'message', 'error', 'close', 'ping', or 'pong'.
4176
+ * @param listener - The callback function that was previously added as the event listener.
4177
+ */
4178
+ off(event, listener) {
4179
+ this.websocketBase.off(event, listener);
4180
+ }
4181
+ /**
4182
+ * Disconnects from the WebSocket server.
4183
+ * If there is no active connection, a warning is logged.
4184
+ * Otherwise, all connections in the connection pool are closed gracefully,
4185
+ * and a message is logged indicating that the connection has been disconnected.
4186
+ * @returns A Promise that resolves when all connections have been closed.
4187
+ * @throws Error if the WebSocket client is not set.
4188
+ */
4189
+ disconnect() {
4190
+ return this.websocketBase.disconnect();
4191
+ }
4192
+ /**
4193
+ * Checks if the WebSocket connection is currently open.
4194
+ * @returns `true` if the connection is open, `false` otherwise.
4195
+ */
4196
+ isConnected() {
4197
+ return this.websocketBase.isConnected();
4198
+ }
4199
+ /**
4200
+ * Sends a ping message to all connected Websocket servers in the pool.
4201
+ * If no connections are ready, a warning is logged.
4202
+ * For each active connection, the ping message is sent, and debug logs provide details.
4203
+ * @throws Error if a Websocket client is not set for a connection.
4204
+ */
4205
+ pingServer() {
4206
+ this.websocketBase.pingServer();
4207
+ }
4208
+ /**
4209
+ * Subscribes to one or multiple WebSocket streams
4210
+ * Handles both single and pool modes
4211
+ * @param stream Single stream name or array of stream names to subscribe to
4212
+ * @param id Optional subscription ID
4213
+ * @returns void
4214
+ */
4215
+ subscribe(stream, id) {
4216
+ this.websocketBase.subscribe(stream, id);
4217
+ }
4218
+ /**
4219
+ * Unsubscribes from one or multiple WebSocket streams
4220
+ * Handles both single and pool modes
4221
+ * @param stream Single stream name or array of stream names to unsubscribe from
4222
+ * @param id Optional unsubscription ID
4223
+ * @returns void
4224
+ */
4225
+ unsubscribe(stream, id) {
4226
+ this.websocketBase.unsubscribe(stream, id);
4227
+ }
4228
+ /**
4229
+ * Checks if the WebSocket connection is subscribed to the specified stream.
4230
+ * @param stream The name of the WebSocket stream to check.
4231
+ * @returns `true` if the connection is subscribed to the stream, `false` otherwise.
4232
+ */
4233
+ isSubscribed(stream) {
4234
+ return this.websocketBase.isSubscribed(stream);
4235
+ }
4236
+ /**
4237
+ * Subscribes to the user data WebSocket stream using the provided listen key.
4238
+ * @param listenKey - The listen key for the user data WebSocket stream.
4239
+ * @param id - Optional user data stream ID
4240
+ * @returns A WebSocket stream handler for the user data stream.
4241
+ */
4242
+ userData(listenKey, id) {
4243
+ return (0, import_common9.createStreamHandler)(this.websocketBase, listenKey, id);
4244
+ }
4245
+ /**
4246
+ * Underlying(e.g ETHUSDT) index stream.
4247
+ *
4248
+ * Update Speed: 1000ms
4249
+ *
4250
+ * @summary Index Price Streams
4251
+ * @param {IndexPriceStreamsRequest} requestParameters Request parameters.
4252
+ * @returns {WebsocketStream<IndexPriceStreamsResponse>}
4253
+ * @throws {RequiredError}
4254
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Index-Price-Streams Binance API Documentation}
4255
+ */
4256
+ indexPriceStreams(requestParameters) {
4257
+ return this.websocketMarketStreamsApi.indexPriceStreams(requestParameters);
4258
+ }
4259
+ /**
4260
+ * The Kline/Candlestick Stream push updates to the current klines/candlestick every 1000 milliseconds (if existing).
4261
+ *
4262
+ * Update Speed: 1000ms
4263
+ *
4264
+ * @summary Kline/Candlestick Streams
4265
+ * @param {KlineCandlestickStreamsRequest} requestParameters Request parameters.
4266
+ * @returns {WebsocketStream<KlineCandlestickStreamsResponse>}
4267
+ * @throws {RequiredError}
4268
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Kline-Candlestick-Streams Binance API Documentation}
4269
+ */
4270
+ klineCandlestickStreams(requestParameters) {
4271
+ return this.websocketMarketStreamsApi.klineCandlestickStreams(requestParameters);
4272
+ }
4273
+ /**
4274
+ * The mark price for all option symbols on specific underlying asset. E.g.[ETH@markPrice](wss://nbstream.binance.com/eoptions/stream?streams=ETH@markPrice)
4275
+ *
4276
+ * Update Speed: 1000ms
4277
+ *
4278
+ * @summary Mark Price
4279
+ * @param {MarkPriceRequest} requestParameters Request parameters.
4280
+ * @returns {WebsocketStream<MarkPriceResponse>}
4281
+ * @throws {RequiredError}
4282
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Mark-Price Binance API Documentation}
4283
+ */
4284
+ markPrice(requestParameters) {
4285
+ return this.websocketMarketStreamsApi.markPrice(requestParameters);
4286
+ }
4287
+ /**
4288
+ * New symbol listing stream.
4289
+ *
4290
+ * Update Speed: 50ms
4291
+ *
4292
+ * @summary New Symbol Info
4293
+ * @param {NewSymbolInfoRequest} requestParameters Request parameters.
4294
+ * @returns {WebsocketStream<NewSymbolInfoResponse>}
4295
+ * @throws {RequiredError}
4296
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/New-Symbol-Info Binance API Documentation}
4297
+ */
4298
+ newSymbolInfo(requestParameters = {}) {
4299
+ return this.websocketMarketStreamsApi.newSymbolInfo(requestParameters);
4300
+ }
4301
+ /**
4302
+ * Option open interest for specific underlying asset on specific expiration date. E.g.[ETH@openInterest@221125](wss://nbstream.binance.com/eoptions/stream?streams=ETH@openInterest@221125)
4303
+ *
4304
+ * Update Speed: 60s
4305
+ *
4306
+ * @summary Open Interest
4307
+ * @param {OpenInterestRequest} requestParameters Request parameters.
4308
+ * @returns {WebsocketStream<OpenInterestResponse>}
4309
+ * @throws {RequiredError}
4310
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Open-Interest Binance API Documentation}
4311
+ */
4312
+ openInterest(requestParameters) {
4313
+ return this.websocketMarketStreamsApi.openInterest(requestParameters);
4314
+ }
4315
+ /**
4316
+ * Top **<levels\>** bids and asks, Valid levels are **<levels\>** are 10, 20, 50, 100.
4317
+ *
4318
+ * Update Speed: 100ms or 1000ms, 500ms(default when update speed isn't used)
4319
+ *
4320
+ * @summary Partial Book Depth Streams
4321
+ * @param {PartialBookDepthStreamsRequest} requestParameters Request parameters.
4322
+ * @returns {WebsocketStream<PartialBookDepthStreamsResponse>}
4323
+ * @throws {RequiredError}
4324
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Partial-Book-Depth-Streams Binance API Documentation}
4325
+ */
4326
+ partialBookDepthStreams(requestParameters) {
4327
+ return this.websocketMarketStreamsApi.partialBookDepthStreams(requestParameters);
4328
+ }
4329
+ /**
4330
+ * 24hr ticker info for all symbols. Only symbols whose ticker info changed will be sent.
4331
+ *
4332
+ * Update Speed: 1000ms
4333
+ *
4334
+ * @summary 24-hour TICKER
4335
+ * @param {Ticker24HourRequest} requestParameters Request parameters.
4336
+ * @returns {WebsocketStream<Ticker24HourResponse>}
4337
+ * @throws {RequiredError}
4338
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/24-hour-TICKER Binance API Documentation}
4339
+ */
4340
+ ticker24Hour(requestParameters) {
4341
+ return this.websocketMarketStreamsApi.ticker24Hour(requestParameters);
4342
+ }
4343
+ /**
4344
+ * 24hr ticker info by underlying asset and expiration date. E.g.[ETH@ticker@220930](wss://nbstream.binance.com/eoptions/stream?streams=ETH@ticker@220930)
4345
+ *
4346
+ * Update Speed: 1000ms
4347
+ *
4348
+ * @summary 24-hour TICKER by underlying asset and expiration data
4349
+ * @param {Ticker24HourByUnderlyingAssetAndExpirationDataRequest} requestParameters Request parameters.
4350
+ * @returns {WebsocketStream<Ticker24HourByUnderlyingAssetAndExpirationDataResponse>}
4351
+ * @throws {RequiredError}
4352
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/24-hour-TICKER-by-underlying-asset-and-expiration-data Binance API Documentation}
4353
+ */
4354
+ ticker24HourByUnderlyingAssetAndExpirationData(requestParameters) {
4355
+ return this.websocketMarketStreamsApi.ticker24HourByUnderlyingAssetAndExpirationData(
4356
+ requestParameters
4357
+ );
4358
+ }
4359
+ /**
4360
+ * The Trade Streams push raw trade information for specific symbol or underlying asset. E.g.[ETH@trade](wss://nbstream.binance.com/eoptions/stream?streams=ETH@trade)
4361
+ *
4362
+ * Update Speed: 50ms
4363
+ *
4364
+ * @summary Trade Streams
4365
+ * @param {TradeStreamsRequest} requestParameters Request parameters.
4366
+ * @returns {WebsocketStream<TradeStreamsResponse>}
4367
+ * @throws {RequiredError}
4368
+ * @see {@link https://developers.binance.com/docs/derivatives/option/websocket-market-streams/Trade-Streams Binance API Documentation}
4369
+ */
4370
+ tradeStreams(requestParameters) {
4371
+ return this.websocketMarketStreamsApi.tradeStreams(requestParameters);
4372
+ }
4373
+ };
4374
+
4375
+ // src/websocket-streams/websocket-streams.ts
4376
+ var WebsocketStreams = class {
4377
+ constructor(configuration) {
4378
+ this.configuration = configuration;
4379
+ }
4380
+ /**
4381
+ * Connects to the Binance WebSocket streams and returns a `WebsocketStreamsConnection` instance.
4382
+ *
4383
+ * @param {object} [options] - Optional connection options.
4384
+ * @param {string|string[]} [options.stream] - The stream(s) to connect to.
4385
+ * @param {'single'|'pool'} [options.mode] - The connection mode, either 'single' or 'pool'. Overwrite the `mode` option in the configuration.
4386
+ * @param {number} [options.poolSize] - The number of connections to use in pool mode. Overwrite the `poolSize` option in the configuration.
4387
+ * @returns {Promise<WebsocketStreamsConnection>} - A promise that resolves to a `WebsocketStreamsConnection` instance.
4388
+ */
4389
+ async connect({
4390
+ stream,
4391
+ mode,
4392
+ poolSize
4393
+ } = {}) {
4394
+ const websocketBase = new import_common10.WebsocketStreamsBase({
4395
+ ...this.configuration,
4396
+ ...mode && { mode },
4397
+ ...poolSize && { poolSize }
4398
+ });
4399
+ const websocketStreamsConnection = new WebsocketStreamsConnection(websocketBase);
4400
+ await websocketBase.connect(stream);
4401
+ return websocketStreamsConnection;
4402
+ }
4403
+ };
4404
+
4405
+ // src/derivatives-trading-options.ts
4406
+ var DerivativesTradingOptions = class {
4407
+ constructor(config) {
4408
+ if (config?.configurationRestAPI) {
4409
+ const configRestAPI = new import_common11.ConfigurationRestAPI(config.configurationRestAPI);
4410
+ configRestAPI.basePath = configRestAPI.basePath || import_common11.DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL;
4411
+ configRestAPI.baseOptions = configRestAPI.baseOptions || {};
4412
+ configRestAPI.baseOptions.headers = {
4413
+ ...configRestAPI.baseOptions.headers || {},
4414
+ "User-Agent": `${name}/${version} (Node.js/${process.version}; ${(0, import_os.platform)()}; ${(0, import_os.arch)()})`
4415
+ };
4416
+ this.restAPI = new RestAPI(configRestAPI);
4417
+ }
4418
+ if (config?.configurationWebsocketStreams) {
4419
+ const configWebsocketStreams = new import_common11.ConfigurationWebsocketStreams(
4420
+ config.configurationWebsocketStreams
4421
+ );
4422
+ configWebsocketStreams.wsURL = configWebsocketStreams.wsURL || import_common11.DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL;
4423
+ this.websocketStreams = new WebsocketStreams(configWebsocketStreams);
4424
+ }
4425
+ }
4426
+ };
4427
+
4428
+ // src/index.ts
4429
+ var import_common12 = require("@binance/common");
4430
+ // Annotate the CommonJS export names for ESM import in node:
4431
+ 0 && (module.exports = {
4432
+ BadRequestError,
4433
+ ConnectorClientError,
4434
+ DERIVATIVES_TRADING_OPTIONS_REST_API_PROD_URL,
4435
+ DERIVATIVES_TRADING_OPTIONS_WS_STREAMS_PROD_URL,
4436
+ DerivativesTradingOptions,
4437
+ DerivativesTradingOptionsRestAPI,
4438
+ DerivativesTradingOptionsWebsocketStreams,
4439
+ ForbiddenError,
4440
+ NetworkError,
4441
+ NotFoundError,
4442
+ RateLimitBanError,
4443
+ RequiredError,
4444
+ ServerError,
4445
+ TooManyRequestsError,
4446
+ UnauthorizedError
4447
+ });
4448
+ //# sourceMappingURL=index.js.map