ccxt 4.5.0 → 4.5.1

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.
Files changed (52) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +5 -5
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +13 -0
  5. package/dist/cjs/src/coinbase.js +46 -34
  6. package/dist/cjs/src/gate.js +39 -18
  7. package/dist/cjs/src/gemini.js +1 -1
  8. package/dist/cjs/src/hibachi.js +1 -1
  9. package/dist/cjs/src/hyperliquid.js +16 -2
  10. package/dist/cjs/src/kraken.js +1 -12
  11. package/dist/cjs/src/krakenfutures.js +25 -25
  12. package/dist/cjs/src/mexc.js +2 -1
  13. package/dist/cjs/src/pro/bitget.js +193 -51
  14. package/dist/cjs/src/pro/bybit.js +8 -15
  15. package/dist/cjs/src/pro/gate.js +6 -1
  16. package/dist/cjs/src/pro/hyperliquid.js +4 -1
  17. package/dist/cjs/src/pro/kraken.js +1 -0
  18. package/dist/cjs/src/pro/lbank.js +55 -1
  19. package/dist/cjs/src/pro/mexc.js +1 -1
  20. package/dist/cjs/src/timex.js +35 -0
  21. package/dist/cjs/src/tradeogre.js +32 -0
  22. package/dist/cjs/src/wavesexchange.js +33 -0
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/base/Exchange.d.ts +1 -0
  26. package/js/src/base/Exchange.js +14 -1
  27. package/js/src/coinbase.js +46 -34
  28. package/js/src/gate.d.ts +2 -1
  29. package/js/src/gate.js +39 -18
  30. package/js/src/gemini.js +1 -1
  31. package/js/src/hibachi.js +1 -1
  32. package/js/src/hyperliquid.d.ts +1 -0
  33. package/js/src/hyperliquid.js +16 -2
  34. package/js/src/kraken.d.ts +0 -1
  35. package/js/src/kraken.js +1 -12
  36. package/js/src/krakenfutures.d.ts +24 -24
  37. package/js/src/krakenfutures.js +25 -25
  38. package/js/src/mexc.js +2 -1
  39. package/js/src/pro/bitget.d.ts +8 -2
  40. package/js/src/pro/bitget.js +193 -51
  41. package/js/src/pro/bybit.js +8 -15
  42. package/js/src/pro/gate.d.ts +5 -0
  43. package/js/src/pro/gate.js +6 -1
  44. package/js/src/pro/hyperliquid.js +4 -1
  45. package/js/src/pro/kraken.js +1 -0
  46. package/js/src/pro/lbank.d.ts +11 -1
  47. package/js/src/pro/lbank.js +55 -1
  48. package/js/src/pro/mexc.js +1 -1
  49. package/js/src/timex.js +35 -0
  50. package/js/src/tradeogre.js +32 -0
  51. package/js/src/wavesexchange.js +33 -0
  52. package/package.json +1 -1
@@ -47,10 +47,14 @@ export default class bitget extends bitgetRest {
47
47
  'ws': {
48
48
  'public': 'wss://ws.bitget.com/v2/ws/public',
49
49
  'private': 'wss://ws.bitget.com/v2/ws/private',
50
+ 'utaPublic': 'wss://ws.bitget.com/v3/ws/public',
51
+ 'utaPrivate': 'wss://ws.bitget.com/v3/ws/private',
50
52
  },
51
53
  'demo': {
52
54
  'public': 'wss://wspap.bitget.com/v2/ws/public',
53
55
  'private': 'wss://wspap.bitget.com/v2/ws/private',
56
+ 'utaPublic': 'wss://wspap.bitget.com/v3/ws/public',
57
+ 'utaPrivate': 'wss://wspap.bitget.com/v3/ws/private',
54
58
  },
55
59
  },
56
60
  },
@@ -102,7 +106,10 @@ export default class bitget extends bitgetRest {
102
106
  },
103
107
  });
104
108
  }
105
- getInstType(market, params = {}) {
109
+ getInstType(market, uta = false, params = {}) {
110
+ if ((uta === undefined) || !uta) {
111
+ [uta, params] = this.handleOptionAndParams(params, 'getInstType', 'uta', false);
112
+ }
106
113
  let instType = undefined;
107
114
  if (market === undefined) {
108
115
  [instType, params] = this.handleProductTypeAndParams(undefined, params);
@@ -116,6 +123,9 @@ export default class bitget extends bitgetRest {
116
123
  let instypeAux = undefined;
117
124
  [instypeAux, params] = this.handleOptionAndParams(params, 'getInstType', 'instType', instType);
118
125
  instType = instypeAux;
126
+ if (uta) {
127
+ instType = instType.toLowerCase();
128
+ }
119
129
  return [instType, params];
120
130
  }
121
131
  /**
@@ -124,8 +134,10 @@ export default class bitget extends bitgetRest {
124
134
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
125
135
  * @see https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
126
136
  * @see https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
137
+ * @see https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel
127
138
  * @param {string} symbol unified symbol of the market to watch the ticker for
128
139
  * @param {object} [params] extra parameters specific to the exchange API endpoint
140
+ * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
129
141
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
130
142
  */
131
143
  async watchTicker(symbol, params = {}) {
@@ -134,12 +146,16 @@ export default class bitget extends bitgetRest {
134
146
  symbol = market['symbol'];
135
147
  const messageHash = 'ticker:' + symbol;
136
148
  let instType = undefined;
137
- [instType, params] = this.getInstType(market, params);
149
+ let uta = undefined;
150
+ [uta, params] = this.handleOptionAndParams(params, 'watchTicker', 'uta', false);
151
+ [instType, params] = this.getInstType(market, uta, params);
138
152
  const args = {
139
153
  'instType': instType,
140
- 'channel': 'ticker',
141
- 'instId': market['id'],
142
154
  };
155
+ const topicOrChannel = uta ? 'topic' : 'channel';
156
+ const symbolOrInstId = uta ? 'symbol' : 'instId';
157
+ args[topicOrChannel] = 'ticker';
158
+ args[symbolOrInstId] = market['id'];
143
159
  return await this.watchPublic(messageHash, args, params);
144
160
  }
145
161
  /**
@@ -162,8 +178,10 @@ export default class bitget extends bitgetRest {
162
178
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
163
179
  * @see https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
164
180
  * @see https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
181
+ * @see https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel
165
182
  * @param {string[]} symbols unified symbol of the market to watch the tickers for
166
183
  * @param {object} [params] extra parameters specific to the exchange API endpoint
184
+ * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
167
185
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
168
186
  */
169
187
  async watchTickers(symbols = undefined, params = {}) {
@@ -171,7 +189,9 @@ export default class bitget extends bitgetRest {
171
189
  symbols = this.marketSymbols(symbols, undefined, false);
172
190
  const market = this.market(symbols[0]);
173
191
  let instType = undefined;
174
- [instType, params] = this.getInstType(market, params);
192
+ let uta = undefined;
193
+ [uta, params] = this.handleOptionAndParams(params, 'watchTickers', 'uta', false);
194
+ [instType, params] = this.getInstType(market, uta, params);
175
195
  const topics = [];
176
196
  const messageHashes = [];
177
197
  for (let i = 0; i < symbols.length; i++) {
@@ -179,9 +199,11 @@ export default class bitget extends bitgetRest {
179
199
  const marketInner = this.market(symbol);
180
200
  const args = {
181
201
  'instType': instType,
182
- 'channel': 'ticker',
183
- 'instId': marketInner['id'],
184
202
  };
203
+ const topicOrChannel = uta ? 'topic' : 'channel';
204
+ const symbolOrInstId = uta ? 'symbol' : 'instId';
205
+ args[topicOrChannel] = 'ticker';
206
+ args[symbolOrInstId] = marketInner['id'];
185
207
  topics.push(args);
186
208
  messageHashes.push('ticker:' + symbol);
187
209
  }
@@ -194,6 +216,8 @@ export default class bitget extends bitgetRest {
194
216
  return this.filterByArray(this.tickers, 'symbol', symbols);
195
217
  }
196
218
  handleTicker(client, message) {
219
+ //
220
+ // default
197
221
  //
198
222
  // {
199
223
  // "action": "snapshot",
@@ -224,6 +248,29 @@ export default class bitget extends bitgetRest {
224
248
  // "ts": 1701842994341
225
249
  // }
226
250
  //
251
+ // uta
252
+ //
253
+ // {
254
+ // "action": "snapshot",
255
+ // "arg": { "instType": "spot", topic: "ticker", symbol: "BTCUSDT" },
256
+ // "data": [
257
+ // {
258
+ // "highPrice24h": "120255.61",
259
+ // "lowPrice24h": "116145.88",
260
+ // "openPrice24h": "118919.38",
261
+ // "lastPrice": "119818.83",
262
+ // "turnover24h": "215859996.272276",
263
+ // "volume24h": "1819.756798",
264
+ // "bid1Price": "119811.26",
265
+ // "ask1Price": "119831.18",
266
+ // "bid1Size": "0.008732",
267
+ // "ask1Size": "0.004297",
268
+ // "price24hPcnt": "0.02002"
269
+ // }
270
+ // ],
271
+ // "ts": 1753230479687
272
+ // }
273
+ //
227
274
  this.handleBidAsk(client, message);
228
275
  const ticker = this.parseWsTicker(message);
229
276
  const symbol = ticker['symbol'];
@@ -302,48 +349,75 @@ export default class bitget extends bitgetRest {
302
349
  // "ts": 1701843962812
303
350
  // }
304
351
  //
352
+ // uta
353
+ //
354
+ // {
355
+ // "action": "snapshot",
356
+ // "arg": { "instType": "spot", topic: "ticker", symbol: "BTCUSDT" },
357
+ // "data": [
358
+ // {
359
+ // "highPrice24h": "120255.61",
360
+ // "lowPrice24h": "116145.88",
361
+ // "openPrice24h": "118919.38",
362
+ // "lastPrice": "119818.83",
363
+ // "turnover24h": "215859996.272276",
364
+ // "volume24h": "1819.756798",
365
+ // "bid1Price": "119811.26",
366
+ // "ask1Price": "119831.18",
367
+ // "bid1Size": "0.008732",
368
+ // "ask1Size": "0.004297",
369
+ // "price24hPcnt": "0.02002"
370
+ // }
371
+ // ],
372
+ // "ts": 1753230479687
373
+ // }
374
+ //
305
375
  const arg = this.safeValue(message, 'arg', {});
306
376
  const data = this.safeValue(message, 'data', []);
307
377
  const ticker = this.safeValue(data, 0, {});
308
- const timestamp = this.safeInteger(ticker, 'ts');
309
- const instType = this.safeString(arg, 'instType');
310
- const marketType = (instType === 'SPOT') ? 'spot' : 'contract';
311
- const marketId = this.safeString(ticker, 'instId');
378
+ const utaTimestamp = this.safeInteger(message, 'ts');
379
+ const timestamp = this.safeInteger(ticker, 'ts', utaTimestamp);
380
+ const instType = this.safeStringLower(arg, 'instType');
381
+ const marketType = (instType === 'spot') ? 'spot' : 'contract';
382
+ const utaMarketId = this.safeString(arg, 'symbol');
383
+ const marketId = this.safeString(ticker, 'instId', utaMarketId);
312
384
  market = this.safeMarket(marketId, market, undefined, marketType);
313
- const close = this.safeString(ticker, 'lastPr');
314
- const changeDecimal = this.safeString(ticker, 'change24h');
315
- const change = Precise.stringMul(changeDecimal, '100');
385
+ const close = this.safeString2(ticker, 'lastPr', 'lastPrice');
386
+ const changeDecimal = this.safeString(ticker, 'change24h', '');
387
+ const change = this.safeString(ticker, 'price24hPcnt', Precise.stringMul(changeDecimal, '100'));
316
388
  return this.safeTicker({
317
389
  'symbol': market['symbol'],
318
390
  'timestamp': timestamp,
319
391
  'datetime': this.iso8601(timestamp),
320
- 'high': this.safeString(ticker, 'high24h'),
321
- 'low': this.safeString(ticker, 'low24h'),
322
- 'bid': this.safeString(ticker, 'bidPr'),
323
- 'bidVolume': this.safeString(ticker, 'bidSz'),
324
- 'ask': this.safeString(ticker, 'askPr'),
325
- 'askVolume': this.safeString(ticker, 'askSz'),
392
+ 'high': this.safeString2(ticker, 'high24h', 'highPrice24h'),
393
+ 'low': this.safeString2(ticker, 'low24h', 'lowPrice24h'),
394
+ 'bid': this.safeString2(ticker, 'bidPr', 'bid1Price'),
395
+ 'bidVolume': this.safeString2(ticker, 'bidSz', 'bid1Size'),
396
+ 'ask': this.safeString2(ticker, 'askPr', 'ask1Price'),
397
+ 'askVolume': this.safeString2(ticker, 'askSz', 'ask1Size'),
326
398
  'vwap': undefined,
327
- 'open': this.safeString(ticker, 'open24h'),
399
+ 'open': this.safeString2(ticker, 'open24h', 'openPrice24h'),
328
400
  'close': close,
329
401
  'last': close,
330
402
  'previousClose': undefined,
331
403
  'change': undefined,
332
404
  'percentage': change,
333
405
  'average': undefined,
334
- 'baseVolume': this.safeString(ticker, 'baseVolume'),
335
- 'quoteVolume': this.safeString(ticker, 'quoteVolume'),
406
+ 'baseVolume': this.safeString2(ticker, 'baseVolume', 'volume24h'),
407
+ 'quoteVolume': this.safeString2(ticker, 'quoteVolume', 'turnover24h'),
336
408
  'info': ticker,
337
409
  }, market);
338
410
  }
339
411
  /**
340
412
  * @method
341
413
  * @name bitget#watchBidsAsks
414
+ * @description watches best bid & ask for symbols
342
415
  * @see https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
343
416
  * @see https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
344
- * @description watches best bid & ask for symbols
417
+ * @see https://www.bitget.com/api-doc/uta/websocket/public/Tickers-Channel
345
418
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
346
419
  * @param {object} [params] extra parameters specific to the exchange API endpoint
420
+ * @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
347
421
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
348
422
  */
349
423
  async watchBidsAsks(symbols = undefined, params = {}) {
@@ -351,7 +425,9 @@ export default class bitget extends bitgetRest {
351
425
  symbols = this.marketSymbols(symbols, undefined, false);
352
426
  const market = this.market(symbols[0]);
353
427
  let instType = undefined;
354
- [instType, params] = this.getInstType(market, params);
428
+ let uta = undefined;
429
+ [uta, params] = this.handleOptionAndParams(params, 'watchBidsAsks', 'uta', false);
430
+ [instType, params] = this.getInstType(market, uta, params);
355
431
  const topics = [];
356
432
  const messageHashes = [];
357
433
  for (let i = 0; i < symbols.length; i++) {
@@ -359,9 +435,11 @@ export default class bitget extends bitgetRest {
359
435
  const marketInner = this.market(symbol);
360
436
  const args = {
361
437
  'instType': instType,
362
- 'channel': 'ticker',
363
- 'instId': marketInner['id'],
364
438
  };
439
+ const topicOrChannel = uta ? 'topic' : 'channel';
440
+ const symbolOrInstId = uta ? 'symbol' : 'instId';
441
+ args[topicOrChannel] = 'ticker';
442
+ args[symbolOrInstId] = marketInner['id'];
365
443
  topics.push(args);
366
444
  messageHashes.push('bidask:' + symbol);
367
445
  }
@@ -384,19 +462,21 @@ export default class bitget extends bitgetRest {
384
462
  const arg = this.safeValue(message, 'arg', {});
385
463
  const data = this.safeValue(message, 'data', []);
386
464
  const ticker = this.safeValue(data, 0, {});
387
- const timestamp = this.safeInteger(ticker, 'ts');
388
- const instType = this.safeString(arg, 'instType');
389
- const marketType = (instType === 'SPOT') ? 'spot' : 'contract';
390
- const marketId = this.safeString(ticker, 'instId');
465
+ const utaTimestamp = this.safeInteger(message, 'ts');
466
+ const timestamp = this.safeInteger(ticker, 'ts', utaTimestamp);
467
+ const instType = this.safeStringLower(arg, 'instType');
468
+ const marketType = (instType === 'spot') ? 'spot' : 'contract';
469
+ const utaMarketId = this.safeString(arg, 'symbol');
470
+ const marketId = this.safeString(ticker, 'instId', utaMarketId);
391
471
  market = this.safeMarket(marketId, market, undefined, marketType);
392
472
  return this.safeTicker({
393
473
  'symbol': market['symbol'],
394
474
  'timestamp': timestamp,
395
475
  'datetime': this.iso8601(timestamp),
396
- 'ask': this.safeString(ticker, 'askPr'),
397
- 'askVolume': this.safeString(ticker, 'askSz'),
398
- 'bid': this.safeString(ticker, 'bidPr'),
399
- 'bidVolume': this.safeString(ticker, 'bidSz'),
476
+ 'ask': this.safeString2(ticker, 'askPr', 'ask1Price'),
477
+ 'askVolume': this.safeString2(ticker, 'askSz', 'ask1Size'),
478
+ 'bid': this.safeString2(ticker, 'bidPr', 'bid1Price'),
479
+ 'bidVolume': this.safeString2(ticker, 'bidSz', 'bid1Size'),
400
480
  'info': ticker,
401
481
  }, market);
402
482
  }
@@ -421,7 +501,7 @@ export default class bitget extends bitgetRest {
421
501
  const interval = this.safeString(timeframes, timeframe);
422
502
  const messageHash = 'candles:' + timeframe + ':' + symbol;
423
503
  let instType = undefined;
424
- [instType, params] = this.getInstType(market, params);
504
+ [instType, params] = this.getInstType(market, false, params);
425
505
  const args = {
426
506
  'instType': instType,
427
507
  'channel': 'candle' + interval,
@@ -573,7 +653,7 @@ export default class bitget extends bitgetRest {
573
653
  const market = this.market(symbol);
574
654
  const messageHash = 'unsubscribe:' + messageHashTopic + ':' + market['symbol'];
575
655
  let instType = undefined;
576
- [instType, params] = this.getInstType(market, params);
656
+ [instType, params] = this.getInstType(market, false, params);
577
657
  const args = {
578
658
  'instType': instType,
579
659
  'channel': channel,
@@ -607,7 +687,7 @@ export default class bitget extends bitgetRest {
607
687
  const symbol = symbols[i];
608
688
  const market = this.market(symbol);
609
689
  let instType = undefined;
610
- [instType, params] = this.getInstType(market, params);
690
+ [instType, params] = this.getInstType(market, false, params);
611
691
  const args = {
612
692
  'instType': instType,
613
693
  'channel': channel,
@@ -778,7 +858,7 @@ export default class bitget extends bitgetRest {
778
858
  const symbol = symbols[i];
779
859
  const market = this.market(symbol);
780
860
  let instType = undefined;
781
- [instType, params] = this.getInstType(market, params);
861
+ [instType, params] = this.getInstType(market, false, params);
782
862
  const args = {
783
863
  'instType': instType,
784
864
  'channel': 'trade',
@@ -969,7 +1049,7 @@ export default class bitget extends bitgetRest {
969
1049
  symbols = this.marketSymbols(symbols);
970
1050
  if (!this.isEmpty(symbols)) {
971
1051
  market = this.getMarketFromSymbols(symbols);
972
- [instType, params] = this.getInstType(market, params);
1052
+ [instType, params] = this.getInstType(market, false, params);
973
1053
  }
974
1054
  messageHash = instType + ':positions' + messageHash;
975
1055
  const args = {
@@ -1179,7 +1259,7 @@ export default class bitget extends bitgetRest {
1179
1259
  instType = 'SPOT';
1180
1260
  }
1181
1261
  else {
1182
- [instType, params] = this.getInstType(market, params);
1262
+ [instType, params] = this.getInstType(market, false, params);
1183
1263
  }
1184
1264
  if (type === 'spot' && (symbol !== undefined)) {
1185
1265
  subscriptionHash = subscriptionHash + ':' + symbol;
@@ -1563,7 +1643,7 @@ export default class bitget extends bitgetRest {
1563
1643
  instType = 'spot';
1564
1644
  }
1565
1645
  else {
1566
- [instType, params] = this.getInstType(market, params);
1646
+ [instType, params] = this.getInstType(market, false, params);
1567
1647
  }
1568
1648
  const subscriptionHash = 'fill:' + instType;
1569
1649
  const args = {
@@ -1795,12 +1875,25 @@ export default class bitget extends bitgetRest {
1795
1875
  client.resolve(this.balance, messageHash);
1796
1876
  }
1797
1877
  async watchPublic(messageHash, args, params = {}) {
1798
- let url = this.urls['api']['ws']['public'];
1878
+ let uta = undefined;
1879
+ let url = undefined;
1880
+ [uta, params] = this.handleOptionAndParams(params, 'watchPublic', 'uta', false);
1881
+ if (uta) {
1882
+ url = this.urls['api']['ws']['utaPublic'];
1883
+ }
1884
+ else {
1885
+ url = this.urls['api']['ws']['public'];
1886
+ }
1799
1887
  const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
1800
1888
  if (sandboxMode) {
1801
1889
  const instType = this.safeString(args, 'instType');
1802
1890
  if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
1803
- url = this.urls['api']['demo']['public'];
1891
+ if (uta) {
1892
+ url = this.urls['api']['demo']['utaPublic'];
1893
+ }
1894
+ else {
1895
+ url = this.urls['api']['demo']['public'];
1896
+ }
1804
1897
  }
1805
1898
  }
1806
1899
  const request = {
@@ -1811,12 +1904,25 @@ export default class bitget extends bitgetRest {
1811
1904
  return await this.watch(url, messageHash, message, messageHash);
1812
1905
  }
1813
1906
  async unWatchPublic(messageHash, args, params = {}) {
1814
- let url = this.urls['api']['ws']['public'];
1907
+ let uta = undefined;
1908
+ let url = undefined;
1909
+ [uta, params] = this.handleOptionAndParams(params, 'unWatchPublic', 'uta', false);
1910
+ if (uta) {
1911
+ url = this.urls['api']['ws']['utaPublic'];
1912
+ }
1913
+ else {
1914
+ url = this.urls['api']['ws']['public'];
1915
+ }
1815
1916
  const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
1816
1917
  if (sandboxMode) {
1817
1918
  const instType = this.safeString(args, 'instType');
1818
1919
  if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
1819
- url = this.urls['api']['demo']['public'];
1920
+ if (uta) {
1921
+ url = this.urls['api']['demo']['utaPublic'];
1922
+ }
1923
+ else {
1924
+ url = this.urls['api']['demo']['public'];
1925
+ }
1820
1926
  }
1821
1927
  }
1822
1928
  const request = {
@@ -1827,13 +1933,26 @@ export default class bitget extends bitgetRest {
1827
1933
  return await this.watch(url, messageHash, message, messageHash);
1828
1934
  }
1829
1935
  async watchPublicMultiple(messageHashes, argsArray, params = {}) {
1830
- let url = this.urls['api']['ws']['public'];
1936
+ let uta = undefined;
1937
+ let url = undefined;
1938
+ [uta, params] = this.handleOptionAndParams(params, 'watchPublicMultiple', 'uta', false);
1939
+ if (uta) {
1940
+ url = this.urls['api']['ws']['utaPublic'];
1941
+ }
1942
+ else {
1943
+ url = this.urls['api']['ws']['public'];
1944
+ }
1831
1945
  const sandboxMode = this.safeBool2(this.options, 'sandboxMode', 'sandbox', false);
1832
1946
  if (sandboxMode) {
1833
1947
  const argsArrayFirst = this.safeDict(argsArray, 0, {});
1834
1948
  const instType = this.safeString(argsArrayFirst, 'instType');
1835
1949
  if ((instType !== 'SCOIN-FUTURES') && (instType !== 'SUSDT-FUTURES') && (instType !== 'SUSDC-FUTURES')) {
1836
- url = this.urls['api']['demo']['public'];
1950
+ if (uta) {
1951
+ url = this.urls['api']['demo']['utaPublic'];
1952
+ }
1953
+ else {
1954
+ url = this.urls['api']['demo']['public'];
1955
+ }
1837
1956
  }
1838
1957
  }
1839
1958
  const request = {
@@ -1973,6 +2092,29 @@ export default class bitget extends bitgetRest {
1973
2092
  // ]
1974
2093
  // }
1975
2094
  //
2095
+ // uta
2096
+ //
2097
+ // {
2098
+ // "action": "snapshot",
2099
+ // "arg": { "instType": "spot", topic: "ticker", symbol: "BTCUSDT" },
2100
+ // "data": [
2101
+ // {
2102
+ // "highPrice24h": "120255.61",
2103
+ // "lowPrice24h": "116145.88",
2104
+ // "openPrice24h": "118919.38",
2105
+ // "lastPrice": "119818.83",
2106
+ // "turnover24h": "215859996.272276",
2107
+ // "volume24h": "1819.756798",
2108
+ // "bid1Price": "119811.26",
2109
+ // "ask1Price": "119831.18",
2110
+ // "bid1Size": "0.008732",
2111
+ // "ask1Size": "0.004297",
2112
+ // "price24hPcnt": "0.02002"
2113
+ // }
2114
+ // ],
2115
+ // "ts": 1753230479687
2116
+ // }
2117
+ //
1976
2118
  if (this.handleErrorMessage(client, message)) {
1977
2119
  return;
1978
2120
  }
@@ -2013,7 +2155,7 @@ export default class bitget extends bitgetRest {
2013
2155
  'account-crossed': this.handleBalance,
2014
2156
  };
2015
2157
  const arg = this.safeValue(message, 'arg', {});
2016
- const topic = this.safeValue(arg, 'channel', '');
2158
+ const topic = this.safeValue2(arg, 'channel', 'topic', '');
2017
2159
  const method = this.safeValue(methods, topic);
2018
2160
  if (method !== undefined) {
2019
2161
  method.call(this, client, message);
@@ -2098,7 +2240,7 @@ export default class bitget extends bitgetRest {
2098
2240
  const arg = this.safeDict(message, 'arg', {});
2099
2241
  const instType = this.safeStringLower(arg, 'instType');
2100
2242
  const type = (instType === 'spot') ? 'spot' : 'contract';
2101
- const instId = this.safeString(arg, 'instId');
2243
+ const instId = this.safeString2(arg, 'instId', 'symbol');
2102
2244
  const market = this.safeMarket(instId, undefined, undefined, type);
2103
2245
  const symbol = market['symbol'];
2104
2246
  const messageHash = 'unsubscribe:ticker:' + market['symbol'];
@@ -2165,7 +2307,7 @@ export default class bitget extends bitgetRest {
2165
2307
  }
2166
2308
  for (let i = 0; i < argsList.length; i++) {
2167
2309
  const arg = argsList[i];
2168
- const channel = this.safeString(arg, 'channel');
2310
+ const channel = this.safeString2(arg, 'channel', 'topic');
2169
2311
  if (channel === 'books') {
2170
2312
  // for now only unWatchOrderBook is supporteod
2171
2313
  this.handleOrderBookUnSubscription(client, message);
@@ -867,21 +867,14 @@ export default class bybit extends bybitRest {
867
867
  }
868
868
  }
869
869
  else {
870
- if (!market['spot']) {
871
- if (market['option']) {
872
- if ((limit !== 25) && (limit !== 100)) {
873
- throw new BadRequest(this.id + ' watchOrderBookForSymbols() can only use limit 25 and 100 for option markets.');
874
- }
875
- }
876
- else if ((limit !== 1) && (limit !== 50) && (limit !== 200) && (limit !== 500)) {
877
- // bybit only support limit 1, 50, 200, 500 for contract
878
- throw new BadRequest(this.id + ' watchOrderBookForSymbols() can only use limit 1, 50, 200 and 500 for swap and future markets.');
879
- }
880
- }
881
- else {
882
- if ((limit !== 1) && (limit !== 50) && (limit !== 200)) {
883
- throw new BadRequest(this.id + ' watchOrderBookForSymbols() can only use limit 1,50, and 200 for spot markets.');
884
- }
870
+ const limits = {
871
+ 'spot': [1, 50, 200, 1000],
872
+ 'option': [25, 100],
873
+ 'default': [1, 50, 200, 500, 1000],
874
+ };
875
+ const selectedLimits = this.safeList2(limits, market['type'], 'default');
876
+ if (!this.inArray(limit, selectedLimits)) {
877
+ throw new BadRequest(this.id + ' watchOrderBookForSymbols(): for ' + market['type'] + ' markets limit can be one of: ' + this.json(selectedLimits));
885
878
  }
886
879
  }
887
880
  const topics = [];
@@ -143,6 +143,11 @@ export default class gate extends gateRest {
143
143
  * @method
144
144
  * @name gate#watchOrderBook
145
145
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
146
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-channel
147
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-v2-api
148
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#order-book-api
149
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#order-book-v2-api
150
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#order-book-api
146
151
  * @param {string} symbol unified symbol of the market to fetch the order book for
147
152
  * @param {int} [limit] the maximum amount of order book entries to return
148
153
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -361,6 +361,11 @@ export default class gate extends gateRest {
361
361
  * @method
362
362
  * @name gate#watchOrderBook
363
363
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
364
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-channel
365
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-v2-api
366
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#order-book-api
367
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#order-book-v2-api
368
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#order-book-api
364
369
  * @param {string} symbol unified symbol of the market to fetch the order book for
365
370
  * @param {int} [limit] the maximum amount of order book entries to return
366
371
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -378,7 +383,7 @@ export default class gate extends gateRest {
378
383
  const url = this.getUrlByMarket(market);
379
384
  const payload = [marketId, interval];
380
385
  if (limit === undefined) {
381
- limit = 100;
386
+ limit = 100; // max 100 atm
382
387
  }
383
388
  if (market['contract']) {
384
389
  const stringLimit = limit.toString();
@@ -921,7 +921,10 @@ export default class hyperliquid extends hyperliquidRest {
921
921
  return true;
922
922
  }
923
923
  const data = this.safeDict(message, 'data', {});
924
- const id = this.safeString(message, 'id');
924
+ let id = this.safeString(message, 'id');
925
+ if (id === undefined) {
926
+ id = this.safeString(data, 'id');
927
+ }
925
928
  const response = this.safeDict(data, 'response', {});
926
929
  const payload = this.safeDict(response, 'payload', {});
927
930
  const status = this.safeString(payload, 'status');
@@ -70,6 +70,7 @@ export default class kraken extends krakenRest {
70
70
  'broad': {
71
71
  'Already subscribed': BadRequest,
72
72
  'Currency pair not in ISO 4217-A3 format': BadSymbol,
73
+ 'Currency pair not supported': BadSymbol,
73
74
  'Malformed request': BadRequest,
74
75
  'Pair field must be an array': BadRequest,
75
76
  'Pair field unsupported for this subscription type': BadRequest,
@@ -1,5 +1,5 @@
1
1
  import lbankRest from '../lbank.js';
2
- import type { Int, Str, Trade, OrderBook, Order, OHLCV, Ticker } from '../base/types.js';
2
+ import type { Balances, Int, Str, Trade, OrderBook, Order, OHLCV, Ticker } from '../base/types.js';
3
3
  import Client from '../base/ws/Client.js';
4
4
  export default class lbank extends lbankRest {
5
5
  describe(): any;
@@ -94,6 +94,16 @@ export default class lbank extends lbankRest {
94
94
  handleOrders(client: any, message: any): void;
95
95
  parseWsOrder(order: any, market?: any): Order;
96
96
  parseWsOrderStatus(status: any): string;
97
+ /**
98
+ * @method
99
+ * @name lbank#watchBalance
100
+ * @description watch balance and get the amount of funds available for trading or funds locked in orders
101
+ * @see https://www.lbank.com/docs/index.html#update-subscribed-asset
102
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
103
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
104
+ */
105
+ watchBalance(params?: {}): Promise<Balances>;
106
+ handleBalance(client: Client, message: any): void;
97
107
  /**
98
108
  * @method
99
109
  * @name lbank#fetchOrderBookWs