ccxt 4.4.31 → 4.4.33

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 (111) hide show
  1. package/README.md +9 -3
  2. package/dist/ccxt.browser.min.js +4 -4
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +89 -0
  5. package/dist/cjs/src/binance.js +154 -0
  6. package/dist/cjs/src/bitvavo.js +0 -4
  7. package/dist/cjs/src/bybit.js +138 -6
  8. package/dist/cjs/src/cex.js +4 -3
  9. package/dist/cjs/src/coinbase.js +2 -22
  10. package/dist/cjs/src/coinbaseexchange.js +2 -1
  11. package/dist/cjs/src/coincatch.js +3 -3
  12. package/dist/cjs/src/coinex.js +2 -1
  13. package/dist/cjs/src/deribit.js +2 -2
  14. package/dist/cjs/src/gate.js +19 -3
  15. package/dist/cjs/src/hitbtc.js +3 -3
  16. package/dist/cjs/src/htx.js +1 -1
  17. package/dist/cjs/src/hyperliquid.js +14 -2
  18. package/dist/cjs/src/indodax.js +1 -1
  19. package/dist/cjs/src/kraken.js +5 -2
  20. package/dist/cjs/src/krakenfutures.js +2 -0
  21. package/dist/cjs/src/kucoin.js +5 -3
  22. package/dist/cjs/src/kucoinfutures.js +99 -28
  23. package/dist/cjs/src/lbank.js +1 -0
  24. package/dist/cjs/src/okx.js +94 -3
  25. package/dist/cjs/src/phemex.js +31 -30
  26. package/dist/cjs/src/pro/binance.js +8 -8
  27. package/dist/cjs/src/pro/bitget.js +4 -4
  28. package/dist/cjs/src/pro/bitmart.js +2 -2
  29. package/dist/cjs/src/pro/bitmex.js +2 -2
  30. package/dist/cjs/src/pro/bitvavo.js +46 -48
  31. package/dist/cjs/src/pro/blofin.js +2 -2
  32. package/dist/cjs/src/pro/bybit.js +2 -2
  33. package/dist/cjs/src/pro/coincatch.js +1 -1
  34. package/dist/cjs/src/pro/cryptocom.js +4 -4
  35. package/dist/cjs/src/pro/gate.js +4 -4
  36. package/dist/cjs/src/pro/hashkey.js +3 -3
  37. package/dist/cjs/src/pro/mexc.js +1 -2
  38. package/dist/cjs/src/pro/okx.js +11 -1
  39. package/dist/cjs/src/wavesexchange.js +1 -0
  40. package/dist/cjs/src/woofipro.js +2 -2
  41. package/js/ccxt.d.ts +1 -1
  42. package/js/ccxt.js +1 -1
  43. package/js/src/abstract/coinbaseexchange.d.ts +1 -0
  44. package/js/src/abstract/kraken.d.ts +1 -0
  45. package/js/src/base/Exchange.d.ts +3 -0
  46. package/js/src/base/Exchange.js +89 -0
  47. package/js/src/binance.d.ts +1 -0
  48. package/js/src/binance.js +154 -0
  49. package/js/src/bitvavo.js +0 -4
  50. package/js/src/bybit.js +139 -7
  51. package/js/src/cex.d.ts +1 -1
  52. package/js/src/cex.js +5 -4
  53. package/js/src/coinbase.js +2 -22
  54. package/js/src/coinbaseexchange.js +2 -1
  55. package/js/src/coincatch.d.ts +1 -1
  56. package/js/src/coincatch.js +3 -3
  57. package/js/src/coinex.d.ts +1 -1
  58. package/js/src/coinex.js +2 -1
  59. package/js/src/deribit.d.ts +2 -2
  60. package/js/src/deribit.js +2 -2
  61. package/js/src/gate.d.ts +3 -1
  62. package/js/src/gate.js +19 -3
  63. package/js/src/hitbtc.d.ts +3 -3
  64. package/js/src/hitbtc.js +3 -3
  65. package/js/src/htx.d.ts +1 -1
  66. package/js/src/htx.js +1 -1
  67. package/js/src/hyperliquid.d.ts +2 -1
  68. package/js/src/hyperliquid.js +14 -2
  69. package/js/src/indodax.js +1 -1
  70. package/js/src/kraken.d.ts +4 -2
  71. package/js/src/kraken.js +5 -2
  72. package/js/src/krakenfutures.d.ts +2 -0
  73. package/js/src/krakenfutures.js +2 -0
  74. package/js/src/kucoin.d.ts +3 -3
  75. package/js/src/kucoin.js +5 -3
  76. package/js/src/kucoinfutures.d.ts +9 -5
  77. package/js/src/kucoinfutures.js +99 -28
  78. package/js/src/lbank.js +1 -0
  79. package/js/src/okx.d.ts +2 -2
  80. package/js/src/okx.js +94 -3
  81. package/js/src/phemex.d.ts +4 -0
  82. package/js/src/phemex.js +31 -30
  83. package/js/src/pro/binance.d.ts +8 -8
  84. package/js/src/pro/binance.js +8 -8
  85. package/js/src/pro/bitget.d.ts +3 -3
  86. package/js/src/pro/bitget.js +4 -4
  87. package/js/src/pro/bitmart.d.ts +2 -2
  88. package/js/src/pro/bitmart.js +2 -2
  89. package/js/src/pro/bitmex.d.ts +2 -2
  90. package/js/src/pro/bitmex.js +2 -2
  91. package/js/src/pro/bitvavo.d.ts +1 -1
  92. package/js/src/pro/bitvavo.js +46 -48
  93. package/js/src/pro/blofin.d.ts +2 -2
  94. package/js/src/pro/blofin.js +2 -2
  95. package/js/src/pro/bybit.d.ts +2 -2
  96. package/js/src/pro/bybit.js +2 -2
  97. package/js/src/pro/coincatch.d.ts +1 -1
  98. package/js/src/pro/coincatch.js +1 -1
  99. package/js/src/pro/cryptocom.d.ts +4 -4
  100. package/js/src/pro/cryptocom.js +4 -4
  101. package/js/src/pro/gate.d.ts +4 -4
  102. package/js/src/pro/gate.js +4 -4
  103. package/js/src/pro/hashkey.d.ts +3 -3
  104. package/js/src/pro/hashkey.js +3 -3
  105. package/js/src/pro/mexc.js +1 -2
  106. package/js/src/pro/okx.js +11 -1
  107. package/js/src/wavesexchange.d.ts +1 -0
  108. package/js/src/wavesexchange.js +1 -0
  109. package/js/src/woofipro.d.ts +2 -2
  110. package/js/src/woofipro.js +2 -2
  111. package/package.json +1 -1
@@ -221,7 +221,7 @@ export default class binance extends binanceRest {
221
221
  * @description watch the public liquidations of a trading pair
222
222
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Liquidation-Order-Streams
223
223
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/All-Market-Liquidation-Order-Streams
224
- * @param {string[]} symbols
224
+ * @param {string[]} symbols list of unified market symbols
225
225
  * @param {int} [since] the earliest time in ms to fetch liquidations for
226
226
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
227
227
  * @param {object} [params] exchange specific parameters for the bitmex api endpoint
@@ -442,7 +442,7 @@ export default class binance extends binanceRest {
442
442
  * @description watch the private liquidations of a trading pair
443
443
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/user-data-streams/Event-Order-Update
444
444
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/user-data-streams/Event-Order-Update
445
- * @param symbols
445
+ * @param {string[]} symbols list of unified market symbols
446
446
  * @param {int} [since] the earliest time in ms to fetch liquidations for
447
447
  * @param {int} [limit] the maximum number of liquidation structures to retrieve
448
448
  * @param {object} [params] exchange specific parameters for the bitmex api endpoint
@@ -3176,7 +3176,7 @@ export default class binance extends binanceRest {
3176
3176
  * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-order-trade
3177
3177
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
3178
3178
  * @param {string} id order id
3179
- * @param {string} symbol unified market symbol, default is undefined
3179
+ * @param {string} [symbol] unified market symbol, default is undefined
3180
3180
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3181
3181
  * @param {string|undefined} [params.cancelRestrictions] Supported values: ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED.
3182
3182
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -3220,7 +3220,7 @@ export default class binance extends binanceRest {
3220
3220
  * @name binance#cancelAllOrdersWs
3221
3221
  * @description cancel all open orders in a market
3222
3222
  * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-open-orders-trade
3223
- * @param {string} symbol unified market symbol of the market to cancel orders in
3223
+ * @param {string} [symbol] unified market symbol of the market to cancel orders in
3224
3224
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3225
3225
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3226
3226
  */
@@ -3257,8 +3257,8 @@ export default class binance extends binanceRest {
3257
3257
  * @see https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#query-order-user_data
3258
3258
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
3259
3259
  * @param {string} id order id
3260
- * @param {string} symbol unified symbol of the market the order was made in
3261
- * @param {object} params extra parameters specific to the exchange API endpoint
3260
+ * @param {string} [symbol] unified symbol of the market the order was made in
3261
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3262
3262
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3263
3263
  */
3264
3264
  async fetchOrderWs(id, symbol = undefined, params = {}) {
@@ -3708,8 +3708,8 @@ export default class binance extends binanceRest {
3708
3708
  * @name binance#watchPositions
3709
3709
  * @description watch all open positions
3710
3710
  * @param {string[]|undefined} symbols list of unified market symbols
3711
- * @param since
3712
- * @param limit
3711
+ * @param {number} [since] since timestamp
3712
+ * @param {number} [limit] limit
3713
3713
  * @param {object} params extra parameters specific to the exchange API endpoint
3714
3714
  * @param {boolean} [params.portfolioMargin] set to true if you would like to watch positions in a portfolio margin account
3715
3715
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
@@ -78,7 +78,7 @@ export default class bitget extends bitgetRest {
78
78
  * @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
79
79
  * @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
80
80
  * @param {string} symbol unified symbol of the market to unwatch the ohlcv for
81
- * @param {string} timeframe
81
+ * @param {string} [timeframe] the period for the ratio, default is 1 minute
82
82
  * @param {object} [params] extra parameters specific to the exchange API endpoint
83
83
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
84
84
  */
@@ -171,8 +171,8 @@ export default class bitget extends bitgetRest {
171
171
  * @description watch all open positions
172
172
  * @see https://www.bitget.com/api-doc/contract/websocket/private/Positions-Channel
173
173
  * @param {string[]|undefined} symbols list of unified market symbols
174
- * @param since
175
- * @param limit
174
+ * @param {int} [since] the earliest time in ms to fetch positions for
175
+ * @param {int} [limit] the maximum number of positions to retrieve
176
176
  * @param {object} params extra parameters specific to the exchange API endpoint
177
177
  * @param {string} [params.instType] one of 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES', default is 'USDT-FUTURES'
178
178
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
@@ -433,7 +433,7 @@ export default class bitget extends bitgetRest {
433
433
  * @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
434
434
  * @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
435
435
  * @param {string} symbol unified symbol of the market to unwatch the ohlcv for
436
- * @param {string} timeframe
436
+ * @param {string} [timeframe] the period for the ratio, default is 1 minute
437
437
  * @param {object} [params] extra parameters specific to the exchange API endpoint
438
438
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
439
439
  */
@@ -675,7 +675,7 @@ export default class bitget extends bitgetRest {
675
675
  this.handleDeltas(storedOrderBook['bids'], bids);
676
676
  storedOrderBook['timestamp'] = timestamp;
677
677
  storedOrderBook['datetime'] = this.iso8601(timestamp);
678
- const checksum = this.safeBool(this.options, 'checksum', true);
678
+ const checksum = this.handleOption('watchOrderBook', 'checksum', true);
679
679
  const isSnapshot = this.safeString(message, 'action') === 'snapshot'; // snapshot does not have a checksum
680
680
  if (!isSnapshot && checksum) {
681
681
  const storedAsks = storedOrderBook['asks'];
@@ -941,8 +941,8 @@ export default class bitget extends bitgetRest {
941
941
  * @description watch all open positions
942
942
  * @see https://www.bitget.com/api-doc/contract/websocket/private/Positions-Channel
943
943
  * @param {string[]|undefined} symbols list of unified market symbols
944
- * @param since
945
- * @param limit
944
+ * @param {int} [since] the earliest time in ms to fetch positions for
945
+ * @param {int} [limit] the maximum number of positions to retrieve
946
946
  * @param {object} params extra parameters specific to the exchange API endpoint
947
947
  * @param {string} [params.instType] one of 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES', default is 'USDT-FUTURES'
948
948
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
@@ -102,8 +102,8 @@ export default class bitmart extends bitmartRest {
102
102
  * @see https://developer-pro.bitmart.com/en/futures/#private-position-channel
103
103
  * @description watch all open positions
104
104
  * @param {string[]|undefined} symbols list of unified market symbols
105
- * @param since
106
- * @param limit
105
+ * @param {int} [since] the earliest time in ms to fetch positions
106
+ * @param {int} [limit] the maximum number of positions to retrieve
107
107
  * @param {object} params extra parameters specific to the exchange API endpoint
108
108
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
109
109
  */
@@ -731,8 +731,8 @@ export default class bitmart extends bitmartRest {
731
731
  * @see https://developer-pro.bitmart.com/en/futures/#private-position-channel
732
732
  * @description watch all open positions
733
733
  * @param {string[]|undefined} symbols list of unified market symbols
734
- * @param since
735
- * @param limit
734
+ * @param {int} [since] the earliest time in ms to fetch positions
735
+ * @param {int} [limit] the maximum number of positions to retrieve
736
736
  * @param {object} params extra parameters specific to the exchange API endpoint
737
737
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
738
738
  */
@@ -80,8 +80,8 @@ export default class bitmex extends bitmexRest {
80
80
  * @description watch all open positions
81
81
  * @see https://www.bitmex.com/app/wsAPI#Subscriptions
82
82
  * @param {string[]|undefined} symbols list of unified market symbols
83
- * @param since
84
- * @param limit
83
+ * @param {int} [since] the earliest time in ms to watch positions for
84
+ * @param {int} [limit] the maximum number of positions to retrieve
85
85
  * @param {object} params extra parameters specific to the exchange API endpoint
86
86
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
87
87
  */
@@ -731,8 +731,8 @@ export default class bitmex extends bitmexRest {
731
731
  * @description watch all open positions
732
732
  * @see https://www.bitmex.com/app/wsAPI#Subscriptions
733
733
  * @param {string[]|undefined} symbols list of unified market symbols
734
- * @param since
735
- * @param limit
734
+ * @param {int} [since] the earliest time in ms to watch positions for
735
+ * @param {int} [limit] the maximum number of positions to retrieve
736
736
  * @param {object} params extra parameters specific to the exchange API endpoint
737
737
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
738
738
  */
@@ -189,6 +189,7 @@ export default class bitvavo extends bitvavoRest {
189
189
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
190
190
  */
191
191
  fetchOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
192
+ requestId(): number;
192
193
  watchRequest(action: any, request: any): Promise<any>;
193
194
  /**
194
195
  * @method
@@ -308,7 +309,6 @@ export default class bitvavo extends bitvavoRest {
308
309
  handleSingleOrder(client: Client, message: any): void;
309
310
  handleMarkets(client: Client, message: any): void;
310
311
  buildMessageHash(action: any, params?: {}): any;
311
- checkMessageHashDoesNotExist(messageHash: any): void;
312
312
  actionAndMarketMessageHash(action: any, params?: {}): string;
313
313
  actionAndOrderIdMessageHash(action: any, params?: {}): string;
314
314
  handleOrder(client: Client, message: any): void;
@@ -311,10 +311,9 @@ export default class bitvavo extends bitvavoRest {
311
311
  // ]
312
312
  // }
313
313
  //
314
- const action = this.safeString(message, 'action');
315
314
  const response = this.safeValue(message, 'response');
316
315
  const ohlcv = this.parseOHLCVs(response, undefined, undefined, undefined);
317
- const messageHash = this.buildMessageHash(action);
316
+ const messageHash = this.safeString(message, 'requestId');
318
317
  client.resolve(ohlcv, messageHash);
319
318
  }
320
319
  handleOHLCV(client, message) {
@@ -717,14 +716,15 @@ export default class bitvavo extends bitvavoRest {
717
716
  // }]
718
717
  // }
719
718
  //
720
- const action = this.safeString(message, 'action');
721
- const response = this.safeValue(message, 'response');
722
- const firstRawOrder = this.safeValue(response, 0, {});
723
- const marketId = this.safeString(firstRawOrder, 'market');
719
+ // const action = this.safeString (message, 'action');
720
+ const response = this.safeList(message, 'response');
721
+ // const firstRawOrder = this.safeValue (response, 0, {});
722
+ // const marketId = this.safeString (firstRawOrder, 'market');
724
723
  const orders = this.parseOrders(response);
725
- let messageHash = this.buildMessageHash(action, { 'market': marketId });
726
- client.resolve(orders, messageHash);
727
- messageHash = this.buildMessageHash(action, message);
724
+ // let messageHash = this.buildMessageHash (action, { 'market': marketId });
725
+ // client.resolve (orders, messageHash);
726
+ // messageHash = this.buildMessageHash (action, message);
727
+ const messageHash = this.safeString(message, 'requestId');
728
728
  client.resolve(orders, messageHash);
729
729
  }
730
730
  /**
@@ -771,13 +771,19 @@ export default class bitvavo extends bitvavoRest {
771
771
  const orders = await this.watchRequest('privateGetOrders', request);
772
772
  return this.filterBySymbolSinceLimit(orders, symbol, since, limit);
773
773
  }
774
+ requestId() {
775
+ const ts = this.milliseconds().toString();
776
+ const randomNumber = this.randNumber(4);
777
+ const randomPart = randomNumber.toString();
778
+ return parseInt(ts + randomPart);
779
+ }
774
780
  async watchRequest(action, request) {
781
+ const messageHash = this.requestId();
782
+ const messageHashStr = messageHash.toString();
775
783
  request['action'] = action;
776
- const messageHash = this.buildMessageHash(action, request);
777
- this.checkMessageHashDoesNotExist(messageHash);
784
+ request['requestId'] = messageHash;
778
785
  const url = this.urls['api']['ws'];
779
- const randomSubHash = this.randNumber(5).toString() + ':' + messageHash;
780
- return await this.watch(url, messageHash, request, randomSubHash);
786
+ return await this.watch(url, messageHashStr, request, messageHashStr);
781
787
  }
782
788
  /**
783
789
  * @method
@@ -846,12 +852,12 @@ export default class bitvavo extends bitvavoRest {
846
852
  // }
847
853
  //
848
854
  //
849
- const action = this.safeString(message, 'action');
850
- const response = this.safeValue(message, 'response');
851
- const firstRawTrade = this.safeValue(response, 0, {});
852
- const marketId = this.safeString(firstRawTrade, 'market');
855
+ // const action = this.safeString (message, 'action');
856
+ const response = this.safeList(message, 'response');
857
+ // const marketId = this.safeString (firstRawTrade, 'market');
853
858
  const trades = this.parseTrades(response, undefined, undefined, undefined);
854
- const messageHash = this.buildMessageHash(action, { 'market': marketId });
859
+ // const messageHash = this.buildMessageHash (action, { 'market': marketId });
860
+ const messageHash = this.safeString(message, 'requestId');
855
861
  client.resolve(trades, messageHash);
856
862
  }
857
863
  /**
@@ -884,8 +890,9 @@ export default class bitvavo extends bitvavoRest {
884
890
  // }
885
891
  // }
886
892
  //
887
- const action = this.safeString(message, 'action');
888
- const messageHash = this.buildMessageHash(action, message);
893
+ // const action = this.safeString (message, 'action');
894
+ // const messageHash = this.buildMessageHash (action, message);
895
+ const messageHash = this.safeString(message, 'requestId');
889
896
  const response = this.safeValue(message, 'response');
890
897
  const withdraw = this.parseTransaction(response);
891
898
  client.resolve(withdraw, messageHash);
@@ -924,9 +931,10 @@ export default class bitvavo extends bitvavoRest {
924
931
  // ]
925
932
  // }
926
933
  //
927
- const action = this.safeString(message, 'action');
928
- const messageHash = this.buildMessageHash(action, message);
929
- const response = this.safeValue(message, 'response');
934
+ // const action = this.safeString (message, 'action');
935
+ // const messageHash = this.buildMessageHash (action, message);
936
+ const response = this.safeList(message, 'response');
937
+ const messageHash = this.safeString(message, 'requestId');
930
938
  const withdrawals = this.parseTransactions(response, undefined, undefined, undefined, { 'type': 'withdrawal' });
931
939
  client.resolve(withdrawals, messageHash);
932
940
  }
@@ -983,10 +991,9 @@ export default class bitvavo extends bitvavoRest {
983
991
  // ]
984
992
  // }
985
993
  //
986
- const action = this.safeString(message, 'action');
987
- const messageHash = this.buildMessageHash(action, message);
988
994
  const response = this.safeValue(message, 'response');
989
995
  const deposits = this.parseTransactions(response, undefined, undefined, undefined, { 'type': 'deposit' });
996
+ const messageHash = this.safeString(message, 'requestId');
990
997
  client.resolve(deposits, messageHash);
991
998
  }
992
999
  /**
@@ -1046,8 +1053,7 @@ export default class bitvavo extends bitvavoRest {
1046
1053
  // ]
1047
1054
  // }
1048
1055
  //
1049
- const action = this.safeString(message, 'action');
1050
- const messageHash = this.buildMessageHash(action, message);
1056
+ const messageHash = this.safeString(message, 'requestId');
1051
1057
  const response = this.safeValue(message, 'response');
1052
1058
  const currencies = this.parseCurrencies(response);
1053
1059
  client.resolve(currencies, messageHash);
@@ -1065,8 +1071,7 @@ export default class bitvavo extends bitvavoRest {
1065
1071
  // }
1066
1072
  // }
1067
1073
  //
1068
- const action = this.safeString(message, 'action');
1069
- const messageHash = this.buildMessageHash(action, message);
1074
+ const messageHash = this.safeString(message, 'requestId');
1070
1075
  const response = this.safeValue(message, 'response');
1071
1076
  const fees = this.parseTradingFees(response);
1072
1077
  client.resolve(fees, messageHash);
@@ -1097,8 +1102,7 @@ export default class bitvavo extends bitvavoRest {
1097
1102
  // ]
1098
1103
  // }
1099
1104
  //
1100
- const action = this.safeString(message, 'action', 'privateGetBalance');
1101
- const messageHash = this.buildMessageHash(action, message);
1105
+ const messageHash = this.safeString(message, 'requestId');
1102
1106
  const response = this.safeValue(message, 'response', []);
1103
1107
  const balance = this.parseBalance(response);
1104
1108
  client.resolve(balance, messageHash);
@@ -1132,10 +1136,9 @@ export default class bitvavo extends bitvavoRest {
1132
1136
  // }
1133
1137
  // }
1134
1138
  //
1135
- const action = this.safeString(message, 'action');
1136
1139
  const response = this.safeValue(message, 'response', {});
1137
1140
  const order = this.parseOrder(response);
1138
- const messageHash = this.buildMessageHash(action, response);
1141
+ const messageHash = this.safeString(message, 'requestId');
1139
1142
  client.resolve(order, messageHash);
1140
1143
  }
1141
1144
  handleMarkets(client, message) {
@@ -1158,10 +1161,9 @@ export default class bitvavo extends bitvavoRest {
1158
1161
  // ]
1159
1162
  // }
1160
1163
  //
1161
- const action = this.safeString(message, 'action');
1162
1164
  const response = this.safeValue(message, 'response', {});
1163
1165
  const markets = this.parseMarkets(response);
1164
- const messageHash = this.buildMessageHash(action, response);
1166
+ const messageHash = this.safeString(message, 'requestId');
1165
1167
  client.resolve(markets, messageHash);
1166
1168
  }
1167
1169
  buildMessageHash(action, params = {}) {
@@ -1179,18 +1181,6 @@ export default class bitvavo extends bitvavoRest {
1179
1181
  }
1180
1182
  return messageHash;
1181
1183
  }
1182
- checkMessageHashDoesNotExist(messageHash) {
1183
- const supressMultipleWsRequestsError = this.safeBool(this.options, 'supressMultipleWsRequestsError', false);
1184
- if (!supressMultipleWsRequestsError) {
1185
- const client = this.safeValue(this.clients, this.urls['api']['ws']);
1186
- if (client !== undefined) {
1187
- const future = this.safeValue(client.futures, messageHash);
1188
- if (future !== undefined) {
1189
- throw new ExchangeError(this.id + ' a similar request with messageHash ' + messageHash + ' is already pending, you must wait for a response, or turn off this error by setting supressMultipleWsRequestsError in the options to true');
1190
- }
1191
- }
1192
- }
1193
- }
1194
1184
  actionAndMarketMessageHash(action, params = {}) {
1195
1185
  const symbol = this.safeString(params, 'market', '');
1196
1186
  return action + symbol;
@@ -1343,11 +1333,19 @@ export default class bitvavo extends bitvavoRest {
1343
1333
  // errorCode: 217,
1344
1334
  // error: 'Minimum order size in quote currency is 5 EUR or 0.001 BTC.'
1345
1335
  // }
1336
+ // {
1337
+ // action: 'privateCreateOrder',
1338
+ // requestId: '17317539426571916',
1339
+ // market: 'USDT-EUR',
1340
+ // errorCode: 216,
1341
+ // error: 'You do not have sufficient balance to complete this operation.'
1342
+ // }
1346
1343
  //
1347
1344
  const error = this.safeString(message, 'error');
1348
1345
  const code = this.safeInteger(error, 'errorCode');
1349
1346
  const action = this.safeString(message, 'action');
1350
- const messageHash = this.buildMessageHash(action, message);
1347
+ const buildMessage = this.buildMessageHash(action, message);
1348
+ const messageHash = this.safeString(message, 'requestId', buildMessage);
1351
1349
  let rejected = false;
1352
1350
  try {
1353
1351
  this.handleErrors(code, error, client.url, undefined, undefined, error, message, undefined, undefined);
@@ -156,8 +156,8 @@ export default class blofin extends blofinRest {
156
156
  * @see https://docs.blofin.com/index.html#ws-positions-channel
157
157
  * @description watch all open positions
158
158
  * @param {string[]|undefined} symbols list of unified market symbols
159
- * @param since
160
- * @param limit
159
+ * @param {int} [since] the earliest time in ms to fetch positions for
160
+ * @param {int} [limit] the maximum number of positions to retrieve
161
161
  * @param {object} params extra parameters specific to the exchange API endpoint
162
162
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
163
163
  */
@@ -546,8 +546,8 @@ export default class blofin extends blofinRest {
546
546
  * @see https://docs.blofin.com/index.html#ws-positions-channel
547
547
  * @description watch all open positions
548
548
  * @param {string[]|undefined} symbols list of unified market symbols
549
- * @param since
550
- * @param limit
549
+ * @param {int} [since] the earliest time in ms to fetch positions for
550
+ * @param {int} [limit] the maximum number of positions to retrieve
551
551
  * @param {object} params extra parameters specific to the exchange API endpoint
552
552
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
553
553
  */
@@ -311,8 +311,8 @@ export default class bybit extends bybitRest {
311
311
  * @see https://bybit-exchange.github.io/docs/v5/websocket/private/position
312
312
  * @description watch all open positions
313
313
  * @param {string[]} [symbols] list of unified market symbols
314
- * @param since
315
- * @param limit
314
+ * @param {int} [since] the earliest time in ms to fetch positions for
315
+ * @param {int} [limit] the maximum number of positions to retrieve
316
316
  * @param {object} params extra parameters specific to the exchange API endpoint
317
317
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
318
318
  */
@@ -1381,8 +1381,8 @@ export default class bybit extends bybitRest {
1381
1381
  * @see https://bybit-exchange.github.io/docs/v5/websocket/private/position
1382
1382
  * @description watch all open positions
1383
1383
  * @param {string[]} [symbols] list of unified market symbols
1384
- * @param since
1385
- * @param limit
1384
+ * @param {int} [since] the earliest time in ms to fetch positions for
1385
+ * @param {int} [limit] the maximum number of positions to retrieve
1386
1386
  * @param {object} params extra parameters specific to the exchange API endpoint
1387
1387
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
1388
1388
  */
@@ -27,7 +27,7 @@ export default class coincatch extends coincatchRest {
27
27
  watchTicker(symbol: string, params?: {}): Promise<Ticker>;
28
28
  /**
29
29
  * @method
30
- * @name coinctach#unWatchTicker
30
+ * @name coincatch#unWatchTicker
31
31
  * @description unsubscribe from the ticker channel
32
32
  * @see https://coincatch.github.io/github.io/en/mix/#tickers-channel
33
33
  * @param {string} symbol unified symbol of the market to unwatch the ticker for
@@ -252,7 +252,7 @@ export default class coincatch extends coincatchRest {
252
252
  }
253
253
  /**
254
254
  * @method
255
- * @name coinctach#unWatchTicker
255
+ * @name coincatch#unWatchTicker
256
256
  * @description unsubscribe from the ticker channel
257
257
  * @see https://coincatch.github.io/github.io/en/mix/#tickers-channel
258
258
  * @param {string} symbol unified symbol of the market to unwatch the ticker for
@@ -97,7 +97,7 @@ export default class cryptocom extends cryptocomRest {
97
97
  * @name cryptocom#unWatchTradesForSymbols
98
98
  * @description get the list of most recent trades for a particular symbol
99
99
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#trade-instrument_name
100
- * @param symbols
100
+ * @param {string[]} [symbols] list of unified market symbols to unwatch trades for
101
101
  * @param {object} [params] extra parameters specific to the exchange API endpoint
102
102
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
103
103
  */
@@ -212,9 +212,9 @@ export default class cryptocom extends cryptocomRest {
212
212
  * @name cryptocom#watchPositions
213
213
  * @description watch all open positions
214
214
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-position_balance
215
- * @param {string[]|undefined} symbols list of unified market symbols
216
- * @param since
217
- * @param limit
215
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
216
+ * @param {int} [since] the earliest time in ms to fetch positions for
217
+ * @param {int} [limit] the maximum number of positions to retrieve
218
218
  * @param {object} params extra parameters specific to the exchange API endpoint
219
219
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
220
220
  */
@@ -357,7 +357,7 @@ export default class cryptocom extends cryptocomRest {
357
357
  * @name cryptocom#unWatchTradesForSymbols
358
358
  * @description get the list of most recent trades for a particular symbol
359
359
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#trade-instrument_name
360
- * @param symbols
360
+ * @param {string[]} [symbols] list of unified market symbols to unwatch trades for
361
361
  * @param {object} [params] extra parameters specific to the exchange API endpoint
362
362
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
363
363
  */
@@ -843,9 +843,9 @@ export default class cryptocom extends cryptocomRest {
843
843
  * @name cryptocom#watchPositions
844
844
  * @description watch all open positions
845
845
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-position_balance
846
- * @param {string[]|undefined} symbols list of unified market symbols
847
- * @param since
848
- * @param limit
846
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
847
+ * @param {int} [since] the earliest time in ms to fetch positions for
848
+ * @param {int} [limit] the maximum number of positions to retrieve
849
849
  * @param {object} params extra parameters specific to the exchange API endpoint
850
850
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
851
851
  */
@@ -129,7 +129,7 @@ export default class gate extends gateRest {
129
129
  * @name gate#fetchOrdersWs
130
130
  * @see https://www.gate.io/docs/developers/futures/ws/en/#order-list
131
131
  * @description fetches information on multiple orders made by the user by status
132
- * @param status
132
+ * @param {string} status requested order status
133
133
  * @param {string} symbol unified market symbol of the market orders were made in
134
134
  * @param {int|undefined} [since] the earliest time in ms to fetch orders for
135
135
  * @param {int|undefined} [limit] the maximum number of order structures to retrieve
@@ -280,9 +280,9 @@ export default class gate extends gateRest {
280
280
  * @see https://www.gate.io/docs/developers/delivery/ws/en/#positions-subscription
281
281
  * @see https://www.gate.io/docs/developers/options/ws/en/#positions-channel
282
282
  * @description watch all open positions
283
- * @param {string[]|undefined} symbols list of unified market symbols
284
- * @param since
285
- * @param limit
283
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
284
+ * @param {int} [since] the earliest time in ms to fetch positions for
285
+ * @param {int} [limit] the maximum number of positions to retrieve
286
286
  * @param {object} params extra parameters specific to the exchange API endpoint
287
287
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
288
288
  */
@@ -327,7 +327,7 @@ export default class gate extends gateRest {
327
327
  * @name gate#fetchOrdersWs
328
328
  * @see https://www.gate.io/docs/developers/futures/ws/en/#order-list
329
329
  * @description fetches information on multiple orders made by the user by status
330
- * @param status
330
+ * @param {string} status requested order status
331
331
  * @param {string} symbol unified market symbol of the market orders were made in
332
332
  * @param {int|undefined} [since] the earliest time in ms to fetch orders for
333
333
  * @param {int|undefined} [limit] the maximum number of order structures to retrieve
@@ -1120,9 +1120,9 @@ export default class gate extends gateRest {
1120
1120
  * @see https://www.gate.io/docs/developers/delivery/ws/en/#positions-subscription
1121
1121
  * @see https://www.gate.io/docs/developers/options/ws/en/#positions-channel
1122
1122
  * @description watch all open positions
1123
- * @param {string[]|undefined} symbols list of unified market symbols
1124
- * @param since
1125
- * @param limit
1123
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
1124
+ * @param {int} [since] the earliest time in ms to fetch positions for
1125
+ * @param {int} [limit] the maximum number of positions to retrieve
1126
1126
  * @param {object} params extra parameters specific to the exchange API endpoint
1127
1127
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
1128
1128
  */
@@ -93,9 +93,9 @@ export default class hashkey extends hashkeyRest {
93
93
  * @name hashkey#watchPositions
94
94
  * @see https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#private-stream
95
95
  * @description watch all open positions
96
- * @param {string[]|undefined} symbols list of unified market symbols
97
- * @param since
98
- * @param limit
96
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
97
+ * @param {int} [since] the earliest time in ms to fetch positions for
98
+ * @param {int} [limit] the maximum number of positions to retrieve
99
99
  * @param {object} params extra parameters specific to the exchange API endpoint
100
100
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
101
101
  */
@@ -588,9 +588,9 @@ export default class hashkey extends hashkeyRest {
588
588
  * @name hashkey#watchPositions
589
589
  * @see https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#private-stream
590
590
  * @description watch all open positions
591
- * @param {string[]|undefined} symbols list of unified market symbols
592
- * @param since
593
- * @param limit
591
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
592
+ * @param {int} [since] the earliest time in ms to fetch positions for
593
+ * @param {int} [limit] the maximum number of positions to retrieve
594
594
  * @param {object} params extra parameters specific to the exchange API endpoint
595
595
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
596
596
  */
@@ -1308,8 +1308,7 @@ export default class mexc extends mexcRest {
1308
1308
  '2': 'closed',
1309
1309
  '3': 'open',
1310
1310
  '4': 'canceled',
1311
- '5': 'open',
1312
- '6': 'closed',
1311
+ '5': 'closed',
1313
1312
  'NEW': 'open',
1314
1313
  'CANCELED': 'canceled',
1315
1314
  'EXECUTED': 'closed',
package/js/src/pro/okx.js CHANGED
@@ -2257,6 +2257,7 @@ export default class okx extends okxRest {
2257
2257
  //
2258
2258
  // { event: 'error', msg: "Illegal request: {"op":"subscribe","args":["spot/ticker:BTC-USDT"]}", code: "60012" }
2259
2259
  // { event: 'error", msg: "channel:ticker,instId:BTC-USDT doesn"t exist", code: "60018" }
2260
+ // {"event":"error","msg":"Illegal request: {\\"id\\":\\"17321173472466905\\",\\"op\\":\\"amend-order\\",\\"args\\":[{\\"instId\\":\\"ETH-USDC\\",\\"ordId\\":\\"2000345622407479296\\",\\"newSz\\":\\"0.050857\\",\\"newPx\\":\\"2949.4\\",\\"postOnly\\":true}],\\"postOnly\\":true}","code":"60012","connId":"0808af6c"}
2260
2261
  //
2261
2262
  let errorCode = this.safeString(message, 'code');
2262
2263
  try {
@@ -2289,7 +2290,16 @@ export default class okx extends okxRest {
2289
2290
  catch (e) {
2290
2291
  // if the message contains an id, it means it is a response to a request
2291
2292
  // so we only reject that promise, instead of deleting all futures, destroying the authentication future
2292
- const id = this.safeString(message, 'id');
2293
+ let id = this.safeString(message, 'id');
2294
+ if (id === undefined) {
2295
+ // try to parse it from the stringified json inside msg
2296
+ const msg = this.safeString(message, 'msg');
2297
+ if (msg !== undefined && msg.startsWith('Illegal request: {')) {
2298
+ const stringifiedJson = msg.replace('Illegal request: ', '');
2299
+ const parsedJson = this.parseJson(stringifiedJson);
2300
+ id = this.safeString(parsedJson, 'id');
2301
+ }
2302
+ }
2293
2303
  if (id !== undefined) {
2294
2304
  client.reject(e, id);
2295
2305
  return false;
@@ -193,6 +193,7 @@ export default class wavesexchange extends Exchange {
193
193
  * @method
194
194
  * @name wavesexchange#fetchMyTrades
195
195
  * @description fetch all trades made by the user
196
+ * @see https://api.wavesplatform.com/v0/docs/#/transactions/searchTxsExchange
196
197
  * @param {string} symbol unified market symbol
197
198
  * @param {int} [since] the earliest time in ms to fetch trades for
198
199
  * @param {int} [limit] the maximum number of trades structures to retrieve