ccxt 4.2.71 → 4.2.73

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 (139) hide show
  1. package/README.md +124 -122
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +3293 -378
  4. package/dist/ccxt.browser.min.js +4 -4
  5. package/dist/cjs/ccxt.js +6 -1
  6. package/dist/cjs/src/abstract/coinbaseinternational.js +9 -0
  7. package/dist/cjs/src/ascendex.js +149 -2
  8. package/dist/cjs/src/base/Exchange.js +30 -6
  9. package/dist/cjs/src/btcturk.js +3 -3
  10. package/dist/cjs/src/coinbaseinternational.js +2019 -0
  11. package/dist/cjs/src/gate.js +1 -1
  12. package/dist/cjs/src/hyperliquid.js +8 -2
  13. package/dist/cjs/src/mexc.js +1 -1
  14. package/dist/cjs/src/okx.js +1 -1
  15. package/dist/cjs/src/pro/bingx.js +29 -6
  16. package/dist/cjs/src/pro/coinbaseinternational.js +645 -0
  17. package/dist/cjs/src/pro/hitbtc.js +16 -7
  18. package/js/ccxt.d.ts +8 -2
  19. package/js/ccxt.js +6 -2
  20. package/js/src/abstract/coinbaseinternational.d.ts +42 -0
  21. package/js/src/abstract/coinbaseinternational.js +11 -0
  22. package/js/src/ace.d.ts +2 -2
  23. package/js/src/alpaca.d.ts +2 -2
  24. package/js/src/ascendex.d.ts +7 -3
  25. package/js/src/ascendex.js +149 -2
  26. package/js/src/base/Exchange.d.ts +81 -78
  27. package/js/src/base/Exchange.js +30 -6
  28. package/js/src/base/types.d.ts +10 -0
  29. package/js/src/bigone.d.ts +2 -2
  30. package/js/src/binance.d.ts +8 -8
  31. package/js/src/bingx.d.ts +4 -4
  32. package/js/src/bit2c.d.ts +2 -2
  33. package/js/src/bitbank.d.ts +2 -2
  34. package/js/src/bitbns.d.ts +2 -2
  35. package/js/src/bitfinex.d.ts +3 -3
  36. package/js/src/bitfinex2.d.ts +5 -5
  37. package/js/src/bitflyer.d.ts +2 -2
  38. package/js/src/bitget.d.ts +4 -4
  39. package/js/src/bithumb.d.ts +2 -2
  40. package/js/src/bitmart.d.ts +4 -4
  41. package/js/src/bitmex.d.ts +3 -3
  42. package/js/src/bitopro.d.ts +2 -2
  43. package/js/src/bitrue.d.ts +5 -5
  44. package/js/src/bitso.d.ts +2 -2
  45. package/js/src/bitstamp.d.ts +2 -2
  46. package/js/src/bitteam.d.ts +2 -2
  47. package/js/src/bitvavo.d.ts +4 -4
  48. package/js/src/bl3p.d.ts +2 -2
  49. package/js/src/blockchaincom.d.ts +2 -2
  50. package/js/src/blofin.d.ts +4 -4
  51. package/js/src/btcalpha.d.ts +2 -2
  52. package/js/src/btcbox.d.ts +2 -2
  53. package/js/src/btcmarkets.d.ts +2 -2
  54. package/js/src/btcturk.d.ts +2 -2
  55. package/js/src/btcturk.js +3 -3
  56. package/js/src/bybit.d.ts +5 -5
  57. package/js/src/cex.d.ts +4 -4
  58. package/js/src/coinbase.d.ts +3 -3
  59. package/js/src/coinbaseinternational.d.ts +146 -0
  60. package/js/src/coinbaseinternational.js +2020 -0
  61. package/js/src/coinbasepro.d.ts +2 -2
  62. package/js/src/coincheck.d.ts +2 -2
  63. package/js/src/coinex.d.ts +4 -4
  64. package/js/src/coinlist.d.ts +3 -3
  65. package/js/src/coinmate.d.ts +2 -2
  66. package/js/src/coinmetro.d.ts +2 -2
  67. package/js/src/coinone.d.ts +2 -2
  68. package/js/src/coinsph.d.ts +2 -2
  69. package/js/src/coinspot.d.ts +2 -2
  70. package/js/src/cryptocom.d.ts +4 -4
  71. package/js/src/currencycom.d.ts +2 -2
  72. package/js/src/delta.d.ts +3 -3
  73. package/js/src/deribit.d.ts +3 -3
  74. package/js/src/digifinex.d.ts +3 -3
  75. package/js/src/exmo.d.ts +3 -3
  76. package/js/src/gate.d.ts +5 -5
  77. package/js/src/gate.js +1 -1
  78. package/js/src/gemini.d.ts +2 -2
  79. package/js/src/hitbtc.d.ts +4 -4
  80. package/js/src/hollaex.d.ts +2 -2
  81. package/js/src/htx.d.ts +6 -6
  82. package/js/src/huobijp.d.ts +2 -2
  83. package/js/src/hyperliquid.d.ts +4 -3
  84. package/js/src/hyperliquid.js +9 -3
  85. package/js/src/idex.d.ts +3 -3
  86. package/js/src/independentreserve.d.ts +2 -2
  87. package/js/src/indodax.d.ts +2 -2
  88. package/js/src/kraken.d.ts +3 -3
  89. package/js/src/krakenfutures.d.ts +4 -4
  90. package/js/src/kucoin.d.ts +4 -4
  91. package/js/src/kucoinfutures.d.ts +4 -4
  92. package/js/src/kuna.d.ts +2 -2
  93. package/js/src/latoken.d.ts +2 -2
  94. package/js/src/lbank.d.ts +2 -2
  95. package/js/src/luno.d.ts +2 -2
  96. package/js/src/lykke.d.ts +2 -2
  97. package/js/src/mercado.d.ts +2 -2
  98. package/js/src/mexc.d.ts +2 -2
  99. package/js/src/mexc.js +1 -1
  100. package/js/src/ndax.d.ts +3 -3
  101. package/js/src/novadax.d.ts +2 -2
  102. package/js/src/oceanex.d.ts +2 -2
  103. package/js/src/okcoin.d.ts +3 -3
  104. package/js/src/okx.d.ts +4 -4
  105. package/js/src/okx.js +1 -1
  106. package/js/src/onetrading.d.ts +2 -2
  107. package/js/src/p2b.d.ts +2 -2
  108. package/js/src/paymium.d.ts +2 -2
  109. package/js/src/phemex.d.ts +3 -3
  110. package/js/src/poloniex.d.ts +3 -3
  111. package/js/src/poloniexfutures.d.ts +4 -4
  112. package/js/src/pro/binance.d.ts +3 -3
  113. package/js/src/pro/bingx.d.ts +1 -0
  114. package/js/src/pro/bingx.js +29 -6
  115. package/js/src/pro/bitvavo.d.ts +11 -11
  116. package/js/src/pro/bybit.d.ts +1 -1
  117. package/js/src/pro/cex.d.ts +8 -8
  118. package/js/src/pro/coinbase.d.ts +2 -2
  119. package/js/src/pro/coinbaseinternational.d.ts +28 -0
  120. package/js/src/pro/coinbaseinternational.js +646 -0
  121. package/js/src/pro/cryptocom.d.ts +2 -2
  122. package/js/src/pro/hitbtc.d.ts +2 -2
  123. package/js/src/pro/hitbtc.js +16 -7
  124. package/js/src/pro/kraken.d.ts +3 -3
  125. package/js/src/pro/okx.d.ts +3 -3
  126. package/js/src/pro/poloniex.d.ts +5 -5
  127. package/js/src/probit.d.ts +2 -2
  128. package/js/src/timex.d.ts +3 -3
  129. package/js/src/tokocrypto.d.ts +2 -2
  130. package/js/src/upbit.d.ts +2 -2
  131. package/js/src/wavesexchange.d.ts +2 -2
  132. package/js/src/wazirx.d.ts +2 -2
  133. package/js/src/whitebit.d.ts +2 -2
  134. package/js/src/woo.d.ts +5 -5
  135. package/js/src/yobit.d.ts +2 -2
  136. package/js/src/zaif.d.ts +2 -2
  137. package/js/src/zonda.d.ts +2 -2
  138. package/package.json +1 -1
  139. package/skip-tests.json +13 -0
@@ -2909,7 +2909,7 @@ class gate extends gate$1 {
2909
2909
  let request = {};
2910
2910
  [request, params] = this.prepareRequest(market, undefined, params);
2911
2911
  request['interval'] = this.safeString(this.timeframes, timeframe, timeframe);
2912
- let maxLimit = 1000;
2912
+ let maxLimit = market['contract'] ? 1999 : 1000;
2913
2913
  limit = (limit === undefined) ? maxLimit : Math.min(limit, maxLimit);
2914
2914
  let until = this.safeInteger(params, 'until');
2915
2915
  if (until !== undefined) {
@@ -364,8 +364,8 @@ class hyperliquid extends hyperliquid$1 {
364
364
  'strike': undefined,
365
365
  'optionType': undefined,
366
366
  'precision': {
367
- 'amount': 0.00000001,
368
- 'price': 0.00000001,
367
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'szDecimals'))),
368
+ 'price': this.parseNumber('5'), // significant digits
369
369
  },
370
370
  'limits': {
371
371
  'leverage': {
@@ -624,6 +624,12 @@ class hyperliquid extends hyperliquid$1 {
624
624
  amountToPrecision(symbol, amount) {
625
625
  return this.decimalToPrecision(amount, number.ROUND, this.markets[symbol]['precision']['amount'], this.precisionMode);
626
626
  }
627
+ priceToPrecision(symbol, price) {
628
+ const market = this.market(symbol);
629
+ const result = this.decimalToPrecision(price, number.ROUND, market['precision']['price'], number.SIGNIFICANT_DIGITS, this.paddingMode);
630
+ const decimalParsedResult = this.decimalToPrecision(result, number.ROUND, 6, number.DECIMAL_PLACES, this.paddingMode);
631
+ return decimalParsedResult;
632
+ }
627
633
  hashMessage(message) {
628
634
  return '0x' + this.hash(message, sha3.keccak_256, 'hex');
629
635
  }
@@ -918,7 +918,7 @@ class mexc extends mexc$1 {
918
918
  'Combination of optional parameters invalid': errors.BadRequest,
919
919
  'api market order is disabled': errors.BadRequest,
920
920
  'Contract not allow place order!': errors.InvalidOrder,
921
- 'Oversold': errors.InvalidOrder,
921
+ 'Oversold': errors.InsufficientFunds,
922
922
  'Insufficient position': errors.InsufficientFunds,
923
923
  'Insufficient balance!': errors.InsufficientFunds,
924
924
  'Bid price is great than max allow price': errors.InvalidOrder,
@@ -2234,7 +2234,7 @@ class okx extends okx$1 {
2234
2234
  let paginate = false;
2235
2235
  [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
2236
2236
  if (paginate) {
2237
- return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params);
2237
+ return await this.fetchPaginatedCallDeterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 100);
2238
2238
  }
2239
2239
  const market = this.market(symbol);
2240
2240
  const request = {
@@ -762,21 +762,44 @@ class bingx extends bingx$1 {
762
762
  }
763
763
  return true;
764
764
  }
765
- async authenticate(params = {}) {
766
- const time = this.milliseconds();
765
+ async keepAliveListenKey(params = {}) {
767
766
  const listenKey = this.safeString(this.options, 'listenKey');
768
767
  if (listenKey === undefined) {
769
- const response = await this.userAuthPrivatePostUserDataStream();
770
- this.options['listenKey'] = this.safeString(response, 'listenKey');
771
- this.options['lastAuthenticatedTime'] = time;
768
+ // A network error happened: we can't renew a listen key that does not exist.
772
769
  return;
773
770
  }
771
+ try {
772
+ await this.userAuthPrivatePutUserDataStream({ 'listenKey': listenKey }); // extend the expiry
773
+ }
774
+ catch (error) {
775
+ const types = ['spot', 'swap'];
776
+ for (let i = 0; i < types.length; i++) {
777
+ const type = types[i];
778
+ const url = this.urls['api']['ws'][type] + '?listenKey=' + listenKey;
779
+ const client = this.client(url);
780
+ const messageHashes = Object.keys(client.futures);
781
+ for (let j = 0; j < messageHashes.length; j++) {
782
+ const messageHash = messageHashes[j];
783
+ client.reject(error, messageHash);
784
+ }
785
+ }
786
+ this.options['listenKey'] = undefined;
787
+ this.options['lastAuthenticatedTime'] = 0;
788
+ return;
789
+ }
790
+ // whether or not to schedule another listenKey keepAlive request
791
+ const listenKeyRefreshRate = this.safeInteger(this.options, 'listenKeyRefreshRate', 3600000);
792
+ this.delay(listenKeyRefreshRate, this.keepAliveListenKey, params);
793
+ }
794
+ async authenticate(params = {}) {
795
+ const time = this.milliseconds();
774
796
  const lastAuthenticatedTime = this.safeInteger(this.options, 'lastAuthenticatedTime', 0);
775
797
  const listenKeyRefreshRate = this.safeInteger(this.options, 'listenKeyRefreshRate', 3600000); // 1 hour
776
798
  if (time - lastAuthenticatedTime > listenKeyRefreshRate) {
777
- const response = await this.userAuthPrivatePutUserDataStream({ 'listenKey': listenKey }); // extend the expiry
799
+ const response = await this.userAuthPrivatePostUserDataStream();
778
800
  this.options['listenKey'] = this.safeString(response, 'listenKey');
779
801
  this.options['lastAuthenticatedTime'] = time;
802
+ this.delay(listenKeyRefreshRate, this.keepAliveListenKey, params);
780
803
  }
781
804
  }
782
805
  async pong(client, message) {