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/dist/cjs/ccxt.js CHANGED
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
180
180
 
181
181
  //-----------------------------------------------------------------------------
182
182
  // this is updated by vss.js when building
183
- const version = '4.0.79';
183
+ const version = '4.0.80';
184
184
  Exchange["default"].ccxtVersion = version;
185
185
  const exchanges = {
186
186
  'ace': ace,
@@ -1351,8 +1351,8 @@ class bitmex extends bitmex$1 {
1351
1351
  'change': undefined,
1352
1352
  'percentage': undefined,
1353
1353
  'average': undefined,
1354
- 'baseVolume': this.convertFromRawQuantity(symbol, this.safeString(ticker, 'homeNotional24h')),
1355
- 'quoteVolume': this.convertFromRawQuantity(symbol, this.safeString(ticker, 'foreignNotional24h')),
1354
+ 'baseVolume': this.safeString(ticker, 'homeNotional24h'),
1355
+ 'quoteVolume': this.safeString(ticker, 'foreignNotional24h'),
1356
1356
  'info': ticker,
1357
1357
  }, market);
1358
1358
  }
@@ -248,6 +248,7 @@ class bybit extends bybit$1 {
248
248
  'v5/spot-lever-token/info': 2.5,
249
249
  'v5/spot-lever-token/reference': 2.5,
250
250
  // spot margin trade
251
+ 'v5/spot-margin-trade/data': 2.5,
251
252
  'v5/spot-cross-margin-trade/data': 2.5,
252
253
  'v5/spot-cross-margin-trade/pledge-token': 2.5,
253
254
  'v5/spot-cross-margin-trade/borrow-token': 2.5,
@@ -2527,7 +2528,8 @@ class bybit extends bybit$1 {
2527
2528
  if (symbols !== undefined) {
2528
2529
  symbols = this.marketSymbols(symbols);
2529
2530
  market = this.market(symbols[0]);
2530
- if (symbols.length === 1) {
2531
+ const symbolsLength = symbols.length;
2532
+ if (symbolsLength === 1) {
2531
2533
  request['symbol'] = market['id'];
2532
2534
  }
2533
2535
  }
@@ -3911,7 +3913,7 @@ class bybit extends bybit$1 {
3911
3913
  const cost = this.safeNumber(params, 'cost');
3912
3914
  params = this.omit(params, 'cost');
3913
3915
  if (price === undefined && cost === undefined) {
3914
- throw new errors.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)");
3916
+ throw new errors.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)');
3915
3917
  }
3916
3918
  else {
3917
3919
  const amountString = this.numberToString(amount);
@@ -1865,9 +1865,9 @@ class coinsph extends coinsph$1 {
1865
1865
  if (i !== 0) {
1866
1866
  encodedArrayParams += '&';
1867
1867
  }
1868
- const array = query[key];
1868
+ const innerArray = query[key];
1869
1869
  query = this.omit(query, key);
1870
- const encodedArrayParam = this.parseArrayParam(array, key);
1870
+ const encodedArrayParam = this.parseArrayParam(innerArray, key);
1871
1871
  encodedArrayParams += encodedArrayParam;
1872
1872
  }
1873
1873
  }
@@ -1217,7 +1217,7 @@ class krakenfutures extends krakenfutures$1 {
1217
1217
  let statusId = undefined;
1218
1218
  let price = undefined;
1219
1219
  let trades = [];
1220
- if (orderEvents.length > 0) {
1220
+ if (orderEvents.length) {
1221
1221
  const executions = [];
1222
1222
  for (let i = 0; i < orderEvents.length; i++) {
1223
1223
  const item = orderEvents[i];
@@ -1265,7 +1265,7 @@ class krakenfutures extends krakenfutures$1 {
1265
1265
  let remaining = this.safeString(details, 'unfilledSize');
1266
1266
  let average = undefined;
1267
1267
  let filled2 = '0.0';
1268
- if (trades.length > 0) {
1268
+ if (trades.length) {
1269
1269
  let vwapSum = '0.0';
1270
1270
  for (let i = 0; i < trades.length; i++) {
1271
1271
  const trade = trades[i];
@@ -2010,7 +2010,7 @@ class okcoin extends okcoin$1 {
2010
2010
  }
2011
2011
  }
2012
2012
  else if (notional === undefined) {
2013
- throw new errors.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)");
2013
+ throw new errors.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)');
2014
2014
  }
2015
2015
  }
2016
2016
  else {
@@ -3487,7 +3487,7 @@ class okcoin extends okcoin$1 {
3487
3487
  let currency = undefined;
3488
3488
  if (type === 'spot') {
3489
3489
  if (code === undefined) {
3490
- throw new errors.ArgumentsRequired(this.id + " fetchLedger() requires a currency code argument for '" + type + "' markets");
3490
+ throw new errors.ArgumentsRequired(this.id + ' fetchLedger() requires a currency code argument for "' + type + '" markets');
3491
3491
  }
3492
3492
  argument = 'Currency';
3493
3493
  currency = this.currency(code);
@@ -4315,7 +4315,7 @@ class okx extends okx$1 {
4315
4315
  const targetNetwork = this.safeValue(currency['networks'], this.networkIdToCode(network), {});
4316
4316
  fee = this.safeString(targetNetwork, 'fee');
4317
4317
  if (fee === undefined) {
4318
- throw new errors.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.");
4318
+ throw new errors.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.');
4319
4319
  }
4320
4320
  }
4321
4321
  request['fee'] = this.numberToString(fee); // withdrawals to OKCoin or OKX are fee-free, please set 0
@@ -51,9 +51,18 @@ class bitget extends bitget$1 {
51
51
  'ws': {
52
52
  'exact': {
53
53
  '30001': errors.BadRequest,
54
+ '30002': errors.AuthenticationError,
55
+ '30003': errors.BadRequest,
56
+ '30004': errors.AuthenticationError,
57
+ '30005': errors.AuthenticationError,
58
+ '30006': errors.RateLimitExceeded,
59
+ '30007': errors.RateLimitExceeded,
60
+ '30011': errors.AuthenticationError,
61
+ '30012': errors.AuthenticationError,
62
+ '30013': errors.AuthenticationError,
63
+ '30014': errors.BadRequest,
54
64
  '30015': errors.AuthenticationError,
55
- '30016': errors.BadRequest,
56
- '30011': errors.AuthenticationError, // { event: 'error', code: 30011, msg: 'Invalid ACCESS_KEY' }
65
+ '30016': errors.BadRequest, // { event: 'error', code: 30016, msg: 'Param error' }
57
66
  },
58
67
  },
59
68
  },
@@ -1143,6 +1152,9 @@ class bitget extends bitget$1 {
1143
1152
  const code = this.safeString(message, 'code');
1144
1153
  const feedback = this.id + ' ' + this.json(message);
1145
1154
  this.throwExactlyMatchedException(this.exceptions['ws']['exact'], code, feedback);
1155
+ const msg = this.safeString(message, 'msg', '');
1156
+ this.throwBroadlyMatchedException(this.exceptions['ws']['broad'], msg, feedback);
1157
+ throw new errors.ExchangeError(feedback);
1146
1158
  }
1147
1159
  return false;
1148
1160
  }
@@ -1154,6 +1166,10 @@ class bitget extends bitget$1 {
1154
1166
  delete client.subscriptions[messageHash];
1155
1167
  }
1156
1168
  }
1169
+ else {
1170
+ // Note: if error happens on a subscribe event, user will have to close exchange to resubscribe. Issue #19041
1171
+ client.reject(e);
1172
+ }
1157
1173
  return true;
1158
1174
  }
1159
1175
  }
@@ -489,15 +489,17 @@ class gate extends gate$1 {
489
489
  const subscription = this.safeString(ohlcv, 'n', '');
490
490
  const parts = subscription.split('_');
491
491
  const timeframe = this.safeString(parts, 0);
492
+ const timeframeId = this.findTimeframe(timeframe);
492
493
  const prefix = timeframe + '_';
493
494
  const marketId = subscription.replace(prefix, '');
494
495
  const symbol = this.safeSymbol(marketId, undefined, '_', marketType);
495
496
  const parsed = this.parseOHLCV(ohlcv);
496
- let stored = this.safeValue(this.ohlcvs, symbol);
497
+ this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
498
+ let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
497
499
  if (stored === undefined) {
498
500
  const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
499
501
  stored = new Cache.ArrayCacheByTimestamp(limit);
500
- this.ohlcvs[symbol] = stored;
502
+ this.ohlcvs[symbol][timeframeId] = stored;
501
503
  }
502
504
  stored.append(parsed);
503
505
  marketIds[symbol] = timeframe;
@@ -508,7 +510,7 @@ class gate extends gate$1 {
508
510
  const timeframe = marketIds[symbol];
509
511
  const interval = this.findTimeframe(timeframe);
510
512
  const hash = 'candles' + ':' + interval + ':' + symbol;
511
- const stored = this.safeValue(this.ohlcvs, symbol);
513
+ const stored = this.safeValue(this.ohlcvs[symbol], interval);
512
514
  client.resolve(stored, hash);
513
515
  }
514
516
  }
@@ -731,8 +731,8 @@ class kraken extends kraken$1 {
731
731
  }
732
732
  }
733
733
  formatNumber(n, length) {
734
- const string = this.numberToString(n);
735
- const parts = string.split('.');
734
+ const stringNumber = this.numberToString(n);
735
+ const parts = stringNumber.split('.');
736
736
  const integer = this.safeString(parts, 0);
737
737
  const decimals = this.safeString(parts, 1, '');
738
738
  const paddedDecimals = decimals.padEnd(length, '0');
@@ -1224,7 +1224,7 @@ class probit extends probit$1 {
1224
1224
  }
1225
1225
  }
1226
1226
  else if (cost === undefined) {
1227
- throw new errors.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)");
1227
+ throw new errors.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)');
1228
1228
  }
1229
1229
  }
1230
1230
  else {
@@ -1694,7 +1694,7 @@ class probit extends probit$1 {
1694
1694
  const networkCode = this.networkIdToCode(networkId, currency['code']);
1695
1695
  const withdrawalFees = this.safeValue(network, 'withdrawal_fee', {});
1696
1696
  const withdrawFee = this.safeNumber(withdrawalFees[0], 'amount');
1697
- if (withdrawalFees.length > 0) {
1697
+ if (withdrawalFees.length) {
1698
1698
  const withdrawResult = {
1699
1699
  'fee': withdrawFee,
1700
1700
  'percentage': (withdrawFee !== undefined) ? false : undefined,
@@ -1034,7 +1034,7 @@ class upbit extends upbit$1 {
1034
1034
  if (side === 'buy') {
1035
1035
  if (this.options['createMarketBuyOrderRequiresPrice']) {
1036
1036
  if (price === undefined) {
1037
- throw new errors.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)");
1037
+ throw new errors.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)');
1038
1038
  }
1039
1039
  else {
1040
1040
  amount = amount * price;
@@ -2318,7 +2318,8 @@ class wavesexchange extends wavesexchange$1 {
2318
2318
  const entry = depositWithdrawFees[code];
2319
2319
  const networks = this.safeValue(entry, 'networks');
2320
2320
  const networkKeys = Object.keys(networks);
2321
- if (networkKeys.length === 1) {
2321
+ const networkKeysLength = networkKeys.length;
2322
+ if (networkKeysLength === 1) {
2322
2323
  const network = this.safeValue(networks, networkKeys[0]);
2323
2324
  depositWithdrawFees[code]['withdraw'] = this.safeValue(network, 'withdraw');
2324
2325
  depositWithdrawFees[code]['deposit'] = this.safeValue(network, 'deposit');
@@ -2460,7 +2461,8 @@ class wavesexchange extends wavesexchange$1 {
2460
2461
  let isErc20 = true;
2461
2462
  const noPrefix = this.remove0xPrefix(address);
2462
2463
  const lower = noPrefix.toLowerCase();
2463
- for (let i = 0; i < lower.length; i++) {
2464
+ const stringLength = lower.length * 1;
2465
+ for (let i = 0; i < stringLength; i++) {
2464
2466
  const character = lower[i];
2465
2467
  if (!(character in set)) {
2466
2468
  isErc20 = false;
@@ -809,6 +809,7 @@ class wazirx extends wazirx$1 {
809
809
  const stopPrice = this.safeString(params, 'stopPrice');
810
810
  if (stopPrice !== undefined) {
811
811
  request['type'] = 'stop_limit';
812
+ request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
812
813
  }
813
814
  const response = await this.privatePostOrder(this.extend(request, params));
814
815
  // {
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
7
- declare const version = "4.0.78";
7
+ declare const version = "4.0.79";
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.0.79';
41
+ const version = '4.0.80';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -98,6 +98,7 @@ interface Exchange {
98
98
  publicGetV5MarketDeliveryPrice(params?: {}): Promise<implicitReturnType>;
99
99
  publicGetV5SpotLeverTokenInfo(params?: {}): Promise<implicitReturnType>;
100
100
  publicGetV5SpotLeverTokenReference(params?: {}): Promise<implicitReturnType>;
101
+ publicGetV5SpotMarginTradeData(params?: {}): Promise<implicitReturnType>;
101
102
  publicGetV5SpotCrossMarginTradeData(params?: {}): Promise<implicitReturnType>;
102
103
  publicGetV5SpotCrossMarginTradePledgeToken(params?: {}): Promise<implicitReturnType>;
103
104
  publicGetV5SpotCrossMarginTradeBorrowToken(params?: {}): Promise<implicitReturnType>;
package/js/src/bitmex.js CHANGED
@@ -1354,8 +1354,8 @@ export default class bitmex extends Exchange {
1354
1354
  'change': undefined,
1355
1355
  'percentage': undefined,
1356
1356
  'average': undefined,
1357
- 'baseVolume': this.convertFromRawQuantity(symbol, this.safeString(ticker, 'homeNotional24h')),
1358
- 'quoteVolume': this.convertFromRawQuantity(symbol, this.safeString(ticker, 'foreignNotional24h')),
1357
+ 'baseVolume': this.safeString(ticker, 'homeNotional24h'),
1358
+ 'quoteVolume': this.safeString(ticker, 'foreignNotional24h'),
1359
1359
  'info': ticker,
1360
1360
  }, market);
1361
1361
  }
package/js/src/bybit.js CHANGED
@@ -251,6 +251,7 @@ export default class bybit extends Exchange {
251
251
  'v5/spot-lever-token/info': 2.5,
252
252
  'v5/spot-lever-token/reference': 2.5,
253
253
  // spot margin trade
254
+ 'v5/spot-margin-trade/data': 2.5,
254
255
  'v5/spot-cross-margin-trade/data': 2.5,
255
256
  'v5/spot-cross-margin-trade/pledge-token': 2.5,
256
257
  'v5/spot-cross-margin-trade/borrow-token': 2.5,
@@ -2530,7 +2531,8 @@ export default class bybit extends Exchange {
2530
2531
  if (symbols !== undefined) {
2531
2532
  symbols = this.marketSymbols(symbols);
2532
2533
  market = this.market(symbols[0]);
2533
- if (symbols.length === 1) {
2534
+ const symbolsLength = symbols.length;
2535
+ if (symbolsLength === 1) {
2534
2536
  request['symbol'] = market['id'];
2535
2537
  }
2536
2538
  }
@@ -3914,7 +3916,7 @@ export default class bybit extends Exchange {
3914
3916
  const cost = this.safeNumber(params, 'cost');
3915
3917
  params = this.omit(params, 'cost');
3916
3918
  if (price === undefined && cost === undefined) {
3917
- 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)");
3919
+ 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)');
3918
3920
  }
3919
3921
  else {
3920
3922
  const amountString = this.numberToString(amount);
package/js/src/coinsph.js CHANGED
@@ -1868,9 +1868,9 @@ export default class coinsph extends Exchange {
1868
1868
  if (i !== 0) {
1869
1869
  encodedArrayParams += '&';
1870
1870
  }
1871
- const array = query[key];
1871
+ const innerArray = query[key];
1872
1872
  query = this.omit(query, key);
1873
- const encodedArrayParam = this.parseArrayParam(array, key);
1873
+ const encodedArrayParam = this.parseArrayParam(innerArray, key);
1874
1874
  encodedArrayParams += encodedArrayParam;
1875
1875
  }
1876
1876
  }
@@ -1220,7 +1220,7 @@ export default class krakenfutures extends Exchange {
1220
1220
  let statusId = undefined;
1221
1221
  let price = undefined;
1222
1222
  let trades = [];
1223
- if (orderEvents.length > 0) {
1223
+ if (orderEvents.length) {
1224
1224
  const executions = [];
1225
1225
  for (let i = 0; i < orderEvents.length; i++) {
1226
1226
  const item = orderEvents[i];
@@ -1268,7 +1268,7 @@ export default class krakenfutures extends Exchange {
1268
1268
  let remaining = this.safeString(details, 'unfilledSize');
1269
1269
  let average = undefined;
1270
1270
  let filled2 = '0.0';
1271
- if (trades.length > 0) {
1271
+ if (trades.length) {
1272
1272
  let vwapSum = '0.0';
1273
1273
  for (let i = 0; i < trades.length; i++) {
1274
1274
  const trade = trades[i];
package/js/src/okcoin.js CHANGED
@@ -2013,7 +2013,7 @@ export default class okcoin extends Exchange {
2013
2013
  }
2014
2014
  }
2015
2015
  else if (notional === undefined) {
2016
- 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 and supply the total cost value in the 'amount' argument or in the 'notional' extra parameter (the exchange-specific behaviour)");
2016
+ 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 and supply the total cost value in the "amount" argument or in the "notional" extra parameter (the exchange-specific behaviour)');
2017
2017
  }
2018
2018
  }
2019
2019
  else {
@@ -3490,7 +3490,7 @@ export default class okcoin extends Exchange {
3490
3490
  let currency = undefined;
3491
3491
  if (type === 'spot') {
3492
3492
  if (code === undefined) {
3493
- throw new ArgumentsRequired(this.id + " fetchLedger() requires a currency code argument for '" + type + "' markets");
3493
+ throw new ArgumentsRequired(this.id + ' fetchLedger() requires a currency code argument for "' + type + '" markets');
3494
3494
  }
3495
3495
  argument = 'Currency';
3496
3496
  currency = this.currency(code);
package/js/src/okx.js CHANGED
@@ -4318,7 +4318,7 @@ export default class okx extends Exchange {
4318
4318
  const targetNetwork = this.safeValue(currency['networks'], this.networkIdToCode(network), {});
4319
4319
  fee = this.safeString(targetNetwork, 'fee');
4320
4320
  if (fee === undefined) {
4321
- throw new 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.");
4321
+ throw new 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.');
4322
4322
  }
4323
4323
  }
4324
4324
  request['fee'] = this.numberToString(fee); // withdrawals to OKCoin or OKX are fee-free, please set 0
@@ -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.79",
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",