ccxt 4.5.8 → 4.5.10

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 (95) hide show
  1. package/README.md +4 -7
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +111 -17
  5. package/dist/cjs/src/base/ws/Client.js +4 -0
  6. package/dist/cjs/src/bitget.js +59 -72
  7. package/dist/cjs/src/coinbaseexchange.js +15 -0
  8. package/dist/cjs/src/hyperliquid.js +0 -3
  9. package/dist/cjs/src/latoken.js +1 -0
  10. package/dist/cjs/src/phemex.js +15 -6
  11. package/dist/cjs/src/pro/alpaca.js +1 -1
  12. package/dist/cjs/src/pro/apex.js +4 -4
  13. package/dist/cjs/src/pro/binance.js +2 -1
  14. package/dist/cjs/src/pro/bitfinex.js +1 -1
  15. package/dist/cjs/src/pro/bitget.js +1 -1
  16. package/dist/cjs/src/pro/bitmart.js +1 -1
  17. package/dist/cjs/src/pro/bitmex.js +1 -1
  18. package/dist/cjs/src/pro/bitvavo.js +6 -6
  19. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  20. package/dist/cjs/src/pro/bybit.js +2 -1
  21. package/dist/cjs/src/pro/cex.js +2 -2
  22. package/dist/cjs/src/pro/coincatch.js +1 -1
  23. package/dist/cjs/src/pro/coinex.js +3 -3
  24. package/dist/cjs/src/pro/cryptocom.js +1 -1
  25. package/dist/cjs/src/pro/derive.js +1 -1
  26. package/dist/cjs/src/pro/gate.js +1 -1
  27. package/dist/cjs/src/pro/hitbtc.js +1 -1
  28. package/dist/cjs/src/pro/htx.js +2 -2
  29. package/dist/cjs/src/pro/kraken.js +8 -8
  30. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  31. package/dist/cjs/src/pro/kucoin.js +4 -4
  32. package/dist/cjs/src/pro/kucoinfutures.js +4 -4
  33. package/dist/cjs/src/pro/mexc.js +6 -1
  34. package/dist/cjs/src/pro/modetrade.js +2 -2
  35. package/dist/cjs/src/pro/okx.js +4 -2
  36. package/dist/cjs/src/pro/onetrading.js +1 -1
  37. package/dist/cjs/src/pro/oxfun.js +1 -1
  38. package/dist/cjs/src/pro/toobit.js +1 -1
  39. package/dist/cjs/src/pro/whitebit.js +1 -1
  40. package/dist/cjs/src/pro/woo.js +1 -1
  41. package/dist/cjs/src/pro/woofipro.js +2 -2
  42. package/js/ccxt.d.ts +1 -1
  43. package/js/ccxt.js +1 -1
  44. package/js/src/abstract/coinbaseexchange.d.ts +15 -0
  45. package/js/src/base/Exchange.d.ts +13 -5
  46. package/js/src/base/Exchange.js +111 -17
  47. package/js/src/base/ws/Client.d.ts +1 -0
  48. package/js/src/base/ws/Client.js +4 -0
  49. package/js/src/bitget.js +59 -72
  50. package/js/src/coinbaseexchange.js +15 -0
  51. package/js/src/hyperliquid.js +0 -3
  52. package/js/src/latoken.js +1 -0
  53. package/js/src/phemex.js +15 -6
  54. package/js/src/pro/alpaca.js +1 -1
  55. package/js/src/pro/apex.js +4 -4
  56. package/js/src/pro/binance.d.ts +1 -1
  57. package/js/src/pro/binance.js +2 -1
  58. package/js/src/pro/bitfinex.js +1 -1
  59. package/js/src/pro/bitget.js +1 -1
  60. package/js/src/pro/bitmart.js +1 -1
  61. package/js/src/pro/bitmex.js +1 -1
  62. package/js/src/pro/bitvavo.d.ts +3 -3
  63. package/js/src/pro/bitvavo.js +6 -6
  64. package/js/src/pro/blockchaincom.js +1 -1
  65. package/js/src/pro/bybit.js +2 -1
  66. package/js/src/pro/cex.js +2 -2
  67. package/js/src/pro/coincatch.js +1 -1
  68. package/js/src/pro/coinex.js +3 -3
  69. package/js/src/pro/cryptocom.d.ts +1 -1
  70. package/js/src/pro/cryptocom.js +1 -1
  71. package/js/src/pro/derive.js +1 -1
  72. package/js/src/pro/gate.d.ts +1 -1
  73. package/js/src/pro/gate.js +1 -1
  74. package/js/src/pro/hitbtc.d.ts +1 -1
  75. package/js/src/pro/hitbtc.js +1 -1
  76. package/js/src/pro/htx.js +2 -2
  77. package/js/src/pro/hyperliquid.d.ts +1 -1
  78. package/js/src/pro/kraken.d.ts +2 -2
  79. package/js/src/pro/kraken.js +8 -8
  80. package/js/src/pro/krakenfutures.js +1 -1
  81. package/js/src/pro/kucoin.js +4 -4
  82. package/js/src/pro/kucoinfutures.js +4 -4
  83. package/js/src/pro/mexc.js +6 -1
  84. package/js/src/pro/modetrade.js +2 -2
  85. package/js/src/pro/okx.d.ts +2 -2
  86. package/js/src/pro/okx.js +4 -2
  87. package/js/src/pro/onetrading.js +1 -1
  88. package/js/src/pro/oxfun.d.ts +1 -1
  89. package/js/src/pro/oxfun.js +1 -1
  90. package/js/src/pro/poloniex.d.ts +2 -2
  91. package/js/src/pro/toobit.js +1 -1
  92. package/js/src/pro/whitebit.js +1 -1
  93. package/js/src/pro/woo.js +1 -1
  94. package/js/src/pro/woofipro.js +2 -2
  95. package/package.json +21 -10
package/dist/cjs/ccxt.js CHANGED
@@ -189,7 +189,7 @@ var xt$1 = require('./src/pro/xt.js');
189
189
  // ----------------------------------------------------------------------------
190
190
  //-----------------------------------------------------------------------------
191
191
  // this is updated by vss.js when building
192
- const version = '4.5.8';
192
+ const version = '4.5.10';
193
193
  Exchange["default"].ccxtVersion = version;
194
194
  const exchanges = {
195
195
  'alpaca': alpaca["default"],
@@ -1315,7 +1315,7 @@ class Exchange {
1315
1315
  }
1316
1316
  starknetSign(msgHash, pri) {
1317
1317
  // TODO: unify to ecdsa
1318
- const signature = index$1.sign(msgHash.replace('0x', ''), pri.slice(-64));
1318
+ const signature = index$1.sign(msgHash.replace('0x', ''), pri.replace('0x', ''));
1319
1319
  return this.json([signature.r.toString(), signature.s.toString()]);
1320
1320
  }
1321
1321
  async getZKContractSignatureObj(seed, params = {}) {
@@ -2648,22 +2648,21 @@ class Exchange {
2648
2648
  }
2649
2649
  return featuresObj;
2650
2650
  }
2651
- featureValue(symbol, methodName = undefined, paramName = undefined, subParamName = undefined, defaultValue = undefined) {
2651
+ featureValue(symbol, methodName = undefined, paramName = undefined, defaultValue = undefined) {
2652
2652
  /**
2653
2653
  * @method
2654
2654
  * @name exchange#featureValue
2655
2655
  * @description this method is a very deterministic to help users to know what feature is supported by the exchange
2656
2656
  * @param {string} [symbol] unified symbol
2657
2657
  * @param {string} [methodName] view currently supported methods: https://docs.ccxt.com/#/README?id=features
2658
- * @param {string} [paramName] unified param value (check docs for supported param names)
2659
- * @param {string} [subParamName] unified sub-param value (eg. stopLoss->triggerPriceType)
2658
+ * @param {string} [paramName] unified param value, like: `triggerPrice`, `stopLoss.triggerPrice` (check docs for supported param names)
2660
2659
  * @param {object} [defaultValue] return default value if no result found
2661
2660
  * @returns {object} returns feature value
2662
2661
  */
2663
2662
  const market = this.market(symbol);
2664
- return this.featureValueByType(market['type'], market['subType'], methodName, paramName, subParamName, defaultValue);
2663
+ return this.featureValueByType(market['type'], market['subType'], methodName, paramName, defaultValue);
2665
2664
  }
2666
- featureValueByType(marketType, subType, methodName = undefined, paramName = undefined, subParamName = undefined, defaultValue = undefined) {
2665
+ featureValueByType(marketType, subType, methodName = undefined, paramName = undefined, defaultValue = undefined) {
2667
2666
  /**
2668
2667
  * @method
2669
2668
  * @name exchange#featureValueByType
@@ -2672,7 +2671,6 @@ class Exchange {
2672
2671
  * @param {string} [subType] supported only: "linear", "inverse"
2673
2672
  * @param {string} [methodName] view currently supported methods: https://docs.ccxt.com/#/README?id=features
2674
2673
  * @param {string} [paramName] unified param value (check docs for supported param names)
2675
- * @param {string} [subParamName] unified sub-param value (eg. stopLoss->triggerPriceType)
2676
2674
  * @param {object} [defaultValue] return default value if no result found
2677
2675
  * @returns {object} returns feature value
2678
2676
  */
@@ -2719,24 +2717,27 @@ class Exchange {
2719
2717
  if (paramName === undefined) {
2720
2718
  return methodDict;
2721
2719
  }
2722
- if (!(paramName in methodDict)) {
2720
+ const splited = paramName.split('.'); // can be only parent key (`stopLoss`) or with child (`stopLoss.triggerPrice`)
2721
+ const parentKey = splited[0];
2722
+ const subKey = this.safeString(splited, 1);
2723
+ if (!(parentKey in methodDict)) {
2723
2724
  return defaultValue; // unsupported paramName, check "exchange.features" for details');
2724
2725
  }
2725
- const dictionary = this.safeDict(methodDict, paramName);
2726
+ const dictionary = this.safeDict(methodDict, parentKey);
2726
2727
  if (dictionary === undefined) {
2727
2728
  // if the value is not dictionary but a scalar value (or undefined), return as is
2728
- return methodDict[paramName];
2729
+ return methodDict[parentKey];
2729
2730
  }
2730
2731
  else {
2731
- // return as is, when calling without `subParamName` eg: featureValueByType('spot', undefined, 'createOrder', 'stopLoss')
2732
- if (subParamName === undefined) {
2733
- return methodDict[paramName];
2732
+ // return as is, when calling without subKey eg: featureValueByType('spot', undefined, 'createOrder', 'stopLoss')
2733
+ if (subKey === undefined) {
2734
+ return methodDict[parentKey];
2734
2735
  }
2735
- // throw an exception for unsupported subParamName
2736
- if (!(subParamName in methodDict[paramName])) {
2737
- return defaultValue; // unsupported subParamName, check "exchange.features" for details
2736
+ // throw an exception for unsupported subKey
2737
+ if (!(subKey in methodDict[parentKey])) {
2738
+ return defaultValue; // unsupported subKey, check "exchange.features" for details
2738
2739
  }
2739
- return methodDict[paramName][subParamName];
2740
+ return methodDict[parentKey][subKey];
2740
2741
  }
2741
2742
  }
2742
2743
  orderbookChecksumMessage(symbol) {
@@ -7558,6 +7559,99 @@ class Exchange {
7558
7559
  */
7559
7560
  throw new errors.NotSupported(this.id + ' fetchTransfers () is not supported yet');
7560
7561
  }
7562
+ async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
7563
+ /**
7564
+ * @method
7565
+ * @name exchange#unWatchOHLCV
7566
+ * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
7567
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
7568
+ * @param {string} timeframe the length of time each candle represents
7569
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7570
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
7571
+ */
7572
+ throw new errors.NotSupported(this.id + ' unWatchOHLCV () is not supported yet');
7573
+ }
7574
+ async watchMarkPrice(symbol, params = {}) {
7575
+ /**
7576
+ * @method
7577
+ * @name exchange#watchMarkPrice
7578
+ * @description watches a mark price for a specific market
7579
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
7580
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7581
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
7582
+ */
7583
+ throw new errors.NotSupported(this.id + ' watchMarkPrice () is not supported yet');
7584
+ }
7585
+ async watchMarkPrices(symbols = undefined, params = {}) {
7586
+ /**
7587
+ * @method
7588
+ * @name exchange#watchMarkPrices
7589
+ * @description watches the mark price for all markets
7590
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
7591
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7592
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
7593
+ */
7594
+ throw new errors.NotSupported(this.id + ' watchMarkPrices () is not supported yet');
7595
+ }
7596
+ async withdrawWs(code, amount, address, tag = undefined, params = {}) {
7597
+ /**
7598
+ * @method
7599
+ * @name exchange#withdrawWs
7600
+ * @description make a withdrawal
7601
+ * @param {string} code unified currency code
7602
+ * @param {float} amount the amount to withdraw
7603
+ * @param {string} address the address to withdraw to
7604
+ * @param {string} tag
7605
+ * @param {object} [params] extra parameters specific to the bitvavo api endpoint
7606
+ * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
7607
+ */
7608
+ throw new errors.NotSupported(this.id + ' withdrawWs () is not supported yet');
7609
+ }
7610
+ async unWatchMyTrades(symbol = undefined, params = {}) {
7611
+ /**
7612
+ * @method
7613
+ * @name exchange#unWatchMyTrades
7614
+ * @description unWatches information on multiple trades made by the user
7615
+ * @param {string} symbol unified market symbol of the market orders were made in
7616
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7617
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
7618
+ */
7619
+ throw new errors.NotSupported(this.id + ' unWatchMyTrades () is not supported yet');
7620
+ }
7621
+ async createOrdersWs(orders, params = {}) {
7622
+ /**
7623
+ * @method
7624
+ * @name exchange#createOrdersWs
7625
+ * @description create a list of trade orders
7626
+ * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
7627
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7628
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
7629
+ */
7630
+ throw new errors.NotSupported(this.id + ' createOrdersWs () is not supported yet');
7631
+ }
7632
+ async fetchOrdersByStatusWs(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
7633
+ /**
7634
+ * @method
7635
+ * @name exchange#fetchOrdersByStatusWs
7636
+ * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
7637
+ * @param {string} symbol unified symbol of the market to fetch the order book for
7638
+ * @param {int} [limit] the maximum amount of order book entries to return
7639
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7640
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
7641
+ */
7642
+ throw new errors.NotSupported(this.id + ' fetchOrdersByStatusWs () is not supported yet');
7643
+ }
7644
+ async unWatchBidsAsks(symbols = undefined, params = {}) {
7645
+ /**
7646
+ * @method
7647
+ * @name exchange#unWatchBidsAsks
7648
+ * @description unWatches best bid & ask for symbols
7649
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
7650
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
7651
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
7652
+ */
7653
+ throw new errors.NotSupported(this.id + ' unWatchBidsAsks () is not supported yet');
7654
+ }
7561
7655
  cleanUnsubscription(client, subHash, unsubHash, subHashIsPrefix = false) {
7562
7656
  if (unsubHash in client.subscriptions) {
7563
7657
  delete client.subscriptions[unsubHash];
@@ -51,6 +51,10 @@ class Client {
51
51
  // connection-related Future
52
52
  this.connected = Future.Future();
53
53
  }
54
+ reusableFuture(messageHash) {
55
+ // only used in go
56
+ return this.future(messageHash);
57
+ }
54
58
  future(messageHash) {
55
59
  if (!(messageHash in this.futures)) {
56
60
  this.futures[messageHash] = Future.Future();
@@ -4357,10 +4357,53 @@ class bitget extends bitget$1["default"] {
4357
4357
  response = await this.privateMixGetV2MixAccountAccounts(this.extend(request, params));
4358
4358
  }
4359
4359
  else if (marginMode === 'isolated') {
4360
- response = await this.privateMarginGetMarginV1IsolatedAccountAssets(this.extend(request, params));
4360
+ response = await this.privateMarginGetV2MarginIsolatedAccountAssets(this.extend(request, params));
4361
+ //
4362
+ // {
4363
+ // "code": "00000",
4364
+ // "msg": "success",
4365
+ // "requestTime": "1759829170717",
4366
+ // "data": [
4367
+ // {
4368
+ // "symbol": "BTCUSDT",
4369
+ // "coin": "USDT",
4370
+ // "totalAmount": "0.000001",
4371
+ // "available": "0.000001",
4372
+ // "frozen": "0",
4373
+ // "borrow": "0",
4374
+ // "interest": "0",
4375
+ // "net": "0.000001",
4376
+ // "coupon": "0",
4377
+ // "cTime": "1759826434145",
4378
+ // "uTime": "1759826434146"
4379
+ // },
4380
+ // ]
4381
+ // }
4382
+ //
4361
4383
  }
4362
4384
  else if (marginMode === 'cross') {
4363
- response = await this.privateMarginGetMarginV1CrossAccountAssets(this.extend(request, params));
4385
+ response = await this.privateMarginGetV2MarginCrossedAccountAssets(this.extend(request, params));
4386
+ //
4387
+ // {
4388
+ // "code": "00000",
4389
+ // "msg": "success",
4390
+ // "requestTime": "1759828519501",
4391
+ // "data": [
4392
+ // {
4393
+ // "coin": "USDT",
4394
+ // "totalAmount": "0.01",
4395
+ // "available": "0.01",
4396
+ // "frozen": "0",
4397
+ // "borrow": "0",
4398
+ // "interest": "0",
4399
+ // "net": "0.01",
4400
+ // "coupon": "0",
4401
+ // "cTime": "1759828511592",
4402
+ // "uTime": "1759828511592"
4403
+ // }
4404
+ // ]
4405
+ // }
4406
+ //
4364
4407
  }
4365
4408
  else if (marketType === 'spot') {
4366
4409
  response = await this.privateSpotGetV2SpotAccountAssets(this.extend(request, params));
@@ -4412,49 +4455,6 @@ class bitget extends bitget$1["default"] {
4412
4455
  // ]
4413
4456
  // }
4414
4457
  //
4415
- // isolated margin
4416
- //
4417
- // {
4418
- // "code": "00000",
4419
- // "msg": "success",
4420
- // "requestTime": 1697501436571,
4421
- // "data": [
4422
- // {
4423
- // "symbol": "BTCUSDT",
4424
- // "coin": "BTC",
4425
- // "totalAmount": "0.00021654",
4426
- // "available": "0.00021654",
4427
- // "transferable": "0.00021654",
4428
- // "frozen": "0",
4429
- // "borrow": "0",
4430
- // "interest": "0",
4431
- // "net": "0.00021654",
4432
- // "ctime": "1697248128071"
4433
- // },
4434
- // ]
4435
- // }
4436
- //
4437
- // cross margin
4438
- //
4439
- // {
4440
- // "code": "00000",
4441
- // "msg": "success",
4442
- // "requestTime": 1697515463804,
4443
- // "data": [
4444
- // {
4445
- // "coin": "BTC",
4446
- // "totalAmount": "0.00024996",
4447
- // "available": "0.00024996",
4448
- // "transferable": "0.00004994",
4449
- // "frozen": "0",
4450
- // "borrow": "0.0001",
4451
- // "interest": "0.00000001",
4452
- // "net": "0.00014995",
4453
- // "ctime": "1697251265504"
4454
- // },
4455
- // ]
4456
- // }
4457
- //
4458
4458
  // uta
4459
4459
  //
4460
4460
  // {
@@ -4549,34 +4549,21 @@ class bitget extends bitget$1["default"] {
4549
4549
  // "isolatedUnrealizedPL": null
4550
4550
  // }
4551
4551
  //
4552
- // isolated margin
4553
- //
4554
- // {
4555
- // "symbol": "BTCUSDT",
4556
- // "coin": "BTC",
4557
- // "totalAmount": "0.00021654",
4558
- // "available": "0.00021654",
4559
- // "transferable": "0.00021654",
4560
- // "frozen": "0",
4561
- // "borrow": "0",
4562
- // "interest": "0",
4563
- // "net": "0.00021654",
4564
- // "ctime": "1697248128071"
4565
- // }
4566
- //
4567
- // cross margin
4552
+ // cross & isolated margin
4568
4553
  //
4569
- // {
4570
- // "coin": "BTC",
4571
- // "totalAmount": "0.00024995",
4572
- // "available": "0.00024995",
4573
- // "transferable": "0.00004993",
4574
- // "frozen": "0",
4575
- // "borrow": "0.0001",
4576
- // "interest": "0.00000001",
4577
- // "net": "0.00014994",
4578
- // "ctime": "1697251265504"
4579
- // }
4554
+ // {
4555
+ // "coin": "USDT",
4556
+ // "totalAmount": "0.01",
4557
+ // "available": "0.01",
4558
+ // "frozen": "0",
4559
+ // "borrow": "0",
4560
+ // "interest": "0",
4561
+ // "net": "0.01",
4562
+ // "coupon": "0",
4563
+ // "cTime": "1759828511592",
4564
+ // "uTime": "1759828511592"
4565
+ // // "symbol": "BTCUSDT" // only for isolated margin
4566
+ // }
4580
4567
  //
4581
4568
  for (let i = 0; i < balance.length; i++) {
4582
4569
  const entry = balance[i];
@@ -213,7 +213,19 @@ class coinbaseexchange extends coinbaseexchange$1["default"] {
213
213
  'users/self/trailing-volume',
214
214
  'withdrawals/fee-estimate',
215
215
  'conversions/{conversion_id}',
216
+ 'conversions',
216
217
  'conversions/fees',
218
+ 'loans/lending-overview',
219
+ 'loans/lending-overview-xm',
220
+ 'loans/loan-preview',
221
+ 'loans/loan-preview-xm',
222
+ 'loans/repayment-preview',
223
+ 'loans/repayment-preview-xm',
224
+ 'loans/interest/{loan_id}',
225
+ 'loans/interest/history/{loan_id}',
226
+ 'loans/interest',
227
+ 'loans/assets',
228
+ 'loans',
217
229
  ],
218
230
  'post': [
219
231
  'conversions',
@@ -230,6 +242,9 @@ class coinbaseexchange extends coinbaseexchange$1["default"] {
230
242
  'withdrawals/coinbase-account',
231
243
  'withdrawals/crypto',
232
244
  'withdrawals/payment-method',
245
+ 'loans/open',
246
+ 'loans/repay-interest',
247
+ 'loans/repay-principal',
233
248
  ],
234
249
  'delete': [
235
250
  'orders',
@@ -3146,9 +3146,6 @@ class hyperliquid extends hyperliquid$1["default"] {
3146
3146
  'nonce': nonce,
3147
3147
  'signature': transferSig,
3148
3148
  };
3149
- if (vaultAddress !== undefined) {
3150
- transferRequest['vaultAddress'] = vaultAddress;
3151
- }
3152
3149
  const transferResponse = await this.privatePostExchange(transferRequest);
3153
3150
  return transferResponse;
3154
3151
  }
@@ -1605,6 +1605,7 @@ class latoken extends latoken$1["default"] {
1605
1605
  'TRANSACTION_STATUS_EXECUTED': 'ok',
1606
1606
  'TRANSACTION_STATUS_CHECKING': 'pending',
1607
1607
  'TRANSACTION_STATUS_CANCELLED': 'canceled',
1608
+ 'TRANSACTION_STATUS_FAILED': 'failed',
1608
1609
  };
1609
1610
  return this.safeString(statuses, status, status);
1610
1611
  }
@@ -4384,13 +4384,25 @@ class phemex extends phemex$1["default"] {
4384
4384
  }
4385
4385
  await this.loadMarkets();
4386
4386
  const market = this.market(symbol);
4387
- if (!market['swap'] || market['settle'] === 'USDT' || market['settle'] === 'USDC') {
4388
- throw new errors.BadSymbol(this.id + ' setMarginMode() supports swap (non USDT/USDC based) contracts only');
4387
+ if (!market['swap']) {
4388
+ throw new errors.BadSymbol(this.id + ' setMarginMode() supports swap contracts only');
4389
4389
  }
4390
4390
  marginMode = marginMode.toLowerCase();
4391
4391
  if (marginMode !== 'isolated' && marginMode !== 'cross') {
4392
4392
  throw new errors.BadRequest(this.id + ' setMarginMode() marginMode argument should be isolated or cross');
4393
4393
  }
4394
+ const request = {
4395
+ 'symbol': market['id'],
4396
+ };
4397
+ const isCross = marginMode === 'cross';
4398
+ if (this.inArray(market['settle'], ['USDT', 'USDC'])) {
4399
+ const currentLeverage = this.safeString(params, 'leverage');
4400
+ if (currentLeverage === undefined) {
4401
+ throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a "leverage" parameter for USDT markets');
4402
+ }
4403
+ request['leverageRr'] = isCross ? Precise["default"].stringNeg(Precise["default"].stringAbs(currentLeverage)) : Precise["default"].stringAbs(currentLeverage);
4404
+ return await this.privatePutGPositionsLeverage(this.extend(request, params));
4405
+ }
4394
4406
  let leverage = this.safeInteger(params, 'leverage');
4395
4407
  if (marginMode === 'cross') {
4396
4408
  leverage = 0;
@@ -4398,10 +4410,7 @@ class phemex extends phemex$1["default"] {
4398
4410
  if (leverage === undefined) {
4399
4411
  throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a leverage parameter');
4400
4412
  }
4401
- const request = {
4402
- 'symbol': market['id'],
4403
- 'leverage': leverage,
4404
- };
4413
+ request['leverage'] = leverage;
4405
4414
  return await this.privatePutPositionsLeverage(this.extend(request, params));
4406
4415
  }
4407
4416
  /**
@@ -570,7 +570,7 @@ class alpaca extends alpaca$1["default"] {
570
570
  this.checkRequiredCredentials();
571
571
  const messageHash = 'authenticated';
572
572
  const client = this.client(url);
573
- const future = client.future(messageHash);
573
+ const future = client.reusableFuture(messageHash);
574
574
  const authenticated = this.safeValue(client.subscriptions, messageHash);
575
575
  if (authenticated === undefined) {
576
576
  let request = {
@@ -823,7 +823,7 @@ class apex extends apex$1["default"] {
823
823
  const signature = this.hmac(this.encode(messageString), this.encode(this.stringToBase64(this.secret)), sha256.sha256, 'base64');
824
824
  const messageHash = 'authenticated';
825
825
  const client = this.client(url);
826
- const future = client.future(messageHash);
826
+ const future = client.reusableFuture(messageHash);
827
827
  const authenticated = this.safeValue(client.subscriptions, messageHash);
828
828
  if (authenticated === undefined) {
829
829
  // auth sign
@@ -966,10 +966,10 @@ class apex extends apex$1["default"] {
966
966
  }
967
967
  }
968
968
  ping(client) {
969
- const timeStamp = this.milliseconds().toString();
970
- client.lastPong = timeStamp; // server won't send a pong, so we set it here
969
+ const timeStamp = this.milliseconds();
970
+ client.lastPong = timeStamp;
971
971
  return {
972
- 'args': [timeStamp],
972
+ 'args': [timeStamp.toString()],
973
973
  'op': 'ping',
974
974
  };
975
975
  }
@@ -1478,7 +1478,8 @@ class binance extends binance$1["default"] {
1478
1478
  'id': requestId,
1479
1479
  };
1480
1480
  params = this.omit(params, 'callerMethodName');
1481
- const [symbol, timeframe, candles] = await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes, subscribe);
1481
+ const res = await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes, subscribe);
1482
+ const [symbol, timeframe, candles] = res;
1482
1483
  if (this.newUpdates) {
1483
1484
  limit = candles.getLimit(symbol, limit);
1484
1485
  }
@@ -991,7 +991,7 @@ class bitfinex extends bitfinex$1["default"] {
991
991
  const url = this.urls['api']['ws']['private'];
992
992
  const client = this.client(url);
993
993
  const messageHash = 'authenticated';
994
- const future = client.future(messageHash);
994
+ const future = client.reusableFuture(messageHash);
995
995
  const authenticated = this.safeValue(client.subscriptions, messageHash);
996
996
  if (authenticated === undefined) {
997
997
  const nonce = this.milliseconds();
@@ -2476,7 +2476,7 @@ class bitget extends bitget$1["default"] {
2476
2476
  const url = this.safeString(params, 'url');
2477
2477
  const client = this.client(url);
2478
2478
  const messageHash = 'authenticated';
2479
- const future = client.future(messageHash);
2479
+ const future = client.reusableFuture(messageHash);
2480
2480
  const authenticated = this.safeValue(client.subscriptions, messageHash);
2481
2481
  if (authenticated === undefined) {
2482
2482
  const timestamp = this.seconds().toString();
@@ -1502,7 +1502,7 @@ class bitmart extends bitmart$1["default"] {
1502
1502
  const url = this.implodeHostname(this.urls['api']['ws'][type]['private']);
1503
1503
  const messageHash = 'authenticated';
1504
1504
  const client = this.client(url);
1505
- const future = client.future(messageHash);
1505
+ const future = client.reusableFuture(messageHash);
1506
1506
  const authenticated = this.safeValue(client.subscriptions, messageHash);
1507
1507
  if (authenticated === undefined) {
1508
1508
  const timestamp = this.milliseconds().toString();
@@ -686,7 +686,7 @@ class bitmex extends bitmex$1["default"] {
686
686
  const url = this.urls['api']['ws'];
687
687
  const client = this.client(url);
688
688
  const messageHash = 'authenticated';
689
- const future = client.future(messageHash);
689
+ const future = client.reusableFuture(messageHash);
690
690
  const authenticated = this.safeValue(client.subscriptions, messageHash);
691
691
  if (authenticated === undefined) {
692
692
  this.checkRequiredCredentials();
@@ -33,18 +33,18 @@ class bitvavo extends bitvavo$1["default"] {
33
33
  'editOrderWs': true,
34
34
  'fetchBalanceWs': true,
35
35
  'fetchCurrenciesWS': true,
36
- 'fetchDepositAddressWs': true,
36
+ 'fetchDepositAddressWs': false,
37
37
  'fetchDepositsWs': true,
38
- 'fetchDepositWithdrawFeesWs': true,
38
+ 'fetchDepositWithdrawFeesWs': false,
39
39
  'fetchMyTradesWs': true,
40
40
  'fetchOHLCVWs': true,
41
41
  'fetchOpenOrdersWs': true,
42
42
  'fetchOrderWs': true,
43
- 'fetchOrderBookWs': true,
43
+ 'fetchOrderBookWs': false,
44
44
  'fetchOrdersWs': true,
45
- 'fetchTickerWs': true,
46
- 'fetchTickersWs': true,
47
- 'fetchTimeWs': true,
45
+ 'fetchTickerWs': false,
46
+ 'fetchTickersWs': false,
47
+ 'fetchTimeWs': false,
48
48
  'fetchTradingFeesWs': true,
49
49
  'fetchWithdrawalsWs': true,
50
50
  'withdrawWs': true,
@@ -760,7 +760,7 @@ class blockchaincom extends blockchaincom$1["default"] {
760
760
  const url = this.urls['api']['ws'];
761
761
  const client = this.client(url);
762
762
  const messageHash = 'authenticated';
763
- const future = client.future(messageHash);
763
+ const future = client.reusableFuture(messageHash);
764
764
  const isAuthenticated = this.safeValue(client.subscriptions, messageHash);
765
765
  if (isAuthenticated === undefined) {
766
766
  this.checkRequiredCredentials();
@@ -993,6 +993,7 @@ class bybit extends bybit$1["default"] {
993
993
  this.orderbooks[symbol] = this.orderBook();
994
994
  }
995
995
  const orderbook = this.orderbooks[symbol];
996
+ orderbook['symbol'] = symbol;
996
997
  if (isSnapshot) {
997
998
  const snapshot = this.parseOrderBook(data, symbol, timestamp, 'b', 'a');
998
999
  orderbook.reset(snapshot);
@@ -2281,7 +2282,7 @@ class bybit extends bybit$1["default"] {
2281
2282
  this.checkRequiredCredentials();
2282
2283
  const messageHash = 'authenticated';
2283
2284
  const client = this.client(url);
2284
- const future = client.future(messageHash);
2285
+ const future = client.reusableFuture(messageHash);
2285
2286
  const authenticated = this.safeValue(client.subscriptions, messageHash);
2286
2287
  if (authenticated === undefined) {
2287
2288
  const expiresInt = this.milliseconds() + 10000;
@@ -1513,7 +1513,7 @@ class cex extends cex$1["default"] {
1513
1513
  const url = this.urls['api']['ws'];
1514
1514
  const client = this.client(url);
1515
1515
  const messageHash = 'authenticated';
1516
- const future = client.future('authenticated');
1516
+ const future = client.reusableFuture('authenticated');
1517
1517
  const authenticated = this.safeValue(client.subscriptions, messageHash);
1518
1518
  if (authenticated === undefined) {
1519
1519
  this.checkRequiredCredentials();
@@ -1528,7 +1528,7 @@ class cex extends cex$1["default"] {
1528
1528
  'timestamp': nonce,
1529
1529
  },
1530
1530
  };
1531
- await this.watch(url, messageHash, this.extend(request, params), messageHash);
1531
+ this.watch(url, messageHash, this.extend(request, params), messageHash);
1532
1532
  }
1533
1533
  return await future;
1534
1534
  }
@@ -101,7 +101,7 @@ class coincatch extends coincatch$1["default"] {
101
101
  const url = this.urls['api']['ws']['private'];
102
102
  const client = this.client(url);
103
103
  const messageHash = 'authenticated';
104
- const future = client.future(messageHash);
104
+ const future = client.reusableFuture(messageHash);
105
105
  const authenticated = this.safeValue(client.subscriptions, messageHash);
106
106
  if (authenticated === undefined) {
107
107
  const timestamp = this.seconds().toString();