ccxt 4.3.97 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/ccxt.js CHANGED
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.3.97';
197
+ const version = '4.4.1';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -1230,6 +1230,8 @@ class bitget extends bitget$1 {
1230
1230
  '40714': errors.ExchangeError,
1231
1231
  '40762': errors.InsufficientFunds,
1232
1232
  '40768': errors.OrderNotFound,
1233
+ '40808': errors.InvalidOrder,
1234
+ '41103': errors.InvalidOrder,
1233
1235
  '41114': errors.OnMaintenance,
1234
1236
  '43011': errors.InvalidOrder,
1235
1237
  '43012': errors.InsufficientFunds,
@@ -1306,10 +1308,11 @@ class bitget extends bitget$1 {
1306
1308
  },
1307
1309
  'precisionMode': number.TICK_SIZE,
1308
1310
  'commonCurrencies': {
1309
- 'JADE': 'Jade Protocol',
1311
+ 'APX': 'AstroPepeX',
1310
1312
  'DEGEN': 'DegenReborn',
1313
+ 'JADE': 'Jade Protocol',
1314
+ 'OMNI': 'omni',
1311
1315
  'TONCOIN': 'TON',
1312
- 'OMNI': 'omni', // conflict with Omni Network
1313
1316
  },
1314
1317
  'options': {
1315
1318
  'timeframes': {
@@ -607,6 +607,7 @@ class gate extends gate$1 {
607
607
  'MPH': 'MORPHER',
608
608
  'POINT': 'GATEPOINT',
609
609
  'RAI': 'RAIREFLEXINDEX',
610
+ 'RED': 'RedLang',
610
611
  'SBTC': 'SUPERBITCOIN',
611
612
  'TNC': 'TRINITYNETWORKCREDIT',
612
613
  'VAI': 'VAIOT',
@@ -4017,7 +4018,7 @@ class gate extends gate$1 {
4017
4018
  request['settle'] = market['settleId']; // filled in prepareRequest above
4018
4019
  }
4019
4020
  if (isMarketOrder) {
4020
- request['price'] = price; // set to 0 for market orders
4021
+ request['price'] = '0'; // set to 0 for market orders
4021
4022
  }
4022
4023
  else {
4023
4024
  request['price'] = (price === 0) ? '0' : this.priceToPrecision(symbol, price);
@@ -3828,7 +3828,7 @@ class kucoin extends kucoin$1 {
3828
3828
  params = this.omit(params, 'type');
3829
3829
  let hf = undefined;
3830
3830
  [hf, params] = this.handleHfAndParams(params);
3831
- if (hf) {
3831
+ if (hf && (type !== 'main')) {
3832
3832
  type = 'trade_hf';
3833
3833
  }
3834
3834
  const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
@@ -160,6 +160,34 @@ class hyperliquid extends hyperliquid$1 {
160
160
  const orderbook = await this.watch(url, messageHash, message, messageHash);
161
161
  return orderbook.limit();
162
162
  }
163
+ async unWatchOrderBook(symbol, params = {}) {
164
+ /**
165
+ * @method
166
+ * @name hyperliquid#unWatchOrderBook
167
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
168
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
169
+ * @param {string} symbol unified symbol of the market to fetch the order book for
170
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
171
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
172
+ */
173
+ await this.loadMarkets();
174
+ const market = this.market(symbol);
175
+ symbol = market['symbol'];
176
+ const subMessageHash = 'orderbook:' + symbol;
177
+ const messageHash = 'unsubscribe:' + subMessageHash;
178
+ const url = this.urls['api']['ws']['public'];
179
+ const id = this.nonce().toString();
180
+ const request = {
181
+ 'id': id,
182
+ 'method': 'unsubscribe',
183
+ 'subscription': {
184
+ 'type': 'l2Book',
185
+ 'coin': market['swap'] ? market['base'] : market['id'],
186
+ },
187
+ };
188
+ const message = this.extend(request, params);
189
+ return await this.watch(url, messageHash, message, messageHash);
190
+ }
163
191
  handleOrderBook(client, message) {
164
192
  //
165
193
  // {
@@ -234,6 +262,30 @@ class hyperliquid extends hyperliquid$1 {
234
262
  }
235
263
  return this.tickers;
236
264
  }
265
+ async unWatchTickers(symbols = undefined, params = {}) {
266
+ /**
267
+ * @method
268
+ * @name hyperliquid#unWatchTickers
269
+ * @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
270
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
271
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
272
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
273
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
274
+ */
275
+ await this.loadMarkets();
276
+ symbols = this.marketSymbols(symbols, undefined, true);
277
+ const subMessageHash = 'tickers';
278
+ const messageHash = 'unsubscribe:' + subMessageHash;
279
+ const url = this.urls['api']['ws']['public'];
280
+ const request = {
281
+ 'method': 'unsubscribe',
282
+ 'subscription': {
283
+ 'type': 'webData2',
284
+ 'user': '0x0000000000000000000000000000000000000000',
285
+ },
286
+ };
287
+ return await this.watch(url, messageHash, this.extend(request, params), messageHash);
288
+ }
237
289
  async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
238
290
  /**
239
291
  * @method
@@ -403,17 +455,17 @@ class hyperliquid extends hyperliquid$1 {
403
455
  client.resolve(trades, messageHash);
404
456
  }
405
457
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
406
- /**
407
- * @method
408
- * @name hyperliquid#watchTrades
409
- * @description watches information on multiple trades made in a market
410
- * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
411
- * @param {string} symbol unified market symbol of the market trades were made in
412
- * @param {int} [since] the earliest time in ms to fetch trades for
413
- * @param {int} [limit] the maximum number of trade structures to retrieve
414
- * @param {object} [params] extra parameters specific to the exchange API endpoint
415
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
416
- */
458
+ // s
459
+ // @method
460
+ // @name hyperliquid#watchTrades
461
+ // @description watches information on multiple trades made in a market
462
+ // @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
463
+ // @param {string} symbol unified market symbol of the market trades were made in
464
+ // @param {int} [since] the earliest time in ms to fetch trades for
465
+ // @param {int} [limit] the maximum number of trade structures to retrieve
466
+ // @param {object} [params] extra parameters specific to the exchange API endpoint
467
+ // @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
468
+ //
417
469
  await this.loadMarkets();
418
470
  const market = this.market(symbol);
419
471
  symbol = market['symbol'];
@@ -433,6 +485,32 @@ class hyperliquid extends hyperliquid$1 {
433
485
  }
434
486
  return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
435
487
  }
488
+ async unWatchTrades(symbol, params = {}) {
489
+ /**
490
+ * @method
491
+ * @name hyperliquid#unWatchTrades
492
+ * @description unWatches information on multiple trades made in a market
493
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
494
+ * @param {string} symbol unified market symbol of the market trades were made in
495
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
496
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
497
+ */
498
+ await this.loadMarkets();
499
+ const market = this.market(symbol);
500
+ symbol = market['symbol'];
501
+ const subMessageHash = 'trade:' + symbol;
502
+ const messageHash = 'unsubscribe:' + subMessageHash;
503
+ const url = this.urls['api']['ws']['public'];
504
+ const request = {
505
+ 'method': 'unsubscribe',
506
+ 'subscription': {
507
+ 'type': 'trades',
508
+ 'coin': market['swap'] ? market['base'] : market['id'],
509
+ },
510
+ };
511
+ const message = this.extend(request, params);
512
+ return await this.watch(url, messageHash, message, messageHash);
513
+ }
436
514
  handleTrades(client, message) {
437
515
  //
438
516
  // {
@@ -566,6 +644,34 @@ class hyperliquid extends hyperliquid$1 {
566
644
  }
567
645
  return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
568
646
  }
647
+ async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
648
+ /**
649
+ * @method
650
+ * @name hyperliquid#unWatchOHLCV
651
+ * @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
652
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
653
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
654
+ * @param {string} timeframe the length of time each candle represents
655
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
656
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
657
+ */
658
+ await this.loadMarkets();
659
+ const market = this.market(symbol);
660
+ symbol = market['symbol'];
661
+ const url = this.urls['api']['ws']['public'];
662
+ const request = {
663
+ 'method': 'unsubscribe',
664
+ 'subscription': {
665
+ 'type': 'candle',
666
+ 'coin': market['swap'] ? market['base'] : market['id'],
667
+ 'interval': timeframe,
668
+ },
669
+ };
670
+ const subMessageHash = 'candles:' + timeframe + ':' + symbol;
671
+ const messagehash = 'unsubscribe:' + subMessageHash;
672
+ const message = this.extend(request, params);
673
+ return await this.watch(url, messagehash, message, messagehash);
674
+ }
569
675
  handleOHLCV(client, message) {
570
676
  //
571
677
  // {
@@ -721,7 +827,153 @@ class hyperliquid extends hyperliquid$1 {
721
827
  return false;
722
828
  }
723
829
  }
830
+ handleOrderBookUnsubscription(client, subscription) {
831
+ //
832
+ // "subscription":{
833
+ // "type":"l2Book",
834
+ // "coin":"BTC",
835
+ // "nSigFigs":5,
836
+ // "mantissa":null
837
+ // }
838
+ //
839
+ const coin = this.safeString(subscription, 'coin');
840
+ const marketId = this.coinToMarketId(coin);
841
+ const symbol = this.safeSymbol(marketId);
842
+ const subMessageHash = 'orderbook:' + symbol;
843
+ const messageHash = 'unsubscribe:' + subMessageHash;
844
+ if (messageHash in client.subscriptions) {
845
+ delete client.subscriptions[messageHash];
846
+ }
847
+ if (subMessageHash in client.subscriptions) {
848
+ delete client.subscriptions[subMessageHash];
849
+ }
850
+ const error = new errors.UnsubscribeError(this.id + ' ' + subMessageHash);
851
+ client.reject(error, subMessageHash);
852
+ client.resolve(true, messageHash);
853
+ if (symbol in this.orderbooks) {
854
+ delete this.orderbooks[symbol];
855
+ }
856
+ }
857
+ handleTradesUnsubscription(client, subscription) {
858
+ //
859
+ const coin = this.safeString(subscription, 'coin');
860
+ const marketId = this.coinToMarketId(coin);
861
+ const symbol = this.safeSymbol(marketId);
862
+ const subMessageHash = 'trade:' + symbol;
863
+ const messageHash = 'unsubscribe:' + subMessageHash;
864
+ if (messageHash in client.subscriptions) {
865
+ delete client.subscriptions[messageHash];
866
+ }
867
+ if (subMessageHash in client.subscriptions) {
868
+ delete client.subscriptions[subMessageHash];
869
+ }
870
+ const error = new errors.UnsubscribeError(this.id + ' ' + subMessageHash);
871
+ client.reject(error, subMessageHash);
872
+ client.resolve(true, messageHash);
873
+ if (symbol in this.trades) {
874
+ delete this.trades[symbol];
875
+ }
876
+ }
877
+ handleTickersUnsubscription(client, subscription) {
878
+ //
879
+ const subMessageHash = 'tickers';
880
+ const messageHash = 'unsubscribe:' + subMessageHash;
881
+ if (messageHash in client.subscriptions) {
882
+ delete client.subscriptions[messageHash];
883
+ }
884
+ if (subMessageHash in client.subscriptions) {
885
+ delete client.subscriptions[subMessageHash];
886
+ }
887
+ const error = new errors.UnsubscribeError(this.id + ' ' + subMessageHash);
888
+ client.reject(error, subMessageHash);
889
+ client.resolve(true, messageHash);
890
+ const symbols = Object.keys(this.tickers);
891
+ for (let i = 0; i < symbols.length; i++) {
892
+ delete this.tickers[symbols[i]];
893
+ }
894
+ }
895
+ handleOHLCVUnsubscription(client, subscription) {
896
+ const coin = this.safeString(subscription, 'coin');
897
+ const marketId = this.coinToMarketId(coin);
898
+ const symbol = this.safeSymbol(marketId);
899
+ const interval = this.safeString(subscription, 'interval');
900
+ const timeframe = this.findTimeframe(interval);
901
+ const subMessageHash = 'candles:' + timeframe + ':' + symbol;
902
+ const messageHash = 'unsubscribe:' + subMessageHash;
903
+ if (messageHash in client.subscriptions) {
904
+ delete client.subscriptions[messageHash];
905
+ }
906
+ if (subMessageHash in client.subscriptions) {
907
+ delete client.subscriptions[subMessageHash];
908
+ }
909
+ const error = new errors.UnsubscribeError(this.id + ' ' + subMessageHash);
910
+ client.reject(error, subMessageHash);
911
+ client.resolve(true, messageHash);
912
+ if (symbol in this.ohlcvs) {
913
+ if (timeframe in this.ohlcvs[symbol]) {
914
+ delete this.ohlcvs[symbol][timeframe];
915
+ }
916
+ }
917
+ }
918
+ handleSubscriptionResponse(client, message) {
919
+ // {
920
+ // "channel":"subscriptionResponse",
921
+ // "data":{
922
+ // "method":"unsubscribe",
923
+ // "subscription":{
924
+ // "type":"l2Book",
925
+ // "coin":"BTC",
926
+ // "nSigFigs":5,
927
+ // "mantissa":null
928
+ // }
929
+ // }
930
+ // }
931
+ //
932
+ // {
933
+ // "channel":"subscriptionResponse",
934
+ // "data":{
935
+ // "method":"unsubscribe",
936
+ // "subscription":{
937
+ // "type":"trades",
938
+ // "coin":"PURR/USDC"
939
+ // }
940
+ // }
941
+ // }
942
+ //
943
+ const data = this.safeDict(message, 'data', {});
944
+ const method = this.safeString(data, 'method');
945
+ if (method === 'unsubscribe') {
946
+ const subscription = this.safeDict(data, 'subscription', {});
947
+ const type = this.safeString(subscription, 'type');
948
+ if (type === 'l2Book') {
949
+ this.handleOrderBookUnsubscription(client, subscription);
950
+ }
951
+ else if (type === 'trades') {
952
+ this.handleTradesUnsubscription(client, subscription);
953
+ }
954
+ else if (type === 'webData2') {
955
+ this.handleTickersUnsubscription(client, subscription);
956
+ }
957
+ else if (type === 'candle') {
958
+ this.handleOHLCVUnsubscription(client, subscription);
959
+ }
960
+ }
961
+ }
724
962
  handleMessage(client, message) {
963
+ //
964
+ // {
965
+ // "channel":"subscriptionResponse",
966
+ // "data":{
967
+ // "method":"unsubscribe",
968
+ // "subscription":{
969
+ // "type":"l2Book",
970
+ // "coin":"BTC",
971
+ // "nSigFigs":5,
972
+ // "mantissa":null
973
+ // }
974
+ // }
975
+ // }
976
+ //
725
977
  if (this.handleErrorMessage(client, message)) {
726
978
  return;
727
979
  }
@@ -735,6 +987,7 @@ class hyperliquid extends hyperliquid$1 {
735
987
  'userFills': this.handleMyTrades,
736
988
  'webData2': this.handleWsTickers,
737
989
  'post': this.handleWsPost,
990
+ 'subscriptionResponse': this.handleSubscriptionResponse,
738
991
  };
739
992
  const exacMethod = this.safeValue(methods, topic);
740
993
  if (exacMethod !== undefined) {
@@ -112,7 +112,7 @@ class kraken extends kraken$1 {
112
112
  /**
113
113
  * @method
114
114
  * @name kraken#createOrderWs
115
- * @see https://docs.kraken.com/websockets/#message-addOrder
115
+ * @see https://docs.kraken.com/api/docs/websocket-v1/addorder
116
116
  * @description create a trade order
117
117
  * @param {string} symbol unified symbol of the market to create an order in
118
118
  * @param {string} type 'market' or 'limit'
@@ -169,7 +169,7 @@ class kraken extends kraken$1 {
169
169
  * @method
170
170
  * @name kraken#editOrderWs
171
171
  * @description edit a trade order
172
- * @see https://docs.kraken.com/websockets/#message-editOrder
172
+ * @see https://docs.kraken.com/api/docs/websocket-v1/editorder
173
173
  * @param {string} id order id
174
174
  * @param {string} symbol unified symbol of the market to create an order in
175
175
  * @param {string} type 'market' or 'limit'
@@ -202,7 +202,7 @@ class kraken extends kraken$1 {
202
202
  /**
203
203
  * @method
204
204
  * @name kraken#cancelOrdersWs
205
- * @see https://docs.kraken.com/websockets/#message-cancelOrder
205
+ * @see https://docs.kraken.com/api/docs/websocket-v1/cancelorder
206
206
  * @description cancel multiple orders
207
207
  * @param {string[]} ids order ids
208
208
  * @param {string} symbol unified market symbol, default is undefined
@@ -226,7 +226,7 @@ class kraken extends kraken$1 {
226
226
  /**
227
227
  * @method
228
228
  * @name kraken#cancelOrderWs
229
- * @see https://docs.kraken.com/websockets/#message-cancelOrder
229
+ * @see https://docs.kraken.com/api/docs/websocket-v1/cancelorder
230
230
  * @description cancels an open order
231
231
  * @param {string} id order id
232
232
  * @param {string} symbol unified symbol of the market the order was made in
@@ -264,7 +264,7 @@ class kraken extends kraken$1 {
264
264
  /**
265
265
  * @method
266
266
  * @name kraken#cancelAllOrdersWs
267
- * @see https://docs.kraken.com/websockets/#message-cancelAll
267
+ * @see https://docs.kraken.com/api/docs/websocket-v1/cancelall
268
268
  * @description cancel all open orders
269
269
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
270
270
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -466,6 +466,7 @@ class kraken extends kraken$1 {
466
466
  * @method
467
467
  * @name kraken#watchTicker
468
468
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
469
+ * @see https://docs.kraken.com/api/docs/websocket-v1/ticker
469
470
  * @param {string} symbol unified symbol of the market to fetch the ticker for
470
471
  * @param {object} [params] extra parameters specific to the exchange API endpoint
471
472
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -480,6 +481,7 @@ class kraken extends kraken$1 {
480
481
  * @method
481
482
  * @name kraken#watchTickers
482
483
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
484
+ * @see https://docs.kraken.com/api/docs/websocket-v1/ticker
483
485
  * @param {string} symbol unified symbol of the market to fetch the ticker for
484
486
  * @param {object} [params] extra parameters specific to the exchange API endpoint
485
487
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -499,7 +501,7 @@ class kraken extends kraken$1 {
499
501
  * @method
500
502
  * @name kraken#watchTrades
501
503
  * @description get the list of most recent trades for a particular symbol
502
- * @see https://docs.kraken.com/websockets/#message-trade
504
+ * @see https://docs.kraken.com/api/docs/websocket-v1/trade
503
505
  * @param {string} symbol unified symbol of the market to fetch trades for
504
506
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
505
507
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -512,7 +514,7 @@ class kraken extends kraken$1 {
512
514
  /**
513
515
  * @method
514
516
  * @name kraken#watchTradesForSymbols
515
- * @see https://docs.kraken.com/websockets/#message-trade
517
+ * @see https://docs.kraken.com/api/docs/websocket-v1/trade
516
518
  * @description get the list of most recent trades for a list of symbols
517
519
  * @param {string[]} symbols unified symbol of the market to fetch trades for
518
520
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -533,7 +535,7 @@ class kraken extends kraken$1 {
533
535
  * @method
534
536
  * @name kraken#watchOrderBook
535
537
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
536
- * @see https://docs.kraken.com/websockets/#message-book
538
+ * @see https://docs.kraken.com/api/docs/websocket-v1/book
537
539
  * @param {string} symbol unified symbol of the market to fetch the order book for
538
540
  * @param {int} [limit] the maximum amount of order book entries to return
539
541
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -546,7 +548,7 @@ class kraken extends kraken$1 {
546
548
  * @method
547
549
  * @name kraken#watchOrderBookForSymbols
548
550
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
549
- * @see https://docs.kraken.com/websockets/#message-book
551
+ * @see https://docs.kraken.com/api/docs/websocket-v1/book
550
552
  * @param {string[]} symbols unified array of symbols
551
553
  * @param {int} [limit] the maximum amount of order book entries to return
552
554
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -571,6 +573,7 @@ class kraken extends kraken$1 {
571
573
  * @method
572
574
  * @name kraken#watchOHLCV
573
575
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
576
+ * @see https://docs.kraken.com/api/docs/websocket-v1/ohlc
574
577
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
575
578
  * @param {string} timeframe the length of time each candle represents
576
579
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -880,6 +883,7 @@ class kraken extends kraken$1 {
880
883
  * @method
881
884
  * @name kraken#watchMyTrades
882
885
  * @description watches information on multiple trades made by the user
886
+ * @see https://docs.kraken.com/api/docs/websocket-v1/owntrades
883
887
  * @param {string} symbol unified market symbol of the market trades were made in
884
888
  * @param {int} [since] the earliest time in ms to fetch trades for
885
889
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -1040,7 +1044,7 @@ class kraken extends kraken$1 {
1040
1044
  /**
1041
1045
  * @method
1042
1046
  * @name kraken#watchOrders
1043
- * @see https://docs.kraken.com/websockets/#message-openOrders
1047
+ * @see https://docs.kraken.com/api/docs/websocket-v1/openorders
1044
1048
  * @description watches information on multiple orders made by the user
1045
1049
  * @param {string} symbol unified market symbol of the market orders were made in
1046
1050
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -638,6 +638,22 @@ class kucoin extends kucoin$1 {
638
638
  //
639
639
  return await this.watchOrderBookForSymbols([symbol], limit, params);
640
640
  }
641
+ async unWatchOrderBook(symbol, params = {}) {
642
+ /**
643
+ * @method
644
+ * @name kucoin#unWatchOrderBook
645
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data
646
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data
647
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders
648
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders
649
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
650
+ * @param {string} symbol unified symbol of the market to fetch the order book for
651
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
652
+ * @param {string} [params.method] either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2'
653
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
654
+ */
655
+ return await this.unWatchOrderBookForSymbols([symbol], params);
656
+ }
641
657
  async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
642
658
  /**
643
659
  * @method
@@ -691,6 +707,49 @@ class kucoin extends kucoin$1 {
691
707
  const orderbook = await this.subscribeMultiple(url, messageHashes, topic, subscriptionHashes, params, subscription);
692
708
  return orderbook.limit();
693
709
  }
710
+ async unWatchOrderBookForSymbols(symbols, params = {}) {
711
+ /**
712
+ * @method
713
+ * @name kucoin#unWatchOrderBookForSymbols
714
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data
715
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data
716
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders
717
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders
718
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
719
+ * @param {string[]} symbols unified array of symbols
720
+ * @param {int} [limit] the maximum amount of order book entries to return
721
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
722
+ * @param {string} [params.method] either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2'
723
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
724
+ */
725
+ const limit = this.safeInteger(params, 'limit');
726
+ params = this.omit(params, 'limit');
727
+ await this.loadMarkets();
728
+ symbols = this.marketSymbols(symbols, undefined, false);
729
+ const marketIds = this.marketIds(symbols);
730
+ const url = await this.negotiate(false);
731
+ let method = undefined;
732
+ [method, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'method', '/market/level2');
733
+ if ((limit === 5) || (limit === 50)) {
734
+ method = '/spotMarket/level2Depth' + limit.toString();
735
+ }
736
+ const topic = method + ':' + marketIds.join(',');
737
+ const messageHashes = [];
738
+ const subscriptionHashes = [];
739
+ for (let i = 0; i < symbols.length; i++) {
740
+ const symbol = symbols[i];
741
+ messageHashes.push('unsubscribe:orderbook:' + symbol);
742
+ subscriptionHashes.push('orderbook:' + symbol);
743
+ }
744
+ const subscription = {
745
+ 'messageHashes': messageHashes,
746
+ 'symbols': symbols,
747
+ 'unsubscribe': true,
748
+ 'topic': 'orderbook',
749
+ 'subMessageHashes': subscriptionHashes,
750
+ };
751
+ return await this.unSubscribeMultiple(url, messageHashes, topic, messageHashes, params, subscription);
752
+ }
694
753
  handleOrderBook(client, message) {
695
754
  //
696
755
  // initial snapshot is fetched with ccxt's fetchOrderBook
@@ -1623,20 +1623,19 @@ class whitebit extends whitebit$1 {
1623
1623
  * @name whitebit#fetchOpenOrders
1624
1624
  * @description fetch all unfilled currently open orders
1625
1625
  * @see https://docs.whitebit.com/private/http-trade-v4/#query-unexecutedactive-orders
1626
- * @param {string} symbol unified market symbol
1626
+ * @param {string} [symbol] unified market symbol
1627
1627
  * @param {int} [since] the earliest time in ms to fetch open orders for
1628
1628
  * @param {int} [limit] the maximum number of open order structures to retrieve
1629
1629
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1630
1630
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1631
1631
  */
1632
- if (symbol === undefined) {
1633
- throw new errors.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
1634
- }
1635
1632
  await this.loadMarkets();
1636
- const market = this.market(symbol);
1637
- const request = {
1638
- 'market': market['id'],
1639
- };
1633
+ let market = undefined;
1634
+ const request = {};
1635
+ if (symbol !== undefined) {
1636
+ market = this.market(symbol);
1637
+ request['market'] = market['id'];
1638
+ }
1640
1639
  if (limit !== undefined) {
1641
1640
  request['limit'] = Math.min(limit, 100);
1642
1641
  }
@@ -351,7 +351,7 @@ async function run () {
351
351
  if (!isWsMethod && !raw) {
352
352
  log (exchange.iso8601 (end), 'iteration', i++, 'passed in', end - start, 'ms\n')
353
353
  }
354
- printHumanReadable (exchange, JSON.parse(JSON.stringify(result)))
354
+ printHumanReadable (exchange, result)
355
355
  if (!isWsMethod && !raw) {
356
356
  log (exchange.iso8601 (end), 'iteration', i, 'passed in', end - start, 'ms\n')
357
357
  }
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, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } 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.3.96";
7
+ declare const version = "4.4.0";
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.3.97';
41
+ const version = '4.4.1';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';