ccxt 4.5.44 → 4.5.45

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 (81) hide show
  1. package/README.md +9 -12
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -12
  4. package/dist/cjs/src/abstract/kucoinfutures.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +36 -3
  6. package/dist/cjs/src/base/functions/encode.js +2 -2
  7. package/dist/cjs/src/base/functions/generic.js +8 -2
  8. package/dist/cjs/src/bitrue.js +1 -1
  9. package/dist/cjs/src/bitteam.js +1 -1
  10. package/dist/cjs/src/btcbox.js +1 -1
  11. package/dist/cjs/src/cex.js +1 -0
  12. package/dist/cjs/src/gate.js +227 -168
  13. package/dist/cjs/src/grvt.js +3 -2
  14. package/dist/cjs/src/hyperliquid.js +16 -5
  15. package/dist/cjs/src/kraken.js +2 -2
  16. package/dist/cjs/src/krakenfutures.js +1 -5
  17. package/dist/cjs/src/kucoin.js +4729 -970
  18. package/dist/cjs/src/kucoinfutures.js +14 -3434
  19. package/dist/cjs/src/lbank.js +1 -1
  20. package/dist/cjs/src/poloniex.js +1 -1
  21. package/dist/cjs/src/pro/gate.js +37 -1
  22. package/dist/cjs/src/pro/kucoin.js +819 -178
  23. package/dist/cjs/src/pro/kucoinfutures.js +95 -1261
  24. package/dist/cjs/src/pro/mexc.js +10 -5
  25. package/dist/cjs/src/pro/okx.js +84 -39
  26. package/js/ccxt.d.ts +2 -14
  27. package/js/ccxt.js +2 -10
  28. package/js/src/abstract/kucoin.d.ts +46 -3
  29. package/js/src/abstract/kucoinfutures.d.ts +27 -12
  30. package/js/src/base/Exchange.d.ts +12 -1
  31. package/js/src/base/Exchange.js +36 -3
  32. package/js/src/base/functions/encode.js +2 -2
  33. package/js/src/base/functions/generic.js +9 -3
  34. package/js/src/bitrue.js +1 -1
  35. package/js/src/bitteam.js +1 -1
  36. package/js/src/btcbox.js +1 -1
  37. package/js/src/cex.js +2 -1
  38. package/js/src/gate.d.ts +125 -119
  39. package/js/src/gate.js +227 -168
  40. package/js/src/grvt.js +3 -2
  41. package/js/src/hyperliquid.d.ts +3 -1
  42. package/js/src/hyperliquid.js +16 -5
  43. package/js/src/kraken.js +2 -2
  44. package/js/src/krakenfutures.js +1 -5
  45. package/js/src/kucoin.d.ts +696 -100
  46. package/js/src/kucoin.js +4730 -971
  47. package/js/src/kucoinfutures.d.ts +4 -522
  48. package/js/src/kucoinfutures.js +14 -3434
  49. package/js/src/lbank.js +1 -1
  50. package/js/src/poloniex.js +1 -1
  51. package/js/src/pro/gate.d.ts +30 -1
  52. package/js/src/pro/gate.js +37 -1
  53. package/js/src/pro/kucoin.d.ts +70 -30
  54. package/js/src/pro/kucoin.js +821 -180
  55. package/js/src/pro/kucoinfutures.d.ts +17 -195
  56. package/js/src/pro/kucoinfutures.js +96 -1262
  57. package/js/src/pro/mexc.js +10 -5
  58. package/js/src/pro/okx.d.ts +1 -0
  59. package/js/src/pro/okx.js +84 -39
  60. package/package.json +1 -1
  61. package/dist/cjs/src/abstract/alp.js +0 -11
  62. package/dist/cjs/src/abstract/defx.js +0 -11
  63. package/dist/cjs/src/abstract/timex.js +0 -11
  64. package/dist/cjs/src/alp.js +0 -1059
  65. package/dist/cjs/src/defx.js +0 -2142
  66. package/dist/cjs/src/pro/defx.js +0 -866
  67. package/dist/cjs/src/timex.js +0 -1793
  68. package/js/src/abstract/alp.d.ts +0 -21
  69. package/js/src/abstract/alp.js +0 -5
  70. package/js/src/abstract/defx.d.ts +0 -72
  71. package/js/src/abstract/defx.js +0 -5
  72. package/js/src/abstract/timex.d.ts +0 -65
  73. package/js/src/abstract/timex.js +0 -5
  74. package/js/src/alp.d.ts +0 -209
  75. package/js/src/alp.js +0 -1052
  76. package/js/src/defx.d.ts +0 -348
  77. package/js/src/defx.js +0 -2135
  78. package/js/src/pro/defx.d.ts +0 -236
  79. package/js/src/pro/defx.js +0 -859
  80. package/js/src/timex.d.ts +0 -247
  81. package/js/src/timex.js +0 -1786
@@ -2364,7 +2364,7 @@ class lbank extends lbank$1["default"] {
2364
2364
  // "result":true,
2365
2365
  // "data": {
2366
2366
  // "fee":10.00000000000000000000,
2367
- // "withdrawId":1900376
2367
+ // "withdrawId":1900377
2368
2368
  // },
2369
2369
  // "error_code":0,
2370
2370
  // "ts":1648992501414
@@ -3621,7 +3621,7 @@ class poloniex extends poloniex$1["default"] {
3621
3621
  if (this.inArray(api, ['swapPublic', 'swapPrivate'])) {
3622
3622
  url = this.urls['api']['swap'];
3623
3623
  }
3624
- if ('symbol' in params) {
3624
+ if (method === 'GET' && ('symbol' in params)) {
3625
3625
  params['symbol'] = this.encodeURIComponent(params['symbol']); // handle symbols like 索拉拉/USDT'
3626
3626
  }
3627
3627
  const query = this.omit(params, this.extractParams(path));
@@ -182,6 +182,7 @@ class gate extends gate$1["default"] {
182
182
  if (market['swap'] !== true) {
183
183
  throw new errors.NotSupported(this.id + ' createOrdersWs is not supported for swap markets');
184
184
  }
185
+ // todo add swap support
185
186
  const messageType = this.getTypeByMarket(market);
186
187
  const channel = messageType + '.order_batch_place';
187
188
  const url = this.getUrlByMarket(market);
@@ -193,7 +194,7 @@ class gate extends gate$1["default"] {
193
194
  * @method
194
195
  * @name gate#cancelAllOrdersWs
195
196
  * @description cancel all open orders
196
- * @see https://www.gate.io/docs/developers/futures/ws/en/#cancel-all-open-orders-matched
197
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#cancel-matched-open-orders
197
198
  * @see https://www.gate.io/docs/developers/apiv4/ws/en/#order-cancel-all-with-specified-currency-pair
198
199
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
199
200
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -365,6 +366,7 @@ class gate extends gate$1["default"] {
365
366
  * @see https://www.gate.com/docs/developers/futures/ws/en/#order-book-api
366
367
  * @see https://www.gate.com/docs/developers/futures/ws/en/#order-book-v2-api
367
368
  * @see https://www.gate.com/docs/developers/delivery/ws/en/#order-book-api
369
+ * @see https://www.gate.com/docs/developers/options/ws/en/#order-book-channel
368
370
  * @param {string} symbol unified symbol of the market to fetch the order book for
369
371
  * @param {int} [limit] the maximum amount of order book entries to return
370
372
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -383,6 +385,9 @@ class gate extends gate$1["default"] {
383
385
  const payload = [marketId, interval];
384
386
  if (limit === undefined) {
385
387
  limit = 100; // max 100 atm
388
+ if (messageType === 'options') {
389
+ limit = 50; // max 50 for options
390
+ }
386
391
  }
387
392
  if (market['contract']) {
388
393
  const stringLimit = limit.toString();
@@ -574,6 +579,8 @@ class gate extends gate$1["default"] {
574
579
  * @method
575
580
  * @name gate#watchTicker
576
581
  * @see https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel
582
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#tickers-api
583
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#tickers-api
577
584
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
578
585
  * @param {string} symbol unified symbol of the market to fetch the ticker for
579
586
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -591,6 +598,8 @@ class gate extends gate$1["default"] {
591
598
  * @method
592
599
  * @name gate#watchTickers
593
600
  * @see https://www.gate.io/docs/developers/apiv4/ws/en/#tickers-channel
601
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#tickers-api
602
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#tickers-api
594
603
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
595
604
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
596
605
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -625,6 +634,7 @@ class gate extends gate$1["default"] {
625
634
  * @name gate#watchBidsAsks
626
635
  * @see https://www.gate.io/docs/developers/apiv4/ws/en/#best-bid-or-ask-price
627
636
  * @see https://www.gate.io/docs/developers/apiv4/ws/en/#order-book-channel
637
+ * @see https://www.gate.com/docs/developers/options/ws/en/#best-bid-or-ask-price
628
638
  * @description watches best bid & ask for symbols
629
639
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
630
640
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -714,6 +724,10 @@ class gate extends gate$1["default"] {
714
724
  /**
715
725
  * @method
716
726
  * @name gate#watchTrades
727
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#public-trades-channel
728
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#trades-api
729
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#trades-api
730
+ * @see https://www.gate.com/docs/developers/options/ws/en/#public-contract-trades-channel
717
731
  * @description get the list of most recent trades for a particular symbol
718
732
  * @param {string} symbol unified symbol of the market to fetch trades for
719
733
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -727,6 +741,10 @@ class gate extends gate$1["default"] {
727
741
  /**
728
742
  * @method
729
743
  * @name gate#watchTradesForSymbols
744
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#public-trades-channel
745
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#trades-api
746
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#trades-api
747
+ * @see https://www.gate.com/docs/developers/options/ws/en/#public-contract-trades-channel
730
748
  * @description get the list of most recent trades for a particular symbol
731
749
  * @param {string[]} symbols unified symbol of the market to fetch trades for
732
750
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -830,6 +848,9 @@ class gate extends gate$1["default"] {
830
848
  /**
831
849
  * @method
832
850
  * @name gate#watchOHLCV
851
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#candlesticks-channel
852
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#candlesticks-api
853
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#candlesticks-api
833
854
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
834
855
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
835
856
  * @param {string} timeframe the length of time each candle represents
@@ -840,6 +861,7 @@ class gate extends gate$1["default"] {
840
861
  */
841
862
  async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
842
863
  await this.loadMarkets();
864
+ // todo add options support
843
865
  const market = this.market(symbol);
844
866
  symbol = market['symbol'];
845
867
  const marketId = market['id'];
@@ -914,6 +936,10 @@ class gate extends gate$1["default"] {
914
936
  /**
915
937
  * @method
916
938
  * @name gate#watchMyTrades
939
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#user-trades-channel
940
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#user-trades-api
941
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#user-trades-api
942
+ * @see https://www.gate.com/docs/developers/options/ws/en/#user-trades-channel
917
943
  * @description watches information on multiple trades made by the user
918
944
  * @param {string} symbol unified market symbol of the market trades were made in
919
945
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -1007,6 +1033,10 @@ class gate extends gate$1["default"] {
1007
1033
  /**
1008
1034
  * @method
1009
1035
  * @name gate#watchBalance
1036
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#spot-balance-channel
1037
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#balances-api
1038
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#balances-api
1039
+ * @see https://www.gate.com/docs/developers/options/ws/en/#balances-channel
1010
1040
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
1011
1041
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1012
1042
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure}
@@ -1027,6 +1057,7 @@ class gate extends gate$1["default"] {
1027
1057
  'swap': 'futures',
1028
1058
  'option': 'options',
1029
1059
  });
1060
+ // todo: add correct margin support
1030
1061
  const channel = channelType + '.balances';
1031
1062
  const messageHash = type + '.balance';
1032
1063
  return await this.subscribePrivate(url, messageHash, undefined, channel, params, requiresUid);
@@ -1292,6 +1323,10 @@ class gate extends gate$1["default"] {
1292
1323
  /**
1293
1324
  * @method
1294
1325
  * @name gate#watchOrders
1326
+ * @see https://www.gate.com/docs/developers/apiv4/ws/en/#orders-channel
1327
+ * @see https://www.gate.com/docs/developers/futures/ws/en/#orders-api
1328
+ * @see https://www.gate.com/docs/developers/delivery/ws/en/#orders-api
1329
+ * @see https://www.gate.com/docs/developers/options/ws/en/#orders-channel
1295
1330
  * @description watches information on multiple orders made by the user
1296
1331
  * @param {string} symbol unified market symbol of the market orders were made in
1297
1332
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1687,6 +1722,7 @@ class gate extends gate$1["default"] {
1687
1722
  'balance': this.handleBalanceSubscription,
1688
1723
  'spot.order_book_update': this.handleOrderBookSubscription,
1689
1724
  'futures.order_book_update': this.handleOrderBookSubscription,
1725
+ 'options.order_book_update': this.handleOrderBookSubscription,
1690
1726
  };
1691
1727
  const id = this.safeString(message, 'id');
1692
1728
  if (channel in methods) {