ccxt 4.3.15 → 4.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/alpaca.js +1 -0
  4. package/dist/cjs/src/ascendex.js +1 -0
  5. package/dist/cjs/src/base/Exchange.js +24 -15
  6. package/dist/cjs/src/base/Precise.js +3 -2
  7. package/dist/cjs/src/base/ws/WsClient.js +4 -0
  8. package/dist/cjs/src/binance.js +10 -9
  9. package/dist/cjs/src/bingx.js +1 -0
  10. package/dist/cjs/src/bitmex.js +1 -0
  11. package/dist/cjs/src/bybit.js +11 -7
  12. package/dist/cjs/src/coinbaseinternational.js +1 -0
  13. package/dist/cjs/src/coinmetro.js +1 -0
  14. package/dist/cjs/src/cryptocom.js +1 -0
  15. package/dist/cjs/src/currencycom.js +1 -0
  16. package/dist/cjs/src/deribit.js +1 -0
  17. package/dist/cjs/src/gate.js +1 -0
  18. package/dist/cjs/src/gemini.js +1 -0
  19. package/dist/cjs/src/hitbtc.js +1 -0
  20. package/dist/cjs/src/hollaex.js +1 -0
  21. package/dist/cjs/src/hyperliquid.js +5 -0
  22. package/dist/cjs/src/idex.js +1 -0
  23. package/dist/cjs/src/krakenfutures.js +1 -0
  24. package/dist/cjs/src/ndax.js +1 -0
  25. package/dist/cjs/src/okx.js +18 -0
  26. package/dist/cjs/src/phemex.js +1 -0
  27. package/dist/cjs/src/poloniex.js +1 -0
  28. package/dist/cjs/src/pro/bitfinex2.js +2 -0
  29. package/dist/cjs/src/pro/bitget.js +3 -0
  30. package/dist/cjs/src/pro/bybit.js +3 -3
  31. package/dist/cjs/src/pro/htx.js +2 -0
  32. package/dist/cjs/src/pro/independentreserve.js +2 -0
  33. package/dist/cjs/src/pro/kraken.js +2 -0
  34. package/dist/cjs/src/pro/okx.js +22 -22
  35. package/dist/cjs/src/probit.js +1 -0
  36. package/dist/cjs/src/wavesexchange.js +1 -0
  37. package/dist/cjs/src/woo.js +1 -0
  38. package/dist/cjs/src/zaif.js +1 -1
  39. package/js/ccxt.d.ts +1 -1
  40. package/js/ccxt.js +1 -1
  41. package/js/src/alpaca.js +1 -0
  42. package/js/src/ascendex.js +1 -0
  43. package/js/src/base/Exchange.d.ts +1 -0
  44. package/js/src/base/Exchange.js +24 -15
  45. package/js/src/base/Precise.d.ts +19 -19
  46. package/js/src/base/Precise.js +3 -2
  47. package/js/src/base/errors.d.ts +37 -37
  48. package/js/src/base/ws/WsClient.d.ts +1 -1
  49. package/js/src/base/ws/WsClient.js +4 -0
  50. package/js/src/binance.js +10 -9
  51. package/js/src/bingx.js +1 -0
  52. package/js/src/bitmex.js +1 -0
  53. package/js/src/bybit.js +11 -7
  54. package/js/src/coinbaseinternational.js +1 -0
  55. package/js/src/coinmetro.js +1 -0
  56. package/js/src/cryptocom.js +1 -0
  57. package/js/src/currencycom.js +1 -0
  58. package/js/src/deribit.js +1 -0
  59. package/js/src/gate.js +1 -0
  60. package/js/src/gemini.js +1 -0
  61. package/js/src/hitbtc.js +1 -0
  62. package/js/src/hollaex.js +1 -0
  63. package/js/src/hyperliquid.js +5 -0
  64. package/js/src/idex.js +1 -0
  65. package/js/src/krakenfutures.js +1 -0
  66. package/js/src/kuna.d.ts +1 -1
  67. package/js/src/ndax.js +1 -0
  68. package/js/src/okx.js +19 -1
  69. package/js/src/phemex.js +1 -0
  70. package/js/src/poloniex.js +1 -0
  71. package/js/src/pro/bitfinex2.js +2 -0
  72. package/js/src/pro/bitget.js +3 -0
  73. package/js/src/pro/bybit.js +3 -3
  74. package/js/src/pro/htx.js +2 -0
  75. package/js/src/pro/independentreserve.js +2 -0
  76. package/js/src/pro/kraken.js +2 -0
  77. package/js/src/pro/okx.js +23 -23
  78. package/js/src/probit.js +1 -0
  79. package/js/src/wavesexchange.js +1 -0
  80. package/js/src/woo.js +1 -0
  81. package/js/src/zaif.js +1 -1
  82. package/package.json +1 -1
package/js/src/bybit.js CHANGED
@@ -122,6 +122,7 @@ export default class bybit extends Exchange {
122
122
  'fetchVolatilityHistory': true,
123
123
  'fetchWithdrawals': true,
124
124
  'repayCrossMargin': true,
125
+ 'sandbox': true,
125
126
  'setLeverage': true,
126
127
  'setMarginMode': true,
127
128
  'setPositionMode': true,
@@ -1493,6 +1494,7 @@ export default class bybit extends Exchange {
1493
1494
  // "quoteCoin": "USDT",
1494
1495
  // "innovation": "0",
1495
1496
  // "status": "Trading",
1497
+ // "marginTrading": "both",
1496
1498
  // "lotSizeFilter": {
1497
1499
  // "basePrecision": "0.000001",
1498
1500
  // "quotePrecision": "0.00000001",
@@ -1529,7 +1531,9 @@ export default class bybit extends Exchange {
1529
1531
  const lotSizeFilter = this.safeDict(market, 'lotSizeFilter');
1530
1532
  const priceFilter = this.safeDict(market, 'priceFilter');
1531
1533
  const quotePrecision = this.safeNumber(lotSizeFilter, 'quotePrecision');
1532
- result.push({
1534
+ const marginTrading = this.safeString(market, 'marginTrading', 'none');
1535
+ const allowsMargin = marginTrading !== 'none';
1536
+ result.push(this.safeMarketStructure({
1533
1537
  'id': id,
1534
1538
  'symbol': symbol,
1535
1539
  'base': base,
@@ -1540,7 +1544,7 @@ export default class bybit extends Exchange {
1540
1544
  'settleId': undefined,
1541
1545
  'type': 'spot',
1542
1546
  'spot': true,
1543
- 'margin': undefined,
1547
+ 'margin': allowsMargin,
1544
1548
  'swap': false,
1545
1549
  'future': false,
1546
1550
  'option': false,
@@ -1579,7 +1583,7 @@ export default class bybit extends Exchange {
1579
1583
  },
1580
1584
  'created': undefined,
1581
1585
  'info': market,
1582
- });
1586
+ }));
1583
1587
  }
1584
1588
  return result;
1585
1589
  }
@@ -1704,7 +1708,7 @@ export default class bybit extends Exchange {
1704
1708
  symbol = symbol + '-' + this.yymmdd(expiry);
1705
1709
  }
1706
1710
  const contractSize = inverse ? this.safeNumber2(lotSizeFilter, 'minTradingQty', 'minOrderQty') : this.parseNumber('1');
1707
- result.push({
1711
+ result.push(this.safeMarketStructure({
1708
1712
  'id': id,
1709
1713
  'symbol': symbol,
1710
1714
  'base': base,
@@ -1754,7 +1758,7 @@ export default class bybit extends Exchange {
1754
1758
  },
1755
1759
  'created': this.safeInteger(market, 'launchTime'),
1756
1760
  'info': market,
1757
- });
1761
+ }));
1758
1762
  }
1759
1763
  return result;
1760
1764
  }
@@ -1837,7 +1841,7 @@ export default class bybit extends Exchange {
1837
1841
  const optionLetter = this.safeString(splitId, 3);
1838
1842
  const isActive = (status === 'Trading');
1839
1843
  if (isActive || (this.options['loadAllOptions']) || (this.options['loadExpiredOptions'])) {
1840
- result.push({
1844
+ result.push(this.safeMarketStructure({
1841
1845
  'id': id,
1842
1846
  'symbol': base + '/' + quote + ':' + settle + '-' + this.yymmdd(expiry) + '-' + strike + '-' + optionLetter,
1843
1847
  'base': base,
@@ -1887,7 +1891,7 @@ export default class bybit extends Exchange {
1887
1891
  },
1888
1892
  'created': this.safeInteger(market, 'launchTime'),
1889
1893
  'info': market,
1890
- });
1894
+ }));
1891
1895
  }
1892
1896
  }
1893
1897
  return result;
@@ -107,6 +107,7 @@ export default class coinbaseinternational extends Exchange {
107
107
  'fetchTradingFees': false,
108
108
  'fetchWithdrawals': true,
109
109
  'reduceMargin': false,
110
+ 'sandbox': true,
110
111
  'setLeverage': false,
111
112
  'setMargin': true,
112
113
  'setMarginMode': false,
@@ -115,6 +115,7 @@ export default class coinmetro extends Exchange {
115
115
  'reduceMargin': false,
116
116
  'repayCrossMargin': false,
117
117
  'repayIsolatedMargin': false,
118
+ 'sandbox': true,
118
119
  'setLeverage': false,
119
120
  'setMargin': false,
120
121
  'setMarginMode': false,
@@ -105,6 +105,7 @@ export default class cryptocom extends Exchange {
105
105
  'reduceMargin': false,
106
106
  'repayCrossMargin': false,
107
107
  'repayIsolatedMargin': false,
108
+ 'sandbox': true,
108
109
  'setLeverage': false,
109
110
  'setMarginMode': false,
110
111
  'setPositionMode': false,
@@ -104,6 +104,7 @@ export default class currencycom extends Exchange {
104
104
  'fetchWithdrawal': undefined,
105
105
  'fetchWithdrawals': true,
106
106
  'reduceMargin': undefined,
107
+ 'sandbox': true,
107
108
  'setLeverage': undefined,
108
109
  'setMarginMode': undefined,
109
110
  'setPositionMode': undefined,
package/js/src/deribit.js CHANGED
@@ -97,6 +97,7 @@ export default class deribit extends Exchange {
97
97
  'fetchVolatilityHistory': true,
98
98
  'fetchWithdrawal': false,
99
99
  'fetchWithdrawals': true,
100
+ 'sandbox': true,
100
101
  'transfer': true,
101
102
  'withdraw': true,
102
103
  },
package/js/src/gate.js CHANGED
@@ -160,6 +160,7 @@ export default class gate extends Exchange {
160
160
  'reduceMargin': true,
161
161
  'repayCrossMargin': true,
162
162
  'repayIsolatedMargin': true,
163
+ 'sandbox': true,
163
164
  'setLeverage': true,
164
165
  'setMarginMode': false,
165
166
  'setPositionMode': true,
package/js/src/gemini.js CHANGED
@@ -84,6 +84,7 @@ export default class gemini extends Exchange {
84
84
  'fetchTransactions': 'emulated',
85
85
  'postOnly': true,
86
86
  'reduceMargin': false,
87
+ 'sandbox': true,
87
88
  'setLeverage': false,
88
89
  'setMarginMode': false,
89
90
  'setPositionMode': false,
package/js/src/hitbtc.js CHANGED
@@ -94,6 +94,7 @@ export default class hitbtc extends Exchange {
94
94
  'fetchTransactions': 'emulated',
95
95
  'fetchWithdrawals': true,
96
96
  'reduceMargin': true,
97
+ 'sandbox': true,
97
98
  'setLeverage': true,
98
99
  'setMargin': false,
99
100
  'setMarginMode': false,
package/js/src/hollaex.js CHANGED
@@ -91,6 +91,7 @@ export default class hollaex extends Exchange {
91
91
  'fetchWithdrawal': true,
92
92
  'fetchWithdrawals': true,
93
93
  'reduceMargin': false,
94
+ 'sandbox': true,
94
95
  'setLeverage': false,
95
96
  'setMarginMode': false,
96
97
  'setPositionMode': false,
@@ -109,6 +109,7 @@ export default class hyperliquid extends Exchange {
109
109
  'reduceMargin': true,
110
110
  'repayCrossMargin': false,
111
111
  'repayIsolatedMargin': false,
112
+ 'sandbox': true,
112
113
  'setLeverage': true,
113
114
  'setMarginMode': true,
114
115
  'setPositionMode': false,
@@ -443,6 +444,10 @@ export default class hyperliquid extends Exchange {
443
444
  for (let i = 0; i < meta.length; i++) {
444
445
  const market = this.safeDict(meta, i, {});
445
446
  const marketName = this.safeString(market, 'name');
447
+ if (marketName.indexOf('/') < 0) {
448
+ // there are some weird spot markets in testnet, eg @2
449
+ continue;
450
+ }
446
451
  const marketParts = marketName.split('/');
447
452
  const baseName = this.safeString(marketParts, 0);
448
453
  const quoteId = this.safeString(marketParts, 1);
package/js/src/idex.js CHANGED
@@ -98,6 +98,7 @@ export default class idex extends Exchange {
98
98
  'fetchWithdrawal': true,
99
99
  'fetchWithdrawals': true,
100
100
  'reduceMargin': false,
101
+ 'sandbox': true,
101
102
  'setLeverage': false,
102
103
  'setMarginMode': false,
103
104
  'setPositionMode': false,
@@ -74,6 +74,7 @@ export default class krakenfutures extends Exchange {
74
74
  'fetchPremiumIndexOHLCV': false,
75
75
  'fetchTickers': true,
76
76
  'fetchTrades': true,
77
+ 'sandbox': true,
77
78
  'setLeverage': true,
78
79
  'setMarginMode': false,
79
80
  'transfer': true,
package/js/src/kuna.d.ts CHANGED
@@ -21,7 +21,7 @@ export default class kuna extends Exchange {
21
21
  deposit: any;
22
22
  withdraw: any;
23
23
  fee: any;
24
- precision: any;
24
+ precision: string;
25
25
  limits: {
26
26
  amount: {
27
27
  min: any;
package/js/src/ndax.js CHANGED
@@ -88,6 +88,7 @@ export default class ndax extends Exchange {
88
88
  'fetchTradingFees': false,
89
89
  'fetchWithdrawals': true,
90
90
  'reduceMargin': false,
91
+ 'sandbox': true,
91
92
  'setLeverage': false,
92
93
  'setMarginMode': false,
93
94
  'setPositionMode': false,
package/js/src/okx.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/okx.js';
9
- import { ExchangeError, ExchangeNotAvailable, OnMaintenance, ArgumentsRequired, BadRequest, AccountSuspended, InvalidAddress, PermissionDenied, InsufficientFunds, InvalidNonce, InvalidOrder, OrderNotFound, AuthenticationError, RequestTimeout, BadSymbol, RateLimitExceeded, NetworkError, CancelPending, NotSupported, AccountNotEnabled, ContractUnavailable } from './base/errors.js';
9
+ import { ExchangeError, ExchangeNotAvailable, OnMaintenance, ArgumentsRequired, BadRequest, AccountSuspended, InvalidAddress, DDoSProtection, PermissionDenied, InsufficientFunds, InvalidNonce, InvalidOrder, OrderNotFound, AuthenticationError, RequestTimeout, BadSymbol, RateLimitExceeded, NetworkError, CancelPending, NotSupported, AccountNotEnabled, ContractUnavailable } from './base/errors.js';
10
10
  import { Precise } from './base/Precise.js';
11
11
  import { TICK_SIZE } from './base/functions/number.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
@@ -141,6 +141,7 @@ export default class okx extends Exchange {
141
141
  'fetchWithdrawalWhitelist': false,
142
142
  'reduceMargin': true,
143
143
  'repayCrossMargin': true,
144
+ 'sandbox': true,
144
145
  'setLeverage': true,
145
146
  'setMargin': false,
146
147
  'setMarginMode': true,
@@ -891,7 +892,24 @@ export default class okx extends Exchange {
891
892
  '60017': BadRequest,
892
893
  '60018': BadRequest,
893
894
  '60019': BadRequest,
895
+ '60020': ExchangeError,
896
+ '60021': AccountNotEnabled,
897
+ '60022': AuthenticationError,
898
+ '60023': DDoSProtection,
899
+ '60024': AuthenticationError,
900
+ '60025': ExchangeError,
901
+ '60026': AuthenticationError,
902
+ '60027': ArgumentsRequired,
903
+ '60028': NotSupported,
904
+ '60029': AccountNotEnabled,
905
+ '60030': AccountNotEnabled,
906
+ '60031': AuthenticationError,
907
+ '60032': AuthenticationError,
894
908
  '63999': ExchangeError,
909
+ '64000': BadRequest,
910
+ '64001': BadRequest,
911
+ '64002': BadRequest,
912
+ '64003': AccountNotEnabled,
895
913
  '70010': BadRequest,
896
914
  '70013': BadRequest,
897
915
  '70016': BadRequest, // Please specify your instrument settings for at least one instType.
package/js/src/phemex.js CHANGED
@@ -82,6 +82,7 @@ export default class phemex extends Exchange {
82
82
  'fetchTransfers': true,
83
83
  'fetchWithdrawals': true,
84
84
  'reduceMargin': false,
85
+ 'sandbox': true,
85
86
  'setLeverage': true,
86
87
  'setMargin': true,
87
88
  'setMarginMode': true,
@@ -72,6 +72,7 @@ export default class poloniex extends Exchange {
72
72
  'fetchTransfer': false,
73
73
  'fetchTransfers': false,
74
74
  'fetchWithdrawals': true,
75
+ 'sandbox': true,
75
76
  'transfer': true,
76
77
  'withdraw': true,
77
78
  },
@@ -685,6 +685,8 @@ export default class bitfinex2 extends bitfinex2Rest {
685
685
  const responseChecksum = this.safeInteger(message, 2);
686
686
  if (responseChecksum !== localChecksum) {
687
687
  const error = new InvalidNonce(this.id + ' invalid checksum');
688
+ delete client.subscriptions[messageHash];
689
+ delete this.orderbooks[symbol];
688
690
  client.reject(error, messageHash);
689
691
  }
690
692
  }
@@ -563,7 +563,10 @@ export default class bitget extends bitgetRest {
563
563
  const responseChecksum = this.safeInteger(rawOrderBook, 'checksum');
564
564
  if (calculatedChecksum !== responseChecksum) {
565
565
  const error = new InvalidNonce(this.id + ' invalid checksum');
566
+ delete client.subscriptions[messageHash];
567
+ delete this.orderbooks[symbol];
566
568
  client.reject(error, messageHash);
569
+ return;
567
570
  }
568
571
  }
569
572
  }
@@ -15,11 +15,11 @@ export default class bybit extends bybitRest {
15
15
  return this.deepExtend(super.describe(), {
16
16
  'has': {
17
17
  'ws': true,
18
- 'createOrderWs': false,
19
- 'editOrderWs': false,
18
+ 'createOrderWs': true,
19
+ 'editOrderWs': true,
20
20
  'fetchOpenOrdersWs': false,
21
21
  'fetchOrderWs': false,
22
- 'cancelOrderWs': false,
22
+ 'cancelOrderWs': true,
23
23
  'cancelOrdersWs': false,
24
24
  'cancelAllOrdersWs': false,
25
25
  'fetchTradesWs': false,
package/js/src/pro/htx.js CHANGED
@@ -435,6 +435,8 @@ export default class htx extends htxRest {
435
435
  }
436
436
  }
437
437
  catch (e) {
438
+ delete client.subscriptions[messageHash];
439
+ delete this.orderbooks[symbol];
438
440
  client.reject(e, messageHash);
439
441
  }
440
442
  }
@@ -220,6 +220,8 @@ export default class independentreserve extends independentreserveRest {
220
220
  const responseChecksum = this.safeInteger(orderBook, 'Crc32');
221
221
  if (calculatedChecksum !== responseChecksum) {
222
222
  const error = new InvalidNonce(this.id + ' invalid checksum');
223
+ delete client.subscriptions[messageHash];
224
+ delete this.orderbooks[symbol];
223
225
  client.reject(error, messageHash);
224
226
  }
225
227
  }
@@ -770,6 +770,8 @@ export default class kraken extends krakenRest {
770
770
  const localChecksum = this.crc32(payload, false);
771
771
  if (localChecksum !== c) {
772
772
  const error = new InvalidNonce(this.id + ' invalid checksum');
773
+ delete client.subscriptions[messageHash];
774
+ delete this.orderbooks[symbol];
773
775
  client.reject(error, messageHash);
774
776
  return;
775
777
  }
package/js/src/pro/okx.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import okxRest from '../okx.js';
9
- import { ArgumentsRequired, AuthenticationError, BadRequest, InvalidNonce } from '../base/errors.js';
9
+ import { ArgumentsRequired, BadRequest, ExchangeError, InvalidNonce, AuthenticationError } from '../base/errors.js';
10
10
  import { ArrayCache, ArrayCacheByTimestamp, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide } from '../base/ws/Cache.js';
11
11
  import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
12
12
  // ---------------------------------------------------------------------------
@@ -453,10 +453,12 @@ export default class okx extends okxRest {
453
453
  /**
454
454
  * @method
455
455
  * @name okx#watchOrderBook
456
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel
456
457
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
457
458
  * @param {string} symbol unified symbol of the market to fetch the order book for
458
459
  * @param {int} [limit] the maximum amount of order book entries to return
459
460
  * @param {object} [params] extra parameters specific to the exchange API endpoint
461
+ * @param {string} [params.depth] okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt
460
462
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
461
463
  */
462
464
  //
@@ -488,16 +490,18 @@ export default class okx extends okxRest {
488
490
  /**
489
491
  * @method
490
492
  * @name okx#watchOrderBookForSymbols
493
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel
491
494
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
492
495
  * @param {string[]} symbols unified array of symbols
493
496
  * @param {int} [limit] 1,5, 400, 50 (l2-tbt, vip4+) or 40000 (vip5+) the maximum amount of order book entries to return
494
497
  * @param {object} [params] extra parameters specific to the exchange API endpoint
498
+ * @param {string} [params.depth] okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt
495
499
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
496
500
  */
497
501
  await this.loadMarkets();
498
502
  symbols = this.marketSymbols(symbols);
499
- const options = this.safeValue(this.options, 'watchOrderBook', {});
500
- let depth = this.safeString(options, 'depth', 'books');
503
+ let depth = undefined;
504
+ [depth, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'depth', 'books');
501
505
  if (limit !== undefined) {
502
506
  if (limit === 1) {
503
507
  depth = 'bbo-tbt';
@@ -505,17 +509,17 @@ export default class okx extends okxRest {
505
509
  else if (limit > 1 && limit <= 5) {
506
510
  depth = 'books5';
507
511
  }
508
- else if (limit === 400) {
509
- depth = 'books';
510
- }
511
512
  else if (limit === 50) {
512
513
  depth = 'books50-l2-tbt'; // Make sure you have VIP4 and above
513
514
  }
514
- else if (limit === 4000) {
515
- depth = 'books-l2-tbt'; // Make sure you have VIP5 and above
515
+ else if (limit === 400) {
516
+ depth = 'books';
516
517
  }
517
518
  }
518
519
  if ((depth === 'books-l2-tbt') || (depth === 'books50-l2-tbt')) {
520
+ if (!this.checkRequiredCredentials(false)) {
521
+ throw new AuthenticationError(this.id + ' watchOrderBook/watchOrderBookForSymbols requires authentication for this depth. Add credentials or change the depth option to books or books5');
522
+ }
519
523
  await this.authenticate({ 'access': 'public' });
520
524
  }
521
525
  const topics = [];
@@ -579,6 +583,8 @@ export default class okx extends okxRest {
579
583
  const storedBids = orderbook['bids'];
580
584
  this.handleDeltas(storedAsks, asks);
581
585
  this.handleDeltas(storedBids, bids);
586
+ const marketId = this.safeString(message, 'instId');
587
+ const symbol = this.safeSymbol(marketId);
582
588
  const checksum = this.safeBool(this.options, 'checksum', true);
583
589
  if (checksum) {
584
590
  const asksLength = storedAsks.length;
@@ -599,6 +605,8 @@ export default class okx extends okxRest {
599
605
  const localChecksum = this.crc32(payload, true);
600
606
  if (responseChecksum !== localChecksum) {
601
607
  const error = new InvalidNonce(this.id + ' invalid checksum');
608
+ delete client.subscriptions[messageHash];
609
+ delete this.orderbooks[symbol];
602
610
  client.reject(error, messageHash);
603
611
  }
604
612
  }
@@ -693,10 +701,10 @@ export default class okx extends okxRest {
693
701
  // ]
694
702
  // }
695
703
  //
696
- const arg = this.safeValue(message, 'arg', {});
704
+ const arg = this.safeDict(message, 'arg', {});
697
705
  const channel = this.safeString(arg, 'channel');
698
706
  const action = this.safeString(message, 'action');
699
- const data = this.safeValue(message, 'data', []);
707
+ const data = this.safeList(message, 'data', []);
700
708
  const marketId = this.safeString(arg, 'instId');
701
709
  const market = this.safeMarket(marketId);
702
710
  const symbol = market['symbol'];
@@ -1526,29 +1534,21 @@ export default class okx extends okxRest {
1526
1534
  // { event: 'error', msg: "Illegal request: {"op":"subscribe","args":["spot/ticker:BTC-USDT"]}", code: "60012" }
1527
1535
  // { event: 'error", msg: "channel:ticker,instId:BTC-USDT doesn"t exist", code: "60018" }
1528
1536
  //
1529
- const errorCode = this.safeInteger(message, 'code');
1537
+ const errorCode = this.safeString(message, 'code');
1530
1538
  try {
1531
- if (errorCode) {
1539
+ if (errorCode && errorCode !== '0') {
1532
1540
  const feedback = this.id + ' ' + this.json(message);
1533
1541
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
1534
1542
  const messageString = this.safeValue(message, 'msg');
1535
1543
  if (messageString !== undefined) {
1536
1544
  this.throwBroadlyMatchedException(this.exceptions['broad'], messageString, feedback);
1537
1545
  }
1546
+ throw new ExchangeError(feedback);
1538
1547
  }
1539
1548
  }
1540
1549
  catch (e) {
1541
- if (e instanceof AuthenticationError) {
1542
- const messageHash = 'authenticated';
1543
- client.reject(e, messageHash);
1544
- if (messageHash in client.subscriptions) {
1545
- delete client.subscriptions[messageHash];
1546
- }
1547
- return false;
1548
- }
1549
- else {
1550
- client.reject(e);
1551
- }
1550
+ client.reject(e);
1551
+ return false;
1552
1552
  }
1553
1553
  return message;
1554
1554
  }
package/js/src/probit.js CHANGED
@@ -89,6 +89,7 @@ export default class probit extends Exchange {
89
89
  'fetchWithdrawal': false,
90
90
  'fetchWithdrawals': true,
91
91
  'reduceMargin': false,
92
+ 'sandbox': true,
92
93
  'setLeverage': false,
93
94
  'setMarginMode': false,
94
95
  'setPositionMode': false,
@@ -82,6 +82,7 @@ export default class wavesexchange extends Exchange {
82
82
  'fetchTransfer': false,
83
83
  'fetchTransfers': false,
84
84
  'reduceMargin': false,
85
+ 'sandbox': true,
85
86
  'setLeverage': false,
86
87
  'setMarginMode': false,
87
88
  'setPositionMode': false,
package/js/src/woo.js CHANGED
@@ -107,6 +107,7 @@ export default class woo extends Exchange {
107
107
  'fetchTransfers': true,
108
108
  'fetchWithdrawals': true,
109
109
  'reduceMargin': false,
110
+ 'sandbox': true,
110
111
  'setLeverage': true,
111
112
  'setMargin': false,
112
113
  'setPositionMode': true,
package/js/src/zaif.js CHANGED
@@ -678,7 +678,7 @@ export default class zaif extends Exchange {
678
678
  };
679
679
  }
680
680
  customNonce() {
681
- const num = (this.milliseconds() / 1000).toString();
681
+ const num = this.numberToString(this.milliseconds() / 1000);
682
682
  const nonce = parseFloat(num);
683
683
  return nonce.toFixed(8);
684
684
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.15",
3
+ "version": "4.3.17",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",