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/js/src/bitget.js CHANGED
@@ -1233,6 +1233,8 @@ export default class bitget extends Exchange {
1233
1233
  '40714': ExchangeError,
1234
1234
  '40762': InsufficientFunds,
1235
1235
  '40768': OrderNotFound,
1236
+ '40808': InvalidOrder,
1237
+ '41103': InvalidOrder,
1236
1238
  '41114': OnMaintenance,
1237
1239
  '43011': InvalidOrder,
1238
1240
  '43012': InsufficientFunds,
@@ -1309,10 +1311,11 @@ export default class bitget extends Exchange {
1309
1311
  },
1310
1312
  'precisionMode': TICK_SIZE,
1311
1313
  'commonCurrencies': {
1312
- 'JADE': 'Jade Protocol',
1314
+ 'APX': 'AstroPepeX',
1313
1315
  'DEGEN': 'DegenReborn',
1316
+ 'JADE': 'Jade Protocol',
1317
+ 'OMNI': 'omni',
1314
1318
  'TONCOIN': 'TON',
1315
- 'OMNI': 'omni', // conflict with Omni Network
1316
1319
  },
1317
1320
  'options': {
1318
1321
  'timeframes': {
package/js/src/gate.js CHANGED
@@ -610,6 +610,7 @@ export default class gate extends Exchange {
610
610
  'MPH': 'MORPHER',
611
611
  'POINT': 'GATEPOINT',
612
612
  'RAI': 'RAIREFLEXINDEX',
613
+ 'RED': 'RedLang',
613
614
  'SBTC': 'SUPERBITCOIN',
614
615
  'TNC': 'TRINITYNETWORKCREDIT',
615
616
  'VAI': 'VAIOT',
@@ -4020,7 +4021,7 @@ export default class gate extends Exchange {
4020
4021
  request['settle'] = market['settleId']; // filled in prepareRequest above
4021
4022
  }
4022
4023
  if (isMarketOrder) {
4023
- request['price'] = price; // set to 0 for market orders
4024
+ request['price'] = '0'; // set to 0 for market orders
4024
4025
  }
4025
4026
  else {
4026
4027
  request['price'] = (price === 0) ? '0' : this.priceToPrecision(symbol, price);
package/js/src/kucoin.js CHANGED
@@ -3831,7 +3831,7 @@ export default class kucoin extends Exchange {
3831
3831
  params = this.omit(params, 'type');
3832
3832
  let hf = undefined;
3833
3833
  [hf, params] = this.handleHfAndParams(params);
3834
- if (hf) {
3834
+ if (hf && (type !== 'main')) {
3835
3835
  type = 'trade_hf';
3836
3836
  }
3837
3837
  const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
@@ -7,21 +7,30 @@ export default class hyperliquid extends hyperliquidRest {
7
7
  createOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
8
8
  editOrderWs(id: string, symbol: string, type: string, side: string, amount?: Num, price?: Num, params?: {}): Promise<Order>;
9
9
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
10
+ unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
10
11
  handleOrderBook(client: any, message: any): void;
11
12
  watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
13
+ unWatchTickers(symbols?: Strings, params?: {}): Promise<any>;
12
14
  watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
13
15
  handleWsTickers(client: Client, message: any): void;
14
16
  parseWsTicker(rawTicker: any, market?: Market): Ticker;
15
17
  handleMyTrades(client: Client, message: any): void;
16
18
  watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
19
+ unWatchTrades(symbol: string, params?: {}): Promise<any>;
17
20
  handleTrades(client: Client, message: any): void;
18
21
  parseWsTrade(trade: Dict, market?: Market): Trade;
19
22
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
23
+ unWatchOHLCV(symbol: string, timeframe?: string, params?: {}): Promise<any>;
20
24
  handleOHLCV(client: Client, message: any): void;
21
- handleWsPost(client: Client, message: any): void;
25
+ handleWsPost(client: Client, message: Dict): void;
22
26
  watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
23
27
  handleOrder(client: Client, message: any): void;
24
28
  handleErrorMessage(client: Client, message: any): boolean;
29
+ handleOrderBookUnsubscription(client: Client, subscription: Dict): void;
30
+ handleTradesUnsubscription(client: Client, subscription: Dict): void;
31
+ handleTickersUnsubscription(client: Client, subscription: Dict): void;
32
+ handleOHLCVUnsubscription(client: Client, subscription: Dict): void;
33
+ handleSubscriptionResponse(client: Client, message: any): void;
25
34
  handleMessage(client: Client, message: any): void;
26
35
  ping(client: Client): {
27
36
  method: string;
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import hyperliquidRest from '../hyperliquid.js';
9
- import { ExchangeError } from '../base/errors.js';
9
+ import { ExchangeError, UnsubscribeError } from '../base/errors.js';
10
10
  import { ArrayCache, ArrayCacheByTimestamp, ArrayCacheBySymbolById } from '../base/ws/Cache.js';
11
11
  // ---------------------------------------------------------------------------
12
12
  export default class hyperliquid extends hyperliquidRest {
@@ -163,6 +163,34 @@ export default class hyperliquid extends hyperliquidRest {
163
163
  const orderbook = await this.watch(url, messageHash, message, messageHash);
164
164
  return orderbook.limit();
165
165
  }
166
+ async unWatchOrderBook(symbol, params = {}) {
167
+ /**
168
+ * @method
169
+ * @name hyperliquid#unWatchOrderBook
170
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
171
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
172
+ * @param {string} symbol unified symbol of the market to fetch the order book for
173
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
174
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
175
+ */
176
+ await this.loadMarkets();
177
+ const market = this.market(symbol);
178
+ symbol = market['symbol'];
179
+ const subMessageHash = 'orderbook:' + symbol;
180
+ const messageHash = 'unsubscribe:' + subMessageHash;
181
+ const url = this.urls['api']['ws']['public'];
182
+ const id = this.nonce().toString();
183
+ const request = {
184
+ 'id': id,
185
+ 'method': 'unsubscribe',
186
+ 'subscription': {
187
+ 'type': 'l2Book',
188
+ 'coin': market['swap'] ? market['base'] : market['id'],
189
+ },
190
+ };
191
+ const message = this.extend(request, params);
192
+ return await this.watch(url, messageHash, message, messageHash);
193
+ }
166
194
  handleOrderBook(client, message) {
167
195
  //
168
196
  // {
@@ -237,6 +265,30 @@ export default class hyperliquid extends hyperliquidRest {
237
265
  }
238
266
  return this.tickers;
239
267
  }
268
+ async unWatchTickers(symbols = undefined, params = {}) {
269
+ /**
270
+ * @method
271
+ * @name hyperliquid#unWatchTickers
272
+ * @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
273
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
274
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
275
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
276
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
277
+ */
278
+ await this.loadMarkets();
279
+ symbols = this.marketSymbols(symbols, undefined, true);
280
+ const subMessageHash = 'tickers';
281
+ const messageHash = 'unsubscribe:' + subMessageHash;
282
+ const url = this.urls['api']['ws']['public'];
283
+ const request = {
284
+ 'method': 'unsubscribe',
285
+ 'subscription': {
286
+ 'type': 'webData2',
287
+ 'user': '0x0000000000000000000000000000000000000000',
288
+ },
289
+ };
290
+ return await this.watch(url, messageHash, this.extend(request, params), messageHash);
291
+ }
240
292
  async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
241
293
  /**
242
294
  * @method
@@ -406,17 +458,17 @@ export default class hyperliquid extends hyperliquidRest {
406
458
  client.resolve(trades, messageHash);
407
459
  }
408
460
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
409
- /**
410
- * @method
411
- * @name hyperliquid#watchTrades
412
- * @description watches information on multiple trades made in a market
413
- * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
414
- * @param {string} symbol unified market symbol of the market trades were made in
415
- * @param {int} [since] the earliest time in ms to fetch trades for
416
- * @param {int} [limit] the maximum number of trade structures to retrieve
417
- * @param {object} [params] extra parameters specific to the exchange API endpoint
418
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
419
- */
461
+ // s
462
+ // @method
463
+ // @name hyperliquid#watchTrades
464
+ // @description watches information on multiple trades made in a market
465
+ // @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
466
+ // @param {string} symbol unified market symbol of the market trades were made in
467
+ // @param {int} [since] the earliest time in ms to fetch trades for
468
+ // @param {int} [limit] the maximum number of trade structures to retrieve
469
+ // @param {object} [params] extra parameters specific to the exchange API endpoint
470
+ // @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
471
+ //
420
472
  await this.loadMarkets();
421
473
  const market = this.market(symbol);
422
474
  symbol = market['symbol'];
@@ -436,6 +488,32 @@ export default class hyperliquid extends hyperliquidRest {
436
488
  }
437
489
  return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
438
490
  }
491
+ async unWatchTrades(symbol, params = {}) {
492
+ /**
493
+ * @method
494
+ * @name hyperliquid#unWatchTrades
495
+ * @description unWatches information on multiple trades made in a market
496
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
497
+ * @param {string} symbol unified market symbol of the market trades were made in
498
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
499
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
500
+ */
501
+ await this.loadMarkets();
502
+ const market = this.market(symbol);
503
+ symbol = market['symbol'];
504
+ const subMessageHash = 'trade:' + symbol;
505
+ const messageHash = 'unsubscribe:' + subMessageHash;
506
+ const url = this.urls['api']['ws']['public'];
507
+ const request = {
508
+ 'method': 'unsubscribe',
509
+ 'subscription': {
510
+ 'type': 'trades',
511
+ 'coin': market['swap'] ? market['base'] : market['id'],
512
+ },
513
+ };
514
+ const message = this.extend(request, params);
515
+ return await this.watch(url, messageHash, message, messageHash);
516
+ }
439
517
  handleTrades(client, message) {
440
518
  //
441
519
  // {
@@ -569,6 +647,34 @@ export default class hyperliquid extends hyperliquidRest {
569
647
  }
570
648
  return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
571
649
  }
650
+ async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
651
+ /**
652
+ * @method
653
+ * @name hyperliquid#unWatchOHLCV
654
+ * @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
655
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
656
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
657
+ * @param {string} timeframe the length of time each candle represents
658
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
659
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
660
+ */
661
+ await this.loadMarkets();
662
+ const market = this.market(symbol);
663
+ symbol = market['symbol'];
664
+ const url = this.urls['api']['ws']['public'];
665
+ const request = {
666
+ 'method': 'unsubscribe',
667
+ 'subscription': {
668
+ 'type': 'candle',
669
+ 'coin': market['swap'] ? market['base'] : market['id'],
670
+ 'interval': timeframe,
671
+ },
672
+ };
673
+ const subMessageHash = 'candles:' + timeframe + ':' + symbol;
674
+ const messagehash = 'unsubscribe:' + subMessageHash;
675
+ const message = this.extend(request, params);
676
+ return await this.watch(url, messagehash, message, messagehash);
677
+ }
572
678
  handleOHLCV(client, message) {
573
679
  //
574
680
  // {
@@ -724,7 +830,153 @@ export default class hyperliquid extends hyperliquidRest {
724
830
  return false;
725
831
  }
726
832
  }
833
+ handleOrderBookUnsubscription(client, subscription) {
834
+ //
835
+ // "subscription":{
836
+ // "type":"l2Book",
837
+ // "coin":"BTC",
838
+ // "nSigFigs":5,
839
+ // "mantissa":null
840
+ // }
841
+ //
842
+ const coin = this.safeString(subscription, 'coin');
843
+ const marketId = this.coinToMarketId(coin);
844
+ const symbol = this.safeSymbol(marketId);
845
+ const subMessageHash = 'orderbook:' + symbol;
846
+ const messageHash = 'unsubscribe:' + subMessageHash;
847
+ if (messageHash in client.subscriptions) {
848
+ delete client.subscriptions[messageHash];
849
+ }
850
+ if (subMessageHash in client.subscriptions) {
851
+ delete client.subscriptions[subMessageHash];
852
+ }
853
+ const error = new UnsubscribeError(this.id + ' ' + subMessageHash);
854
+ client.reject(error, subMessageHash);
855
+ client.resolve(true, messageHash);
856
+ if (symbol in this.orderbooks) {
857
+ delete this.orderbooks[symbol];
858
+ }
859
+ }
860
+ handleTradesUnsubscription(client, subscription) {
861
+ //
862
+ const coin = this.safeString(subscription, 'coin');
863
+ const marketId = this.coinToMarketId(coin);
864
+ const symbol = this.safeSymbol(marketId);
865
+ const subMessageHash = 'trade:' + symbol;
866
+ const messageHash = 'unsubscribe:' + subMessageHash;
867
+ if (messageHash in client.subscriptions) {
868
+ delete client.subscriptions[messageHash];
869
+ }
870
+ if (subMessageHash in client.subscriptions) {
871
+ delete client.subscriptions[subMessageHash];
872
+ }
873
+ const error = new UnsubscribeError(this.id + ' ' + subMessageHash);
874
+ client.reject(error, subMessageHash);
875
+ client.resolve(true, messageHash);
876
+ if (symbol in this.trades) {
877
+ delete this.trades[symbol];
878
+ }
879
+ }
880
+ handleTickersUnsubscription(client, subscription) {
881
+ //
882
+ const subMessageHash = 'tickers';
883
+ const messageHash = 'unsubscribe:' + subMessageHash;
884
+ if (messageHash in client.subscriptions) {
885
+ delete client.subscriptions[messageHash];
886
+ }
887
+ if (subMessageHash in client.subscriptions) {
888
+ delete client.subscriptions[subMessageHash];
889
+ }
890
+ const error = new UnsubscribeError(this.id + ' ' + subMessageHash);
891
+ client.reject(error, subMessageHash);
892
+ client.resolve(true, messageHash);
893
+ const symbols = Object.keys(this.tickers);
894
+ for (let i = 0; i < symbols.length; i++) {
895
+ delete this.tickers[symbols[i]];
896
+ }
897
+ }
898
+ handleOHLCVUnsubscription(client, subscription) {
899
+ const coin = this.safeString(subscription, 'coin');
900
+ const marketId = this.coinToMarketId(coin);
901
+ const symbol = this.safeSymbol(marketId);
902
+ const interval = this.safeString(subscription, 'interval');
903
+ const timeframe = this.findTimeframe(interval);
904
+ const subMessageHash = 'candles:' + timeframe + ':' + symbol;
905
+ const messageHash = 'unsubscribe:' + subMessageHash;
906
+ if (messageHash in client.subscriptions) {
907
+ delete client.subscriptions[messageHash];
908
+ }
909
+ if (subMessageHash in client.subscriptions) {
910
+ delete client.subscriptions[subMessageHash];
911
+ }
912
+ const error = new UnsubscribeError(this.id + ' ' + subMessageHash);
913
+ client.reject(error, subMessageHash);
914
+ client.resolve(true, messageHash);
915
+ if (symbol in this.ohlcvs) {
916
+ if (timeframe in this.ohlcvs[symbol]) {
917
+ delete this.ohlcvs[symbol][timeframe];
918
+ }
919
+ }
920
+ }
921
+ handleSubscriptionResponse(client, message) {
922
+ // {
923
+ // "channel":"subscriptionResponse",
924
+ // "data":{
925
+ // "method":"unsubscribe",
926
+ // "subscription":{
927
+ // "type":"l2Book",
928
+ // "coin":"BTC",
929
+ // "nSigFigs":5,
930
+ // "mantissa":null
931
+ // }
932
+ // }
933
+ // }
934
+ //
935
+ // {
936
+ // "channel":"subscriptionResponse",
937
+ // "data":{
938
+ // "method":"unsubscribe",
939
+ // "subscription":{
940
+ // "type":"trades",
941
+ // "coin":"PURR/USDC"
942
+ // }
943
+ // }
944
+ // }
945
+ //
946
+ const data = this.safeDict(message, 'data', {});
947
+ const method = this.safeString(data, 'method');
948
+ if (method === 'unsubscribe') {
949
+ const subscription = this.safeDict(data, 'subscription', {});
950
+ const type = this.safeString(subscription, 'type');
951
+ if (type === 'l2Book') {
952
+ this.handleOrderBookUnsubscription(client, subscription);
953
+ }
954
+ else if (type === 'trades') {
955
+ this.handleTradesUnsubscription(client, subscription);
956
+ }
957
+ else if (type === 'webData2') {
958
+ this.handleTickersUnsubscription(client, subscription);
959
+ }
960
+ else if (type === 'candle') {
961
+ this.handleOHLCVUnsubscription(client, subscription);
962
+ }
963
+ }
964
+ }
727
965
  handleMessage(client, message) {
966
+ //
967
+ // {
968
+ // "channel":"subscriptionResponse",
969
+ // "data":{
970
+ // "method":"unsubscribe",
971
+ // "subscription":{
972
+ // "type":"l2Book",
973
+ // "coin":"BTC",
974
+ // "nSigFigs":5,
975
+ // "mantissa":null
976
+ // }
977
+ // }
978
+ // }
979
+ //
728
980
  if (this.handleErrorMessage(client, message)) {
729
981
  return;
730
982
  }
@@ -738,6 +990,7 @@ export default class hyperliquid extends hyperliquidRest {
738
990
  'userFills': this.handleMyTrades,
739
991
  'webData2': this.handleWsTickers,
740
992
  'post': this.handleWsPost,
993
+ 'subscriptionResponse': this.handleSubscriptionResponse,
741
994
  };
742
995
  const exacMethod = this.safeValue(methods, topic);
743
996
  if (exacMethod !== undefined) {
@@ -115,7 +115,7 @@ export default class kraken extends krakenRest {
115
115
  /**
116
116
  * @method
117
117
  * @name kraken#createOrderWs
118
- * @see https://docs.kraken.com/websockets/#message-addOrder
118
+ * @see https://docs.kraken.com/api/docs/websocket-v1/addorder
119
119
  * @description create a trade order
120
120
  * @param {string} symbol unified symbol of the market to create an order in
121
121
  * @param {string} type 'market' or 'limit'
@@ -172,7 +172,7 @@ export default class kraken extends krakenRest {
172
172
  * @method
173
173
  * @name kraken#editOrderWs
174
174
  * @description edit a trade order
175
- * @see https://docs.kraken.com/websockets/#message-editOrder
175
+ * @see https://docs.kraken.com/api/docs/websocket-v1/editorder
176
176
  * @param {string} id order id
177
177
  * @param {string} symbol unified symbol of the market to create an order in
178
178
  * @param {string} type 'market' or 'limit'
@@ -205,7 +205,7 @@ export default class kraken extends krakenRest {
205
205
  /**
206
206
  * @method
207
207
  * @name kraken#cancelOrdersWs
208
- * @see https://docs.kraken.com/websockets/#message-cancelOrder
208
+ * @see https://docs.kraken.com/api/docs/websocket-v1/cancelorder
209
209
  * @description cancel multiple orders
210
210
  * @param {string[]} ids order ids
211
211
  * @param {string} symbol unified market symbol, default is undefined
@@ -229,7 +229,7 @@ export default class kraken extends krakenRest {
229
229
  /**
230
230
  * @method
231
231
  * @name kraken#cancelOrderWs
232
- * @see https://docs.kraken.com/websockets/#message-cancelOrder
232
+ * @see https://docs.kraken.com/api/docs/websocket-v1/cancelorder
233
233
  * @description cancels an open order
234
234
  * @param {string} id order id
235
235
  * @param {string} symbol unified symbol of the market the order was made in
@@ -267,7 +267,7 @@ export default class kraken extends krakenRest {
267
267
  /**
268
268
  * @method
269
269
  * @name kraken#cancelAllOrdersWs
270
- * @see https://docs.kraken.com/websockets/#message-cancelAll
270
+ * @see https://docs.kraken.com/api/docs/websocket-v1/cancelall
271
271
  * @description cancel all open orders
272
272
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
273
273
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -469,6 +469,7 @@ export default class kraken extends krakenRest {
469
469
  * @method
470
470
  * @name kraken#watchTicker
471
471
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
472
+ * @see https://docs.kraken.com/api/docs/websocket-v1/ticker
472
473
  * @param {string} symbol unified symbol of the market to fetch the ticker for
473
474
  * @param {object} [params] extra parameters specific to the exchange API endpoint
474
475
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -483,6 +484,7 @@ export default class kraken extends krakenRest {
483
484
  * @method
484
485
  * @name kraken#watchTickers
485
486
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
487
+ * @see https://docs.kraken.com/api/docs/websocket-v1/ticker
486
488
  * @param {string} symbol unified symbol of the market to fetch the ticker for
487
489
  * @param {object} [params] extra parameters specific to the exchange API endpoint
488
490
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -502,7 +504,7 @@ export default class kraken extends krakenRest {
502
504
  * @method
503
505
  * @name kraken#watchTrades
504
506
  * @description get the list of most recent trades for a particular symbol
505
- * @see https://docs.kraken.com/websockets/#message-trade
507
+ * @see https://docs.kraken.com/api/docs/websocket-v1/trade
506
508
  * @param {string} symbol unified symbol of the market to fetch trades for
507
509
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
508
510
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -515,7 +517,7 @@ export default class kraken extends krakenRest {
515
517
  /**
516
518
  * @method
517
519
  * @name kraken#watchTradesForSymbols
518
- * @see https://docs.kraken.com/websockets/#message-trade
520
+ * @see https://docs.kraken.com/api/docs/websocket-v1/trade
519
521
  * @description get the list of most recent trades for a list of symbols
520
522
  * @param {string[]} symbols unified symbol of the market to fetch trades for
521
523
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -536,7 +538,7 @@ export default class kraken extends krakenRest {
536
538
  * @method
537
539
  * @name kraken#watchOrderBook
538
540
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
539
- * @see https://docs.kraken.com/websockets/#message-book
541
+ * @see https://docs.kraken.com/api/docs/websocket-v1/book
540
542
  * @param {string} symbol unified symbol of the market to fetch the order book for
541
543
  * @param {int} [limit] the maximum amount of order book entries to return
542
544
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -549,7 +551,7 @@ export default class kraken extends krakenRest {
549
551
  * @method
550
552
  * @name kraken#watchOrderBookForSymbols
551
553
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
552
- * @see https://docs.kraken.com/websockets/#message-book
554
+ * @see https://docs.kraken.com/api/docs/websocket-v1/book
553
555
  * @param {string[]} symbols unified array of symbols
554
556
  * @param {int} [limit] the maximum amount of order book entries to return
555
557
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -574,6 +576,7 @@ export default class kraken extends krakenRest {
574
576
  * @method
575
577
  * @name kraken#watchOHLCV
576
578
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
579
+ * @see https://docs.kraken.com/api/docs/websocket-v1/ohlc
577
580
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
578
581
  * @param {string} timeframe the length of time each candle represents
579
582
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -883,6 +886,7 @@ export default class kraken extends krakenRest {
883
886
  * @method
884
887
  * @name kraken#watchMyTrades
885
888
  * @description watches information on multiple trades made by the user
889
+ * @see https://docs.kraken.com/api/docs/websocket-v1/owntrades
886
890
  * @param {string} symbol unified market symbol of the market trades were made in
887
891
  * @param {int} [since] the earliest time in ms to fetch trades for
888
892
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -1043,7 +1047,7 @@ export default class kraken extends krakenRest {
1043
1047
  /**
1044
1048
  * @method
1045
1049
  * @name kraken#watchOrders
1046
- * @see https://docs.kraken.com/websockets/#message-openOrders
1050
+ * @see https://docs.kraken.com/api/docs/websocket-v1/openorders
1047
1051
  * @description watches information on multiple orders made by the user
1048
1052
  * @param {string} symbol unified market symbol of the market orders were made in
1049
1053
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -24,7 +24,9 @@ export default class kucoin extends kucoinRest {
24
24
  unWatchTrades(symbol: string, params?: {}): Promise<any>;
25
25
  handleTrade(client: Client, message: any): void;
26
26
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
27
+ unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
27
28
  watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
29
+ unWatchOrderBookForSymbols(symbols: string[], params?: {}): Promise<any>;
28
30
  handleOrderBook(client: Client, message: any): void;
29
31
  getCacheIndex(orderbook: any, cache: any): any;
30
32
  handleDelta(orderbook: any, delta: any): void;
@@ -641,6 +641,22 @@ export default class kucoin extends kucoinRest {
641
641
  //
642
642
  return await this.watchOrderBookForSymbols([symbol], limit, params);
643
643
  }
644
+ async unWatchOrderBook(symbol, params = {}) {
645
+ /**
646
+ * @method
647
+ * @name kucoin#unWatchOrderBook
648
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data
649
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data
650
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders
651
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders
652
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
653
+ * @param {string} symbol unified symbol of the market to fetch the order book for
654
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
655
+ * @param {string} [params.method] either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2'
656
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
657
+ */
658
+ return await this.unWatchOrderBookForSymbols([symbol], params);
659
+ }
644
660
  async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
645
661
  /**
646
662
  * @method
@@ -694,6 +710,49 @@ export default class kucoin extends kucoinRest {
694
710
  const orderbook = await this.subscribeMultiple(url, messageHashes, topic, subscriptionHashes, params, subscription);
695
711
  return orderbook.limit();
696
712
  }
713
+ async unWatchOrderBookForSymbols(symbols, params = {}) {
714
+ /**
715
+ * @method
716
+ * @name kucoin#unWatchOrderBookForSymbols
717
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data
718
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data
719
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders
720
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders
721
+ * @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
722
+ * @param {string[]} symbols unified array of symbols
723
+ * @param {int} [limit] the maximum amount of order book entries to return
724
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
725
+ * @param {string} [params.method] either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2'
726
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
727
+ */
728
+ const limit = this.safeInteger(params, 'limit');
729
+ params = this.omit(params, 'limit');
730
+ await this.loadMarkets();
731
+ symbols = this.marketSymbols(symbols, undefined, false);
732
+ const marketIds = this.marketIds(symbols);
733
+ const url = await this.negotiate(false);
734
+ let method = undefined;
735
+ [method, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'method', '/market/level2');
736
+ if ((limit === 5) || (limit === 50)) {
737
+ method = '/spotMarket/level2Depth' + limit.toString();
738
+ }
739
+ const topic = method + ':' + marketIds.join(',');
740
+ const messageHashes = [];
741
+ const subscriptionHashes = [];
742
+ for (let i = 0; i < symbols.length; i++) {
743
+ const symbol = symbols[i];
744
+ messageHashes.push('unsubscribe:orderbook:' + symbol);
745
+ subscriptionHashes.push('orderbook:' + symbol);
746
+ }
747
+ const subscription = {
748
+ 'messageHashes': messageHashes,
749
+ 'symbols': symbols,
750
+ 'unsubscribe': true,
751
+ 'topic': 'orderbook',
752
+ 'subMessageHashes': subscriptionHashes,
753
+ };
754
+ return await this.unSubscribeMultiple(url, messageHashes, topic, messageHashes, params, subscription);
755
+ }
697
756
  handleOrderBook(client, message) {
698
757
  //
699
758
  // initial snapshot is fetched with ccxt's fetchOrderBook
@@ -1626,20 +1626,19 @@ export default class whitebit extends Exchange {
1626
1626
  * @name whitebit#fetchOpenOrders
1627
1627
  * @description fetch all unfilled currently open orders
1628
1628
  * @see https://docs.whitebit.com/private/http-trade-v4/#query-unexecutedactive-orders
1629
- * @param {string} symbol unified market symbol
1629
+ * @param {string} [symbol] unified market symbol
1630
1630
  * @param {int} [since] the earliest time in ms to fetch open orders for
1631
1631
  * @param {int} [limit] the maximum number of open order structures to retrieve
1632
1632
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1633
1633
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1634
1634
  */
1635
- if (symbol === undefined) {
1636
- throw new ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument');
1637
- }
1638
1635
  await this.loadMarkets();
1639
- const market = this.market(symbol);
1640
- const request = {
1641
- 'market': market['id'],
1642
- };
1636
+ let market = undefined;
1637
+ const request = {};
1638
+ if (symbol !== undefined) {
1639
+ market = this.market(symbol);
1640
+ request['market'] = market['id'];
1641
+ }
1643
1642
  if (limit !== undefined) {
1644
1643
  request['limit'] = Math.min(limit, 100);
1645
1644
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.97",
3
+ "version": "4.4.1",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",