ccxt 4.4.31 → 4.4.32

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 (92) hide show
  1. package/README.md +9 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/binance.js +1 -0
  5. package/dist/cjs/src/bitvavo.js +0 -4
  6. package/dist/cjs/src/cex.js +1 -1
  7. package/dist/cjs/src/coincatch.js +3 -3
  8. package/dist/cjs/src/coinex.js +1 -1
  9. package/dist/cjs/src/deribit.js +2 -2
  10. package/dist/cjs/src/gate.js +19 -3
  11. package/dist/cjs/src/hitbtc.js +3 -3
  12. package/dist/cjs/src/htx.js +1 -1
  13. package/dist/cjs/src/indodax.js +1 -1
  14. package/dist/cjs/src/kraken.js +4 -2
  15. package/dist/cjs/src/krakenfutures.js +2 -0
  16. package/dist/cjs/src/kucoin.js +5 -3
  17. package/dist/cjs/src/kucoinfutures.js +98 -27
  18. package/dist/cjs/src/okx.js +2 -2
  19. package/dist/cjs/src/phemex.js +19 -23
  20. package/dist/cjs/src/pro/binance.js +8 -8
  21. package/dist/cjs/src/pro/bitget.js +4 -4
  22. package/dist/cjs/src/pro/bitmart.js +2 -2
  23. package/dist/cjs/src/pro/bitmex.js +2 -2
  24. package/dist/cjs/src/pro/bitvavo.js +46 -48
  25. package/dist/cjs/src/pro/blofin.js +2 -2
  26. package/dist/cjs/src/pro/bybit.js +2 -2
  27. package/dist/cjs/src/pro/coincatch.js +1 -1
  28. package/dist/cjs/src/pro/cryptocom.js +4 -4
  29. package/dist/cjs/src/pro/gate.js +4 -4
  30. package/dist/cjs/src/pro/hashkey.js +3 -3
  31. package/dist/cjs/src/pro/mexc.js +1 -2
  32. package/dist/cjs/src/wavesexchange.js +1 -0
  33. package/dist/cjs/src/woofipro.js +2 -2
  34. package/js/ccxt.d.ts +1 -1
  35. package/js/ccxt.js +1 -1
  36. package/js/src/binance.d.ts +1 -0
  37. package/js/src/binance.js +1 -0
  38. package/js/src/bitvavo.js +0 -4
  39. package/js/src/cex.d.ts +1 -1
  40. package/js/src/cex.js +1 -1
  41. package/js/src/coincatch.d.ts +1 -1
  42. package/js/src/coincatch.js +3 -3
  43. package/js/src/coinex.d.ts +1 -1
  44. package/js/src/coinex.js +1 -1
  45. package/js/src/deribit.d.ts +2 -2
  46. package/js/src/deribit.js +2 -2
  47. package/js/src/gate.d.ts +3 -1
  48. package/js/src/gate.js +19 -3
  49. package/js/src/hitbtc.d.ts +3 -3
  50. package/js/src/hitbtc.js +3 -3
  51. package/js/src/htx.d.ts +1 -1
  52. package/js/src/htx.js +1 -1
  53. package/js/src/indodax.js +1 -1
  54. package/js/src/kraken.d.ts +4 -2
  55. package/js/src/kraken.js +4 -2
  56. package/js/src/krakenfutures.d.ts +2 -0
  57. package/js/src/krakenfutures.js +2 -0
  58. package/js/src/kucoin.d.ts +3 -3
  59. package/js/src/kucoin.js +5 -3
  60. package/js/src/kucoinfutures.d.ts +8 -4
  61. package/js/src/kucoinfutures.js +98 -27
  62. package/js/src/okx.d.ts +2 -2
  63. package/js/src/okx.js +2 -2
  64. package/js/src/phemex.js +19 -23
  65. package/js/src/pro/binance.d.ts +8 -8
  66. package/js/src/pro/binance.js +8 -8
  67. package/js/src/pro/bitget.d.ts +3 -3
  68. package/js/src/pro/bitget.js +4 -4
  69. package/js/src/pro/bitmart.d.ts +2 -2
  70. package/js/src/pro/bitmart.js +2 -2
  71. package/js/src/pro/bitmex.d.ts +2 -2
  72. package/js/src/pro/bitmex.js +2 -2
  73. package/js/src/pro/bitvavo.d.ts +1 -1
  74. package/js/src/pro/bitvavo.js +46 -48
  75. package/js/src/pro/blofin.d.ts +2 -2
  76. package/js/src/pro/blofin.js +2 -2
  77. package/js/src/pro/bybit.d.ts +2 -2
  78. package/js/src/pro/bybit.js +2 -2
  79. package/js/src/pro/coincatch.d.ts +1 -1
  80. package/js/src/pro/coincatch.js +1 -1
  81. package/js/src/pro/cryptocom.d.ts +4 -4
  82. package/js/src/pro/cryptocom.js +4 -4
  83. package/js/src/pro/gate.d.ts +4 -4
  84. package/js/src/pro/gate.js +4 -4
  85. package/js/src/pro/hashkey.d.ts +3 -3
  86. package/js/src/pro/hashkey.js +3 -3
  87. package/js/src/pro/mexc.js +1 -2
  88. package/js/src/wavesexchange.d.ts +1 -0
  89. package/js/src/wavesexchange.js +1 -0
  90. package/js/src/woofipro.d.ts +2 -2
  91. package/js/src/woofipro.js +2 -2
  92. package/package.json +1 -1
@@ -430,7 +430,7 @@ class bitget extends bitget$1 {
430
430
  * @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
431
431
  * @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
432
432
  * @param {string} symbol unified symbol of the market to unwatch the ohlcv for
433
- * @param {string} timeframe
433
+ * @param {string} [timeframe] the period for the ratio, default is 1 minute
434
434
  * @param {object} [params] extra parameters specific to the exchange API endpoint
435
435
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
436
436
  */
@@ -672,7 +672,7 @@ class bitget extends bitget$1 {
672
672
  this.handleDeltas(storedOrderBook['bids'], bids);
673
673
  storedOrderBook['timestamp'] = timestamp;
674
674
  storedOrderBook['datetime'] = this.iso8601(timestamp);
675
- const checksum = this.safeBool(this.options, 'checksum', true);
675
+ const checksum = this.handleOption('watchOrderBook', 'checksum', true);
676
676
  const isSnapshot = this.safeString(message, 'action') === 'snapshot'; // snapshot does not have a checksum
677
677
  if (!isSnapshot && checksum) {
678
678
  const storedAsks = storedOrderBook['asks'];
@@ -938,8 +938,8 @@ class bitget extends bitget$1 {
938
938
  * @description watch all open positions
939
939
  * @see https://www.bitget.com/api-doc/contract/websocket/private/Positions-Channel
940
940
  * @param {string[]|undefined} symbols list of unified market symbols
941
- * @param since
942
- * @param limit
941
+ * @param {int} [since] the earliest time in ms to fetch positions for
942
+ * @param {int} [limit] the maximum number of positions to retrieve
943
943
  * @param {object} params extra parameters specific to the exchange API endpoint
944
944
  * @param {string} [params.instType] one of 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES', default is 'USDT-FUTURES'
945
945
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
@@ -728,8 +728,8 @@ class bitmart extends bitmart$1 {
728
728
  * @see https://developer-pro.bitmart.com/en/futures/#private-position-channel
729
729
  * @description watch all open positions
730
730
  * @param {string[]|undefined} symbols list of unified market symbols
731
- * @param since
732
- * @param limit
731
+ * @param {int} [since] the earliest time in ms to fetch positions
732
+ * @param {int} [limit] the maximum number of positions to retrieve
733
733
  * @param {object} params extra parameters specific to the exchange API endpoint
734
734
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
735
735
  */
@@ -726,8 +726,8 @@ class bitmex extends bitmex$1 {
726
726
  * @description watch all open positions
727
727
  * @see https://www.bitmex.com/app/wsAPI#Subscriptions
728
728
  * @param {string[]|undefined} symbols list of unified market symbols
729
- * @param since
730
- * @param limit
729
+ * @param {int} [since] the earliest time in ms to watch positions for
730
+ * @param {int} [limit] the maximum number of positions to retrieve
731
731
  * @param {object} params extra parameters specific to the exchange API endpoint
732
732
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
733
733
  */
@@ -308,10 +308,9 @@ class bitvavo extends bitvavo$1 {
308
308
  // ]
309
309
  // }
310
310
  //
311
- const action = this.safeString(message, 'action');
312
311
  const response = this.safeValue(message, 'response');
313
312
  const ohlcv = this.parseOHLCVs(response, undefined, undefined, undefined);
314
- const messageHash = this.buildMessageHash(action);
313
+ const messageHash = this.safeString(message, 'requestId');
315
314
  client.resolve(ohlcv, messageHash);
316
315
  }
317
316
  handleOHLCV(client, message) {
@@ -714,14 +713,15 @@ class bitvavo extends bitvavo$1 {
714
713
  // }]
715
714
  // }
716
715
  //
717
- const action = this.safeString(message, 'action');
718
- const response = this.safeValue(message, 'response');
719
- const firstRawOrder = this.safeValue(response, 0, {});
720
- const marketId = this.safeString(firstRawOrder, 'market');
716
+ // const action = this.safeString (message, 'action');
717
+ const response = this.safeList(message, 'response');
718
+ // const firstRawOrder = this.safeValue (response, 0, {});
719
+ // const marketId = this.safeString (firstRawOrder, 'market');
721
720
  const orders = this.parseOrders(response);
722
- let messageHash = this.buildMessageHash(action, { 'market': marketId });
723
- client.resolve(orders, messageHash);
724
- messageHash = this.buildMessageHash(action, message);
721
+ // let messageHash = this.buildMessageHash (action, { 'market': marketId });
722
+ // client.resolve (orders, messageHash);
723
+ // messageHash = this.buildMessageHash (action, message);
724
+ const messageHash = this.safeString(message, 'requestId');
725
725
  client.resolve(orders, messageHash);
726
726
  }
727
727
  /**
@@ -768,13 +768,19 @@ class bitvavo extends bitvavo$1 {
768
768
  const orders = await this.watchRequest('privateGetOrders', request);
769
769
  return this.filterBySymbolSinceLimit(orders, symbol, since, limit);
770
770
  }
771
+ requestId() {
772
+ const ts = this.milliseconds().toString();
773
+ const randomNumber = this.randNumber(4);
774
+ const randomPart = randomNumber.toString();
775
+ return parseInt(ts + randomPart);
776
+ }
771
777
  async watchRequest(action, request) {
778
+ const messageHash = this.requestId();
779
+ const messageHashStr = messageHash.toString();
772
780
  request['action'] = action;
773
- const messageHash = this.buildMessageHash(action, request);
774
- this.checkMessageHashDoesNotExist(messageHash);
781
+ request['requestId'] = messageHash;
775
782
  const url = this.urls['api']['ws'];
776
- const randomSubHash = this.randNumber(5).toString() + ':' + messageHash;
777
- return await this.watch(url, messageHash, request, randomSubHash);
783
+ return await this.watch(url, messageHashStr, request, messageHashStr);
778
784
  }
779
785
  /**
780
786
  * @method
@@ -843,12 +849,12 @@ class bitvavo extends bitvavo$1 {
843
849
  // }
844
850
  //
845
851
  //
846
- const action = this.safeString(message, 'action');
847
- const response = this.safeValue(message, 'response');
848
- const firstRawTrade = this.safeValue(response, 0, {});
849
- const marketId = this.safeString(firstRawTrade, 'market');
852
+ // const action = this.safeString (message, 'action');
853
+ const response = this.safeList(message, 'response');
854
+ // const marketId = this.safeString (firstRawTrade, 'market');
850
855
  const trades = this.parseTrades(response, undefined, undefined, undefined);
851
- const messageHash = this.buildMessageHash(action, { 'market': marketId });
856
+ // const messageHash = this.buildMessageHash (action, { 'market': marketId });
857
+ const messageHash = this.safeString(message, 'requestId');
852
858
  client.resolve(trades, messageHash);
853
859
  }
854
860
  /**
@@ -881,8 +887,9 @@ class bitvavo extends bitvavo$1 {
881
887
  // }
882
888
  // }
883
889
  //
884
- const action = this.safeString(message, 'action');
885
- const messageHash = this.buildMessageHash(action, message);
890
+ // const action = this.safeString (message, 'action');
891
+ // const messageHash = this.buildMessageHash (action, message);
892
+ const messageHash = this.safeString(message, 'requestId');
886
893
  const response = this.safeValue(message, 'response');
887
894
  const withdraw = this.parseTransaction(response);
888
895
  client.resolve(withdraw, messageHash);
@@ -921,9 +928,10 @@ class bitvavo extends bitvavo$1 {
921
928
  // ]
922
929
  // }
923
930
  //
924
- const action = this.safeString(message, 'action');
925
- const messageHash = this.buildMessageHash(action, message);
926
- const response = this.safeValue(message, 'response');
931
+ // const action = this.safeString (message, 'action');
932
+ // const messageHash = this.buildMessageHash (action, message);
933
+ const response = this.safeList(message, 'response');
934
+ const messageHash = this.safeString(message, 'requestId');
927
935
  const withdrawals = this.parseTransactions(response, undefined, undefined, undefined, { 'type': 'withdrawal' });
928
936
  client.resolve(withdrawals, messageHash);
929
937
  }
@@ -980,10 +988,9 @@ class bitvavo extends bitvavo$1 {
980
988
  // ]
981
989
  // }
982
990
  //
983
- const action = this.safeString(message, 'action');
984
- const messageHash = this.buildMessageHash(action, message);
985
991
  const response = this.safeValue(message, 'response');
986
992
  const deposits = this.parseTransactions(response, undefined, undefined, undefined, { 'type': 'deposit' });
993
+ const messageHash = this.safeString(message, 'requestId');
987
994
  client.resolve(deposits, messageHash);
988
995
  }
989
996
  /**
@@ -1043,8 +1050,7 @@ class bitvavo extends bitvavo$1 {
1043
1050
  // ]
1044
1051
  // }
1045
1052
  //
1046
- const action = this.safeString(message, 'action');
1047
- const messageHash = this.buildMessageHash(action, message);
1053
+ const messageHash = this.safeString(message, 'requestId');
1048
1054
  const response = this.safeValue(message, 'response');
1049
1055
  const currencies = this.parseCurrencies(response);
1050
1056
  client.resolve(currencies, messageHash);
@@ -1062,8 +1068,7 @@ class bitvavo extends bitvavo$1 {
1062
1068
  // }
1063
1069
  // }
1064
1070
  //
1065
- const action = this.safeString(message, 'action');
1066
- const messageHash = this.buildMessageHash(action, message);
1071
+ const messageHash = this.safeString(message, 'requestId');
1067
1072
  const response = this.safeValue(message, 'response');
1068
1073
  const fees = this.parseTradingFees(response);
1069
1074
  client.resolve(fees, messageHash);
@@ -1094,8 +1099,7 @@ class bitvavo extends bitvavo$1 {
1094
1099
  // ]
1095
1100
  // }
1096
1101
  //
1097
- const action = this.safeString(message, 'action', 'privateGetBalance');
1098
- const messageHash = this.buildMessageHash(action, message);
1102
+ const messageHash = this.safeString(message, 'requestId');
1099
1103
  const response = this.safeValue(message, 'response', []);
1100
1104
  const balance = this.parseBalance(response);
1101
1105
  client.resolve(balance, messageHash);
@@ -1129,10 +1133,9 @@ class bitvavo extends bitvavo$1 {
1129
1133
  // }
1130
1134
  // }
1131
1135
  //
1132
- const action = this.safeString(message, 'action');
1133
1136
  const response = this.safeValue(message, 'response', {});
1134
1137
  const order = this.parseOrder(response);
1135
- const messageHash = this.buildMessageHash(action, response);
1138
+ const messageHash = this.safeString(message, 'requestId');
1136
1139
  client.resolve(order, messageHash);
1137
1140
  }
1138
1141
  handleMarkets(client, message) {
@@ -1155,10 +1158,9 @@ class bitvavo extends bitvavo$1 {
1155
1158
  // ]
1156
1159
  // }
1157
1160
  //
1158
- const action = this.safeString(message, 'action');
1159
1161
  const response = this.safeValue(message, 'response', {});
1160
1162
  const markets = this.parseMarkets(response);
1161
- const messageHash = this.buildMessageHash(action, response);
1163
+ const messageHash = this.safeString(message, 'requestId');
1162
1164
  client.resolve(markets, messageHash);
1163
1165
  }
1164
1166
  buildMessageHash(action, params = {}) {
@@ -1176,18 +1178,6 @@ class bitvavo extends bitvavo$1 {
1176
1178
  }
1177
1179
  return messageHash;
1178
1180
  }
1179
- checkMessageHashDoesNotExist(messageHash) {
1180
- const supressMultipleWsRequestsError = this.safeBool(this.options, 'supressMultipleWsRequestsError', false);
1181
- if (!supressMultipleWsRequestsError) {
1182
- const client = this.safeValue(this.clients, this.urls['api']['ws']);
1183
- if (client !== undefined) {
1184
- const future = this.safeValue(client.futures, messageHash);
1185
- if (future !== undefined) {
1186
- throw new errors.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');
1187
- }
1188
- }
1189
- }
1190
- }
1191
1181
  actionAndMarketMessageHash(action, params = {}) {
1192
1182
  const symbol = this.safeString(params, 'market', '');
1193
1183
  return action + symbol;
@@ -1340,11 +1330,19 @@ class bitvavo extends bitvavo$1 {
1340
1330
  // errorCode: 217,
1341
1331
  // error: 'Minimum order size in quote currency is 5 EUR or 0.001 BTC.'
1342
1332
  // }
1333
+ // {
1334
+ // action: 'privateCreateOrder',
1335
+ // requestId: '17317539426571916',
1336
+ // market: 'USDT-EUR',
1337
+ // errorCode: 216,
1338
+ // error: 'You do not have sufficient balance to complete this operation.'
1339
+ // }
1343
1340
  //
1344
1341
  const error = this.safeString(message, 'error');
1345
1342
  const code = this.safeInteger(error, 'errorCode');
1346
1343
  const action = this.safeString(message, 'action');
1347
- const messageHash = this.buildMessageHash(action, message);
1344
+ const buildMessage = this.buildMessageHash(action, message);
1345
+ const messageHash = this.safeString(message, 'requestId', buildMessage);
1348
1346
  let rejected = false;
1349
1347
  try {
1350
1348
  this.handleErrors(code, error, client.url, undefined, undefined, error, message, undefined, undefined);
@@ -543,8 +543,8 @@ class blofin extends blofin$1 {
543
543
  * @see https://docs.blofin.com/index.html#ws-positions-channel
544
544
  * @description watch all open positions
545
545
  * @param {string[]|undefined} symbols list of unified market symbols
546
- * @param since
547
- * @param limit
546
+ * @param {int} [since] the earliest time in ms to fetch positions for
547
+ * @param {int} [limit] the maximum number of positions to retrieve
548
548
  * @param {object} params extra parameters specific to the exchange API endpoint
549
549
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
550
550
  */
@@ -1378,8 +1378,8 @@ class bybit extends bybit$1 {
1378
1378
  * @see https://bybit-exchange.github.io/docs/v5/websocket/private/position
1379
1379
  * @description watch all open positions
1380
1380
  * @param {string[]} [symbols] list of unified market symbols
1381
- * @param since
1382
- * @param limit
1381
+ * @param {int} [since] the earliest time in ms to fetch positions for
1382
+ * @param {int} [limit] the maximum number of positions to retrieve
1383
1383
  * @param {object} params extra parameters specific to the exchange API endpoint
1384
1384
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
1385
1385
  */
@@ -249,7 +249,7 @@ class coincatch extends coincatch$1 {
249
249
  }
250
250
  /**
251
251
  * @method
252
- * @name coinctach#unWatchTicker
252
+ * @name coincatch#unWatchTicker
253
253
  * @description unsubscribe from the ticker channel
254
254
  * @see https://coincatch.github.io/github.io/en/mix/#tickers-channel
255
255
  * @param {string} symbol unified symbol of the market to unwatch the ticker for
@@ -354,7 +354,7 @@ class cryptocom extends cryptocom$1 {
354
354
  * @name cryptocom#unWatchTradesForSymbols
355
355
  * @description get the list of most recent trades for a particular symbol
356
356
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#trade-instrument_name
357
- * @param symbols
357
+ * @param {string[]} [symbols] list of unified market symbols to unwatch trades for
358
358
  * @param {object} [params] extra parameters specific to the exchange API endpoint
359
359
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
360
360
  */
@@ -840,9 +840,9 @@ class cryptocom extends cryptocom$1 {
840
840
  * @name cryptocom#watchPositions
841
841
  * @description watch all open positions
842
842
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#user-position_balance
843
- * @param {string[]|undefined} symbols list of unified market symbols
844
- * @param since
845
- * @param limit
843
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
844
+ * @param {int} [since] the earliest time in ms to fetch positions for
845
+ * @param {int} [limit] the maximum number of positions to retrieve
846
846
  * @param {object} params extra parameters specific to the exchange API endpoint
847
847
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
848
848
  */
@@ -324,7 +324,7 @@ class gate extends gate$1 {
324
324
  * @name gate#fetchOrdersWs
325
325
  * @see https://www.gate.io/docs/developers/futures/ws/en/#order-list
326
326
  * @description fetches information on multiple orders made by the user by status
327
- * @param status
327
+ * @param {string} status requested order status
328
328
  * @param {string} symbol unified market symbol of the market orders were made in
329
329
  * @param {int|undefined} [since] the earliest time in ms to fetch orders for
330
330
  * @param {int|undefined} [limit] the maximum number of order structures to retrieve
@@ -1117,9 +1117,9 @@ class gate extends gate$1 {
1117
1117
  * @see https://www.gate.io/docs/developers/delivery/ws/en/#positions-subscription
1118
1118
  * @see https://www.gate.io/docs/developers/options/ws/en/#positions-channel
1119
1119
  * @description watch all open positions
1120
- * @param {string[]|undefined} symbols list of unified market symbols
1121
- * @param since
1122
- * @param limit
1120
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
1121
+ * @param {int} [since] the earliest time in ms to fetch positions for
1122
+ * @param {int} [limit] the maximum number of positions to retrieve
1123
1123
  * @param {object} params extra parameters specific to the exchange API endpoint
1124
1124
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
1125
1125
  */
@@ -585,9 +585,9 @@ class hashkey extends hashkey$1 {
585
585
  * @name hashkey#watchPositions
586
586
  * @see https://hashkeyglobal-apidoc.readme.io/reference/websocket-api#private-stream
587
587
  * @description watch all open positions
588
- * @param {string[]|undefined} symbols list of unified market symbols
589
- * @param since
590
- * @param limit
588
+ * @param {string[]} [symbols] list of unified market symbols to watch positions for
589
+ * @param {int} [since] the earliest time in ms to fetch positions for
590
+ * @param {int} [limit] the maximum number of positions to retrieve
591
591
  * @param {object} params extra parameters specific to the exchange API endpoint
592
592
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
593
593
  */
@@ -1305,8 +1305,7 @@ class mexc extends mexc$1 {
1305
1305
  '2': 'closed',
1306
1306
  '3': 'open',
1307
1307
  '4': 'canceled',
1308
- '5': 'open',
1309
- '6': 'closed',
1308
+ '5': 'closed',
1310
1309
  'NEW': 'open',
1311
1310
  'CANCELED': 'canceled',
1312
1311
  'EXECUTED': 'closed',
@@ -1988,6 +1988,7 @@ class wavesexchange extends wavesexchange$1 {
1988
1988
  * @method
1989
1989
  * @name wavesexchange#fetchMyTrades
1990
1990
  * @description fetch all trades made by the user
1991
+ * @see https://api.wavesplatform.com/v0/docs/#/transactions/searchTxsExchange
1991
1992
  * @param {string} symbol unified market symbol
1992
1993
  * @param {int} [since] the earliest time in ms to fetch trades for
1993
1994
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -2465,8 +2465,8 @@ class woofipro extends woofipro$1 {
2465
2465
  * @name woofipro#setLeverage
2466
2466
  * @description set the level of leverage for a market
2467
2467
  * @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/update-leverage-setting
2468
- * @param leverage
2469
- * @param {string} symbol unified market symbol
2468
+ * @param {int} [leverage] the rate of leverage
2469
+ * @param {string} [symbol] unified market symbol
2470
2470
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2471
2471
  * @returns {object} response from the exchange
2472
2472
  */
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.4.30";
7
+ declare const version = "4.4.31";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.4.31';
41
+ const version = '4.4.32';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -1525,6 +1525,7 @@ export default class binance extends Exchange {
1525
1525
  parseOption(chain: Dict, currency?: Currency, market?: Market): Option;
1526
1526
  /**
1527
1527
  * @method
1528
+ * @name binance#fetchMarginAdjustmentHistory
1528
1529
  * @description fetches the history of margin added or reduced from contract isolated positions
1529
1530
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Get-Position-Margin-Change-History
1530
1531
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Get-Position-Margin-Change-History
package/js/src/binance.js CHANGED
@@ -13396,6 +13396,7 @@ export default class binance extends Exchange {
13396
13396
  }
13397
13397
  /**
13398
13398
  * @method
13399
+ * @name binance#fetchMarginAdjustmentHistory
13399
13400
  * @description fetches the history of margin added or reduced from contract isolated positions
13400
13401
  * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Get-Position-Margin-Change-History
13401
13402
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Get-Position-Margin-Change-History
package/js/src/bitvavo.js CHANGED
@@ -1117,10 +1117,6 @@ export default class bitvavo extends Exchange {
1117
1117
  if (postOnly) {
1118
1118
  request['postOnly'] = true;
1119
1119
  }
1120
- const clientOrderId = this.safeString(params, 'clientOrderId');
1121
- if (clientOrderId === undefined) {
1122
- request['clientOrderId'] = this.uuid22();
1123
- }
1124
1120
  return this.extend(request, params);
1125
1121
  }
1126
1122
  /**
package/js/src/cex.d.ts CHANGED
@@ -125,7 +125,7 @@ export default class cex extends Exchange {
125
125
  * @name cex#fetchOrders
126
126
  * @description fetches information on multiple orders made by the user
127
127
  * @see https://trade.cex.io/docs/#rest-private-api-calls-orders
128
- * @param status
128
+ * @param {string} status order status to fetch for
129
129
  * @param {string} symbol unified market symbol of the market orders were made in
130
130
  * @param {int} [since] the earliest time in ms to fetch orders for
131
131
  * @param {int} [limit] the maximum number of order structures to retrieve
package/js/src/cex.js CHANGED
@@ -863,7 +863,7 @@ export default class cex extends Exchange {
863
863
  * @name cex#fetchOrders
864
864
  * @description fetches information on multiple orders made by the user
865
865
  * @see https://trade.cex.io/docs/#rest-private-api-calls-orders
866
- * @param status
866
+ * @param {string} status order status to fetch for
867
867
  * @param {string} symbol unified market symbol of the market orders were made in
868
868
  * @param {int} [since] the earliest time in ms to fetch orders for
869
869
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -668,7 +668,7 @@ export default class coincatch extends Exchange {
668
668
  fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
669
669
  /**
670
670
  * @method
671
- * @name hashkey#setLeverage
671
+ * @name coincatch#setLeverage
672
672
  * @description set the level of leverage for a market
673
673
  * @see https://hashkeyglobal-apidoc.readme.io/reference/change-futures-leverage-trade
674
674
  * @param {float} leverage the rate of leverage
@@ -2275,7 +2275,7 @@ export default class coincatch extends Exchange {
2275
2275
  /**
2276
2276
  * @method
2277
2277
  * @ignore
2278
- * @name hashkey#createSpotOrderRequest
2278
+ * @name coincatch#createSpotOrderRequest
2279
2279
  * @description helper function to build request
2280
2280
  * @param {string} symbol unified symbol of the market to create an order in
2281
2281
  * @param {string} type 'market' or 'limit'
@@ -2455,7 +2455,7 @@ export default class coincatch extends Exchange {
2455
2455
  /**
2456
2456
  * @method
2457
2457
  * @ignore
2458
- * @name hashkey#createSwapOrderRequest
2458
+ * @name coincatch#createSwapOrderRequest
2459
2459
  * @description helper function to build request
2460
2460
  * @param {string} symbol unified symbol of the market to create an order in
2461
2461
  * @param {string} type 'market' or 'limit'
@@ -4622,7 +4622,7 @@ export default class coincatch extends Exchange {
4622
4622
  }
4623
4623
  /**
4624
4624
  * @method
4625
- * @name hashkey#setLeverage
4625
+ * @name coincatch#setLeverage
4626
4626
  * @description set the level of leverage for a market
4627
4627
  * @see https://hashkeyglobal-apidoc.readme.io/reference/change-futures-leverage-trade
4628
4628
  * @param {float} leverage the rate of leverage
@@ -279,7 +279,7 @@ export default class coinex extends Exchange {
279
279
  * @see https://docs.coinex.com/api/v2/spot/order/http/list-finished-stop-order
280
280
  * @see https://docs.coinex.com/api/v2/futures/order/http/list-finished-order
281
281
  * @see https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order
282
- * @param status
282
+ * @param {string} status order status to fetch for
283
283
  * @param {string} symbol unified market symbol of the market orders were made in
284
284
  * @param {int} [since] the earliest time in ms to fetch orders for
285
285
  * @param {int} [limit] the maximum number of order structures to retrieve
package/js/src/coinex.js CHANGED
@@ -3393,7 +3393,7 @@ export default class coinex extends Exchange {
3393
3393
  * @see https://docs.coinex.com/api/v2/spot/order/http/list-finished-stop-order
3394
3394
  * @see https://docs.coinex.com/api/v2/futures/order/http/list-finished-order
3395
3395
  * @see https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order
3396
- * @param status
3396
+ * @param {string} status order status to fetch for
3397
3397
  * @param {string} symbol unified market symbol of the market orders were made in
3398
3398
  * @param {int} [since] the earliest time in ms to fetch orders for
3399
3399
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -438,8 +438,8 @@ export default class deribit extends Exchange {
438
438
  * @description fetch the current funding rate
439
439
  * @see https://docs.deribit.com/#public-get_funding_rate_history
440
440
  * @param {string} symbol unified market symbol
441
- * @param since
442
- * @param limit
441
+ * @param {int} [since] the earliest time in ms to fetch funding rate history for
442
+ * @param {int} [limit] the maximum number of entries to retrieve
443
443
  * @param {object} [params] extra parameters specific to the exchange API endpoint
444
444
  * @param {int} [params.end_timestamp] fetch funding rate ending at this timestamp
445
445
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
package/js/src/deribit.js CHANGED
@@ -3061,8 +3061,8 @@ export default class deribit extends Exchange {
3061
3061
  * @description fetch the current funding rate
3062
3062
  * @see https://docs.deribit.com/#public-get_funding_rate_history
3063
3063
  * @param {string} symbol unified market symbol
3064
- * @param since
3065
- * @param limit
3064
+ * @param {int} [since] the earliest time in ms to fetch funding rate history for
3065
+ * @param {int} [limit] the maximum number of entries to retrieve
3066
3066
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3067
3067
  * @param {int} [params.end_timestamp] fetch funding rate ending at this timestamp
3068
3068
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
package/js/src/gate.d.ts CHANGED
@@ -8,9 +8,9 @@ export default class gate extends Exchange {
8
8
  describe(): any;
9
9
  setSandboxMode(enable: boolean): void;
10
10
  /**
11
- * @param {object} [params] extra parameters specific to the exchange API endpoint
12
11
  * @method
13
12
  * @name gate#isUnifiedEnabled
13
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
14
14
  * @description returns unifiedAccount so the user can check if the unified account is enabled
15
15
  * @see https://www.gate.io/docs/developers/apiv4/#get-account-detail
16
16
  * @returns {boolean} true or false if the enabled unified account is enabled or not and sets the unifiedAccount option if it is undefined
@@ -300,6 +300,8 @@ export default class gate extends Exchange {
300
300
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
301
301
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
302
302
  * @param {object} [params] extra parameters specific to the exchange API endpoint
303
+ * @param {int} [params.until] timestamp in ms of the latest funding rate to fetch
304
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
303
305
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
304
306
  */
305
307
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
package/js/src/gate.js CHANGED
@@ -900,9 +900,9 @@ export default class gate extends Exchange {
900
900
  this.options['sandboxMode'] = enable;
901
901
  }
902
902
  /**
903
- * @param {object} [params] extra parameters specific to the exchange API endpoint
904
903
  * @method
905
904
  * @name gate#isUnifiedEnabled
905
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
906
906
  * @description returns unifiedAccount so the user can check if the unified account is enabled
907
907
  * @see https://www.gate.io/docs/developers/apiv4/#get-account-detail
908
908
  * @returns {boolean} true or false if the enabled unified account is enabled or not and sets the unifiedAccount option if it is undefined
@@ -3141,6 +3141,8 @@ export default class gate extends Exchange {
3141
3141
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
3142
3142
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
3143
3143
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3144
+ * @param {int} [params.until] timestamp in ms of the latest funding rate to fetch
3145
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3144
3146
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
3145
3147
  */
3146
3148
  async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -3148,15 +3150,29 @@ export default class gate extends Exchange {
3148
3150
  throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
3149
3151
  }
3150
3152
  await this.loadMarkets();
3153
+ let paginate = false;
3154
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
3155
+ if (paginate) {
3156
+ return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
3157
+ }
3151
3158
  const market = this.market(symbol);
3152
3159
  if (!market['swap']) {
3153
3160
  throw new BadSymbol(this.id + ' fetchFundingRateHistory() supports swap contracts only');
3154
3161
  }
3155
- const [request, query] = this.prepareRequest(market, undefined, params);
3162
+ let request = {};
3163
+ [request, params] = this.prepareRequest(market, undefined, params);
3156
3164
  if (limit !== undefined) {
3157
3165
  request['limit'] = limit;
3158
3166
  }
3159
- const response = await this.publicFuturesGetSettleFundingRate(this.extend(request, query));
3167
+ if (since !== undefined) {
3168
+ request['from'] = this.parseToInt(since / 1000);
3169
+ }
3170
+ const until = this.safeInteger(params, 'until');
3171
+ if (until !== undefined) {
3172
+ params = this.omit(params, 'until');
3173
+ request['to'] = this.parseToInt(until / 1000);
3174
+ }
3175
+ const response = await this.publicFuturesGetSettleFundingRate(this.extend(request, params));
3160
3176
  //
3161
3177
  // {
3162
3178
  // "r": "0.00063521",