ccxt 4.0.78 → 4.0.80

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 (50) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +189 -169
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/binance.js +78 -67
  6. package/dist/cjs/src/bithumb.js +1 -1
  7. package/dist/cjs/src/bitmex.js +2 -2
  8. package/dist/cjs/src/bybit.js +4 -2
  9. package/dist/cjs/src/coinsph.js +2 -2
  10. package/dist/cjs/src/krakenfutures.js +2 -2
  11. package/dist/cjs/src/mexc.js +1 -0
  12. package/dist/cjs/src/okcoin.js +2 -2
  13. package/dist/cjs/src/okx.js +1 -1
  14. package/dist/cjs/src/phemex.js +8 -3
  15. package/dist/cjs/src/poloniex.js +54 -74
  16. package/dist/cjs/src/pro/bitget.js +18 -2
  17. package/dist/cjs/src/pro/gate.js +5 -3
  18. package/dist/cjs/src/pro/kraken.js +2 -2
  19. package/dist/cjs/src/probit.js +2 -2
  20. package/dist/cjs/src/upbit.js +1 -1
  21. package/dist/cjs/src/wavesexchange.js +4 -2
  22. package/dist/cjs/src/wazirx.js +1 -0
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/abstract/binance.d.ts +12 -1
  26. package/js/src/abstract/binancecoinm.d.ts +12 -1
  27. package/js/src/abstract/binanceus.d.ts +12 -1
  28. package/js/src/abstract/binanceusdm.d.ts +12 -1
  29. package/js/src/abstract/bybit.d.ts +1 -0
  30. package/js/src/abstract/mexc.d.ts +1 -0
  31. package/js/src/abstract/mexc3.d.ts +1 -0
  32. package/js/src/binance.js +78 -67
  33. package/js/src/bithumb.js +1 -1
  34. package/js/src/bitmex.js +2 -2
  35. package/js/src/bybit.js +4 -2
  36. package/js/src/coinsph.js +2 -2
  37. package/js/src/krakenfutures.js +2 -2
  38. package/js/src/mexc.js +1 -0
  39. package/js/src/okcoin.js +2 -2
  40. package/js/src/okx.js +1 -1
  41. package/js/src/phemex.js +8 -3
  42. package/js/src/poloniex.js +54 -74
  43. package/js/src/pro/bitget.js +19 -3
  44. package/js/src/pro/gate.js +5 -3
  45. package/js/src/pro/kraken.js +2 -2
  46. package/js/src/probit.js +2 -2
  47. package/js/src/upbit.js +1 -1
  48. package/js/src/wavesexchange.js +4 -2
  49. package/js/src/wazirx.js +1 -0
  50. package/package.json +1 -1
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import bitgetRest from '../bitget.js';
9
- import { AuthenticationError, BadRequest, ArgumentsRequired, NotSupported, InvalidNonce } from '../base/errors.js';
9
+ import { AuthenticationError, BadRequest, ArgumentsRequired, NotSupported, InvalidNonce, ExchangeError, RateLimitExceeded } from '../base/errors.js';
10
10
  import { Precise } from '../base/Precise.js';
11
11
  import { ArrayCache, ArrayCacheBySymbolById, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
12
12
  import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
@@ -54,9 +54,18 @@ export default class bitget extends bitgetRest {
54
54
  'ws': {
55
55
  'exact': {
56
56
  '30001': BadRequest,
57
+ '30002': AuthenticationError,
58
+ '30003': BadRequest,
59
+ '30004': AuthenticationError,
60
+ '30005': AuthenticationError,
61
+ '30006': RateLimitExceeded,
62
+ '30007': RateLimitExceeded,
63
+ '30011': AuthenticationError,
64
+ '30012': AuthenticationError,
65
+ '30013': AuthenticationError,
66
+ '30014': BadRequest,
57
67
  '30015': AuthenticationError,
58
- '30016': BadRequest,
59
- '30011': AuthenticationError, // { event: 'error', code: 30011, msg: 'Invalid ACCESS_KEY' }
68
+ '30016': BadRequest, // { event: 'error', code: 30016, msg: 'Param error' }
60
69
  },
61
70
  },
62
71
  },
@@ -1146,6 +1155,9 @@ export default class bitget extends bitgetRest {
1146
1155
  const code = this.safeString(message, 'code');
1147
1156
  const feedback = this.id + ' ' + this.json(message);
1148
1157
  this.throwExactlyMatchedException(this.exceptions['ws']['exact'], code, feedback);
1158
+ const msg = this.safeString(message, 'msg', '');
1159
+ this.throwBroadlyMatchedException(this.exceptions['ws']['broad'], msg, feedback);
1160
+ throw new ExchangeError(feedback);
1149
1161
  }
1150
1162
  return false;
1151
1163
  }
@@ -1157,6 +1169,10 @@ export default class bitget extends bitgetRest {
1157
1169
  delete client.subscriptions[messageHash];
1158
1170
  }
1159
1171
  }
1172
+ else {
1173
+ // Note: if error happens on a subscribe event, user will have to close exchange to resubscribe. Issue #19041
1174
+ client.reject(e);
1175
+ }
1160
1176
  return true;
1161
1177
  }
1162
1178
  }
@@ -492,15 +492,17 @@ export default class gate extends gateRest {
492
492
  const subscription = this.safeString(ohlcv, 'n', '');
493
493
  const parts = subscription.split('_');
494
494
  const timeframe = this.safeString(parts, 0);
495
+ const timeframeId = this.findTimeframe(timeframe);
495
496
  const prefix = timeframe + '_';
496
497
  const marketId = subscription.replace(prefix, '');
497
498
  const symbol = this.safeSymbol(marketId, undefined, '_', marketType);
498
499
  const parsed = this.parseOHLCV(ohlcv);
499
- let stored = this.safeValue(this.ohlcvs, symbol);
500
+ this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
501
+ let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
500
502
  if (stored === undefined) {
501
503
  const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
502
504
  stored = new ArrayCacheByTimestamp(limit);
503
- this.ohlcvs[symbol] = stored;
505
+ this.ohlcvs[symbol][timeframeId] = stored;
504
506
  }
505
507
  stored.append(parsed);
506
508
  marketIds[symbol] = timeframe;
@@ -511,7 +513,7 @@ export default class gate extends gateRest {
511
513
  const timeframe = marketIds[symbol];
512
514
  const interval = this.findTimeframe(timeframe);
513
515
  const hash = 'candles' + ':' + interval + ':' + symbol;
514
- const stored = this.safeValue(this.ohlcvs, symbol);
516
+ const stored = this.safeValue(this.ohlcvs[symbol], interval);
515
517
  client.resolve(stored, hash);
516
518
  }
517
519
  }
@@ -734,8 +734,8 @@ export default class kraken extends krakenRest {
734
734
  }
735
735
  }
736
736
  formatNumber(n, length) {
737
- const string = this.numberToString(n);
738
- const parts = string.split('.');
737
+ const stringNumber = this.numberToString(n);
738
+ const parts = stringNumber.split('.');
739
739
  const integer = this.safeString(parts, 0);
740
740
  const decimals = this.safeString(parts, 1, '');
741
741
  const paddedDecimals = decimals.padEnd(length, '0');
package/js/src/probit.js CHANGED
@@ -1227,7 +1227,7 @@ export default class probit extends Exchange {
1227
1227
  }
1228
1228
  }
1229
1229
  else if (cost === undefined) {
1230
- throw new InvalidOrder(this.id + " createOrder() requires the price argument for market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false and supply the total cost value in the 'amount' argument or in the 'cost' extra parameter (the exchange-specific behaviour)");
1230
+ throw new InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false and supply the total cost value in the "amount" argument or in the "cost" extra parameter (the exchange-specific behaviour)');
1231
1231
  }
1232
1232
  }
1233
1233
  else {
@@ -1697,7 +1697,7 @@ export default class probit extends Exchange {
1697
1697
  const networkCode = this.networkIdToCode(networkId, currency['code']);
1698
1698
  const withdrawalFees = this.safeValue(network, 'withdrawal_fee', {});
1699
1699
  const withdrawFee = this.safeNumber(withdrawalFees[0], 'amount');
1700
- if (withdrawalFees.length > 0) {
1700
+ if (withdrawalFees.length) {
1701
1701
  const withdrawResult = {
1702
1702
  'fee': withdrawFee,
1703
1703
  'percentage': (withdrawFee !== undefined) ? false : undefined,
package/js/src/upbit.js CHANGED
@@ -1037,7 +1037,7 @@ export default class upbit extends Exchange {
1037
1037
  if (side === 'buy') {
1038
1038
  if (this.options['createMarketBuyOrderRequiresPrice']) {
1039
1039
  if (price === undefined) {
1040
- throw new InvalidOrder(this.id + " createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false to supply the cost in the amount argument (the exchange-specific behaviour)");
1040
+ throw new InvalidOrder(this.id + ' createOrder() requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options["createMarketBuyOrderRequiresPrice"] = false to supply the cost in the amount argument (the exchange-specific behaviour)');
1041
1041
  }
1042
1042
  else {
1043
1043
  amount = amount * price;
@@ -2321,7 +2321,8 @@ export default class wavesexchange extends Exchange {
2321
2321
  const entry = depositWithdrawFees[code];
2322
2322
  const networks = this.safeValue(entry, 'networks');
2323
2323
  const networkKeys = Object.keys(networks);
2324
- if (networkKeys.length === 1) {
2324
+ const networkKeysLength = networkKeys.length;
2325
+ if (networkKeysLength === 1) {
2325
2326
  const network = this.safeValue(networks, networkKeys[0]);
2326
2327
  depositWithdrawFees[code]['withdraw'] = this.safeValue(network, 'withdraw');
2327
2328
  depositWithdrawFees[code]['deposit'] = this.safeValue(network, 'deposit');
@@ -2463,7 +2464,8 @@ export default class wavesexchange extends Exchange {
2463
2464
  let isErc20 = true;
2464
2465
  const noPrefix = this.remove0xPrefix(address);
2465
2466
  const lower = noPrefix.toLowerCase();
2466
- for (let i = 0; i < lower.length; i++) {
2467
+ const stringLength = lower.length * 1;
2468
+ for (let i = 0; i < stringLength; i++) {
2467
2469
  const character = lower[i];
2468
2470
  if (!(character in set)) {
2469
2471
  isErc20 = false;
package/js/src/wazirx.js CHANGED
@@ -812,6 +812,7 @@ export default class wazirx extends Exchange {
812
812
  const stopPrice = this.safeString(params, 'stopPrice');
813
813
  if (stopPrice !== undefined) {
814
814
  request['type'] = 'stop_limit';
815
+ request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
815
816
  }
816
817
  const response = await this.privatePostOrder(this.extend(request, params));
817
818
  // {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.0.78",
3
+ "version": "4.0.80",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",