@binance/alpha 1.0.15 → 2.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.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import { t as __export } from "./chunk.mjs";
2
- import { ALPHA_REST_API_PROD_URL, ALPHA_REST_API_PROD_URL as ALPHA_REST_API_PROD_URL$1, BadRequestError, ConfigurationRestAPI, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError, assertParamExists, buildUserAgent, sendRequest } from "@binance/common";
2
+ import { ALPHA_REST_API_PROD_URL, ALPHA_REST_API_PROD_URL as ALPHA_REST_API_PROD_URL$1, ALPHA_WS_STREAMS_PROD_URL, ALPHA_WS_STREAMS_PROD_URL as ALPHA_WS_STREAMS_PROD_URL$1, BadRequestError, ConfigurationRestAPI, ConfigurationWebsocketStreams, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError, WebsocketStreamsBase, assertParamExists, buildUserAgent, createStreamHandler, replaceWebsocketStreamsPlaceholders, sendRequest } from "@binance/common";
3
3
 
4
4
  //#region package.json
5
5
  var name = "@binance/alpha";
6
- var version = "1.0.15";
6
+ var version = "2.0.0";
7
7
 
8
8
  //#endregion
9
9
  //#region src/rest-api/modules/market-data-api.ts
10
10
  /**
11
- * Binance Alpha REST API
11
+ * Alpha Trading REST API
12
12
  *
13
- * OpenAPI Specification for the Binance Alpha REST API
13
+ * APIs for Binance Alpha Trading.
14
14
  *
15
15
  * The version of the OpenAPI document: 1.0.0
16
16
  *
@@ -45,6 +45,24 @@ const MarketDataApiAxiosParamCreator = function(configuration) {
45
45
  timeUnit: _timeUnit
46
46
  };
47
47
  },
48
+ fullDepth: async (symbol, limit) => {
49
+ assertParamExists("fullDepth", "symbol", symbol);
50
+ const localVarQueryParameter = {};
51
+ const localVarBodyParameter = {};
52
+ const localVarHeaderParameter = {};
53
+ if (symbol !== void 0 && symbol !== null) localVarQueryParameter["symbol"] = symbol;
54
+ if (limit !== void 0 && limit !== null) localVarQueryParameter["limit"] = limit;
55
+ let _timeUnit;
56
+ if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
57
+ return {
58
+ endpoint: "/bapi/defi/v1/public/alpha-trade/fullDepth",
59
+ method: "GET",
60
+ queryParams: localVarQueryParameter,
61
+ bodyParams: localVarBodyParameter,
62
+ headerParams: localVarHeaderParameter,
63
+ timeUnit: _timeUnit
64
+ };
65
+ },
48
66
  getExchangeInfo: async () => {
49
67
  const localVarQueryParameter = {};
50
68
  const localVarBodyParameter = {};
@@ -128,29 +146,39 @@ var MarketDataApi = class {
128
146
  /**
129
147
  * Retrieves compressed, aggregated historical trades for a specific symbol. Useful for recent trade history.
130
148
  *
131
- * Weight: 0
132
- *
133
149
  * @summary Aggregated Trades
134
150
  * @param {AggregatedTradesRequest} requestParameters Request parameters.
135
151
  * @returns {Promise<RestApiResponse<AggregatedTradesResponse>>}
136
152
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
137
153
  * @memberof MarketDataApi
138
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/Aggregated-Trades Binance API Documentation}
154
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#aggregated-trades Binance API Documentation}
139
155
  */
140
156
  async aggregatedTrades(requestParameters) {
141
157
  const localVarAxiosArgs = await this.localVarAxiosParamCreator.aggregatedTrades(requestParameters?.symbol, requestParameters?.fromId, requestParameters?.startTime, requestParameters?.endTime, requestParameters?.limit);
142
158
  return sendRequest(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.queryParams, localVarAxiosArgs.bodyParams, localVarAxiosArgs.headerParams, localVarAxiosArgs?.timeUnit, { isSigned: false });
143
159
  }
144
160
  /**
145
- * Fetches general exchange information, such as supported symbols, rate limits, and server time.
161
+ * Fetches the full order book depth (UI & API orders) for a symbol, including bid and ask orders with their prices and quantities.
146
162
  *
147
- * Weight: 0
163
+ * @summary Full Depth
164
+ * @param {FullDepthRequest} requestParameters Request parameters.
165
+ * @returns {Promise<RestApiResponse<FullDepthResponse>>}
166
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
167
+ * @memberof MarketDataApi
168
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#full-depth Binance API Documentation}
169
+ */
170
+ async fullDepth(requestParameters) {
171
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.fullDepth(requestParameters?.symbol, requestParameters?.limit);
172
+ return sendRequest(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.queryParams, localVarAxiosArgs.bodyParams, localVarAxiosArgs.headerParams, localVarAxiosArgs?.timeUnit, { isSigned: false });
173
+ }
174
+ /**
175
+ * Fetches general exchange information, such as supported symbols, rate limits, and server time.
148
176
  *
149
177
  * @summary Get Exchange Info
150
178
  * @returns {Promise<RestApiResponse<GetExchangeInfoResponse>>}
151
179
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
152
180
  * @memberof MarketDataApi
153
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/Get-Exchange-Info Binance API Documentation}
181
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#get-exchange-info Binance API Documentation}
154
182
  */
155
183
  async getExchangeInfo() {
156
184
  const localVarAxiosArgs = await this.localVarAxiosParamCreator.getExchangeInfo();
@@ -159,14 +187,12 @@ var MarketDataApi = class {
159
187
  /**
160
188
  * Fetches Kline/candlestick bars for a symbol, which include open/high/low/close prices and volume over intervals. Useful for charting and analysis.
161
189
  *
162
- * Weight: 0
163
- *
164
- * @summary Klines (Candlestick Data)
190
+ * @summary Klines
165
191
  * @param {KlinesRequest} requestParameters Request parameters.
166
192
  * @returns {Promise<RestApiResponse<KlinesResponse>>}
167
193
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
168
194
  * @memberof MarketDataApi
169
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/Klines Binance API Documentation}
195
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#klines Binance API Documentation}
170
196
  */
171
197
  async klines(requestParameters) {
172
198
  const localVarAxiosArgs = await this.localVarAxiosParamCreator.klines(requestParameters?.symbol, requestParameters?.interval, requestParameters?.limit, requestParameters?.startTime, requestParameters?.endTime);
@@ -175,14 +201,12 @@ var MarketDataApi = class {
175
201
  /**
176
202
  * Gets the 24-hour rolling window price change statistics for a symbol, including volume and price changes.
177
203
  *
178
- * Weight: 0
179
- *
180
- * @summary Ticker (24hr Price Statistics)
204
+ * @summary Ticker
181
205
  * @param {TickerRequest} requestParameters Request parameters.
182
206
  * @returns {Promise<RestApiResponse<TickerResponse>>}
183
207
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
184
208
  * @memberof MarketDataApi
185
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/24hr-ticker-price-change Binance API Documentation}
209
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#ticker Binance API Documentation}
186
210
  */
187
211
  async ticker(requestParameters) {
188
212
  const localVarAxiosArgs = await this.localVarAxiosParamCreator.ticker(requestParameters?.symbol);
@@ -191,26 +215,54 @@ var MarketDataApi = class {
191
215
  /**
192
216
  * Retrieves a list of all available ALPHA tokens, including their IDs and symbols. Use this to find the token ID for constructing symbols in other endpoints.
193
217
  *
194
- * Weight: 0
195
- *
196
218
  * @summary Token List
197
219
  * @returns {Promise<RestApiResponse<TokenListResponse>>}
198
220
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
199
221
  * @memberof MarketDataApi
200
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/Token-List Binance API Documentation}
222
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#token-list Binance API Documentation}
201
223
  */
202
224
  async tokenList() {
203
225
  const localVarAxiosArgs = await this.localVarAxiosParamCreator.tokenList();
204
226
  return sendRequest(this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.queryParams, localVarAxiosArgs.bodyParams, localVarAxiosArgs.headerParams, localVarAxiosArgs?.timeUnit, { isSigned: false });
205
227
  }
206
228
  };
229
+ let FullDepthLimitEnum = /* @__PURE__ */ function(FullDepthLimitEnum$1) {
230
+ FullDepthLimitEnum$1[FullDepthLimitEnum$1["LIMIT_5"] = 5] = "LIMIT_5";
231
+ FullDepthLimitEnum$1[FullDepthLimitEnum$1["LIMIT_10"] = 10] = "LIMIT_10";
232
+ FullDepthLimitEnum$1[FullDepthLimitEnum$1["LIMIT_20"] = 20] = "LIMIT_20";
233
+ FullDepthLimitEnum$1[FullDepthLimitEnum$1["LIMIT_50"] = 50] = "LIMIT_50";
234
+ FullDepthLimitEnum$1[FullDepthLimitEnum$1["LIMIT_100"] = 100] = "LIMIT_100";
235
+ FullDepthLimitEnum$1[FullDepthLimitEnum$1["LIMIT_500"] = 500] = "LIMIT_500";
236
+ FullDepthLimitEnum$1[FullDepthLimitEnum$1["LIMIT_1000"] = 1e3] = "LIMIT_1000";
237
+ return FullDepthLimitEnum$1;
238
+ }({});
239
+ let KlinesIntervalEnum = /* @__PURE__ */ function(KlinesIntervalEnum$1) {
240
+ KlinesIntervalEnum$1["INTERVAL_1s"] = "1s";
241
+ KlinesIntervalEnum$1["INTERVAL_15s"] = "15s";
242
+ KlinesIntervalEnum$1["INTERVAL_1m"] = "1m";
243
+ KlinesIntervalEnum$1["INTERVAL_3m"] = "3m";
244
+ KlinesIntervalEnum$1["INTERVAL_5m"] = "5m";
245
+ KlinesIntervalEnum$1["INTERVAL_15m"] = "15m";
246
+ KlinesIntervalEnum$1["INTERVAL_30m"] = "30m";
247
+ KlinesIntervalEnum$1["INTERVAL_1h"] = "1h";
248
+ KlinesIntervalEnum$1["INTERVAL_2h"] = "2h";
249
+ KlinesIntervalEnum$1["INTERVAL_4h"] = "4h";
250
+ KlinesIntervalEnum$1["INTERVAL_6h"] = "6h";
251
+ KlinesIntervalEnum$1["INTERVAL_8h"] = "8h";
252
+ KlinesIntervalEnum$1["INTERVAL_12h"] = "12h";
253
+ KlinesIntervalEnum$1["INTERVAL_1d"] = "1d";
254
+ KlinesIntervalEnum$1["INTERVAL_3d"] = "3d";
255
+ KlinesIntervalEnum$1["INTERVAL_1w"] = "1w";
256
+ KlinesIntervalEnum$1["INTERVAL_1M"] = "1M";
257
+ return KlinesIntervalEnum$1;
258
+ }({});
207
259
 
208
260
  //#endregion
209
261
  //#region src/rest-api/rest-api.ts
210
262
  /**
211
- * Binance Alpha REST API
263
+ * Alpha Trading REST API
212
264
  *
213
- * OpenAPI Specification for the Binance Alpha REST API
265
+ * APIs for Binance Alpha Trading.
214
266
  *
215
267
  * The version of the OpenAPI document: 1.0.0
216
268
  *
@@ -251,28 +303,37 @@ var RestAPI = class {
251
303
  /**
252
304
  * Retrieves compressed, aggregated historical trades for a specific symbol. Useful for recent trade history.
253
305
  *
254
- * Weight: 0
255
- *
256
306
  * @summary Aggregated Trades
257
307
  * @param {AggregatedTradesRequest} requestParameters Request parameters.
258
308
  *
259
309
  * @returns {Promise<RestApiResponse<AggregatedTradesResponse>>}
260
310
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
261
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/Aggregated-Trades Binance API Documentation}
311
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#aggregated-trades Binance API Documentation}
262
312
  */
263
313
  aggregatedTrades(requestParameters) {
264
314
  return this.marketDataApi.aggregatedTrades(requestParameters);
265
315
  }
266
316
  /**
267
- * Fetches general exchange information, such as supported symbols, rate limits, and server time.
317
+ * Fetches the full order book depth (UI & API orders) for a symbol, including bid and ask orders with their prices and quantities.
318
+ *
319
+ * @summary Full Depth
320
+ * @param {FullDepthRequest} requestParameters Request parameters.
268
321
  *
269
- * Weight: 0
322
+ * @returns {Promise<RestApiResponse<FullDepthResponse>>}
323
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
324
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#full-depth Binance API Documentation}
325
+ */
326
+ fullDepth(requestParameters) {
327
+ return this.marketDataApi.fullDepth(requestParameters);
328
+ }
329
+ /**
330
+ * Fetches general exchange information, such as supported symbols, rate limits, and server time.
270
331
  *
271
332
  * @summary Get Exchange Info
272
333
  *
273
334
  * @returns {Promise<RestApiResponse<GetExchangeInfoResponse>>}
274
335
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
275
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/Get-Exchange-Info Binance API Documentation}
336
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#get-exchange-info Binance API Documentation}
276
337
  */
277
338
  getExchangeInfo() {
278
339
  return this.marketDataApi.getExchangeInfo();
@@ -280,14 +341,12 @@ var RestAPI = class {
280
341
  /**
281
342
  * Fetches Kline/candlestick bars for a symbol, which include open/high/low/close prices and volume over intervals. Useful for charting and analysis.
282
343
  *
283
- * Weight: 0
284
- *
285
- * @summary Klines (Candlestick Data)
344
+ * @summary Klines
286
345
  * @param {KlinesRequest} requestParameters Request parameters.
287
346
  *
288
347
  * @returns {Promise<RestApiResponse<KlinesResponse>>}
289
348
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
290
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/Klines Binance API Documentation}
349
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#klines Binance API Documentation}
291
350
  */
292
351
  klines(requestParameters) {
293
352
  return this.marketDataApi.klines(requestParameters);
@@ -295,14 +354,12 @@ var RestAPI = class {
295
354
  /**
296
355
  * Gets the 24-hour rolling window price change statistics for a symbol, including volume and price changes.
297
356
  *
298
- * Weight: 0
299
- *
300
- * @summary Ticker (24hr Price Statistics)
357
+ * @summary Ticker
301
358
  * @param {TickerRequest} requestParameters Request parameters.
302
359
  *
303
360
  * @returns {Promise<RestApiResponse<TickerResponse>>}
304
361
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
305
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/24hr-ticker-price-change Binance API Documentation}
362
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#ticker Binance API Documentation}
306
363
  */
307
364
  ticker(requestParameters) {
308
365
  return this.marketDataApi.ticker(requestParameters);
@@ -310,13 +367,11 @@ var RestAPI = class {
310
367
  /**
311
368
  * Retrieves a list of all available ALPHA tokens, including their IDs and symbols. Use this to find the token ID for constructing symbols in other endpoints.
312
369
  *
313
- * Weight: 0
314
- *
315
370
  * @summary Token List
316
371
  *
317
372
  * @returns {Promise<RestApiResponse<TokenListResponse>>}
318
373
  * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
319
- * @see {@link https://developers.binance.com/docs/alpha/market-data/rest-api/Token-List Binance API Documentation}
374
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#token-list Binance API Documentation}
320
375
  */
321
376
  tokenList() {
322
377
  return this.marketDataApi.tokenList();
@@ -326,10 +381,658 @@ var RestAPI = class {
326
381
  //#endregion
327
382
  //#region src/rest-api/index.ts
328
383
  var rest_api_exports = /* @__PURE__ */ __export({
384
+ FullDepthLimitEnum: () => FullDepthLimitEnum,
385
+ KlinesIntervalEnum: () => KlinesIntervalEnum,
329
386
  MarketDataApi: () => MarketDataApi,
330
387
  RestAPI: () => RestAPI
331
388
  });
332
389
 
390
+ //#endregion
391
+ //#region src/websocket-streams/modules/api.ts
392
+ /**
393
+ * Alpha WebSocket Market Streams
394
+ *
395
+ * Access Alpha market streams over WebSocket.
396
+ *
397
+ * The version of the OpenAPI document: 1.0.0
398
+ *
399
+ *
400
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
401
+ * https://openapi-generator.tech
402
+ * Do not edit the class manually.
403
+ */
404
+ const ApiParamCreator = function() {
405
+ return {
406
+ aggregateTradeStream: (symbol, id) => {
407
+ assertParamExists("aggregateTradeStream", "symbol", symbol);
408
+ return replaceWebsocketStreamsPlaceholders("/<symbol>@aggTrade".slice(1), {
409
+ symbol,
410
+ id
411
+ });
412
+ },
413
+ allBookTickerStream: (id) => {
414
+ return replaceWebsocketStreamsPlaceholders("/!bookTicker".slice(1), { id });
415
+ },
416
+ allMiniTickerStream: (id) => {
417
+ return replaceWebsocketStreamsPlaceholders("/!miniTicker@arr".slice(1), { id });
418
+ },
419
+ allTickerStream: (id) => {
420
+ return replaceWebsocketStreamsPlaceholders("/!ticker@arr".slice(1), { id });
421
+ },
422
+ allTokens24hTickerStream: (id) => {
423
+ return replaceWebsocketStreamsPlaceholders("/came@allTokens@ticker24".slice(1), { id });
424
+ },
425
+ bookTickerStream: (symbol, id) => {
426
+ assertParamExists("bookTickerStream", "symbol", symbol);
427
+ return replaceWebsocketStreamsPlaceholders("/<symbol>@bookTicker".slice(1), {
428
+ symbol,
429
+ id
430
+ });
431
+ },
432
+ contractKlineStream: (contractAddress, chainId, interval, id) => {
433
+ assertParamExists("contractKlineStream", "contractAddress", contractAddress);
434
+ assertParamExists("contractKlineStream", "chainId", chainId);
435
+ assertParamExists("contractKlineStream", "interval", interval);
436
+ return replaceWebsocketStreamsPlaceholders("/came@<contractAddress>@<chainId>@kline_<interval>".slice(1), {
437
+ contractAddress,
438
+ chainId,
439
+ interval,
440
+ id
441
+ });
442
+ },
443
+ fullDepthStream: (symbol, interval, id) => {
444
+ assertParamExists("fullDepthStream", "symbol", symbol);
445
+ assertParamExists("fullDepthStream", "interval", interval);
446
+ return replaceWebsocketStreamsPlaceholders("/<symbol>@fulldepth@<interval>".slice(1), {
447
+ symbol,
448
+ interval,
449
+ id
450
+ });
451
+ },
452
+ klineStream: (symbol, interval, id) => {
453
+ assertParamExists("klineStream", "symbol", symbol);
454
+ assertParamExists("klineStream", "interval", interval);
455
+ return replaceWebsocketStreamsPlaceholders("/<symbol>@kline_<interval>".slice(1), {
456
+ symbol,
457
+ interval,
458
+ id
459
+ });
460
+ },
461
+ miniTickerStream: (symbol, id) => {
462
+ assertParamExists("miniTickerStream", "symbol", symbol);
463
+ return replaceWebsocketStreamsPlaceholders("/<symbol>@miniTicker".slice(1), {
464
+ symbol,
465
+ id
466
+ });
467
+ },
468
+ partialDepthStream: (symbol, levels, interval, id) => {
469
+ assertParamExists("partialDepthStream", "symbol", symbol);
470
+ assertParamExists("partialDepthStream", "levels", levels);
471
+ assertParamExists("partialDepthStream", "interval", interval);
472
+ return replaceWebsocketStreamsPlaceholders("/<symbol>@depth<levels>@<interval>".slice(1), {
473
+ symbol,
474
+ levels,
475
+ interval,
476
+ id
477
+ });
478
+ },
479
+ tickerStream: (symbol, id) => {
480
+ assertParamExists("tickerStream", "symbol", symbol);
481
+ return replaceWebsocketStreamsPlaceholders("/<symbol>@ticker".slice(1), {
482
+ symbol,
483
+ id
484
+ });
485
+ },
486
+ tradeStream: (symbol, id) => {
487
+ assertParamExists("tradeStream", "symbol", symbol);
488
+ return replaceWebsocketStreamsPlaceholders("/<symbol>@trade".slice(1), {
489
+ symbol,
490
+ id
491
+ });
492
+ }
493
+ };
494
+ };
495
+ /**
496
+ * Api - interface
497
+ * @class Api
498
+ * @extends {WebsocketStreamsBase}
499
+ */
500
+ var Api = class {
501
+ constructor(websocketBase) {
502
+ this.websocketBase = websocketBase;
503
+ this.localVarParamCreator = ApiParamCreator();
504
+ }
505
+ /**
506
+ * Pushes aggregate trade updates for a symbol.
507
+ *
508
+ * @summary Aggregate Trade Stream
509
+ * @param {AggregateTradeStreamRequest} requestParameters Request parameters.
510
+ * @returns {WebsocketStream<AggregateTradeStreamResponse>}
511
+ * @throws {RequiredError}
512
+ * @memberof Api
513
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#aggregate-trade-stream Binance API Documentation}
514
+ */
515
+ aggregateTradeStream(requestParameters) {
516
+ const stream = this.localVarParamCreator.aggregateTradeStream(requestParameters?.symbol, requestParameters?.id);
517
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
518
+ }
519
+ /**
520
+ * Pushes best bid/ask updates for all symbols.
521
+ *
522
+ * @summary All Book Ticker Stream
523
+ * @param {AllBookTickerStreamRequest} requestParameters Request parameters.
524
+ * @returns {WebsocketStream<AllBookTickerStreamResponse>}
525
+ * @throws {RequiredError}
526
+ * @memberof Api
527
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#all-book-ticker-stream Binance API Documentation}
528
+ */
529
+ allBookTickerStream(requestParameters = {}) {
530
+ const stream = this.localVarParamCreator.allBookTickerStream(requestParameters?.id);
531
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
532
+ }
533
+ /**
534
+ * Pushes mini ticker statistics for all symbols.
535
+ *
536
+ * @summary All Mini Ticker Stream
537
+ * @param {AllMiniTickerStreamRequest} requestParameters Request parameters.
538
+ * @returns {WebsocketStream<AllMiniTickerStreamResponse>}
539
+ * @throws {RequiredError}
540
+ * @memberof Api
541
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#all-mini-ticker-stream Binance API Documentation}
542
+ */
543
+ allMiniTickerStream(requestParameters = {}) {
544
+ const stream = this.localVarParamCreator.allMiniTickerStream(requestParameters?.id);
545
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
546
+ }
547
+ /**
548
+ * Pushes full ticker statistics for all symbols.
549
+ *
550
+ * @summary All Ticker Stream
551
+ * @param {AllTickerStreamRequest} requestParameters Request parameters.
552
+ * @returns {WebsocketStream<AllTickerStreamResponse>}
553
+ * @throws {RequiredError}
554
+ * @memberof Api
555
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#all-ticker-stream Binance API Documentation}
556
+ */
557
+ allTickerStream(requestParameters = {}) {
558
+ const stream = this.localVarParamCreator.allTickerStream(requestParameters?.id);
559
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
560
+ }
561
+ /**
562
+ * Pushes 24h ticker-like metrics for all tokens.
563
+ *
564
+ * @summary All Tokens 24h Ticker Stream
565
+ * @param {AllTokens24hTickerStreamRequest} requestParameters Request parameters.
566
+ * @returns {WebsocketStream<AllTokens24hTickerStreamResponse>}
567
+ * @throws {RequiredError}
568
+ * @memberof Api
569
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#all-tokens24h-ticker-stream Binance API Documentation}
570
+ */
571
+ allTokens24hTickerStream(requestParameters = {}) {
572
+ const stream = this.localVarParamCreator.allTokens24hTickerStream(requestParameters?.id);
573
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
574
+ }
575
+ /**
576
+ * Pushes best bid/ask updates for a symbol.
577
+ *
578
+ * @summary Book Ticker Stream
579
+ * @param {BookTickerStreamRequest} requestParameters Request parameters.
580
+ * @returns {WebsocketStream<BookTickerStreamResponse>}
581
+ * @throws {RequiredError}
582
+ * @memberof Api
583
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#book-ticker-stream Binance API Documentation}
584
+ */
585
+ bookTickerStream(requestParameters) {
586
+ const stream = this.localVarParamCreator.bookTickerStream(requestParameters?.symbol, requestParameters?.id);
587
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
588
+ }
589
+ /**
590
+ * Pushes kline updates by contractAddress@chainId.
591
+ *
592
+ * @summary Contract Kline Stream
593
+ * @param {ContractKlineStreamRequest} requestParameters Request parameters.
594
+ * @returns {WebsocketStream<ContractKlineStreamResponse>}
595
+ * @throws {RequiredError}
596
+ * @memberof Api
597
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#contract-kline-stream Binance API Documentation}
598
+ */
599
+ contractKlineStream(requestParameters) {
600
+ const stream = this.localVarParamCreator.contractKlineStream(requestParameters?.contractAddress, requestParameters?.chainId, requestParameters?.interval, requestParameters?.id);
601
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
602
+ }
603
+ /**
604
+ * Returns all available depth, including UI and API orders.
605
+ *
606
+ * @summary Full Depth Stream
607
+ * @param {FullDepthStreamRequest} requestParameters Request parameters.
608
+ * @returns {WebsocketStream<FullDepthStreamResponse>}
609
+ * @throws {RequiredError}
610
+ * @memberof Api
611
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#full-depth-stream Binance API Documentation}
612
+ */
613
+ fullDepthStream(requestParameters) {
614
+ const stream = this.localVarParamCreator.fullDepthStream(requestParameters?.symbol, requestParameters?.interval, requestParameters?.id);
615
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
616
+ }
617
+ /**
618
+ * Pushes kline updates for a symbol.
619
+ *
620
+ * @summary Kline Stream
621
+ * @param {KlineStreamRequest} requestParameters Request parameters.
622
+ * @returns {WebsocketStream<KlineStreamResponse>}
623
+ * @throws {RequiredError}
624
+ * @memberof Api
625
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#kline-stream Binance API Documentation}
626
+ */
627
+ klineStream(requestParameters) {
628
+ const stream = this.localVarParamCreator.klineStream(requestParameters?.symbol, requestParameters?.interval, requestParameters?.id);
629
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
630
+ }
631
+ /**
632
+ * Pushes 24h rolling mini ticker statistics.
633
+ *
634
+ * @summary Mini Ticker Stream
635
+ * @param {MiniTickerStreamRequest} requestParameters Request parameters.
636
+ * @returns {WebsocketStream<MiniTickerStreamResponse>}
637
+ * @throws {RequiredError}
638
+ * @memberof Api
639
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#mini-ticker-stream Binance API Documentation}
640
+ */
641
+ miniTickerStream(requestParameters) {
642
+ const stream = this.localVarParamCreator.miniTickerStream(requestParameters?.symbol, requestParameters?.id);
643
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
644
+ }
645
+ /**
646
+ * Pushes partial depth updates (UI orders only).
647
+ *
648
+ * @summary Partial Depth Stream
649
+ * @param {PartialDepthStreamRequest} requestParameters Request parameters.
650
+ * @returns {WebsocketStream<PartialDepthStreamResponse>}
651
+ * @throws {RequiredError}
652
+ * @memberof Api
653
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#partial-depth-stream Binance API Documentation}
654
+ */
655
+ partialDepthStream(requestParameters) {
656
+ const stream = this.localVarParamCreator.partialDepthStream(requestParameters?.symbol, requestParameters?.levels, requestParameters?.interval, requestParameters?.id);
657
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
658
+ }
659
+ /**
660
+ * Pushes full 24h rolling ticker statistics.
661
+ *
662
+ * @summary Ticker Stream
663
+ * @param {TickerStreamRequest} requestParameters Request parameters.
664
+ * @returns {WebsocketStream<TickerStreamResponse>}
665
+ * @throws {RequiredError}
666
+ * @memberof Api
667
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#ticker-stream Binance API Documentation}
668
+ */
669
+ tickerStream(requestParameters) {
670
+ const stream = this.localVarParamCreator.tickerStream(requestParameters?.symbol, requestParameters?.id);
671
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
672
+ }
673
+ /**
674
+ * Pushes raw trade updates for a symbol.
675
+ *
676
+ * @summary Trade Stream
677
+ * @param {TradeStreamRequest} requestParameters Request parameters.
678
+ * @returns {WebsocketStream<TradeStreamResponse>}
679
+ * @throws {RequiredError}
680
+ * @memberof Api
681
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#trade-stream Binance API Documentation}
682
+ */
683
+ tradeStream(requestParameters) {
684
+ const stream = this.localVarParamCreator.tradeStream(requestParameters?.symbol, requestParameters?.id);
685
+ return createStreamHandler(this.websocketBase, stream, requestParameters?.id);
686
+ }
687
+ };
688
+ let ContractKlineStreamIntervalEnum = /* @__PURE__ */ function(ContractKlineStreamIntervalEnum$1) {
689
+ ContractKlineStreamIntervalEnum$1["INTERVAL_1s"] = "1s";
690
+ ContractKlineStreamIntervalEnum$1["INTERVAL_1m"] = "1m";
691
+ ContractKlineStreamIntervalEnum$1["INTERVAL_5m"] = "5m";
692
+ ContractKlineStreamIntervalEnum$1["INTERVAL_15m"] = "15m";
693
+ ContractKlineStreamIntervalEnum$1["INTERVAL_1h"] = "1h";
694
+ ContractKlineStreamIntervalEnum$1["INTERVAL_4h"] = "4h";
695
+ ContractKlineStreamIntervalEnum$1["INTERVAL_1d"] = "1d";
696
+ return ContractKlineStreamIntervalEnum$1;
697
+ }({});
698
+ let FullDepthStreamIntervalEnum = /* @__PURE__ */ function(FullDepthStreamIntervalEnum$1) {
699
+ FullDepthStreamIntervalEnum$1["INTERVAL_0ms"] = "0ms";
700
+ FullDepthStreamIntervalEnum$1["INTERVAL_100ms"] = "100ms";
701
+ FullDepthStreamIntervalEnum$1["INTERVAL_500ms"] = "500ms";
702
+ return FullDepthStreamIntervalEnum$1;
703
+ }({});
704
+ let KlineStreamIntervalEnum = /* @__PURE__ */ function(KlineStreamIntervalEnum$1) {
705
+ KlineStreamIntervalEnum$1["INTERVAL_1m"] = "1m";
706
+ KlineStreamIntervalEnum$1["INTERVAL_3m"] = "3m";
707
+ KlineStreamIntervalEnum$1["INTERVAL_5m"] = "5m";
708
+ KlineStreamIntervalEnum$1["INTERVAL_15m"] = "15m";
709
+ KlineStreamIntervalEnum$1["INTERVAL_30m"] = "30m";
710
+ KlineStreamIntervalEnum$1["INTERVAL_1h"] = "1h";
711
+ KlineStreamIntervalEnum$1["INTERVAL_2h"] = "2h";
712
+ KlineStreamIntervalEnum$1["INTERVAL_4h"] = "4h";
713
+ KlineStreamIntervalEnum$1["INTERVAL_6h"] = "6h";
714
+ KlineStreamIntervalEnum$1["INTERVAL_8h"] = "8h";
715
+ KlineStreamIntervalEnum$1["INTERVAL_12h"] = "12h";
716
+ KlineStreamIntervalEnum$1["INTERVAL_1d"] = "1d";
717
+ KlineStreamIntervalEnum$1["INTERVAL_3d"] = "3d";
718
+ KlineStreamIntervalEnum$1["INTERVAL_1w"] = "1w";
719
+ KlineStreamIntervalEnum$1["INTERVAL_1M"] = "1M";
720
+ return KlineStreamIntervalEnum$1;
721
+ }({});
722
+ let PartialDepthStreamLevelsEnum = /* @__PURE__ */ function(PartialDepthStreamLevelsEnum$1) {
723
+ PartialDepthStreamLevelsEnum$1["LEVELS_5"] = "5";
724
+ PartialDepthStreamLevelsEnum$1["LEVELS_10"] = "10";
725
+ PartialDepthStreamLevelsEnum$1["LEVELS_20"] = "20";
726
+ return PartialDepthStreamLevelsEnum$1;
727
+ }({});
728
+ let PartialDepthStreamIntervalEnum = /* @__PURE__ */ function(PartialDepthStreamIntervalEnum$1) {
729
+ PartialDepthStreamIntervalEnum$1["INTERVAL_0ms"] = "0ms";
730
+ PartialDepthStreamIntervalEnum$1["INTERVAL_100ms"] = "100ms";
731
+ PartialDepthStreamIntervalEnum$1["INTERVAL_500ms"] = "500ms";
732
+ return PartialDepthStreamIntervalEnum$1;
733
+ }({});
734
+
735
+ //#endregion
736
+ //#region src/websocket-streams/websocket-streams-connection.ts
737
+ var WebsocketStreamsConnection = class {
738
+ constructor(websocketBase) {
739
+ this.websocketBase = websocketBase;
740
+ this.api = new Api(websocketBase);
741
+ }
742
+ /**
743
+ * Adds an event listener for the specified WebSocket event.
744
+ * @param event - The WebSocket event to listen for, such as 'open', 'message', 'error', 'close', 'ping', or 'pong'.
745
+ * @param listener - The callback function to be executed when the event is triggered. The function can accept any number of arguments.
746
+ */
747
+ on(event, listener) {
748
+ this.websocketBase.on(event, listener);
749
+ }
750
+ /**
751
+ * Removes an event listener for the specified WebSocket event.
752
+ * @param event - The WebSocket event to stop listening for, such as 'open', 'message', 'error', 'close', 'ping', or 'pong'.
753
+ * @param listener - The callback function that was previously added as the event listener.
754
+ */
755
+ off(event, listener) {
756
+ this.websocketBase.off(event, listener);
757
+ }
758
+ /**
759
+ * Disconnects from the WebSocket server.
760
+ * If there is no active connection, a warning is logged.
761
+ * Otherwise, all connections in the connection pool are closed gracefully,
762
+ * and a message is logged indicating that the connection has been disconnected.
763
+ * @returns A Promise that resolves when all connections have been closed.
764
+ * @throws Error if the WebSocket client is not set.
765
+ */
766
+ disconnect() {
767
+ return this.websocketBase.disconnect();
768
+ }
769
+ /**
770
+ * Checks if the WebSocket connection is currently open.
771
+ * @returns `true` if the connection is open, `false` otherwise.
772
+ */
773
+ isConnected() {
774
+ return this.websocketBase.isConnected();
775
+ }
776
+ /**
777
+ * Sends a ping message to all connected Websocket servers in the pool.
778
+ * If no connections are ready, a warning is logged.
779
+ * For each active connection, the ping message is sent, and debug logs provide details.
780
+ * @throws Error if a Websocket client is not set for a connection.
781
+ */
782
+ pingServer() {
783
+ this.websocketBase.pingServer();
784
+ }
785
+ /**
786
+ * Subscribes to one or multiple WebSocket streams
787
+ * Handles both single and pool modes
788
+ * @param stream Single stream name or array of stream names to subscribe to
789
+ * @param id Optional subscription ID
790
+ * @returns void
791
+ */
792
+ subscribe(stream, id) {
793
+ this.websocketBase.subscribe(stream, id);
794
+ }
795
+ /**
796
+ * Unsubscribes from one or multiple WebSocket streams
797
+ * Handles both single and pool modes
798
+ * @param stream Single stream name or array of stream names to unsubscribe from
799
+ * @param id Optional unsubscription ID
800
+ * @returns void
801
+ */
802
+ unsubscribe(stream, id) {
803
+ this.websocketBase.unsubscribe(stream, id);
804
+ }
805
+ /**
806
+ * Checks if the WebSocket connection is subscribed to the specified stream.
807
+ * @param stream The name of the WebSocket stream to check.
808
+ * @returns `true` if the connection is subscribed to the stream, `false` otherwise.
809
+ */
810
+ isSubscribed(stream) {
811
+ return this.websocketBase.isSubscribed(stream);
812
+ }
813
+ /**
814
+ * Pushes aggregate trade updates for a symbol.
815
+ *
816
+ * @summary Aggregate Trade Stream
817
+ * @param {AggregateTradeStreamRequest} requestParameters Request parameters.
818
+ *
819
+ * @returns {WebsocketStream<AggregateTradeStreamResponse>}
820
+ * @throws {RequiredError}
821
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#aggregate-trade-stream Binance API Documentation}
822
+ */
823
+ aggregateTradeStream(requestParameters) {
824
+ return this.api.aggregateTradeStream(requestParameters);
825
+ }
826
+ /**
827
+ * Pushes best bid/ask updates for all symbols.
828
+ *
829
+ * @summary All Book Ticker Stream
830
+ * @param {AllBookTickerStreamRequest} requestParameters Request parameters.
831
+ *
832
+ * @returns {WebsocketStream<AllBookTickerStreamResponse>}
833
+ * @throws {RequiredError}
834
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#all-book-ticker-stream Binance API Documentation}
835
+ */
836
+ allBookTickerStream(requestParameters = {}) {
837
+ return this.api.allBookTickerStream(requestParameters);
838
+ }
839
+ /**
840
+ * Pushes mini ticker statistics for all symbols.
841
+ *
842
+ * @summary All Mini Ticker Stream
843
+ * @param {AllMiniTickerStreamRequest} requestParameters Request parameters.
844
+ *
845
+ * @returns {WebsocketStream<AllMiniTickerStreamResponse>}
846
+ * @throws {RequiredError}
847
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#all-mini-ticker-stream Binance API Documentation}
848
+ */
849
+ allMiniTickerStream(requestParameters = {}) {
850
+ return this.api.allMiniTickerStream(requestParameters);
851
+ }
852
+ /**
853
+ * Pushes full ticker statistics for all symbols.
854
+ *
855
+ * @summary All Ticker Stream
856
+ * @param {AllTickerStreamRequest} requestParameters Request parameters.
857
+ *
858
+ * @returns {WebsocketStream<AllTickerStreamResponse>}
859
+ * @throws {RequiredError}
860
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#all-ticker-stream Binance API Documentation}
861
+ */
862
+ allTickerStream(requestParameters = {}) {
863
+ return this.api.allTickerStream(requestParameters);
864
+ }
865
+ /**
866
+ * Pushes 24h ticker-like metrics for all tokens.
867
+ *
868
+ * @summary All Tokens 24h Ticker Stream
869
+ * @param {AllTokens24hTickerStreamRequest} requestParameters Request parameters.
870
+ *
871
+ * @returns {WebsocketStream<AllTokens24hTickerStreamResponse>}
872
+ * @throws {RequiredError}
873
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#all-tokens24h-ticker-stream Binance API Documentation}
874
+ */
875
+ allTokens24hTickerStream(requestParameters = {}) {
876
+ return this.api.allTokens24hTickerStream(requestParameters);
877
+ }
878
+ /**
879
+ * Pushes best bid/ask updates for a symbol.
880
+ *
881
+ * @summary Book Ticker Stream
882
+ * @param {BookTickerStreamRequest} requestParameters Request parameters.
883
+ *
884
+ * @returns {WebsocketStream<BookTickerStreamResponse>}
885
+ * @throws {RequiredError}
886
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#book-ticker-stream Binance API Documentation}
887
+ */
888
+ bookTickerStream(requestParameters) {
889
+ return this.api.bookTickerStream(requestParameters);
890
+ }
891
+ /**
892
+ * Pushes kline updates by contractAddress@chainId.
893
+ *
894
+ * @summary Contract Kline Stream
895
+ * @param {ContractKlineStreamRequest} requestParameters Request parameters.
896
+ *
897
+ * @returns {WebsocketStream<ContractKlineStreamResponse>}
898
+ * @throws {RequiredError}
899
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#contract-kline-stream Binance API Documentation}
900
+ */
901
+ contractKlineStream(requestParameters) {
902
+ return this.api.contractKlineStream(requestParameters);
903
+ }
904
+ /**
905
+ * Returns all available depth, including UI and API orders.
906
+ *
907
+ * @summary Full Depth Stream
908
+ * @param {FullDepthStreamRequest} requestParameters Request parameters.
909
+ *
910
+ * @returns {WebsocketStream<FullDepthStreamResponse>}
911
+ * @throws {RequiredError}
912
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#full-depth-stream Binance API Documentation}
913
+ */
914
+ fullDepthStream(requestParameters) {
915
+ return this.api.fullDepthStream(requestParameters);
916
+ }
917
+ /**
918
+ * Pushes kline updates for a symbol.
919
+ *
920
+ * @summary Kline Stream
921
+ * @param {KlineStreamRequest} requestParameters Request parameters.
922
+ *
923
+ * @returns {WebsocketStream<KlineStreamResponse>}
924
+ * @throws {RequiredError}
925
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#kline-stream Binance API Documentation}
926
+ */
927
+ klineStream(requestParameters) {
928
+ return this.api.klineStream(requestParameters);
929
+ }
930
+ /**
931
+ * Pushes 24h rolling mini ticker statistics.
932
+ *
933
+ * @summary Mini Ticker Stream
934
+ * @param {MiniTickerStreamRequest} requestParameters Request parameters.
935
+ *
936
+ * @returns {WebsocketStream<MiniTickerStreamResponse>}
937
+ * @throws {RequiredError}
938
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#mini-ticker-stream Binance API Documentation}
939
+ */
940
+ miniTickerStream(requestParameters) {
941
+ return this.api.miniTickerStream(requestParameters);
942
+ }
943
+ /**
944
+ * Pushes partial depth updates (UI orders only).
945
+ *
946
+ * @summary Partial Depth Stream
947
+ * @param {PartialDepthStreamRequest} requestParameters Request parameters.
948
+ *
949
+ * @returns {WebsocketStream<PartialDepthStreamResponse>}
950
+ * @throws {RequiredError}
951
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#partial-depth-stream Binance API Documentation}
952
+ */
953
+ partialDepthStream(requestParameters) {
954
+ return this.api.partialDepthStream(requestParameters);
955
+ }
956
+ /**
957
+ * Pushes full 24h rolling ticker statistics.
958
+ *
959
+ * @summary Ticker Stream
960
+ * @param {TickerStreamRequest} requestParameters Request parameters.
961
+ *
962
+ * @returns {WebsocketStream<TickerStreamResponse>}
963
+ * @throws {RequiredError}
964
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#ticker-stream Binance API Documentation}
965
+ */
966
+ tickerStream(requestParameters) {
967
+ return this.api.tickerStream(requestParameters);
968
+ }
969
+ /**
970
+ * Pushes raw trade updates for a symbol.
971
+ *
972
+ * @summary Trade Stream
973
+ * @param {TradeStreamRequest} requestParameters Request parameters.
974
+ *
975
+ * @returns {WebsocketStream<TradeStreamResponse>}
976
+ * @throws {RequiredError}
977
+ * @see {@link https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/ws-streams/~#trade-stream Binance API Documentation}
978
+ */
979
+ tradeStream(requestParameters) {
980
+ return this.api.tradeStream(requestParameters);
981
+ }
982
+ };
983
+
984
+ //#endregion
985
+ //#region src/websocket-streams/websocket-streams.ts
986
+ /**
987
+ * Alpha WebSocket Market Streams
988
+ *
989
+ * Access Alpha market streams over WebSocket.
990
+ *
991
+ * The version of the OpenAPI document: 1.0.0
992
+ *
993
+ *
994
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
995
+ * https://openapi-generator.tech
996
+ * Do not edit the class manually.
997
+ */
998
+ var WebsocketStreams = class {
999
+ constructor(configuration) {
1000
+ this.configuration = configuration;
1001
+ }
1002
+ /**
1003
+ * Connects to the Binance WebSocket streams and returns a `WebsocketStreamsConnection` instance.
1004
+ *
1005
+ * @param {object} [options] - Optional connection options.
1006
+ * @param {string|string[]} [options.stream] - The stream(s) to connect to.
1007
+ * @param {'single'|'pool'} [options.mode] - The connection mode, either 'single' or 'pool'. Overwrite the `mode` option in the configuration.
1008
+ * @param {number} [options.poolSize] - The number of connections to use in pool mode. Overwrite the `poolSize` option in the configuration.
1009
+ * @returns {Promise<WebsocketStreamsConnection>} - A promise that resolves to a `WebsocketStreamsConnection` instance.
1010
+ */
1011
+ async connect({ stream, mode, poolSize } = {}) {
1012
+ const websocketBase = new WebsocketStreamsBase({
1013
+ ...this.configuration,
1014
+ ...mode && { mode },
1015
+ ...poolSize && { poolSize }
1016
+ });
1017
+ const websocketStreamsConnection = new WebsocketStreamsConnection(websocketBase);
1018
+ await websocketBase.connect(stream);
1019
+ return websocketStreamsConnection;
1020
+ }
1021
+ };
1022
+
1023
+ //#endregion
1024
+ //#region src/websocket-streams/index.ts
1025
+ var websocket_streams_exports = /* @__PURE__ */ __export({
1026
+ Api: () => Api,
1027
+ ContractKlineStreamIntervalEnum: () => ContractKlineStreamIntervalEnum,
1028
+ FullDepthStreamIntervalEnum: () => FullDepthStreamIntervalEnum,
1029
+ KlineStreamIntervalEnum: () => KlineStreamIntervalEnum,
1030
+ PartialDepthStreamIntervalEnum: () => PartialDepthStreamIntervalEnum,
1031
+ PartialDepthStreamLevelsEnum: () => PartialDepthStreamLevelsEnum,
1032
+ WebsocketStreams: () => WebsocketStreams,
1033
+ WebsocketStreamsConnection: () => WebsocketStreamsConnection
1034
+ });
1035
+
333
1036
  //#endregion
334
1037
  //#region src/alpha.ts
335
1038
  var Alpha = class {
@@ -345,9 +1048,15 @@ var Alpha = class {
345
1048
  };
346
1049
  this.restAPI = new RestAPI(configRestAPI);
347
1050
  }
1051
+ if (config?.configurationWebsocketStreams) {
1052
+ const configWebsocketStreams = new ConfigurationWebsocketStreams(config.configurationWebsocketStreams);
1053
+ configWebsocketStreams.wsURL = configWebsocketStreams.wsURL || ALPHA_WS_STREAMS_PROD_URL$1;
1054
+ configWebsocketStreams.userAgent = userAgent;
1055
+ this.websocketStreams = new WebsocketStreams(configWebsocketStreams);
1056
+ }
348
1057
  }
349
1058
  };
350
1059
 
351
1060
  //#endregion
352
- export { ALPHA_REST_API_PROD_URL, Alpha, rest_api_exports as AlphaRestAPI, BadRequestError, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError };
1061
+ export { ALPHA_REST_API_PROD_URL, ALPHA_WS_STREAMS_PROD_URL, Alpha, rest_api_exports as AlphaRestAPI, websocket_streams_exports as AlphaWebsocketStreams, BadRequestError, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError };
353
1062
  //# sourceMappingURL=index.mjs.map