ccxt 4.3.97 → 4.3.98

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.3.98';
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,
@@ -4017,7 +4017,7 @@ class gate extends gate$1 {
4017
4017
  request['settle'] = market['settleId']; // filled in prepareRequest above
4018
4018
  }
4019
4019
  if (isMarketOrder) {
4020
- request['price'] = price; // set to 0 for market orders
4020
+ request['price'] = '0'; // set to 0 for market orders
4021
4021
  }
4022
4022
  else {
4023
4023
  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);
@@ -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
  }
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.3.97";
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.3.98';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
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,
package/js/src/gate.js CHANGED
@@ -4020,7 +4020,7 @@ export default class gate extends Exchange {
4020
4020
  request['settle'] = market['settleId']; // filled in prepareRequest above
4021
4021
  }
4022
4022
  if (isMarketOrder) {
4023
- request['price'] = price; // set to 0 for market orders
4023
+ request['price'] = '0'; // set to 0 for market orders
4024
4024
  }
4025
4025
  else {
4026
4026
  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);
@@ -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.3.98",
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",