ccxt 4.0.79 → 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.
package/README.md CHANGED
@@ -215,13 +215,13 @@ console.log(version, Object.keys(exchanges));
215
215
 
216
216
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
217
217
 
218
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.79/dist/ccxt.browser.js
219
- * unpkg: https://unpkg.com/ccxt@4.0.79/dist/ccxt.browser.js
218
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.80/dist/ccxt.browser.js
219
+ * unpkg: https://unpkg.com/ccxt@4.0.80/dist/ccxt.browser.js
220
220
 
221
221
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
222
222
 
223
223
  ```HTML
224
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.79/dist/ccxt.browser.js"></script>
224
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.80/dist/ccxt.browser.js"></script>
225
225
  ```
226
226
 
227
227
  Creates a global `ccxt` object:
@@ -47848,8 +47848,8 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
47848
47848
  'change': undefined,
47849
47849
  'percentage': undefined,
47850
47850
  'average': undefined,
47851
- 'baseVolume': this.convertFromRawQuantity(symbol, this.safeString(ticker, 'homeNotional24h')),
47852
- 'quoteVolume': this.convertFromRawQuantity(symbol, this.safeString(ticker, 'foreignNotional24h')),
47851
+ 'baseVolume': this.safeString(ticker, 'homeNotional24h'),
47852
+ 'quoteVolume': this.safeString(ticker, 'foreignNotional24h'),
47853
47853
  'info': ticker,
47854
47854
  }, market);
47855
47855
  }
@@ -71536,6 +71536,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
71536
71536
  'v5/spot-lever-token/info': 2.5,
71537
71537
  'v5/spot-lever-token/reference': 2.5,
71538
71538
  // spot margin trade
71539
+ 'v5/spot-margin-trade/data': 2.5,
71539
71540
  'v5/spot-cross-margin-trade/data': 2.5,
71540
71541
  'v5/spot-cross-margin-trade/pledge-token': 2.5,
71541
71542
  'v5/spot-cross-margin-trade/borrow-token': 2.5,
@@ -73815,7 +73816,8 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
73815
73816
  if (symbols !== undefined) {
73816
73817
  symbols = this.marketSymbols(symbols);
73817
73818
  market = this.market(symbols[0]);
73818
- if (symbols.length === 1) {
73819
+ const symbolsLength = symbols.length;
73820
+ if (symbolsLength === 1) {
73819
73821
  request['symbol'] = market['id'];
73820
73822
  }
73821
73823
  }
@@ -75199,7 +75201,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75199
75201
  const cost = this.safeNumber(params, 'cost');
75200
75202
  params = this.omit(params, 'cost');
75201
75203
  if (price === undefined && cost === undefined) {
75202
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.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)");
75204
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.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)');
75203
75205
  }
75204
75206
  else {
75205
75207
  const amountString = this.numberToString(amount);
@@ -97589,9 +97591,9 @@ class coinsph extends _abstract_coinsph_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
97589
97591
  if (i !== 0) {
97590
97592
  encodedArrayParams += '&';
97591
97593
  }
97592
- const array = query[key];
97594
+ const innerArray = query[key];
97593
97595
  query = this.omit(query, key);
97594
- const encodedArrayParam = this.parseArrayParam(array, key);
97596
+ const encodedArrayParam = this.parseArrayParam(innerArray, key);
97595
97597
  encodedArrayParams += encodedArrayParam;
97596
97598
  }
97597
97599
  }
@@ -145952,7 +145954,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
145952
145954
  let statusId = undefined;
145953
145955
  let price = undefined;
145954
145956
  let trades = [];
145955
- if (orderEvents.length > 0) {
145957
+ if (orderEvents.length) {
145956
145958
  const executions = [];
145957
145959
  for (let i = 0; i < orderEvents.length; i++) {
145958
145960
  const item = orderEvents[i];
@@ -146000,7 +146002,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
146000
146002
  let remaining = this.safeString(details, 'unfilledSize');
146001
146003
  let average = undefined;
146002
146004
  let filled2 = '0.0';
146003
- if (trades.length > 0) {
146005
+ if (trades.length) {
146004
146006
  let vwapSum = '0.0';
146005
146007
  for (let i = 0; i < trades.length; i++) {
146006
146008
  const trade = trades[i];
@@ -175163,7 +175165,7 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
175163
175165
  }
175164
175166
  }
175165
175167
  else if (notional === undefined) {
175166
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.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 and supply the total cost value in the 'amount' argument or in the 'notional' extra parameter (the exchange-specific behaviour)");
175168
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.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 and supply the total cost value in the "amount" argument or in the "notional" extra parameter (the exchange-specific behaviour)');
175167
175169
  }
175168
175170
  }
175169
175171
  else {
@@ -176640,7 +176642,7 @@ class okcoin extends _abstract_okcoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
176640
176642
  let currency = undefined;
176641
176643
  if (type === 'spot') {
176642
176644
  if (code === undefined) {
176643
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + " fetchLedger() requires a currency code argument for '" + type + "' markets");
176645
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' fetchLedger() requires a currency code argument for "' + type + '" markets');
176644
176646
  }
176645
176647
  argument = 'Currency';
176646
176648
  currency = this.currency(code);
@@ -181378,7 +181380,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
181378
181380
  const targetNetwork = this.safeValue(currency['networks'], this.networkIdToCode(network), {});
181379
181381
  fee = this.safeString(targetNetwork, 'fee');
181380
181382
  if (fee === undefined) {
181381
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + " withdraw() requires a 'fee' string parameter, network transaction fee must be ≥ 0. Withdrawals to OKCoin or OKX are fee-free, please set '0'. Withdrawing to external digital asset address requires network transaction fee.");
181383
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' withdraw() requires a "fee" string parameter, network transaction fee must be ≥ 0. Withdrawals to OKCoin or OKX are fee-free, please set "0". Withdrawing to external digital asset address requires network transaction fee.');
181382
181384
  }
181383
181385
  }
181384
181386
  request['fee'] = this.numberToString(fee); // withdrawals to OKCoin or OKX are fee-free, please set 0
@@ -199156,9 +199158,18 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
199156
199158
  'ws': {
199157
199159
  'exact': {
199158
199160
  '30001': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
199161
+ '30002': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
199162
+ '30003': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
199163
+ '30004': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
199164
+ '30005': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
199165
+ '30006': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.RateLimitExceeded,
199166
+ '30007': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.RateLimitExceeded,
199167
+ '30011': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
199168
+ '30012': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
199169
+ '30013': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
199170
+ '30014': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
199159
199171
  '30015': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
199160
- '30016': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
199161
- '30011': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError, // { event: 'error', code: 30011, msg: 'Invalid ACCESS_KEY' }
199172
+ '30016': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest, // { event: 'error', code: 30016, msg: 'Param error' }
199162
199173
  },
199163
199174
  },
199164
199175
  },
@@ -200248,6 +200259,9 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
200248
200259
  const code = this.safeString(message, 'code');
200249
200260
  const feedback = this.id + ' ' + this.json(message);
200250
200261
  this.throwExactlyMatchedException(this.exceptions['ws']['exact'], code, feedback);
200262
+ const msg = this.safeString(message, 'msg', '');
200263
+ this.throwBroadlyMatchedException(this.exceptions['ws']['broad'], msg, feedback);
200264
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(feedback);
200251
200265
  }
200252
200266
  return false;
200253
200267
  }
@@ -200259,6 +200273,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
200259
200273
  delete client.subscriptions[messageHash];
200260
200274
  }
200261
200275
  }
200276
+ else {
200277
+ // Note: if error happens on a subscribe event, user will have to close exchange to resubscribe. Issue #19041
200278
+ client.reject(e);
200279
+ }
200262
200280
  return true;
200263
200281
  }
200264
200282
  }
@@ -216211,15 +216229,17 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
216211
216229
  const subscription = this.safeString(ohlcv, 'n', '');
216212
216230
  const parts = subscription.split('_');
216213
216231
  const timeframe = this.safeString(parts, 0);
216232
+ const timeframeId = this.findTimeframe(timeframe);
216214
216233
  const prefix = timeframe + '_';
216215
216234
  const marketId = subscription.replace(prefix, '');
216216
216235
  const symbol = this.safeSymbol(marketId, undefined, '_', marketType);
216217
216236
  const parsed = this.parseOHLCV(ohlcv);
216218
- let stored = this.safeValue(this.ohlcvs, symbol);
216237
+ this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
216238
+ let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
216219
216239
  if (stored === undefined) {
216220
216240
  const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
216221
216241
  stored = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheByTimestamp */ .Py(limit);
216222
- this.ohlcvs[symbol] = stored;
216242
+ this.ohlcvs[symbol][timeframeId] = stored;
216223
216243
  }
216224
216244
  stored.append(parsed);
216225
216245
  marketIds[symbol] = timeframe;
@@ -216230,7 +216250,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
216230
216250
  const timeframe = marketIds[symbol];
216231
216251
  const interval = this.findTimeframe(timeframe);
216232
216252
  const hash = 'candles' + ':' + interval + ':' + symbol;
216233
- const stored = this.safeValue(this.ohlcvs, symbol);
216253
+ const stored = this.safeValue(this.ohlcvs[symbol], interval);
216234
216254
  client.resolve(stored, hash);
216235
216255
  }
216236
216256
  }
@@ -223091,8 +223111,8 @@ class kraken extends _kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
223091
223111
  }
223092
223112
  }
223093
223113
  formatNumber(n, length) {
223094
- const string = this.numberToString(n);
223095
- const parts = string.split('.');
223114
+ const stringNumber = this.numberToString(n);
223115
+ const parts = stringNumber.split('.');
223096
223116
  const integer = this.safeString(parts, 0);
223097
223117
  const decimals = this.safeString(parts, 1, '');
223098
223118
  const paddedDecimals = decimals.padEnd(length, '0');
@@ -238944,7 +238964,7 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
238944
238964
  }
238945
238965
  }
238946
238966
  else if (cost === undefined) {
238947
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.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)");
238967
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.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)');
238948
238968
  }
238949
238969
  }
238950
238970
  else {
@@ -239414,7 +239434,7 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
239414
239434
  const networkCode = this.networkIdToCode(networkId, currency['code']);
239415
239435
  const withdrawalFees = this.safeValue(network, 'withdrawal_fee', {});
239416
239436
  const withdrawFee = this.safeNumber(withdrawalFees[0], 'amount');
239417
- if (withdrawalFees.length > 0) {
239437
+ if (withdrawalFees.length) {
239418
239438
  const withdrawResult = {
239419
239439
  'fee': withdrawFee,
239420
239440
  'percentage': (withdrawFee !== undefined) ? false : undefined,
@@ -254690,7 +254710,7 @@ class upbit extends _abstract_upbit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
254690
254710
  if (side === 'buy') {
254691
254711
  if (this.options['createMarketBuyOrderRequiresPrice']) {
254692
254712
  if (price === undefined) {
254693
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.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)");
254713
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.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)');
254694
254714
  }
254695
254715
  else {
254696
254716
  amount = amount * price;
@@ -257808,7 +257828,8 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
257808
257828
  const entry = depositWithdrawFees[code];
257809
257829
  const networks = this.safeValue(entry, 'networks');
257810
257830
  const networkKeys = Object.keys(networks);
257811
- if (networkKeys.length === 1) {
257831
+ const networkKeysLength = networkKeys.length;
257832
+ if (networkKeysLength === 1) {
257812
257833
  const network = this.safeValue(networks, networkKeys[0]);
257813
257834
  depositWithdrawFees[code]['withdraw'] = this.safeValue(network, 'withdraw');
257814
257835
  depositWithdrawFees[code]['deposit'] = this.safeValue(network, 'deposit');
@@ -257950,7 +257971,8 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
257950
257971
  let isErc20 = true;
257951
257972
  const noPrefix = this.remove0xPrefix(address);
257952
257973
  const lower = noPrefix.toLowerCase();
257953
- for (let i = 0; i < lower.length; i++) {
257974
+ const stringLength = lower.length * 1;
257975
+ for (let i = 0; i < stringLength; i++) {
257954
257976
  const character = lower[i];
257955
257977
  if (!(character in set)) {
257956
257978
  isErc20 = false;
@@ -258909,6 +258931,7 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
258909
258931
  const stopPrice = this.safeString(params, 'stopPrice');
258910
258932
  if (stopPrice !== undefined) {
258911
258933
  request['type'] = 'stop_limit';
258934
+ request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
258912
258935
  }
258913
258936
  const response = await this.privatePostOrder(this.extend(request, params));
258914
258937
  // {
@@ -273441,7 +273464,7 @@ SOFTWARE.
273441
273464
 
273442
273465
  //-----------------------------------------------------------------------------
273443
273466
  // this is updated by vss.js when building
273444
- const version = '4.0.79';
273467
+ const version = '4.0.80';
273445
273468
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
273446
273469
  //-----------------------------------------------------------------------------
273447
273470