ccxt 4.0.106 → 4.0.108

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.
@@ -6529,16 +6529,19 @@ class ascendex extends _abstract_ascendex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
6529
6529
  /* harmony export */ });
6530
6530
  /* unused harmony export default */
6531
6531
  /* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7100);
6532
- /* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6689);
6533
- /* harmony import */ var _Precise_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2194);
6534
- /* harmony import */ var _ws_WsClient_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7517);
6535
- /* harmony import */ var _ws_Future_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2367);
6536
- /* harmony import */ var _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7091);
6537
- /* harmony import */ var _functions_totp_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2523);
6532
+ /* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(927);
6533
+ /* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2116);
6534
+ /* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6689);
6535
+ /* harmony import */ var _Precise_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2194);
6536
+ /* harmony import */ var _ws_WsClient_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7517);
6537
+ /* harmony import */ var _ws_Future_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2367);
6538
+ /* harmony import */ var _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7091);
6539
+ /* harmony import */ var _functions_totp_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2523);
6538
6540
  // ----------------------------------------------------------------------------
6539
6541
  /* eslint-disable */
6540
6542
 
6541
- const { isNode, keys, values, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, vwap, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, parseDate, ymd, isArray, base64ToString, crc32, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS } = _functions_js__WEBPACK_IMPORTED_MODULE_0__;
6543
+ const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, parseDate, ymd, base64ToString, crc32, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS } = _functions_js__WEBPACK_IMPORTED_MODULE_0__;
6544
+
6542
6545
  // import exceptions from "./errors.js"
6543
6546
 
6544
6547
 
@@ -6629,8 +6632,8 @@ class Exchange {
6629
6632
  this.streaming = {};
6630
6633
  this.deepExtend = deepExtend;
6631
6634
  this.isNode = isNode;
6632
- this.keys = keys;
6633
- this.values = values;
6635
+ this.keys = _functions_js__WEBPACK_IMPORTED_MODULE_1__/* .keys */ .XP;
6636
+ this.values = _functions_js__WEBPACK_IMPORTED_MODULE_1__/* .values */ .VO;
6634
6637
  this.extend = extend;
6635
6638
  this.clone = clone;
6636
6639
  this.flatten = flatten;
@@ -6666,7 +6669,7 @@ class Exchange {
6666
6669
  this.implodeParams = implodeParams;
6667
6670
  this.extractParams = extractParams;
6668
6671
  this.json = json;
6669
- this.vwap = vwap;
6672
+ this.vwap = _functions_js__WEBPACK_IMPORTED_MODULE_2__/* .vwap */ .KY;
6670
6673
  this.merge = merge;
6671
6674
  this.binaryConcat = binaryConcat;
6672
6675
  this.hash = hash;
@@ -6721,7 +6724,7 @@ class Exchange {
6721
6724
  this.urlencodeNested = urlencodeNested;
6722
6725
  this.parseDate = parseDate;
6723
6726
  this.ymd = ymd;
6724
- this.isArray = isArray;
6727
+ this.isArray = _functions_js__WEBPACK_IMPORTED_MODULE_1__/* .inArray */ .d3;
6725
6728
  this.base64ToString = base64ToString;
6726
6729
  this.crc32 = crc32;
6727
6730
  Object.assign(this, _functions_js__WEBPACK_IMPORTED_MODULE_0__);
@@ -7005,31 +7008,31 @@ class Exchange {
7005
7008
  },
7006
7009
  'exceptions': undefined,
7007
7010
  'httpExceptions': {
7008
- '422': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError,
7009
- '418': _errors_js__WEBPACK_IMPORTED_MODULE_1__.DDoSProtection,
7010
- '429': _errors_js__WEBPACK_IMPORTED_MODULE_1__.RateLimitExceeded,
7011
- '404': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7012
- '409': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7013
- '410': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7014
- '451': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7015
- '500': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7016
- '501': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7017
- '502': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7018
- '520': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7019
- '521': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7020
- '522': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7021
- '525': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7022
- '526': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7023
- '400': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7024
- '403': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7025
- '405': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7026
- '503': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7027
- '530': _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeNotAvailable,
7028
- '408': _errors_js__WEBPACK_IMPORTED_MODULE_1__.RequestTimeout,
7029
- '504': _errors_js__WEBPACK_IMPORTED_MODULE_1__.RequestTimeout,
7030
- '401': _errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
7031
- '407': _errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
7032
- '511': _errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
7011
+ '422': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError,
7012
+ '418': _errors_js__WEBPACK_IMPORTED_MODULE_3__.DDoSProtection,
7013
+ '429': _errors_js__WEBPACK_IMPORTED_MODULE_3__.RateLimitExceeded,
7014
+ '404': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7015
+ '409': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7016
+ '410': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7017
+ '451': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7018
+ '500': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7019
+ '501': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7020
+ '502': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7021
+ '520': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7022
+ '521': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7023
+ '522': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7024
+ '525': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7025
+ '526': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7026
+ '400': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7027
+ '403': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7028
+ '405': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7029
+ '503': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7030
+ '530': _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeNotAvailable,
7031
+ '408': _errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout,
7032
+ '504': _errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout,
7033
+ '401': _errors_js__WEBPACK_IMPORTED_MODULE_3__.AuthenticationError,
7034
+ '407': _errors_js__WEBPACK_IMPORTED_MODULE_3__.AuthenticationError,
7035
+ '511': _errors_js__WEBPACK_IMPORTED_MODULE_3__.AuthenticationError,
7033
7036
  },
7034
7037
  'commonCurrencies': {
7035
7038
  'XBT': 'BTC',
@@ -7066,7 +7069,7 @@ class Exchange {
7066
7069
  }
7067
7070
  if (!result) {
7068
7071
  if (error) {
7069
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported('Your current version of CCXT is ' + Exchange.ccxtVersion + ', a newer version ' + requiredVersion + ' is required, please, upgrade your version of CCXT');
7072
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported('Your current version of CCXT is ' + Exchange.ccxtVersion + ', a newer version ' + requiredVersion + ' is required, please, upgrade your version of CCXT');
7070
7073
  }
7071
7074
  else {
7072
7075
  return error;
@@ -7076,11 +7079,11 @@ class Exchange {
7076
7079
  }
7077
7080
  checkAddress(address) {
7078
7081
  if (address === undefined) {
7079
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidAddress(this.id + ' address is undefined');
7082
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidAddress(this.id + ' address is undefined');
7080
7083
  }
7081
7084
  // check the address is not the same letter like 'aaaaa' nor too short nor has a space
7082
7085
  if ((this.unique(address).length === 1) || address.length < this.minFundingAddressLength || address.includes(' ')) {
7083
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidAddress(this.id + ' address is invalid or has less than ' + this.minFundingAddressLength.toString() + ' characters: "' + this.json(address) + '"');
7086
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidAddress(this.id + ' address is invalid or has less than ' + this.minFundingAddressLength.toString() + ' characters: "' + this.json(address) + '"');
7084
7087
  }
7085
7088
  return address;
7086
7089
  }
@@ -7144,7 +7147,7 @@ class Exchange {
7144
7147
  this.defineRestApiEndpoint(methodName, uppercaseMethod, lowercaseMethod, camelcaseMethod, path, paths, { cost: config });
7145
7148
  }
7146
7149
  else {
7147
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' defineRestApi() API format is not supported, API leafs must strings, objects or numbers');
7150
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' defineRestApi() API format is not supported, API leafs must strings, objects or numbers');
7148
7151
  }
7149
7152
  }
7150
7153
  }
@@ -7185,7 +7188,7 @@ class Exchange {
7185
7188
  module = await import(/* webpackIgnore: true */ 'socks-proxy-agent');
7186
7189
  }
7187
7190
  catch (e) {
7188
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' - to use SOCKS proxy with ccxt, at first you need install module "npm i socks-proxy-agent" ');
7191
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' - to use SOCKS proxy with ccxt, at first you need install module "npm i socks-proxy-agent" ');
7189
7192
  }
7190
7193
  this.agent = new module.SocksProxyAgent(socksProxy);
7191
7194
  }
@@ -7239,10 +7242,10 @@ class Exchange {
7239
7242
  }
7240
7243
  catch (e) {
7241
7244
  if (e instanceof this.AbortError) {
7242
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.RequestTimeout(this.id + ' ' + method + ' ' + url + ' request timed out (' + this.timeout + ' ms)');
7245
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.RequestTimeout(this.id + ' ' + method + ' ' + url + ' request timed out (' + this.timeout + ' ms)');
7243
7246
  }
7244
7247
  else if (e instanceof this.FetchError) {
7245
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NetworkError(this.id + ' ' + method + ' ' + url + ' fetch failed');
7248
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NetworkError(this.id + ' ' + method + ' ' + url + ' fetch failed');
7246
7249
  }
7247
7250
  throw e;
7248
7251
  }
@@ -7372,11 +7375,11 @@ class Exchange {
7372
7375
  checkOrderArguments(market, type, side, amount, price, params) {
7373
7376
  if (price === undefined) {
7374
7377
  if (type === 'limit') {
7375
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createOrder() requires a price argument for a limit order');
7378
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' createOrder() requires a price argument for a limit order');
7376
7379
  }
7377
7380
  }
7378
7381
  if (amount <= 0) {
7379
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' createOrder() amount should be above 0');
7382
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' createOrder() amount should be above 0');
7380
7383
  }
7381
7384
  }
7382
7385
  handleHttpStatusCode(code, reason, url, method, body) {
@@ -7395,7 +7398,7 @@ class Exchange {
7395
7398
  }
7396
7399
  }
7397
7400
  spawn(method, ...args) {
7398
- const future = (0,_ws_Future_js__WEBPACK_IMPORTED_MODULE_2__/* .createFuture */ .N)();
7401
+ const future = (0,_ws_Future_js__WEBPACK_IMPORTED_MODULE_4__/* .createFuture */ .N)();
7399
7402
  method.apply(this, args).then(future.resolve).catch(future.reject);
7400
7403
  return future;
7401
7404
  }
@@ -7408,13 +7411,13 @@ class Exchange {
7408
7411
  // -----------------------------------------------------------------------
7409
7412
  // WS/PRO methods
7410
7413
  orderBook(snapshot = {}, depth = Number.MAX_SAFE_INTEGER) {
7411
- return new _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_3__/* .OrderBook */ .ZY(snapshot, depth);
7414
+ return new _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_5__/* .OrderBook */ .ZY(snapshot, depth);
7412
7415
  }
7413
7416
  indexedOrderBook(snapshot = {}, depth = Number.MAX_SAFE_INTEGER) {
7414
- return new _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_3__/* .IndexedOrderBook */ .rc(snapshot, depth);
7417
+ return new _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_5__/* .IndexedOrderBook */ .rc(snapshot, depth);
7415
7418
  }
7416
7419
  countedOrderBook(snapshot = {}, depth = Number.MAX_SAFE_INTEGER) {
7417
- return new _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_3__/* .CountedOrderBook */ .yk(snapshot, depth);
7420
+ return new _ws_OrderBook_js__WEBPACK_IMPORTED_MODULE_5__/* .CountedOrderBook */ .yk(snapshot, depth);
7418
7421
  }
7419
7422
  handleMessage(client, message) { } // stub to override
7420
7423
  // ping (client) {} // stub to override
@@ -7437,7 +7440,7 @@ class Exchange {
7437
7440
  'agent': this.agent,
7438
7441
  }
7439
7442
  }, wsOptions);
7440
- this.clients[url] = new _ws_WsClient_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z(url, onMessage, onError, onClose, onConnected, options);
7443
+ this.clients[url] = new _ws_WsClient_js__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z(url, onMessage, onError, onClose, onConnected, options);
7441
7444
  }
7442
7445
  return this.clients[url];
7443
7446
  }
@@ -7548,7 +7551,7 @@ class Exchange {
7548
7551
  }
7549
7552
  async loadOrderBook(client, messageHash, symbol, limit = undefined, params = {}) {
7550
7553
  if (!(symbol in this.orderbooks)) {
7551
- client.reject(new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' loadOrderBook() orderbook is not initiated'), messageHash);
7554
+ client.reject(new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' loadOrderBook() orderbook is not initiated'), messageHash);
7552
7555
  return;
7553
7556
  }
7554
7557
  const maxRetries = this.handleOption('watchOrderBook', 'snapshotMaxRetries', 3);
@@ -7568,7 +7571,7 @@ class Exchange {
7568
7571
  }
7569
7572
  tries++;
7570
7573
  }
7571
- client.reject(new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' nonce is behind the cache after ' + maxRetries.toString() + ' tries.'), messageHash);
7574
+ client.reject(new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' nonce is behind the cache after ' + maxRetries.toString() + ' tries.'), messageHash);
7572
7575
  delete this.clients[client.url];
7573
7576
  }
7574
7577
  catch (e) {
@@ -7637,7 +7640,7 @@ class Exchange {
7637
7640
  }
7638
7641
  }
7639
7642
  handleDelta(bookside, delta) {
7640
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' handleDelta not supported yet');
7643
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' handleDelta not supported yet');
7641
7644
  }
7642
7645
  getCacheIndex(orderbook, deltas) {
7643
7646
  // return the first index of the cache that can be applied to the orderbook or -1 if not possible
@@ -7712,7 +7715,7 @@ class Exchange {
7712
7715
  val = val + 1;
7713
7716
  }
7714
7717
  if (val > 1) {
7715
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy, userAgent');
7718
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy, userAgent');
7716
7719
  }
7717
7720
  return [proxyUrl, httpProxy, httpsProxy, socksProxy];
7718
7721
  }
@@ -7801,7 +7804,7 @@ class Exchange {
7801
7804
  }
7802
7805
  }
7803
7806
  else {
7804
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' does not have a sandbox URL');
7807
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' does not have a sandbox URL');
7805
7808
  }
7806
7809
  }
7807
7810
  else if ('apiBackup' in this.urls) {
@@ -7819,31 +7822,31 @@ class Exchange {
7819
7822
  return {};
7820
7823
  }
7821
7824
  async fetchAccounts(params = {}) {
7822
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchAccounts() is not supported yet');
7825
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchAccounts() is not supported yet');
7823
7826
  }
7824
7827
  async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
7825
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTrades() is not supported yet');
7828
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTrades() is not supported yet');
7826
7829
  }
7827
7830
  async fetchTradesWs(symbol, since = undefined, limit = undefined, params = {}) {
7828
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTradesWs() is not supported yet');
7831
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradesWs() is not supported yet');
7829
7832
  }
7830
7833
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
7831
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchTrades() is not supported yet');
7834
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchTrades() is not supported yet');
7832
7835
  }
7833
7836
  async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
7834
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchTradesForSymbols() is not supported yet');
7837
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchTradesForSymbols() is not supported yet');
7835
7838
  }
7836
7839
  async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
7837
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchOHLCVForSymbols() is not supported yet');
7840
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOHLCVForSymbols() is not supported yet');
7838
7841
  }
7839
7842
  async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
7840
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchOrderBookForSymbols() is not supported yet');
7843
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOrderBookForSymbols() is not supported yet');
7841
7844
  }
7842
7845
  async fetchDepositAddresses(codes = undefined, params = {}) {
7843
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchDepositAddresses() is not supported yet');
7846
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositAddresses() is not supported yet');
7844
7847
  }
7845
7848
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
7846
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrderBook() is not supported yet');
7849
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrderBook() is not supported yet');
7847
7850
  }
7848
7851
  async fetchRestOrderBookSafe(symbol, limit = undefined, params = {}) {
7849
7852
  const fetchSnapshotMaxRetries = this.handleOption('watchOrderBook', 'maxRetries', 3);
@@ -7861,82 +7864,82 @@ class Exchange {
7861
7864
  return undefined;
7862
7865
  }
7863
7866
  async watchOrderBook(symbol, limit = undefined, params = {}) {
7864
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchOrderBook() is not supported yet');
7867
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOrderBook() is not supported yet');
7865
7868
  }
7866
7869
  async fetchTime(params = {}) {
7867
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTime() is not supported yet');
7870
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTime() is not supported yet');
7868
7871
  }
7869
7872
  async fetchTradingLimits(symbols = undefined, params = {}) {
7870
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTradingLimits() is not supported yet');
7873
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradingLimits() is not supported yet');
7871
7874
  }
7872
7875
  parseTicker(ticker, market = undefined) {
7873
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseTicker() is not supported yet');
7876
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseTicker() is not supported yet');
7874
7877
  }
7875
7878
  parseDepositAddress(depositAddress, currency = undefined) {
7876
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseDepositAddress() is not supported yet');
7879
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseDepositAddress() is not supported yet');
7877
7880
  }
7878
7881
  parseTrade(trade, market = undefined) {
7879
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseTrade() is not supported yet');
7882
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseTrade() is not supported yet');
7880
7883
  }
7881
7884
  parseTransaction(transaction, currency = undefined) {
7882
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseTransaction() is not supported yet');
7885
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseTransaction() is not supported yet');
7883
7886
  }
7884
7887
  parseTransfer(transfer, currency = undefined) {
7885
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseTransfer() is not supported yet');
7888
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseTransfer() is not supported yet');
7886
7889
  }
7887
7890
  parseAccount(account) {
7888
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseAccount() is not supported yet');
7891
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseAccount() is not supported yet');
7889
7892
  }
7890
7893
  parseLedgerEntry(item, currency = undefined) {
7891
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseLedgerEntry() is not supported yet');
7894
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseLedgerEntry() is not supported yet');
7892
7895
  }
7893
7896
  parseOrder(order, market = undefined) {
7894
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseOrder() is not supported yet');
7897
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseOrder() is not supported yet');
7895
7898
  }
7896
7899
  async fetchBorrowRates(params = {}) {
7897
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchBorrowRates() is not supported yet');
7900
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchBorrowRates() is not supported yet');
7898
7901
  }
7899
7902
  parseMarketLeverageTiers(info, market = undefined) {
7900
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseMarketLeverageTiers() is not supported yet');
7903
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseMarketLeverageTiers() is not supported yet');
7901
7904
  }
7902
7905
  async fetchLeverageTiers(symbols = undefined, params = {}) {
7903
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchLeverageTiers() is not supported yet');
7906
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchLeverageTiers() is not supported yet');
7904
7907
  }
7905
7908
  parsePosition(position, market = undefined) {
7906
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parsePosition() is not supported yet');
7909
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parsePosition() is not supported yet');
7907
7910
  }
7908
7911
  parseFundingRateHistory(info, market = undefined) {
7909
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseFundingRateHistory() is not supported yet');
7912
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseFundingRateHistory() is not supported yet');
7910
7913
  }
7911
7914
  parseBorrowInterest(info, market = undefined) {
7912
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseBorrowInterest() is not supported yet');
7915
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseBorrowInterest() is not supported yet');
7913
7916
  }
7914
7917
  parseWsTrade(trade, market = undefined) {
7915
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseWsTrade() is not supported yet');
7918
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseWsTrade() is not supported yet');
7916
7919
  }
7917
7920
  parseWsOrder(order, market = undefined) {
7918
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseWsOrder() is not supported yet');
7921
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseWsOrder() is not supported yet');
7919
7922
  }
7920
7923
  parseWsOrderTrade(trade, market = undefined) {
7921
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseWsOrderTrade() is not supported yet');
7924
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseWsOrderTrade() is not supported yet');
7922
7925
  }
7923
7926
  parseWsOHLCV(ohlcv, market = undefined) {
7924
7927
  return this.parseOHLCV(ohlcv, market);
7925
7928
  }
7926
7929
  async fetchFundingRates(symbols = undefined, params = {}) {
7927
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchFundingRates() is not supported yet');
7930
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingRates() is not supported yet');
7928
7931
  }
7929
7932
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
7930
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' transfer() is not supported yet');
7933
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' transfer() is not supported yet');
7931
7934
  }
7932
7935
  async withdraw(code, amount, address, tag = undefined, params = {}) {
7933
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' withdraw() is not supported yet');
7936
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' withdraw() is not supported yet');
7934
7937
  }
7935
7938
  async createDepositAddress(code, params = {}) {
7936
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createDepositAddress() is not supported yet');
7939
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createDepositAddress() is not supported yet');
7937
7940
  }
7938
7941
  async setLeverage(leverage, symbol = undefined, params = {}) {
7939
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' setLeverage() is not supported yet');
7942
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' setLeverage() is not supported yet');
7940
7943
  }
7941
7944
  parseToInt(number) {
7942
7945
  // Solve Common parseInt misuse ex: parseInt ((since / 1000).toString ())
@@ -7970,18 +7973,18 @@ class Exchange {
7970
7973
  const amount = this.safeString(entry, 'amount');
7971
7974
  if (amount !== undefined) {
7972
7975
  if (before === undefined && after !== undefined) {
7973
- before = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringSub */ .O.stringSub(after, amount);
7976
+ before = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringSub */ .O.stringSub(after, amount);
7974
7977
  }
7975
7978
  else if (before !== undefined && after === undefined) {
7976
- after = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringAdd */ .O.stringAdd(before, amount);
7979
+ after = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringAdd */ .O.stringAdd(before, amount);
7977
7980
  }
7978
7981
  }
7979
7982
  if (before !== undefined && after !== undefined) {
7980
7983
  if (direction === undefined) {
7981
- if (_Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringGt */ .O.stringGt(before, after)) {
7984
+ if (_Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringGt */ .O.stringGt(before, after)) {
7982
7985
  direction = 'out';
7983
7986
  }
7984
- if (_Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringGt */ .O.stringGt(after, before)) {
7987
+ if (_Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringGt */ .O.stringGt(after, before)) {
7985
7988
  direction = 'in';
7986
7989
  }
7987
7990
  }
@@ -8136,13 +8139,13 @@ class Exchange {
8136
8139
  let used = this.safeString(balance[code], 'used');
8137
8140
  const debt = this.safeString(balance[code], 'debt');
8138
8141
  if ((total === undefined) && (free !== undefined) && (used !== undefined)) {
8139
- total = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringAdd */ .O.stringAdd(free, used);
8142
+ total = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringAdd */ .O.stringAdd(free, used);
8140
8143
  }
8141
8144
  if ((free === undefined) && (total !== undefined) && (used !== undefined)) {
8142
- free = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringSub */ .O.stringSub(total, used);
8145
+ free = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringSub */ .O.stringSub(total, used);
8143
8146
  }
8144
8147
  if ((used === undefined) && (total !== undefined) && (free !== undefined)) {
8145
- used = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringSub */ .O.stringSub(total, free);
8148
+ used = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringSub */ .O.stringSub(total, free);
8146
8149
  }
8147
8150
  balance[code]['free'] = this.parseNumber(free);
8148
8151
  balance[code]['used'] = this.parseNumber(used);
@@ -8227,11 +8230,11 @@ class Exchange {
8227
8230
  const trade = trades[i];
8228
8231
  const tradeAmount = this.safeString(trade, 'amount');
8229
8232
  if (parseFilled && (tradeAmount !== undefined)) {
8230
- filled = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringAdd */ .O.stringAdd(filled, tradeAmount);
8233
+ filled = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringAdd */ .O.stringAdd(filled, tradeAmount);
8231
8234
  }
8232
8235
  const tradeCost = this.safeString(trade, 'cost');
8233
8236
  if (parseCost && (tradeCost !== undefined)) {
8234
- cost = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringAdd */ .O.stringAdd(cost, tradeCost);
8237
+ cost = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringAdd */ .O.stringAdd(cost, tradeCost);
8235
8238
  }
8236
8239
  if (parseSymbol) {
8237
8240
  symbol = this.safeString(trade, 'symbol');
@@ -8290,7 +8293,7 @@ class Exchange {
8290
8293
  if (amount === undefined) {
8291
8294
  // ensure amount = filled + remaining
8292
8295
  if (filled !== undefined && remaining !== undefined) {
8293
- amount = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringAdd */ .O.stringAdd(filled, remaining);
8296
+ amount = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringAdd */ .O.stringAdd(filled, remaining);
8294
8297
  }
8295
8298
  else if (status === 'closed') {
8296
8299
  amount = filled;
@@ -8298,7 +8301,7 @@ class Exchange {
8298
8301
  }
8299
8302
  if (filled === undefined) {
8300
8303
  if (amount !== undefined && remaining !== undefined) {
8301
- filled = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringSub */ .O.stringSub(amount, remaining);
8304
+ filled = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringSub */ .O.stringSub(amount, remaining);
8302
8305
  }
8303
8306
  else if (status === 'closed' && amount !== undefined) {
8304
8307
  filled = amount;
@@ -8306,7 +8309,7 @@ class Exchange {
8306
8309
  }
8307
8310
  if (remaining === undefined) {
8308
8311
  if (amount !== undefined && filled !== undefined) {
8309
- remaining = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringSub */ .O.stringSub(amount, filled);
8312
+ remaining = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringSub */ .O.stringSub(amount, filled);
8310
8313
  }
8311
8314
  else if (status === 'closed') {
8312
8315
  remaining = '0';
@@ -8321,13 +8324,13 @@ class Exchange {
8321
8324
  // linear
8322
8325
  // price = cost / (filled * contract size)
8323
8326
  if (average === undefined) {
8324
- if ((filled !== undefined) && (cost !== undefined) && _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringGt */ .O.stringGt(filled, '0')) {
8325
- const filledTimesContractSize = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(filled, contractSize);
8327
+ if ((filled !== undefined) && (cost !== undefined) && _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringGt */ .O.stringGt(filled, '0')) {
8328
+ const filledTimesContractSize = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(filled, contractSize);
8326
8329
  if (inverse) {
8327
- average = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv(filledTimesContractSize, cost);
8330
+ average = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv(filledTimesContractSize, cost);
8328
8331
  }
8329
8332
  else {
8330
- average = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv(cost, filledTimesContractSize);
8333
+ average = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv(cost, filledTimesContractSize);
8331
8334
  }
8332
8335
  }
8333
8336
  }
@@ -8347,17 +8350,17 @@ class Exchange {
8347
8350
  multiplyPrice = average;
8348
8351
  }
8349
8352
  // contract trading
8350
- const filledTimesContractSize = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(filled, contractSize);
8353
+ const filledTimesContractSize = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(filled, contractSize);
8351
8354
  if (inverse) {
8352
- cost = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv(filledTimesContractSize, multiplyPrice);
8355
+ cost = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv(filledTimesContractSize, multiplyPrice);
8353
8356
  }
8354
8357
  else {
8355
- cost = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(filledTimesContractSize, multiplyPrice);
8358
+ cost = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(filledTimesContractSize, multiplyPrice);
8356
8359
  }
8357
8360
  }
8358
8361
  // support for market orders
8359
8362
  const orderType = this.safeValue(order, 'type');
8360
- const emptyPrice = (price === undefined) || _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringEquals */ .O.stringEquals(price, '0');
8363
+ const emptyPrice = (price === undefined) || _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringEquals */ .O.stringEquals(price, '0');
8361
8364
  if (emptyPrice && (orderType === 'market')) {
8362
8365
  price = average;
8363
8366
  }
@@ -8367,12 +8370,12 @@ class Exchange {
8367
8370
  entry['amount'] = this.safeNumber(entry, 'amount');
8368
8371
  entry['price'] = this.safeNumber(entry, 'price');
8369
8372
  entry['cost'] = this.safeNumber(entry, 'cost');
8370
- const fee = this.safeValue(entry, 'fee', {});
8371
- fee['cost'] = this.safeNumber(fee, 'cost');
8372
- if ('rate' in fee) {
8373
- fee['rate'] = this.safeNumber(fee, 'rate');
8373
+ const tradeFee = this.safeValue(entry, 'fee', {});
8374
+ tradeFee['cost'] = this.safeNumber(tradeFee, 'cost');
8375
+ if ('rate' in tradeFee) {
8376
+ tradeFee['rate'] = this.safeNumber(tradeFee, 'rate');
8374
8377
  }
8375
- entry['fee'] = fee;
8378
+ entry['fee'] = tradeFee;
8376
8379
  }
8377
8380
  let timeInForce = this.safeString(order, 'timeInForce');
8378
8381
  let postOnly = this.safeValue(order, 'postOnly');
@@ -8470,7 +8473,7 @@ class Exchange {
8470
8473
  }
8471
8474
  calculateFee(symbol, type, side, amount, price, takerOrMaker = 'taker', params = {}) {
8472
8475
  if (type === 'market' && takerOrMaker === 'maker') {
8473
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' calculateFee() - you have provided incompatible arguments - "market" type order can not be "maker". Change either the "type" or the "takerOrMaker" argument to calculate the fee.');
8476
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' calculateFee() - you have provided incompatible arguments - "market" type order can not be "maker". Change either the "type" or the "takerOrMaker" argument to calculate the fee.');
8474
8477
  }
8475
8478
  const market = this.markets[symbol];
8476
8479
  const feeSide = this.safeString(market, 'feeSide', 'quote');
@@ -8491,7 +8494,7 @@ class Exchange {
8491
8494
  let key = undefined;
8492
8495
  if (useQuote) {
8493
8496
  const priceString = this.numberToString(price);
8494
- cost = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(cost, priceString);
8497
+ cost = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(cost, priceString);
8495
8498
  key = 'quote';
8496
8499
  }
8497
8500
  else {
@@ -8506,7 +8509,7 @@ class Exchange {
8506
8509
  takerOrMaker = 'taker';
8507
8510
  }
8508
8511
  const rate = this.safeString(market, takerOrMaker);
8509
- cost = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(cost, rate);
8512
+ cost = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(cost, rate);
8510
8513
  return {
8511
8514
  'type': takerOrMaker,
8512
8515
  'currency': market[key],
@@ -8525,11 +8528,11 @@ class Exchange {
8525
8528
  if (contractSize !== undefined) {
8526
8529
  const inverse = this.safeValue(market, 'inverse', false);
8527
8530
  if (inverse) {
8528
- multiplyPrice = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv('1', price);
8531
+ multiplyPrice = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv('1', price);
8529
8532
  }
8530
- multiplyPrice = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(multiplyPrice, contractSize);
8533
+ multiplyPrice = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(multiplyPrice, contractSize);
8531
8534
  }
8532
- cost = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(multiplyPrice, amount);
8535
+ cost = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(multiplyPrice, amount);
8533
8536
  }
8534
8537
  const parseFee = this.safeValue(trade, 'fee') === undefined;
8535
8538
  const parseFees = this.safeValue(trade, 'fees') === undefined;
@@ -8637,7 +8640,7 @@ class Exchange {
8637
8640
  if (feeCurrencyCode !== undefined) {
8638
8641
  const rate = this.safeString(fee, 'rate');
8639
8642
  const cost = this.safeValue(fee, 'cost');
8640
- if (_Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringEq */ .O.stringEq(cost, '0')) {
8643
+ if (_Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringEq */ .O.stringEq(cost, '0')) {
8641
8644
  // omit zero cost fees
8642
8645
  continue;
8643
8646
  }
@@ -8646,7 +8649,7 @@ class Exchange {
8646
8649
  }
8647
8650
  const rateKey = (rate === undefined) ? '' : rate;
8648
8651
  if (rateKey in reduced[feeCurrencyCode]) {
8649
- reduced[feeCurrencyCode][rateKey]['cost'] = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringAdd */ .O.stringAdd(reduced[feeCurrencyCode][rateKey]['cost'], cost);
8652
+ reduced[feeCurrencyCode][rateKey]['cost'] = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringAdd */ .O.stringAdd(reduced[feeCurrencyCode][rateKey]['cost'], cost);
8650
8653
  }
8651
8654
  else {
8652
8655
  reduced[feeCurrencyCode][rateKey] = {
@@ -8678,7 +8681,7 @@ class Exchange {
8678
8681
  const baseVolume = this.safeString(ticker, 'baseVolume');
8679
8682
  const quoteVolume = this.safeString(ticker, 'quoteVolume');
8680
8683
  if (vwap === undefined) {
8681
- vwap = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv(quoteVolume, baseVolume);
8684
+ vwap = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv(quoteVolume, baseVolume);
8682
8685
  }
8683
8686
  if ((last !== undefined) && (close === undefined)) {
8684
8687
  close = last;
@@ -8688,20 +8691,20 @@ class Exchange {
8688
8691
  }
8689
8692
  if ((last !== undefined) && (open !== undefined)) {
8690
8693
  if (change === undefined) {
8691
- change = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringSub */ .O.stringSub(last, open);
8694
+ change = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringSub */ .O.stringSub(last, open);
8692
8695
  }
8693
8696
  if (average === undefined) {
8694
- average = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv(_Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringAdd */ .O.stringAdd(last, open), '2');
8697
+ average = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv(_Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringAdd */ .O.stringAdd(last, open), '2');
8695
8698
  }
8696
8699
  }
8697
- if ((percentage === undefined) && (change !== undefined) && (open !== undefined) && _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringGt */ .O.stringGt(open, '0')) {
8698
- percentage = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(_Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv(change, open), '100');
8700
+ if ((percentage === undefined) && (change !== undefined) && (open !== undefined) && _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringGt */ .O.stringGt(open, '0')) {
8701
+ percentage = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(_Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv(change, open), '100');
8699
8702
  }
8700
8703
  if ((change === undefined) && (percentage !== undefined) && (open !== undefined)) {
8701
- change = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv(_Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(percentage, open), '100');
8704
+ change = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv(_Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(percentage, open), '100');
8702
8705
  }
8703
8706
  if ((open === undefined) && (last !== undefined) && (change !== undefined)) {
8704
- open = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringSub */ .O.stringSub(last, change);
8707
+ open = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringSub */ .O.stringSub(last, change);
8705
8708
  }
8706
8709
  // timestamp and symbol operations don't belong in safeTicker
8707
8710
  // they should be done in the derived classes
@@ -8729,10 +8732,10 @@ class Exchange {
8729
8732
  if (this.has['fetchTrades']) {
8730
8733
  message = '. If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see "build-ohlcv-bars" file';
8731
8734
  }
8732
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOHLCV() is not supported yet' + message);
8735
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOHLCV() is not supported yet' + message);
8733
8736
  }
8734
8737
  async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
8735
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchOHLCV() is not supported yet');
8738
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOHLCV() is not supported yet');
8736
8739
  }
8737
8740
  convertTradingViewToOHLCV(ohlcvs, timestamp = 't', open = 'o', high = 'h', low = 'l', close = 'c', volume = 'v', ms = false) {
8738
8741
  const result = [];
@@ -8812,7 +8815,7 @@ class Exchange {
8812
8815
  return jsoned; // if parsing was not successfull, exception should be thrown
8813
8816
  }
8814
8817
  else {
8815
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.BadResponse('could not parse the response into json');
8818
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadResponse('could not parse the response into json');
8816
8819
  }
8817
8820
  }
8818
8821
  else {
@@ -8826,7 +8829,7 @@ class Exchange {
8826
8829
  return undefined;
8827
8830
  }
8828
8831
  else {
8829
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.BadResponse(errorMessage);
8832
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadResponse(errorMessage);
8830
8833
  }
8831
8834
  }
8832
8835
  marketIds(symbols) {
@@ -8842,14 +8845,14 @@ class Exchange {
8842
8845
  marketSymbols(symbols, type = undefined, allowEmpty = true) {
8843
8846
  if (symbols === undefined) {
8844
8847
  if (!allowEmpty) {
8845
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
8848
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
8846
8849
  }
8847
8850
  return symbols;
8848
8851
  }
8849
8852
  const symbolsLength = symbols.length;
8850
8853
  if (symbolsLength === 0) {
8851
8854
  if (!allowEmpty) {
8852
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
8855
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' empty list of symbols is not supported');
8853
8856
  }
8854
8857
  return symbols;
8855
8858
  }
@@ -8857,7 +8860,7 @@ class Exchange {
8857
8860
  for (let i = 0; i < symbols.length; i++) {
8858
8861
  const market = this.market(symbols[i]);
8859
8862
  if (type !== undefined && market['type'] !== type) {
8860
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' symbols must be of same type ' + type + '. If the type is incorrect you can change it in options or the params of the request');
8863
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadRequest(this.id + ' symbols must be of same type ' + type + '. If the type is incorrect you can change it in options or the params of the request');
8861
8864
  }
8862
8865
  const symbol = this.safeString(market, 'symbol', symbols[i]);
8863
8866
  result.push(symbol);
@@ -9017,7 +9020,7 @@ class Exchange {
9017
9020
  const responseNetworksLength = availableNetworkIds.length;
9018
9021
  if (networkCode !== undefined) {
9019
9022
  if (responseNetworksLength === 0) {
9020
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' - ' + networkCode + ' network did not return any result for ' + currencyCode);
9023
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' - ' + networkCode + ' network did not return any result for ' + currencyCode);
9021
9024
  }
9022
9025
  else {
9023
9026
  // if networkCode was provided by user, we should check it after response, as the referenced exchange doesn't support network-code during request
@@ -9026,13 +9029,13 @@ class Exchange {
9026
9029
  chosenNetworkId = networkId;
9027
9030
  }
9028
9031
  else {
9029
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' - ' + networkId + ' network was not found for ' + currencyCode + ', use one of ' + availableNetworkIds.join(', '));
9032
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' - ' + networkId + ' network was not found for ' + currencyCode + ', use one of ' + availableNetworkIds.join(', '));
9030
9033
  }
9031
9034
  }
9032
9035
  }
9033
9036
  else {
9034
9037
  if (responseNetworksLength === 0) {
9035
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' - no networks were returned for ' + currencyCode);
9038
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' - no networks were returned for ' + currencyCode);
9036
9039
  }
9037
9040
  else {
9038
9041
  // if networkCode was not provided by user, then we try to use the default network (if it was defined in "defaultNetworks"), otherwise, we just return the first network entry
@@ -9106,7 +9109,7 @@ class Exchange {
9106
9109
  const percentage = this.safeValue(position, 'percentage');
9107
9110
  if ((percentage === undefined) && (unrealizedPnlString !== undefined) && (initialMarginString !== undefined)) {
9108
9111
  // as it was done in all implementations ( aax, btcex, bybit, deribit, ftx, gate, kucoinfutures, phemex )
9109
- const percentageString = _Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringMul */ .O.stringMul(_Precise_js__WEBPACK_IMPORTED_MODULE_5__/* .Precise.stringDiv */ .O.stringDiv(unrealizedPnlString, initialMarginString, 4), '100');
9112
+ const percentageString = _Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringMul */ .O.stringMul(_Precise_js__WEBPACK_IMPORTED_MODULE_7__/* .Precise.stringDiv */ .O.stringDiv(unrealizedPnlString, initialMarginString, 4), '100');
9110
9113
  position['percentage'] = this.parseNumber(percentageString);
9111
9114
  }
9112
9115
  // if contractSize is undefined get from market
@@ -9327,10 +9330,10 @@ class Exchange {
9327
9330
  return await this.createOrderWs(symbol, type, side, amount, price, params);
9328
9331
  }
9329
9332
  async fetchPermissions(params = {}) {
9330
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPermissions() is not supported yet');
9333
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPermissions() is not supported yet');
9331
9334
  }
9332
9335
  async fetchPosition(symbol, params = {}) {
9333
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPosition() is not supported yet');
9336
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPosition() is not supported yet');
9334
9337
  }
9335
9338
  async fetchPositionsBySymbol(symbol, params = {}) {
9336
9339
  /**
@@ -9341,16 +9344,16 @@ class Exchange {
9341
9344
  * @param {object} params extra parameters specific to the endpoint
9342
9345
  * @returns {object[]} a list of [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure} with maximum 3 items - one position for "one-way" mode, and two positions (long & short) for "two-way" (a.k.a. hedge) mode
9343
9346
  */
9344
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPositionsBySymbol() is not supported yet');
9347
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPositionsBySymbol() is not supported yet');
9345
9348
  }
9346
9349
  async fetchPositions(symbols = undefined, params = {}) {
9347
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPositions() is not supported yet');
9350
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPositions() is not supported yet');
9348
9351
  }
9349
9352
  async fetchPositionsRisk(symbols = undefined, params = {}) {
9350
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPositionsRisk() is not supported yet');
9353
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPositionsRisk() is not supported yet');
9351
9354
  }
9352
9355
  async fetchBidsAsks(symbols = undefined, params = {}) {
9353
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchBidsAsks() is not supported yet');
9356
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchBidsAsks() is not supported yet');
9354
9357
  }
9355
9358
  parseBidAsk(bidask, priceKey = 0, amountKey = 1) {
9356
9359
  const price = this.safeNumber(bidask, priceKey);
@@ -9427,13 +9430,13 @@ class Exchange {
9427
9430
  }
9428
9431
  else {
9429
9432
  if ((marketType === undefined) && (market === undefined)) {
9430
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' safeMarket() requires a fourth argument for ' + marketId + ' to disambiguate between different markets with the same market id');
9433
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' safeMarket() requires a fourth argument for ' + marketId + ' to disambiguate between different markets with the same market id');
9431
9434
  }
9432
9435
  const inferredMarketType = (marketType === undefined) ? market['type'] : marketType;
9433
9436
  for (let i = 0; i < markets.length; i++) {
9434
- const market = markets[i];
9435
- if (market[inferredMarketType]) {
9436
- return market;
9437
+ const currentMarket = markets[i];
9438
+ if (currentMarket[inferredMarketType]) {
9439
+ return currentMarket;
9437
9440
  }
9438
9441
  }
9439
9442
  }
@@ -9465,7 +9468,7 @@ class Exchange {
9465
9468
  const key = keys[i];
9466
9469
  if (this.requiredCredentials[key] && !this[key]) {
9467
9470
  if (error) {
9468
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError(this.id + ' requires "' + key + '" credential');
9471
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.AuthenticationError(this.id + ' requires "' + key + '" credential');
9469
9472
  }
9470
9473
  else {
9471
9474
  return false;
@@ -9476,23 +9479,23 @@ class Exchange {
9476
9479
  }
9477
9480
  oath() {
9478
9481
  if (this.twofa !== undefined) {
9479
- return (0,_functions_totp_js__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(this.twofa);
9482
+ return (0,_functions_totp_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)(this.twofa);
9480
9483
  }
9481
9484
  else {
9482
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' exchange.twofa has not been set for 2FA Two-Factor Authentication');
9485
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' exchange.twofa has not been set for 2FA Two-Factor Authentication');
9483
9486
  }
9484
9487
  }
9485
9488
  async fetchBalance(params = {}) {
9486
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchBalance() is not supported yet');
9489
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchBalance() is not supported yet');
9487
9490
  }
9488
9491
  async fetchBalanceWs(params = {}) {
9489
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchBalanceWs() is not supported yet');
9492
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchBalanceWs() is not supported yet');
9490
9493
  }
9491
9494
  parseBalance(response) {
9492
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseBalance() is not supported yet');
9495
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseBalance() is not supported yet');
9493
9496
  }
9494
9497
  async watchBalance(params = {}) {
9495
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchBalance() is not supported yet');
9498
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchBalance() is not supported yet');
9496
9499
  }
9497
9500
  async fetchPartialBalance(part, params = {}) {
9498
9501
  const balance = await this.fetchBalance(params);
@@ -9523,32 +9526,32 @@ class Exchange {
9523
9526
  async fetchFundingFee(code, params = {}) {
9524
9527
  const warnOnFetchFundingFee = this.safeValue(this.options, 'warnOnFetchFundingFee', true);
9525
9528
  if (warnOnFetchFundingFee) {
9526
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchFundingFee() method is deprecated, it will be removed in July 2022, please, use fetchTransactionFee() or set exchange.options["warnOnFetchFundingFee"] = false to suppress this warning');
9529
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingFee() method is deprecated, it will be removed in July 2022, please, use fetchTransactionFee() or set exchange.options["warnOnFetchFundingFee"] = false to suppress this warning');
9527
9530
  }
9528
9531
  return await this.fetchTransactionFee(code, params);
9529
9532
  }
9530
9533
  async fetchFundingFees(codes = undefined, params = {}) {
9531
9534
  const warnOnFetchFundingFees = this.safeValue(this.options, 'warnOnFetchFundingFees', true);
9532
9535
  if (warnOnFetchFundingFees) {
9533
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchFundingFees() method is deprecated, it will be removed in July 2022. Please, use fetchTransactionFees() or set exchange.options["warnOnFetchFundingFees"] = false to suppress this warning');
9536
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingFees() method is deprecated, it will be removed in July 2022. Please, use fetchTransactionFees() or set exchange.options["warnOnFetchFundingFees"] = false to suppress this warning');
9534
9537
  }
9535
9538
  return await this.fetchTransactionFees(codes, params);
9536
9539
  }
9537
9540
  async fetchTransactionFee(code, params = {}) {
9538
9541
  if (!this.has['fetchTransactionFees']) {
9539
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTransactionFee() is not supported yet');
9542
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTransactionFee() is not supported yet');
9540
9543
  }
9541
9544
  return await this.fetchTransactionFees([code], params);
9542
9545
  }
9543
9546
  async fetchTransactionFees(codes = undefined, params = {}) {
9544
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTransactionFees() is not supported yet');
9547
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTransactionFees() is not supported yet');
9545
9548
  }
9546
9549
  async fetchDepositWithdrawFees(codes = undefined, params = {}) {
9547
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchDepositWithdrawFees() is not supported yet');
9550
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositWithdrawFees() is not supported yet');
9548
9551
  }
9549
9552
  async fetchDepositWithdrawFee(code, params = {}) {
9550
9553
  if (!this.has['fetchDepositWithdrawFees']) {
9551
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchDepositWithdrawFee() is not supported yet');
9554
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositWithdrawFee() is not supported yet');
9552
9555
  }
9553
9556
  const fees = await this.fetchDepositWithdrawFees([code], params);
9554
9557
  return this.safeValue(fees, code);
@@ -9558,18 +9561,18 @@ class Exchange {
9558
9561
  return mapping[key];
9559
9562
  }
9560
9563
  else {
9561
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' ' + key + ' does not have a value in mapping');
9564
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' ' + key + ' does not have a value in mapping');
9562
9565
  }
9563
9566
  }
9564
9567
  async fetchBorrowRate(code, params = {}) {
9565
9568
  await this.loadMarkets();
9566
9569
  if (!this.has['fetchBorrowRates']) {
9567
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchBorrowRate() is not supported yet');
9570
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchBorrowRate() is not supported yet');
9568
9571
  }
9569
9572
  const borrowRates = await this.fetchBorrowRates(params);
9570
9573
  const rate = this.safeValue(borrowRates, code);
9571
9574
  if (rate === undefined) {
9572
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' fetchBorrowRate() could not find the borrow rate for currency code ' + code);
9575
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' fetchBorrowRate() could not find the borrow rate for currency code ' + code);
9573
9576
  }
9574
9577
  return rate;
9575
9578
  }
@@ -9695,30 +9698,30 @@ class Exchange {
9695
9698
  const tickers = await this.fetchTickers([symbol], params);
9696
9699
  const ticker = this.safeValue(tickers, symbol);
9697
9700
  if (ticker === undefined) {
9698
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NullResponse(this.id + ' fetchTickers() could not find a ticker for ' + symbol);
9701
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NullResponse(this.id + ' fetchTickers() could not find a ticker for ' + symbol);
9699
9702
  }
9700
9703
  else {
9701
9704
  return ticker;
9702
9705
  }
9703
9706
  }
9704
9707
  else {
9705
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTicker() is not supported yet');
9708
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTicker() is not supported yet');
9706
9709
  }
9707
9710
  }
9708
9711
  async watchTicker(symbol, params = {}) {
9709
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchTicker() is not supported yet');
9712
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchTicker() is not supported yet');
9710
9713
  }
9711
9714
  async fetchTickers(symbols = undefined, params = {}) {
9712
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTickers() is not supported yet');
9715
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTickers() is not supported yet');
9713
9716
  }
9714
9717
  async watchTickers(symbols = undefined, params = {}) {
9715
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchTickers() is not supported yet');
9718
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchTickers() is not supported yet');
9716
9719
  }
9717
9720
  async fetchOrder(id, symbol = undefined, params = {}) {
9718
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrder() is not supported yet');
9721
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrder() is not supported yet');
9719
9722
  }
9720
9723
  async fetchOrderWs(id, symbol = undefined, params = {}) {
9721
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrderWs() is not supported yet');
9724
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrderWs() is not supported yet');
9722
9725
  }
9723
9726
  async fetchOrderStatus(id, symbol = undefined, params = {}) {
9724
9727
  // TODO: TypeScript: change method signature by replacing
@@ -9730,58 +9733,58 @@ class Exchange {
9730
9733
  return await this.fetchOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
9731
9734
  }
9732
9735
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
9733
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createOrder() is not supported yet');
9736
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrder() is not supported yet');
9734
9737
  }
9735
9738
  async createOrderWs(symbol, type, side, amount, price = undefined, params = {}) {
9736
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createOrderWs() is not supported yet');
9739
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createOrderWs() is not supported yet');
9737
9740
  }
9738
9741
  async cancelOrder(id, symbol = undefined, params = {}) {
9739
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' cancelOrder() is not supported yet');
9742
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' cancelOrder() is not supported yet');
9740
9743
  }
9741
9744
  async cancelOrderWs(id, symbol = undefined, params = {}) {
9742
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' cancelOrderWs() is not supported yet');
9745
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' cancelOrderWs() is not supported yet');
9743
9746
  }
9744
9747
  async cancelOrdersWs(ids, symbol = undefined, params = {}) {
9745
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' cancelOrdersWs() is not supported yet');
9748
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' cancelOrdersWs() is not supported yet');
9746
9749
  }
9747
9750
  async cancelAllOrders(symbol = undefined, params = {}) {
9748
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' cancelAllOrders() is not supported yet');
9751
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' cancelAllOrders() is not supported yet');
9749
9752
  }
9750
9753
  async cancelAllOrdersWs(symbol = undefined, params = {}) {
9751
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' cancelAllOrdersWs() is not supported yet');
9754
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' cancelAllOrdersWs() is not supported yet');
9752
9755
  }
9753
9756
  async cancelUnifiedOrder(order, params = {}) {
9754
9757
  return this.cancelOrder(this.safeValue(order, 'id'), this.safeValue(order, 'symbol'), params);
9755
9758
  }
9756
9759
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9757
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrders() is not supported yet');
9760
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrders() is not supported yet');
9758
9761
  }
9759
9762
  async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
9760
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrderTrades() is not supported yet');
9763
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOrderTrades() is not supported yet');
9761
9764
  }
9762
9765
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9763
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchOrders() is not supported yet');
9766
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchOrders() is not supported yet');
9764
9767
  }
9765
9768
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9766
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOpenOrders() is not supported yet');
9769
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOpenOrders() is not supported yet');
9767
9770
  }
9768
9771
  async fetchOpenOrdersWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9769
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOpenOrdersWs() is not supported yet');
9772
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOpenOrdersWs() is not supported yet');
9770
9773
  }
9771
9774
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9772
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchClosedOrders() is not supported yet');
9775
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchClosedOrders() is not supported yet');
9773
9776
  }
9774
9777
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9775
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchMyTrades() is not supported yet');
9778
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMyTrades() is not supported yet');
9776
9779
  }
9777
9780
  async fetchMyTradesWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9778
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchMyTradesWs() is not supported yet');
9781
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMyTradesWs() is not supported yet');
9779
9782
  }
9780
9783
  async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9781
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchMyTrades() is not supported yet');
9784
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' watchMyTrades() is not supported yet');
9782
9785
  }
9783
9786
  async fetchOHLCVWs(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
9784
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOHLCVWs() is not supported yet');
9787
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOHLCVWs() is not supported yet');
9785
9788
  }
9786
9789
  async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
9787
9790
  /**
@@ -9794,33 +9797,33 @@ class Exchange {
9794
9797
  * @param {object} [params] extra parameters specific to the exchange api endpoint
9795
9798
  * @returns {object} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
9796
9799
  */
9797
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchDepositsWithdrawals() is not supported yet');
9800
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositsWithdrawals() is not supported yet');
9798
9801
  }
9799
9802
  async fetchDeposits(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9800
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchDeposits() is not supported yet');
9803
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDeposits() is not supported yet');
9801
9804
  }
9802
9805
  async fetchWithdrawals(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9803
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchWithdrawals() is not supported yet');
9806
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchWithdrawals() is not supported yet');
9804
9807
  }
9805
9808
  async fetchOpenInterest(symbol, params = {}) {
9806
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOpenInterest() is not supported yet');
9809
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchOpenInterest() is not supported yet');
9807
9810
  }
9808
9811
  parseLastPrice(price, market = undefined) {
9809
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseLastPrice() is not supported yet');
9812
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseLastPrice() is not supported yet');
9810
9813
  }
9811
9814
  async fetchDepositAddress(code, params = {}) {
9812
9815
  if (this.has['fetchDepositAddresses']) {
9813
9816
  const depositAddresses = await this.fetchDepositAddresses([code], params);
9814
9817
  const depositAddress = this.safeValue(depositAddresses, code);
9815
9818
  if (depositAddress === undefined) {
9816
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidAddress(this.id + ' fetchDepositAddress() could not find a deposit address for ' + code + ', make sure you have created a corresponding deposit address in your wallet on the exchange website');
9819
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidAddress(this.id + ' fetchDepositAddress() could not find a deposit address for ' + code + ', make sure you have created a corresponding deposit address in your wallet on the exchange website');
9817
9820
  }
9818
9821
  else {
9819
9822
  return depositAddress;
9820
9823
  }
9821
9824
  }
9822
9825
  else {
9823
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchDepositAddress() is not supported yet');
9826
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchDepositAddress() is not supported yet');
9824
9827
  }
9825
9828
  }
9826
9829
  account() {
@@ -9838,7 +9841,7 @@ class Exchange {
9838
9841
  }
9839
9842
  currency(code) {
9840
9843
  if (this.currencies === undefined) {
9841
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' currencies not loaded');
9844
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' currencies not loaded');
9842
9845
  }
9843
9846
  if (typeof code === 'string') {
9844
9847
  if (code in this.currencies) {
@@ -9848,11 +9851,11 @@ class Exchange {
9848
9851
  return this.currencies_by_id[code];
9849
9852
  }
9850
9853
  }
9851
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' does not have currency code ' + code);
9854
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' does not have currency code ' + code);
9852
9855
  }
9853
9856
  market(symbol) {
9854
9857
  if (this.markets === undefined) {
9855
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' markets not loaded');
9858
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' markets not loaded');
9856
9859
  }
9857
9860
  if (typeof symbol === 'string') {
9858
9861
  if (symbol in this.markets) {
@@ -9870,7 +9873,7 @@ class Exchange {
9870
9873
  return markets[0];
9871
9874
  }
9872
9875
  }
9873
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.BadSymbol(this.id + ' does not have market symbol ' + symbol);
9876
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadSymbol(this.id + ' does not have market symbol ' + symbol);
9874
9877
  }
9875
9878
  handleWithdrawTagAndParams(tag, params) {
9876
9879
  if (typeof tag === 'object') {
@@ -9911,7 +9914,7 @@ class Exchange {
9911
9914
  const market = this.market(symbol);
9912
9915
  const result = this.decimalToPrecision(price, ROUND, market['precision']['price'], this.precisionMode, this.paddingMode);
9913
9916
  if (result === '0') {
9914
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' price of ' + market['symbol'] + ' must be greater than minimum price precision of ' + this.numberToString(market['precision']['price']));
9917
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidOrder(this.id + ' price of ' + market['symbol'] + ' must be greater than minimum price precision of ' + this.numberToString(market['precision']['price']));
9915
9918
  }
9916
9919
  return result;
9917
9920
  }
@@ -9919,7 +9922,7 @@ class Exchange {
9919
9922
  const market = this.market(symbol);
9920
9923
  const result = this.decimalToPrecision(amount, TRUNCATE, market['precision']['amount'], this.precisionMode, this.paddingMode);
9921
9924
  if (result === '0') {
9922
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' amount of ' + market['symbol'] + ' must be greater than minimum amount precision of ' + this.numberToString(market['precision']['amount']));
9925
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidOrder(this.id + ' amount of ' + market['symbol'] + ' must be greater than minimum amount precision of ' + this.numberToString(market['precision']['amount']));
9923
9926
  }
9924
9927
  return result;
9925
9928
  }
@@ -9998,49 +10001,49 @@ class Exchange {
9998
10001
  if (this.has['fetchLeverageTiers']) {
9999
10002
  const market = this.market(symbol);
10000
10003
  if (!market['contract']) {
10001
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.BadSymbol(this.id + ' fetchMarketLeverageTiers() supports contract markets only');
10004
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadSymbol(this.id + ' fetchMarketLeverageTiers() supports contract markets only');
10002
10005
  }
10003
10006
  const tiers = await this.fetchLeverageTiers([symbol]);
10004
10007
  return this.safeValue(tiers, symbol);
10005
10008
  }
10006
10009
  else {
10007
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchMarketLeverageTiers() is not supported yet');
10010
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMarketLeverageTiers() is not supported yet');
10008
10011
  }
10009
10012
  }
10010
10013
  async createPostOnlyOrder(symbol, type, side, amount, price, params = {}) {
10011
10014
  if (!this.has['createPostOnlyOrder']) {
10012
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + 'createPostOnlyOrder() is not supported yet');
10015
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + 'createPostOnlyOrder() is not supported yet');
10013
10016
  }
10014
10017
  const query = this.extend(params, { 'postOnly': true });
10015
10018
  return await this.createOrder(symbol, type, side, amount, price, query);
10016
10019
  }
10017
10020
  async createReduceOnlyOrder(symbol, type, side, amount, price, params = {}) {
10018
10021
  if (!this.has['createReduceOnlyOrder']) {
10019
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + 'createReduceOnlyOrder() is not supported yet');
10022
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + 'createReduceOnlyOrder() is not supported yet');
10020
10023
  }
10021
10024
  const query = this.extend(params, { 'reduceOnly': true });
10022
10025
  return await this.createOrder(symbol, type, side, amount, price, query);
10023
10026
  }
10024
10027
  async createStopOrder(symbol, type, side, amount, price = undefined, stopPrice = undefined, params = {}) {
10025
10028
  if (!this.has['createStopOrder']) {
10026
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createStopOrder() is not supported yet');
10029
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createStopOrder() is not supported yet');
10027
10030
  }
10028
10031
  if (stopPrice === undefined) {
10029
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' create_stop_order() requires a stopPrice argument');
10032
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' create_stop_order() requires a stopPrice argument');
10030
10033
  }
10031
10034
  const query = this.extend(params, { 'stopPrice': stopPrice });
10032
10035
  return await this.createOrder(symbol, type, side, amount, price, query);
10033
10036
  }
10034
10037
  async createStopLimitOrder(symbol, side, amount, price, stopPrice, params = {}) {
10035
10038
  if (!this.has['createStopLimitOrder']) {
10036
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createStopLimitOrder() is not supported yet');
10039
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createStopLimitOrder() is not supported yet');
10037
10040
  }
10038
10041
  const query = this.extend(params, { 'stopPrice': stopPrice });
10039
10042
  return await this.createOrder(symbol, 'limit', side, amount, price, query);
10040
10043
  }
10041
10044
  async createStopMarketOrder(symbol, side, amount, stopPrice, params = {}) {
10042
10045
  if (!this.has['createStopMarketOrder']) {
10043
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' createStopMarketOrder() is not supported yet');
10046
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' createStopMarketOrder() is not supported yet');
10044
10047
  }
10045
10048
  const query = this.extend(params, { 'stopPrice': stopPrice });
10046
10049
  return await this.createOrder(symbol, 'market', side, amount, undefined, query);
@@ -10172,7 +10175,7 @@ class Exchange {
10172
10175
  return market['symbol'];
10173
10176
  }
10174
10177
  parseFundingRate(contract, market = undefined) {
10175
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseFundingRate() is not supported yet');
10178
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseFundingRate() is not supported yet');
10176
10179
  }
10177
10180
  parseFundingRates(response, market = undefined) {
10178
10181
  const result = {};
@@ -10207,10 +10210,10 @@ class Exchange {
10207
10210
  postOnly = postOnly || timeInForcePostOnly || exchangeSpecificParam;
10208
10211
  if (postOnly) {
10209
10212
  if (ioc || fok) {
10210
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' postOnly orders cannot have timeInForce equal to ' + timeInForce);
10213
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidOrder(this.id + ' postOnly orders cannot have timeInForce equal to ' + timeInForce);
10211
10214
  }
10212
10215
  else if (isMarketOrder) {
10213
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' market orders cannot be postOnly');
10216
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidOrder(this.id + ' market orders cannot be postOnly');
10214
10217
  }
10215
10218
  else {
10216
10219
  return true;
@@ -10237,10 +10240,10 @@ class Exchange {
10237
10240
  postOnly = postOnly || po || exchangeSpecificPostOnlyOption;
10238
10241
  if (postOnly) {
10239
10242
  if (ioc || fok) {
10240
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' postOnly orders cannot have timeInForce equal to ' + timeInForce);
10243
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidOrder(this.id + ' postOnly orders cannot have timeInForce equal to ' + timeInForce);
10241
10244
  }
10242
10245
  else if (isMarketOrder) {
10243
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidOrder(this.id + ' market orders cannot be postOnly');
10246
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.InvalidOrder(this.id + ' market orders cannot be postOnly');
10244
10247
  }
10245
10248
  else {
10246
10249
  if (po) {
@@ -10253,19 +10256,19 @@ class Exchange {
10253
10256
  return [false, params];
10254
10257
  }
10255
10258
  async fetchLastPrices(symbols = undefined, params = {}) {
10256
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchLastPrices() is not supported yet');
10259
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchLastPrices() is not supported yet');
10257
10260
  }
10258
10261
  async fetchTradingFees(params = {}) {
10259
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTradingFees() is not supported yet');
10262
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradingFees() is not supported yet');
10260
10263
  }
10261
10264
  async fetchTradingFee(symbol, params = {}) {
10262
10265
  if (!this.has['fetchTradingFees']) {
10263
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTradingFee() is not supported yet');
10266
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTradingFee() is not supported yet');
10264
10267
  }
10265
10268
  return await this.fetchTradingFees(params);
10266
10269
  }
10267
10270
  parseOpenInterest(interest, market = undefined) {
10268
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseOpenInterest () is not supported yet');
10271
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseOpenInterest () is not supported yet');
10269
10272
  }
10270
10273
  parseOpenInterests(response, market = undefined, since = undefined, limit = undefined) {
10271
10274
  const interests = [];
@@ -10284,19 +10287,19 @@ class Exchange {
10284
10287
  const market = this.market(symbol);
10285
10288
  symbol = market['symbol'];
10286
10289
  if (!market['contract']) {
10287
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.BadSymbol(this.id + ' fetchFundingRate() supports contract markets only');
10290
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.BadSymbol(this.id + ' fetchFundingRate() supports contract markets only');
10288
10291
  }
10289
10292
  const rates = await this.fetchFundingRates([symbol], params);
10290
10293
  const rate = this.safeValue(rates, symbol);
10291
10294
  if (rate === undefined) {
10292
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NullResponse(this.id + ' fetchFundingRate () returned no data for ' + symbol);
10295
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NullResponse(this.id + ' fetchFundingRate () returned no data for ' + symbol);
10293
10296
  }
10294
10297
  else {
10295
10298
  return rate;
10296
10299
  }
10297
10300
  }
10298
10301
  else {
10299
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchFundingRate () is not supported yet');
10302
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchFundingRate () is not supported yet');
10300
10303
  }
10301
10304
  }
10302
10305
  async fetchMarkOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -10318,7 +10321,7 @@ class Exchange {
10318
10321
  return await this.fetchOHLCV(symbol, timeframe, since, limit, this.extend(request, params));
10319
10322
  }
10320
10323
  else {
10321
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchMarkOHLCV () is not supported yet');
10324
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchMarkOHLCV () is not supported yet');
10322
10325
  }
10323
10326
  }
10324
10327
  async fetchIndexOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -10340,7 +10343,7 @@ class Exchange {
10340
10343
  return await this.fetchOHLCV(symbol, timeframe, since, limit, this.extend(request, params));
10341
10344
  }
10342
10345
  else {
10343
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchIndexOHLCV () is not supported yet');
10346
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchIndexOHLCV () is not supported yet');
10344
10347
  }
10345
10348
  }
10346
10349
  async fetchPremiumIndexOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -10362,7 +10365,7 @@ class Exchange {
10362
10365
  return await this.fetchOHLCV(symbol, timeframe, since, limit, this.extend(request, params));
10363
10366
  }
10364
10367
  else {
10365
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchPremiumIndexOHLCV () is not supported yet');
10368
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchPremiumIndexOHLCV () is not supported yet');
10366
10369
  }
10367
10370
  }
10368
10371
  handleTimeInForce(params = {}) {
@@ -10376,7 +10379,7 @@ class Exchange {
10376
10379
  if (timeInForce !== undefined) {
10377
10380
  const exchangeValue = this.safeString(this.options['timeInForce'], timeInForce);
10378
10381
  if (exchangeValue === undefined) {
10379
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' does not support timeInForce "' + timeInForce + '"');
10382
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ExchangeError(this.id + ' does not support timeInForce "' + timeInForce + '"');
10380
10383
  }
10381
10384
  return exchangeValue;
10382
10385
  }
@@ -10420,7 +10423,7 @@ class Exchange {
10420
10423
  if (messageOptions !== '') {
10421
10424
  message += ', one of ' + '(' + messageOptions + ')';
10422
10425
  }
10423
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(message);
10426
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(message);
10424
10427
  }
10425
10428
  }
10426
10429
  checkRequiredMarginArgument(methodName, symbol, marginMode) {
@@ -10432,10 +10435,10 @@ class Exchange {
10432
10435
  * @param {string} marginMode is either 'isolated' or 'cross'
10433
10436
  */
10434
10437
  if ((marginMode === 'isolated') && (symbol === undefined)) {
10435
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' ' + methodName + '() requires a symbol argument for isolated margin');
10438
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' ' + methodName + '() requires a symbol argument for isolated margin');
10436
10439
  }
10437
10440
  else if ((marginMode === 'cross') && (symbol !== undefined)) {
10438
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' ' + methodName + '() cannot have a symbol argument for cross margin');
10441
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.ArgumentsRequired(this.id + ' ' + methodName + '() cannot have a symbol argument for cross margin');
10439
10442
  }
10440
10443
  }
10441
10444
  checkRequiredSymbol(methodName, symbol) {
@@ -10476,7 +10479,7 @@ class Exchange {
10476
10479
  return depositWithdrawFees;
10477
10480
  }
10478
10481
  parseDepositWithdrawFee(fee, currency = undefined) {
10479
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseDepositWithdrawFee() is not supported yet');
10482
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseDepositWithdrawFee() is not supported yet');
10480
10483
  }
10481
10484
  depositWithdrawFee(info) {
10482
10485
  return {
@@ -10519,7 +10522,7 @@ class Exchange {
10519
10522
  return fee;
10520
10523
  }
10521
10524
  parseIncome(info, market = undefined) {
10522
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' parseIncome () is not supported yet');
10525
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' parseIncome () is not supported yet');
10523
10526
  }
10524
10527
  parseIncomes(incomes, market = undefined, since = undefined, limit = undefined) {
10525
10528
  /**
@@ -10572,7 +10575,7 @@ class Exchange {
10572
10575
  return await this.fetchDepositsWithdrawals(code, since, limit, params);
10573
10576
  }
10574
10577
  else {
10575
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchTransactions () is not supported yet');
10578
+ throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchTransactions () is not supported yet');
10576
10579
  }
10577
10580
  }
10578
10581
  filterByArrayPositions(objects, key, values = undefined, indexed = true) {
@@ -15704,7 +15707,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
15704
15707
  'borrowMargin': true,
15705
15708
  'cancelAllOrders': true,
15706
15709
  'cancelOrder': true,
15707
- 'cancelOrders': undefined,
15710
+ 'cancelOrders': true,
15708
15711
  'createDepositAddress': false,
15709
15712
  'createOrder': true,
15710
15713
  'createPostOnlyOrder': true,
@@ -15938,11 +15941,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
15938
15941
  'fiat/orders': 600.03,
15939
15942
  'fiat/payments': 0.1,
15940
15943
  'futures/transfer': 1,
15941
- 'futures/loan/borrow/history': 1,
15942
- 'futures/loan/repay/history': 1,
15943
- 'futures/loan/wallet': 1,
15944
- 'futures/loan/adjustCollateral/history': 1,
15945
- 'futures/loan/liquidationHistory': 1,
15944
+ 'futures/histDataLink': 0.1,
15946
15945
  'rebate/taxQuery': 80.004,
15947
15946
  // https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
15948
15947
  'capital/config/getall': 1,
@@ -16386,6 +16385,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
16386
16385
  'markPriceKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
16387
16386
  'indexPriceKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
16388
16387
  'fundingRate': 1,
16388
+ 'fundingInfo': 1,
16389
16389
  'premiumIndex': 1,
16390
16390
  'ticker/24hr': { 'cost': 1, 'noSymbol': 40 },
16391
16391
  'ticker/price': { 'cost': 1, 'noSymbol': 2 },
@@ -20666,6 +20666,75 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
20666
20666
  return response;
20667
20667
  }
20668
20668
  }
20669
+ async cancelOrders(ids, symbol = undefined, params = {}) {
20670
+ /**
20671
+ * @method
20672
+ * @name binance#cancelOrders
20673
+ * @description cancel multiple orders
20674
+ * @see https://binance-docs.github.io/apidocs/futures/en/#cancel-multiple-orders-trade
20675
+ * @param {[string]} ids order ids
20676
+ * @param {string} [symbol] unified market symbol
20677
+ * @param {object} [params] extra parameters specific to the bingx api endpoint
20678
+ *
20679
+ * EXCHANGE SPECIFIC PARAMETERS
20680
+ * @param {[string]} [params.origClientOrderIdList] max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
20681
+ * @param {[int]} [params.recvWindow]
20682
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
20683
+ */
20684
+ this.checkRequiredSymbol('cancelOrders', symbol);
20685
+ await this.loadMarkets();
20686
+ const market = this.market(symbol);
20687
+ if (!market['contract']) {
20688
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' cancelOrders is only supported for swap markets.');
20689
+ }
20690
+ const request = {
20691
+ 'symbol': market['id'],
20692
+ 'orderidlist': ids,
20693
+ };
20694
+ let response = undefined;
20695
+ if (market['linear']) {
20696
+ response = await this.fapiPrivateDeleteBatchOrders(this.extend(request, params));
20697
+ }
20698
+ else if (market['inverse']) {
20699
+ response = await this.dapiPrivateDeleteBatchOrders(this.extend(request, params));
20700
+ }
20701
+ //
20702
+ // [
20703
+ // {
20704
+ // "clientOrderId": "myOrder1",
20705
+ // "cumQty": "0",
20706
+ // "cumQuote": "0",
20707
+ // "executedQty": "0",
20708
+ // "orderId": 283194212,
20709
+ // "origQty": "11",
20710
+ // "origType": "TRAILING_STOP_MARKET",
20711
+ // "price": "0",
20712
+ // "reduceOnly": false,
20713
+ // "side": "BUY",
20714
+ // "positionSide": "SHORT",
20715
+ // "status": "CANCELED",
20716
+ // "stopPrice": "9300", // please ignore when order type is TRAILING_STOP_MARKET
20717
+ // "closePosition": false, // if Close-All
20718
+ // "symbol": "BTCUSDT",
20719
+ // "timeInForce": "GTC",
20720
+ // "type": "TRAILING_STOP_MARKET",
20721
+ // "activatePrice": "9020", // activation price, only return with TRAILING_STOP_MARKET order
20722
+ // "priceRate": "0.3", // callback rate, only return with TRAILING_STOP_MARKET order
20723
+ // "updateTime": 1571110484038,
20724
+ // "workingType": "CONTRACT_PRICE",
20725
+ // "priceProtect": false, // if conditional order trigger is protected
20726
+ // "priceMatch": "NONE", // price match mode
20727
+ // "selfTradePreventionMode": "NONE", // self trading preventation mode
20728
+ // "goodTillDate": 0 // order pre-set auot cancel time for TIF GTD order
20729
+ // },
20730
+ // {
20731
+ // "code": -2011,
20732
+ // "msg": "Unknown order sent."
20733
+ // }
20734
+ // ]
20735
+ //
20736
+ return this.parseOrders(response, market);
20737
+ }
20669
20738
  async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
20670
20739
  /**
20671
20740
  * @method
@@ -23839,7 +23908,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23839
23908
  }
23840
23909
  let query = undefined;
23841
23910
  const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
23842
- const extendedParams = this.extend({
23911
+ let extendedParams = this.extend({
23843
23912
  'timestamp': this.nonce(),
23844
23913
  }, params);
23845
23914
  if (defaultRecvWindow !== undefined) {
@@ -23853,7 +23922,23 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23853
23922
  query = this.urlencodeWithArrayRepeat(extendedParams);
23854
23923
  }
23855
23924
  else if ((path === 'batchOrders') || (path.indexOf('sub-account') >= 0) || (path === 'capital/withdraw/apply') || (path.indexOf('staking') >= 0)) {
23856
- query = this.rawencode(extendedParams);
23925
+ if ((method === 'DELETE') && (path === 'batchOrders')) {
23926
+ const orderidlist = this.safeValue(extendedParams, 'orderidlist', []);
23927
+ const origclientorderidlist = this.safeValue(extendedParams, 'origclientorderidlist', []);
23928
+ extendedParams = this.omit(extendedParams, ['orderidlist', 'origclientorderidlist']);
23929
+ query = this.rawencode(extendedParams);
23930
+ const orderidlistLength = orderidlist.length;
23931
+ const origclientorderidlistLength = orderidlist.length;
23932
+ if (orderidlistLength > 0) {
23933
+ query = query + '&orderidlist=[' + orderidlist.join(',') + ']';
23934
+ }
23935
+ if (origclientorderidlistLength > 0) {
23936
+ query = query + '&origclientorderidlist=[' + origclientorderidlist.join(',') + ']';
23937
+ }
23938
+ }
23939
+ else {
23940
+ query = this.rawencode(extendedParams);
23941
+ }
23857
23942
  }
23858
23943
  else {
23859
23944
  query = this.urlencode(extendedParams);
@@ -23958,6 +24043,17 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
23958
24043
  if (!success) {
23959
24044
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' ' + body);
23960
24045
  }
24046
+ if (Array.isArray(response)) {
24047
+ // cancelOrders returns an array like this: [{"code":-2011,"msg":"Unknown order sent."}]
24048
+ const numElements = response.length;
24049
+ if (numElements > 0) {
24050
+ const firstElement = response[0];
24051
+ const errorCode = this.safeString(firstElement, 'code');
24052
+ if (errorCode !== undefined) {
24053
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, this.id + ' ' + body);
24054
+ }
24055
+ }
24056
+ }
23961
24057
  return undefined;
23962
24058
  }
23963
24059
  calculateRateLimiterCost(api, method, path, params, config = {}) {
@@ -36793,6 +36889,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
36793
36889
  * @method
36794
36890
  * @name bitforex#fetchMarkets
36795
36891
  * @description retrieves data on all markets for bitforex
36892
+ * @see https://apidoc.bitforex.com/#exchange-information
36796
36893
  * @param {object} [params] extra parameters specific to the exchange api endpoint
36797
36894
  * @returns {object[]} an array of objects representing market data
36798
36895
  */
@@ -36948,6 +37045,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
36948
37045
  * @method
36949
37046
  * @name bitforex#fetchTrades
36950
37047
  * @description get the list of most recent trades for a particular symbol
37048
+ * @see https://apidoc.bitforex.com/#recent-trades-list
36951
37049
  * @param {string} symbol unified symbol of the market to fetch trades for
36952
37050
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
36953
37051
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -37060,6 +37158,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
37060
37158
  * @method
37061
37159
  * @name bitforex#fetchBalance
37062
37160
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
37161
+ * @see https://apidoc.bitforex.com/#user-all-asset-information-user_data
37063
37162
  * @param {object} [params] extra parameters specific to the bitforex api endpoint
37064
37163
  * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
37065
37164
  */
@@ -37109,6 +37208,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
37109
37208
  * @method
37110
37209
  * @name bitforex#fetchTicker
37111
37210
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
37211
+ * @see https://apidoc.bitforex.com/#exchange-information
37112
37212
  * @param {string} symbol unified symbol of the market to fetch the ticker for
37113
37213
  * @param {object} [params] extra parameters specific to the bitforex api endpoint
37114
37214
  * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
@@ -37163,6 +37263,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
37163
37263
  * @method
37164
37264
  * @name bitforex#fetchOHLCV
37165
37265
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
37266
+ * @see https://apidoc.bitforex.com/#kline
37166
37267
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
37167
37268
  * @param {string} timeframe the length of time each candle represents
37168
37269
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -37199,6 +37300,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
37199
37300
  * @method
37200
37301
  * @name bitforex#fetchOrderBook
37201
37302
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
37303
+ * @see https://apidoc.bitforex.com/#order-book
37202
37304
  * @param {string} symbol unified symbol of the market to fetch the order book for
37203
37305
  * @param {int} [limit] the maximum amount of order book entries to return
37204
37306
  * @param {object} [params] extra parameters specific to the bitforex api endpoint
@@ -37287,6 +37389,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
37287
37389
  * @method
37288
37390
  * @name bitforex#fetchOrder
37289
37391
  * @description fetches information on an order made by the user
37392
+ * @see
37290
37393
  * @param {string} symbol unified symbol of the market the order was made in
37291
37394
  * @param {object} [params] extra parameters specific to the bitforex api endpoint
37292
37395
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -37352,6 +37455,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
37352
37455
  * @method
37353
37456
  * @name bitforex#createOrder
37354
37457
  * @description create a trade order
37458
+ * @see https://apidoc.bitforex.com/#new-order-trade
37355
37459
  * @param {string} symbol unified symbol of the market to create an order in
37356
37460
  * @param {string} type 'market' or 'limit'
37357
37461
  * @param {string} side 'buy' or 'sell'
@@ -37387,6 +37491,7 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
37387
37491
  * @method
37388
37492
  * @name bitforex#cancelOrder
37389
37493
  * @description cancels an open order
37494
+ * @see https://apidoc.bitforex.com/#cancel-order-trade
37390
37495
  * @param {string} id order id
37391
37496
  * @param {string} symbol unified symbol of the market the order was made in
37392
37497
  * @param {object} [params] extra parameters specific to the bitforex api endpoint
@@ -45000,40 +45105,47 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45000
45105
  // private fetchMyTrades spot
45001
45106
  //
45002
45107
  // {
45003
- // "detail_id":256348632,
45004
- // "order_id":2147484350,
45005
- // "symbol":"BTC_USDT",
45006
- // "create_time":1590462303000,
45108
+ // "tradeId":"182342999769370687",
45109
+ // "orderId":"183270218784142990",
45110
+ // "clientOrderId":"183270218784142990",
45111
+ // "symbol":"ADA_USDT",
45007
45112
  // "side":"buy",
45008
- // "fees":"0.00001350",
45009
- // "fee_coin_name":"BTC",
45010
- // "notional":"88.00000000",
45011
- // "price_avg":"8800.00",
45012
- // "size":"0.01000",
45013
- // "exec_type":"M"
45113
+ // "orderMode":"spot",
45114
+ // "type":"market",
45115
+ // "price":"0.245948",
45116
+ // "size":"20.71",
45117
+ // "notional":"5.09358308",
45118
+ // "fee":"0.00509358",
45119
+ // "feeCoinName":"USDT",
45120
+ // "tradeRole":"taker",
45121
+ // "createTime":1695658457836,
45014
45122
  // }
45015
45123
  //
45016
- const id = this.safeString(trade, 'detail_id');
45017
- const timestamp = this.safeInteger2(trade, 'order_time', 'create_time');
45018
- const type = undefined;
45019
- const side = this.safeStringLower2(trade, 'type', 'side');
45020
- let takerOrMaker = undefined;
45021
- const execType = this.safeString(trade, 'exec_type');
45022
- if (execType !== undefined) {
45023
- takerOrMaker = (execType === 'M') ? 'maker' : 'taker';
45124
+ const id = this.safeString(trade, 'tradeId');
45125
+ const timestamp = this.safeInteger2(trade, 'order_time', 'createTime');
45126
+ const side = this.safeStringLower2(trade, 'side', 'type');
45127
+ const takerOrMaker = this.safeString(trade, 'tradeRole');
45128
+ const isPublicTrade = ('order_time' in trade);
45129
+ const price = this.safeString(trade, 'price');
45130
+ let amount = undefined;
45131
+ let cost = undefined;
45132
+ let type = undefined;
45133
+ if (isPublicTrade) {
45134
+ amount = this.safeString(trade, 'count');
45135
+ cost = this.safeString(trade, 'amount');
45024
45136
  }
45025
- let priceString = this.safeString(trade, 'price');
45026
- priceString = this.safeString(trade, 'price_avg', priceString);
45027
- let amountString = this.safeString(trade, 'count');
45028
- amountString = this.safeString(trade, 'size', amountString);
45029
- const costString = this.safeString2(trade, 'amount', 'notional');
45030
- const orderId = this.safeString(trade, 'order_id');
45137
+ else {
45138
+ amount = this.safeString(trade, 'size');
45139
+ cost = this.safeString(trade, 'notional');
45140
+ type = this.safeString(trade, 'type');
45141
+ }
45142
+ const orderId = this.safeString(trade, 'orderId');
45031
45143
  const marketId = this.safeString(trade, 'symbol');
45032
45144
  market = this.safeMarket(marketId, market, '_');
45033
- const feeCostString = this.safeString(trade, 'fees');
45145
+ const feeCostString = this.safeString(trade, 'fee');
45034
45146
  let fee = undefined;
45035
45147
  if (feeCostString !== undefined) {
45036
- const feeCurrencyId = this.safeString(trade, 'fee_coin_name');
45148
+ const feeCurrencyId = this.safeString(trade, 'feeCoinName');
45037
45149
  let feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
45038
45150
  if (feeCurrencyCode === undefined) {
45039
45151
  feeCurrencyCode = (side === 'buy') ? market['base'] : market['quote'];
@@ -45052,9 +45164,9 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45052
45164
  'symbol': market['symbol'],
45053
45165
  'type': type,
45054
45166
  'side': side,
45055
- 'price': priceString,
45056
- 'amount': amountString,
45057
- 'cost': costString,
45167
+ 'price': price,
45168
+ 'amount': amount,
45169
+ 'cost': cost,
45058
45170
  'takerOrMaker': takerOrMaker,
45059
45171
  'fee': fee,
45060
45172
  }, market);
@@ -45257,66 +45369,83 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45257
45369
  /**
45258
45370
  * @method
45259
45371
  * @name bitmart#fetchMyTrades
45372
+ * @see https://developer-pro.bitmart.com/en/spot/#account-trade-list-v4-signed
45260
45373
  * @description fetch all trades made by the user
45261
45374
  * @param {string} symbol unified market symbol
45262
45375
  * @param {int} [since] the earliest time in ms to fetch trades for
45263
45376
  * @param {int} [limit] the maximum number of trades structures to retrieve
45264
45377
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
45378
+ * @param {int} [params.until] the latest time in ms to fetch trades for
45379
+ * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported)
45265
45380
  * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
45266
45381
  */
45267
- if (symbol === undefined) {
45268
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
45269
- }
45270
45382
  await this.loadMarkets();
45271
- const market = this.market(symbol);
45272
- if (!market['spot']) {
45273
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades() does not support ' + market['type'] + ' orders, only spot orders are accepted');
45383
+ let market = undefined;
45384
+ const request = {};
45385
+ if (symbol !== undefined) {
45386
+ market = this.market(symbol);
45387
+ }
45388
+ let type = undefined;
45389
+ [type, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
45390
+ if (type !== 'spot') {
45391
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades() does not support ' + type + ' orders, only spot orders are accepted');
45392
+ }
45393
+ let marginMode = undefined;
45394
+ [marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
45395
+ if (marginMode === 'isolated') {
45396
+ request['orderMode'] = 'iso_margin';
45274
45397
  }
45275
45398
  const options = this.safeValue(this.options, 'fetchMyTrades', {});
45276
45399
  const defaultLimit = this.safeInteger(options, 'limit', 200);
45277
45400
  if (limit === undefined) {
45278
45401
  limit = defaultLimit;
45279
45402
  }
45280
- const request = {
45281
- 'symbol': market['id'],
45282
- 'N': limit,
45283
- };
45284
- const response = await this.privateGetSpotV2Trades(this.extend(request, params));
45403
+ request['limit'] = limit;
45404
+ if (symbol !== undefined) {
45405
+ request['symbol'] = market['id'];
45406
+ }
45407
+ const until = this.safeInteger2(params, 'until', 'endTime');
45408
+ if (until !== undefined) {
45409
+ params = this.omit(params, ['endTime']);
45410
+ request['endTime'] = until;
45411
+ }
45412
+ const response = await this.privatePostSpotV4QueryTrades(this.extend(request, params));
45285
45413
  //
45286
45414
  // spot
45287
45415
  //
45288
- // {
45289
- // "message":"OK",
45290
- // "code":1000,
45291
- // "trace":"a06a5c53-8e6f-42d6-8082-2ff4718d221c",
45292
- // "data":{
45293
- // "current_page":1,
45294
- // "trades":[
45295
- // {
45296
- // "detail_id":256348632,
45297
- // "order_id":2147484350,
45298
- // "symbol":"BTC_USDT",
45299
- // "create_time":1590462303000,
45300
- // "side":"buy",
45301
- // "fees":"0.00001350",
45302
- // "fee_coin_name":"BTC",
45303
- // "notional":"88.00000000",
45304
- // "price_avg":"8800.00",
45305
- // "size":"0.01000",
45306
- // "exec_type":"M"
45307
- // },
45308
- // ]
45309
- // }
45310
- // }
45416
+ // {
45417
+ // "code":1000,
45418
+ // "message":"success",
45419
+ // "data":[
45420
+ // {
45421
+ // "tradeId":"182342999769370687",
45422
+ // "orderId":"183270218784142990",
45423
+ // "clientOrderId":"183270218784142990",
45424
+ // "symbol":"ADA_USDT",
45425
+ // "side":"buy",
45426
+ // "orderMode":"spot",
45427
+ // "type":"market",
45428
+ // "price":"0.245948",
45429
+ // "size":"20.71",
45430
+ // "notional":"5.09358308",
45431
+ // "fee":"0.00509358",
45432
+ // "feeCoinName":"USDT",
45433
+ // "tradeRole":"taker",
45434
+ // "createTime":1695658457836,
45435
+ // "updateTime":1695658457836
45436
+ // }
45437
+ // ],
45438
+ // "trace":"fbaee9e0e2f5442fba5b3262fc86b0ac.65.16956593456523085"
45439
+ // }
45311
45440
  //
45312
45441
  const data = this.safeValue(response, 'data', {});
45313
- const trades = this.safeValue(data, 'trades', []);
45314
- return this.parseTrades(trades, market, since, limit);
45442
+ return this.parseTrades(data, market, since, limit);
45315
45443
  }
45316
45444
  async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
45317
45445
  /**
45318
45446
  * @method
45319
45447
  * @name bitmart#fetchOrderTrades
45448
+ * @see https://developer-pro.bitmart.com/en/spot/#order-trade-list-v4-signed
45320
45449
  * @description fetch all the trades made from a single order
45321
45450
  * @param {string} id order id
45322
45451
  * @param {string} symbol unified market symbol
@@ -45325,55 +45454,13 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45325
45454
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
45326
45455
  * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
45327
45456
  */
45328
- if (symbol === undefined) {
45329
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOrderTrades() requires a symbol argument');
45330
- }
45331
45457
  await this.loadMarkets();
45332
- const market = this.market(symbol);
45333
- if (!market['spot']) {
45334
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrderTrades() does not support ' + market['type'] + ' orders, only spot orders are accepted');
45335
- }
45336
- const options = this.safeValue(this.options, 'fetchOrderTrades', {});
45337
- const defaultLimit = this.safeInteger(options, 'limit', 200);
45338
- if (limit === undefined) {
45339
- limit = defaultLimit;
45340
- }
45341
45458
  const request = {
45342
- 'symbol': market['id'],
45343
- 'order_id': id,
45344
- 'N': limit,
45459
+ 'orderId': id,
45345
45460
  };
45346
- const response = await this.privateGetSpotV2Trades(this.extend(request, params));
45347
- //
45348
- // spot
45349
- //
45350
- // {
45351
- // "message":"OK",
45352
- // "code":1000,
45353
- // "trace":"a06a5c53-8e6f-42d6-8082-2ff4718d221c",
45354
- // "data":{
45355
- // "current_page":1,
45356
- // "trades":[
45357
- // {
45358
- // "detail_id":256348632,
45359
- // "order_id":2147484350,
45360
- // "symbol":"BTC_USDT",
45361
- // "create_time":1590462303000,
45362
- // "side":"buy",
45363
- // "fees":"0.00001350",
45364
- // "fee_coin_name":"BTC",
45365
- // "notional":"88.00000000",
45366
- // "price_avg":"8800.00",
45367
- // "size":"0.01000",
45368
- // "exec_type":"M"
45369
- // },
45370
- // ]
45371
- // }
45372
- // }
45373
- //
45461
+ const response = await this.privatePostSpotV4QueryOrderTrades(this.extend(request, params));
45374
45462
  const data = this.safeValue(response, 'data', {});
45375
- const trades = this.safeValue(data, 'trades', []);
45376
- return this.parseTrades(trades, market, since, limit);
45463
+ return this.parseTrades(data, undefined, since, limit);
45377
45464
  }
45378
45465
  customParseBalance(response, marketType) {
45379
45466
  const data = this.safeValue(response, 'data', {});
@@ -45632,24 +45719,55 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45632
45719
  // "status":"8"
45633
45720
  // }
45634
45721
  //
45722
+ // spot v4
45723
+ // {
45724
+ // "orderId" : "118100034543076010",
45725
+ // "clientOrderId" : "118100034543076010",
45726
+ // "symbol" : "BTC_USDT",
45727
+ // "side" : "buy",
45728
+ // "orderMode" : "spot",
45729
+ // "type" : "limit",
45730
+ // "state" : "filled",
45731
+ // "price" : "48800.00",
45732
+ // "priceAvg" : "39999.00",
45733
+ // "size" : "0.10000",
45734
+ // "filledSize" : "0.10000",
45735
+ // "notional" : "4880.00000000",
45736
+ // "filledNotional" : "3999.90000000",
45737
+ // "createTime" : 1681701557927,
45738
+ // "updateTime" : 1681701559408
45739
+ // }
45740
+ //
45741
+ // swap: fetchOpenOrders
45742
+ //
45743
+ // {
45744
+ // "order_id": "230935812485489",
45745
+ // "client_order_id": "",
45746
+ // "price": "24000",
45747
+ // "size": "1",
45748
+ // "symbol": "BTCUSDT",
45749
+ // "state": 2,
45750
+ // "side": 1,
45751
+ // "type": "limit",
45752
+ // "leverage": "10",
45753
+ // "open_type": "isolated",
45754
+ // "deal_avg_price": "0",
45755
+ // "deal_size": "0",
45756
+ // "create_time": 1695702258629,
45757
+ // "update_time": 1695702258642
45758
+ // }
45759
+ //
45635
45760
  let id = undefined;
45636
45761
  if (typeof order === 'string') {
45637
45762
  id = order;
45638
45763
  order = {};
45639
45764
  }
45640
- id = this.safeString(order, 'order_id', id);
45641
- const timestamp = this.safeInteger(order, 'create_time');
45765
+ id = this.safeString2(order, 'order_id', 'orderId', id);
45766
+ const timestamp = this.safeInteger2(order, 'create_time', 'createTime');
45642
45767
  const marketId = this.safeString(order, 'symbol');
45643
- const symbol = this.safeSymbol(marketId, market, '_');
45644
- let status = undefined;
45645
- if (market !== undefined) {
45646
- status = this.parseOrderStatusByType(market['type'], this.safeString(order, 'status'));
45647
- }
45648
- const amount = this.safeString(order, 'size');
45649
- const filled = this.safeString(order, 'filled_size');
45650
- const average = this.safeString(order, 'price_avg');
45651
- const price = this.safeString(order, 'price');
45652
- const side = this.safeString(order, 'side');
45768
+ const symbol = this.safeSymbol(marketId, market);
45769
+ market = this.safeMarket(symbol, market);
45770
+ const orderType = this.safeString(market, 'type', 'spot');
45653
45771
  let type = this.safeString(order, 'type');
45654
45772
  let timeInForce = undefined;
45655
45773
  let postOnly = undefined;
@@ -45664,29 +45782,38 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45664
45782
  }
45665
45783
  return this.safeOrder({
45666
45784
  'id': id,
45667
- 'clientOrderId': undefined,
45785
+ 'clientOrderId': this.safeString(order, 'client_order_id'),
45668
45786
  'info': order,
45669
45787
  'timestamp': timestamp,
45670
45788
  'datetime': this.iso8601(timestamp),
45671
- 'lastTradeTimestamp': undefined,
45789
+ 'lastTradeTimestamp': this.safeInteger(order, 'update_time'),
45672
45790
  'symbol': symbol,
45673
45791
  'type': type,
45674
45792
  'timeInForce': timeInForce,
45675
45793
  'postOnly': postOnly,
45676
- 'side': side,
45677
- 'price': price,
45794
+ 'side': this.parseOrderSide(this.safeString(order, 'side')),
45795
+ 'price': this.omitZero(this.safeString(order, 'price')),
45678
45796
  'stopPrice': undefined,
45679
45797
  'triggerPrice': undefined,
45680
- 'amount': amount,
45681
- 'cost': undefined,
45682
- 'average': average,
45683
- 'filled': filled,
45798
+ 'amount': this.omitZero(this.safeString(order, 'size')),
45799
+ 'cost': this.safeString2(order, 'filled_notional', 'filledNotional'),
45800
+ 'average': this.safeStringN(order, ['price_avg', 'priceAvg', 'deal_avg_price']),
45801
+ 'filled': this.safeStringN(order, ['filled_size', 'filledSize', 'deal_size']),
45684
45802
  'remaining': undefined,
45685
- 'status': status,
45803
+ 'status': this.parseOrderStatusByType(orderType, this.safeString2(order, 'status', 'state')),
45686
45804
  'fee': undefined,
45687
45805
  'trades': undefined,
45688
45806
  }, market);
45689
45807
  }
45808
+ parseOrderSide(side) {
45809
+ const sides = {
45810
+ '1': 'open long',
45811
+ '2': 'close short',
45812
+ '3': 'close long',
45813
+ '4': 'open short',
45814
+ };
45815
+ return this.safeString(sides, side, side);
45816
+ }
45690
45817
  parseOrderStatusByType(type, status) {
45691
45818
  const statusesByType = {
45692
45819
  'spot': {
@@ -45697,7 +45824,11 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45697
45824
  '5': 'open',
45698
45825
  '6': 'closed',
45699
45826
  '7': 'canceling',
45700
- '8': 'canceled', // Canceled
45827
+ '8': 'canceled',
45828
+ 'new': 'open',
45829
+ 'partially_filled': 'filled',
45830
+ 'filled': 'filled',
45831
+ 'partially_canceled': 'canceled',
45701
45832
  },
45702
45833
  'swap': {
45703
45834
  '1': 'open',
@@ -45990,19 +46121,116 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45990
46121
  /**
45991
46122
  * @method
45992
46123
  * @name bitmart#fetchOpenOrders
46124
+ * @see https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
46125
+ * @see https://developer-pro.bitmart.com/en/futures/#get-all-open-orders-keyed
45993
46126
  * @description fetch all unfilled currently open orders
45994
46127
  * @param {string} symbol unified market symbol
45995
46128
  * @param {int} [since] the earliest time in ms to fetch open orders for
45996
- * @param {int} [limit] the maximum number of open orders structures to retrieve
46129
+ * @param {int} [limit] the maximum number of open order structures to retrieve
45997
46130
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
46131
+ * @param {boolean} [params.marginMode] *spot* whether to fetch trades for margin orders or spot orders, defaults to spot orders (only isolated margin orders are supported)
46132
+ * @param {int} [params.until] *spot* the latest time in ms to fetch orders for
46133
+ * @param {string} [params.type] *swap* order type, 'limit' or 'market'
46134
+ * @param {string} [params.order_state] *swap* the order state, 'all' or 'partially_filled', default is 'all'
45998
46135
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
45999
46136
  */
46000
- return await this.fetchOrdersByStatus('open', symbol, since, limit, params);
46137
+ await this.loadMarkets();
46138
+ let market = undefined;
46139
+ const request = {};
46140
+ if (symbol !== undefined) {
46141
+ market = this.market(symbol);
46142
+ request['symbol'] = market['id'];
46143
+ }
46144
+ if (limit !== undefined) {
46145
+ request['limit'] = limit;
46146
+ }
46147
+ let type = undefined;
46148
+ let response = undefined;
46149
+ [type, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
46150
+ if (type === 'spot') {
46151
+ let marginMode = undefined;
46152
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
46153
+ if (marginMode === 'isolated') {
46154
+ request['orderMode'] = 'iso_margin';
46155
+ }
46156
+ if (since !== undefined) {
46157
+ request['startTime'] = since;
46158
+ }
46159
+ const until = this.safeInteger2(params, 'until', 'endTime');
46160
+ if (until !== undefined) {
46161
+ params = this.omit(params, ['endTime']);
46162
+ request['endTime'] = until;
46163
+ }
46164
+ response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
46165
+ }
46166
+ else if (type === 'swap') {
46167
+ response = await this.privateGetContractPrivateGetOpenOrders(this.extend(request, params));
46168
+ }
46169
+ else {
46170
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOpenOrders() does not support ' + type + ' orders, only spot and swap orders are accepted');
46171
+ }
46172
+ //
46173
+ // spot
46174
+ //
46175
+ // {
46176
+ // "code": 1000,
46177
+ // "message": "success",
46178
+ // "data": [
46179
+ // {
46180
+ // "orderId": "183299373022163211",
46181
+ // "clientOrderId": "183299373022163211",
46182
+ // "symbol": "BTC_USDT",
46183
+ // "side": "buy",
46184
+ // "orderMode": "spot",
46185
+ // "type": "limit",
46186
+ // "state": "new",
46187
+ // "price": "25000.00",
46188
+ // "priceAvg": "0.00",
46189
+ // "size": "0.00020",
46190
+ // "filledSize": "0.00000",
46191
+ // "notional": "5.00000000",
46192
+ // "filledNotional": "0.00000000",
46193
+ // "createTime": 1695703703338,
46194
+ // "updateTime": 1695703703359
46195
+ // }
46196
+ // ],
46197
+ // "trace": "15f11d48e3234c81a2e786cr2e7a38e6.71.16957022303515933"
46198
+ // }
46199
+ //
46200
+ // swap
46201
+ //
46202
+ // {
46203
+ // "code": 1000,
46204
+ // "message": "Ok",
46205
+ // "data": [
46206
+ // {
46207
+ // "order_id": "230935812485489",
46208
+ // "client_order_id": "",
46209
+ // "price": "24000",
46210
+ // "size": "1",
46211
+ // "symbol": "BTCUSDT",
46212
+ // "state": 2,
46213
+ // "side": 1,
46214
+ // "type": "limit",
46215
+ // "leverage": "10",
46216
+ // "open_type": "isolated",
46217
+ // "deal_avg_price": "0",
46218
+ // "deal_size": "0",
46219
+ // "create_time": 1695702258629,
46220
+ // "update_time": 1695702258642
46221
+ // }
46222
+ // ],
46223
+ // "trace": "7f9d94g10f9d4513bc08a7rfc3a5559a.71.16957022303515933"
46224
+ // }
46225
+ //
46226
+ const data = this.safeValue(response, 'data', []);
46227
+ return this.parseOrders(data, market, since, limit);
46001
46228
  }
46002
46229
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
46003
46230
  /**
46004
46231
  * @method
46005
46232
  * @name bitmart#fetchClosedOrders
46233
+ * @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
46006
46234
  * @description fetches information on multiple closed orders made by the user
46007
46235
  * @param {string} symbol unified market symbol of the market orders were made in
46008
46236
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -46010,7 +46238,31 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46010
46238
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
46011
46239
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
46012
46240
  */
46013
- return await this.fetchOrdersByStatus('closed', symbol, since, limit, params);
46241
+ await this.loadMarkets();
46242
+ let market = undefined;
46243
+ const request = {};
46244
+ if (symbol !== undefined) {
46245
+ market = this.market(symbol);
46246
+ request['symbol'] = market['id'];
46247
+ }
46248
+ let type = undefined;
46249
+ [type, params] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
46250
+ if (type !== 'spot') {
46251
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchClosedOrders() does not support ' + type + ' orders, only spot orders are accepted');
46252
+ }
46253
+ let marginMode = undefined;
46254
+ [marginMode, params] = this.handleMarginModeAndParams('fetchClosedOrders', params);
46255
+ if (marginMode === 'isolated') {
46256
+ request['orderMode'] = 'iso_margin';
46257
+ }
46258
+ const until = this.safeInteger2(params, 'until', 'endTime');
46259
+ if (until !== undefined) {
46260
+ params = this.omit(params, ['endTime']);
46261
+ request['endTime'] = until;
46262
+ }
46263
+ const response = await this.privatePostSpotV4QueryHistoryOrders(this.extend(request, params));
46264
+ const data = this.safeValue(response, 'data');
46265
+ return this.parseOrders(data, market, since, limit);
46014
46266
  }
46015
46267
  async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
46016
46268
  /**
@@ -46029,49 +46281,29 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46029
46281
  /**
46030
46282
  * @method
46031
46283
  * @name bitmart#fetchOrder
46284
+ * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
46285
+ * @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
46032
46286
  * @description fetches information on an order made by the user
46033
46287
  * @param {string} symbol unified symbol of the market the order was made in
46034
46288
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
46289
+ * @param {string} [params.clientOrderId] fetch the order by client order id instead of order id
46035
46290
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
46036
46291
  */
46037
- if (symbol === undefined) {
46038
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
46039
- }
46040
46292
  await this.loadMarkets();
46041
- const market = this.market(symbol);
46042
- if (!market['spot']) {
46043
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchOrder() does not support ' + market['type'] + ' orders, only spot orders are accepted');
46293
+ const request = {};
46294
+ const clientOrderId = this.safeString(params, 'clientOrderId');
46295
+ if (!clientOrderId) {
46296
+ request['orderId'] = id;
46297
+ }
46298
+ let response = undefined;
46299
+ if (clientOrderId !== undefined) {
46300
+ response = await this.privatePostSpotV4QueryClientOrder(this.extend(request, params));
46301
+ }
46302
+ else {
46303
+ response = await this.privatePostSpotV4QueryOrder(this.extend(request, params));
46044
46304
  }
46045
- const request = {
46046
- 'symbol': market['id'],
46047
- 'order_id': id,
46048
- };
46049
- const response = await this.privateGetSpotV2OrderDetail(this.extend(request, params));
46050
- //
46051
- // spot
46052
- //
46053
- // {
46054
- // "message":"OK",
46055
- // "code":1000,
46056
- // "trace":"a27c2cb5-ead4-471d-8455-1cfeda054ea6",
46057
- // "data": {
46058
- // "order_id":1736871726781,
46059
- // "symbol":"BTC_USDT",
46060
- // "create_time":1591096004000,
46061
- // "side":"sell",
46062
- // "type":"market",
46063
- // "price":"0.00",
46064
- // "price_avg":"0.00",
46065
- // "size":"0.02000",
46066
- // "notional":"0.00000000",
46067
- // "filled_notional":"0.00000000",
46068
- // "filled_size":"0.00000",
46069
- // "status":"8"
46070
- // }
46071
- // }
46072
- //
46073
46305
  const data = this.safeValue(response, 'data', {});
46074
- return this.parseOrder(data, market);
46306
+ return this.parseOrder(data, undefined);
46075
46307
  }
46076
46308
  async fetchDepositAddress(code, params = {}) {
46077
46309
  /**
@@ -110157,6 +110389,7 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
110157
110389
  'createStopLimitOrder': true,
110158
110390
  'createStopMarketOrder': true,
110159
110391
  'createStopOrder': true,
110392
+ 'editOrder': true,
110160
110393
  'fetchAccounts': false,
110161
110394
  'fetchBalance': true,
110162
110395
  'fetchCanceledOrders': true,
@@ -111620,20 +111853,60 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
111620
111853
  * @method
111621
111854
  * @name exmo#cancelOrder
111622
111855
  * @description cancels an open order
111856
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#1f710d4b-75bc-4b65-ad68-006f863a3f26
111857
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#a4d0aae8-28f7-41ac-94fd-c4030130453d // stop market
111858
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#705dfec5-2b35-4667-862b-faf54eca6209 // margin
111623
111859
  * @param {string} id order id
111624
111860
  * @param {string} symbol not used by exmo cancelOrder ()
111625
111861
  * @param {object} [params] extra parameters specific to the exmo api endpoint
111862
+ * @param {boolean} [params.trigger] true to cancel a trigger order
111863
+ * @param {string} [params.marginMode] set to 'cross' or 'isolated' to cancel a margin order
111626
111864
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
111627
111865
  */
111628
111866
  await this.loadMarkets();
111629
- const request = { 'order_id': id };
111630
- return await this.privatePostOrderCancel(this.extend(request, params));
111867
+ const request = {};
111868
+ const stop = this.safeValue2(params, 'trigger', 'stop');
111869
+ params = this.omit(params, ['trigger', 'stop']);
111870
+ let marginMode = undefined;
111871
+ [marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
111872
+ if (marginMode === 'cross') {
111873
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' only supports isolated margin');
111874
+ }
111875
+ let response = undefined;
111876
+ if ((marginMode === 'isolated')) {
111877
+ request['order_id'] = id;
111878
+ response = await this.privatePostMarginUserOrderCancel(this.extend(request, params));
111879
+ //
111880
+ // {}
111881
+ //
111882
+ }
111883
+ else {
111884
+ if (stop) {
111885
+ request['parent_order_id'] = id;
111886
+ response = await this.privatePostStopMarketOrderCancel(this.extend(request, params));
111887
+ //
111888
+ // {}
111889
+ //
111890
+ }
111891
+ else {
111892
+ request['order_id'] = id;
111893
+ response = await this.privatePostOrderCancel(this.extend(request, params));
111894
+ //
111895
+ // {
111896
+ // 'error': '',
111897
+ // 'result': True
111898
+ // }
111899
+ //
111900
+ }
111901
+ }
111902
+ return this.parseOrder(response);
111631
111903
  }
111632
111904
  async fetchOrder(id, symbol = undefined, params = {}) {
111633
111905
  /**
111634
111906
  * @method
111635
111907
  * @name exmo#fetchOrder
111636
- * @description fetches information on an order made by the user
111908
+ * @description *spot only* fetches information on an order made by the user
111909
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#cf27781e-28e5-4b39-a52d-3110f5d22459 // spot
111637
111910
  * @param {string} symbol not used by exmo fetchOrder
111638
111911
  * @param {object} [params] extra parameters specific to the exmo api endpoint
111639
111912
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -111752,30 +112025,123 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
111752
112025
  * @method
111753
112026
  * @name exmo#fetchOpenOrders
111754
112027
  * @description fetch all unfilled currently open orders
112028
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#0e135370-daa4-4689-8acd-b6876dee9ba1 // spot open orders
112029
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#a7cfd4f0-476e-4675-b33f-22a46902f245 // margin
111755
112030
  * @param {string} symbol unified market symbol
111756
112031
  * @param {int} [since] the earliest time in ms to fetch open orders for
111757
112032
  * @param {int} [limit] the maximum number of open orders structures to retrieve
111758
112033
  * @param {object} [params] extra parameters specific to the exmo api endpoint
112034
+ * @param {string} [params.marginMode] set to "isolated" for margin orders
111759
112035
  * @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
111760
112036
  */
111761
112037
  await this.loadMarkets();
112038
+ let market = undefined;
111762
112039
  if (symbol !== undefined) {
111763
- const market = this.market(symbol);
112040
+ market = this.market(symbol);
111764
112041
  symbol = market['symbol'];
111765
112042
  }
111766
- const response = await this.privatePostUserOpenOrders(params);
111767
- const marketIds = Object.keys(response);
112043
+ let marginMode = undefined;
112044
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
112045
+ const isMargin = ((marginMode === 'cross') || (marginMode === 'isolated'));
112046
+ let response = undefined;
111768
112047
  let orders = [];
111769
- for (let i = 0; i < marketIds.length; i++) {
111770
- const marketId = marketIds[i];
111771
- const market = this.safeMarket(marketId);
112048
+ if (isMargin) {
112049
+ response = await this.privatePostMarginUserOrderList(params);
112050
+ //
112051
+ // {
112052
+ // "orders": [
112053
+ // {
112054
+ // "client_id": "0",
112055
+ // "comment": "",
112056
+ // "created": "1619068707985325495",
112057
+ // "distance": "0",
112058
+ // "expire": 0,
112059
+ // "funding_currency": "BTC",
112060
+ // "funding_quantity": "0.01",
112061
+ // "funding_rate": "0.02",
112062
+ // "leverage": "2",
112063
+ // "order_id": "123",
112064
+ // "pair": "BTC_USD",
112065
+ // "previous_type": "limit_sell",
112066
+ // "price": "58000",
112067
+ // "quantity": "0.01",
112068
+ // "src": 0,
112069
+ // "stop_price": "0",
112070
+ // "trigger_price": "58000",
112071
+ // "type": "limit_sell",
112072
+ // "updated": 1619068707989411800
112073
+ // }
112074
+ // ]
112075
+ // }
112076
+ //
111772
112077
  params = this.extend(params, {
111773
112078
  'status': 'open',
111774
112079
  });
111775
- const parsedOrders = this.parseOrders(response[marketId], market, since, limit, params);
111776
- orders = this.arrayConcat(orders, parsedOrders);
112080
+ const responseOrders = this.safeValue(response, 'orders');
112081
+ orders = this.parseOrders(responseOrders, market, since, limit, params);
111777
112082
  }
111778
- return this.filterBySymbolSinceLimit(orders, symbol, since, limit);
112083
+ else {
112084
+ response = await this.privatePostUserOpenOrders(params);
112085
+ //
112086
+ // {
112087
+ // "USDT_USD": [
112088
+ // {
112089
+ // "parent_order_id": "507061384740151010",
112090
+ // "client_id": "100500",
112091
+ // "created": "1589547391",
112092
+ // "type": "stop_market_buy",
112093
+ // "pair": "USDT_USD",
112094
+ // "quantity": "1",
112095
+ // "trigger_price": "5",
112096
+ // "amount": "5"
112097
+ // }
112098
+ // ],
112099
+ // ...
112100
+ // }
112101
+ //
112102
+ const marketIds = Object.keys(response);
112103
+ for (let i = 0; i < marketIds.length; i++) {
112104
+ const marketId = marketIds[i];
112105
+ const marketInner = this.safeMarket(marketId);
112106
+ params = this.extend(params, {
112107
+ 'status': 'open',
112108
+ });
112109
+ const parsedOrders = this.parseOrders(response[marketId], marketInner, since, limit, params);
112110
+ orders = this.arrayConcat(orders, parsedOrders);
112111
+ }
112112
+ }
112113
+ return orders;
112114
+ }
112115
+ parseStatus(status) {
112116
+ if (status === undefined) {
112117
+ return undefined;
112118
+ }
112119
+ const statuses = {
112120
+ 'cancel_started': 'canceled',
112121
+ };
112122
+ if (status.indexOf('cancel') >= 0) {
112123
+ status = 'canceled';
112124
+ }
112125
+ return this.safeString(statuses, status, status);
112126
+ }
112127
+ parseSide(orderType) {
112128
+ const side = {
112129
+ 'limit_buy': 'buy',
112130
+ 'limit_sell': 'sell',
112131
+ 'market_buy': 'buy',
112132
+ 'market_sell': 'sell',
112133
+ 'stop_buy': 'buy',
112134
+ 'stop_sell': 'sell',
112135
+ 'stop_limit_buy': 'buy',
112136
+ 'stop_limit_sell': 'sell',
112137
+ 'trailing_stop_buy': 'buy',
112138
+ 'trailing_stop_sell': 'sell',
112139
+ 'stop_market_sell': 'sell',
112140
+ 'stop_market_buy': 'buy',
112141
+ 'buy': 'buy',
112142
+ 'sell': 'sell',
112143
+ };
112144
+ return this.safeString(side, orderType, orderType);
111779
112145
  }
111780
112146
  parseOrder(order, market = undefined) {
111781
112147
  //
@@ -111813,9 +112179,55 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
111813
112179
  // ]
111814
112180
  // }
111815
112181
  //
111816
- const id = this.safeString(order, 'order_id');
111817
- const timestamp = this.safeTimestamp(order, 'created');
111818
- const side = this.safeString(order, 'type');
112182
+ // Margin fetchOpenOrders
112183
+ //
112184
+ // {
112185
+ // "client_id": "0",
112186
+ // "comment": "",
112187
+ // "created": "1619068707985325495",
112188
+ // "distance": "0",
112189
+ // "expire": 0,
112190
+ // "funding_currency": "BTC",
112191
+ // "funding_quantity": "0.01",
112192
+ // "funding_rate": "0.02",
112193
+ // "leverage": "2",
112194
+ // "order_id": "123",
112195
+ // "pair": "BTC_USD",
112196
+ // "previous_type": "limit_sell",
112197
+ // "price": "58000",
112198
+ // "quantity": "0.01",
112199
+ // "src": 0,
112200
+ // "stop_price": "0",
112201
+ // "trigger_price": "58000",
112202
+ // "type": "limit_sell",
112203
+ // "updated": 1619068707989411800
112204
+ // }
112205
+ //
112206
+ // Margin fetchClosedOrders
112207
+ //
112208
+ // {
112209
+ // "distance": "0",
112210
+ // "event_id": "692842802860022508",
112211
+ // "event_time": "1619069531190173720",
112212
+ // "event_type": "OrderCancelStarted",
112213
+ // "order_id": "123",
112214
+ // "order_status": "cancel_started",
112215
+ // "order_type": "limit_sell",
112216
+ // "pair": "BTC_USD",
112217
+ // "price": "54115",
112218
+ // "quantity": "0.001",
112219
+ // "stop_price": "0",
112220
+ // "trade_id": "0",
112221
+ // "trade_price": "0",
112222
+ // "trade_quantity": "0",
112223
+ // "trade_type": ""
112224
+ // },
112225
+ //
112226
+ const id = this.safeString2(order, 'order_id', 'parent_order_id');
112227
+ const eventTime = this.safeIntegerProduct2(order, 'event_time', 'created', 0.000001);
112228
+ const timestamp = this.safeTimestamp(order, 'created', eventTime);
112229
+ const orderType = this.safeString2(order, 'type', 'order_type');
112230
+ const side = this.parseSide(orderType);
111819
112231
  let marketId = undefined;
111820
112232
  if ('pair' in order) {
111821
112233
  marketId = order['pair'];
@@ -111839,21 +112251,29 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
111839
112251
  const cost = this.safeString(order, 'amount');
111840
112252
  const transactions = this.safeValue(order, 'trades', []);
111841
112253
  const clientOrderId = this.safeInteger(order, 'client_id');
112254
+ let triggerPrice = this.safeString(order, 'stop_price');
112255
+ if (triggerPrice === '0') {
112256
+ triggerPrice = undefined;
112257
+ }
112258
+ let type = undefined;
112259
+ if ((orderType !== 'buy') && (orderType !== 'sell')) {
112260
+ type = orderType;
112261
+ }
111842
112262
  return this.safeOrder({
111843
112263
  'id': id,
111844
112264
  'clientOrderId': clientOrderId,
111845
112265
  'datetime': this.iso8601(timestamp),
111846
112266
  'timestamp': timestamp,
111847
- 'lastTradeTimestamp': undefined,
111848
- 'status': undefined,
112267
+ 'lastTradeTimestamp': this.safeIntegerProduct(order, 'updated', 0.000001),
112268
+ 'status': this.parseStatus(this.safeString(order, 'order_status')),
111849
112269
  'symbol': symbol,
111850
- 'type': undefined,
112270
+ 'type': type,
111851
112271
  'timeInForce': undefined,
111852
112272
  'postOnly': undefined,
111853
112273
  'side': side,
111854
112274
  'price': price,
111855
- 'stopPrice': undefined,
111856
- 'triggerPrice': undefined,
112275
+ 'stopPrice': triggerPrice,
112276
+ 'triggerPrice': triggerPrice,
111857
112277
  'cost': cost,
111858
112278
  'amount': amount,
111859
112279
  'filled': undefined,
@@ -111869,41 +112289,143 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
111869
112289
  * @method
111870
112290
  * @name exmo#fetchCanceledOrders
111871
112291
  * @description fetches information on multiple canceled orders made by the user
112292
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#1d2524dd-ae6d-403a-a067-77b50d13fbe5 // margin
112293
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#a51be1d0-af5f-44e4-99d7-f7b04c6067d0 // spot canceled orders
111872
112294
  * @param {string} symbol unified market symbol of the market orders were made in
111873
112295
  * @param {int} [since] timestamp in ms of the earliest order, default is undefined
111874
112296
  * @param {int} [limit] max number of orders to return, default is undefined
111875
112297
  * @param {object} [params] extra parameters specific to the exmo api endpoint
112298
+ * @param {string} [params.marginMode] set to "isolated" for margin orders
111876
112299
  * @returns {object} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
111877
112300
  */
111878
112301
  await this.loadMarkets();
111879
- const request = {};
111880
- if (since !== undefined) {
111881
- request['offset'] = limit;
112302
+ let marginMode = undefined;
112303
+ [marginMode, params] = this.handleMarginModeAndParams('fetchOrders', params);
112304
+ if (marginMode === 'cross') {
112305
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' only supports isolated margin');
111882
112306
  }
111883
- if (limit !== undefined) {
111884
- request['limit'] = limit;
112307
+ if (limit === undefined) {
112308
+ limit = 100;
112309
+ }
112310
+ const isSpot = (marginMode !== 'isolated');
112311
+ if (symbol !== undefined) {
112312
+ const marketInner = this.market(symbol);
112313
+ symbol = marketInner['symbol'];
111885
112314
  }
112315
+ const request = {
112316
+ 'limit': limit,
112317
+ };
112318
+ request['offset'] = (since !== undefined) ? limit : 0;
112319
+ request['limit'] = limit;
111886
112320
  let market = undefined;
111887
112321
  if (symbol !== undefined) {
111888
112322
  market = this.market(symbol);
111889
112323
  }
111890
- const response = await this.privatePostUserCancelledOrders(this.extend(request, params));
111891
- //
111892
- // [{
111893
- // "order_id": "27056153840",
111894
- // "client_id": "0",
111895
- // "created": "1653428646",
111896
- // "type": "buy",
111897
- // "pair": "BTC_USDT",
111898
- // "quantity": "0.1",
111899
- // "price": "10",
111900
- // "amount": "1"
111901
- // }]
111902
- //
111903
- params = this.extend(params, {
111904
- 'status': 'canceled',
111905
- });
111906
- return this.parseOrders(response, market, since, limit, params);
112324
+ let response = undefined;
112325
+ if (isSpot) {
112326
+ response = await this.privatePostUserCancelledOrders(this.extend(request, params));
112327
+ //
112328
+ // [
112329
+ // {
112330
+ // "order_id": "27056153840",
112331
+ // "client_id": "0",
112332
+ // "created": "1653428646",
112333
+ // "type": "buy",
112334
+ // "pair": "BTC_USDT",
112335
+ // "quantity": "0.1",
112336
+ // "price": "10",
112337
+ // "amount": "1"
112338
+ // }
112339
+ // ]
112340
+ //
112341
+ params = this.extend(params, {
112342
+ 'status': 'canceled',
112343
+ });
112344
+ return this.parseOrders(response, market, since, limit, params);
112345
+ }
112346
+ else {
112347
+ const responseSwap = await this.privatePostMarginUserOrderHistory(this.extend(request, params));
112348
+ //
112349
+ // {
112350
+ // "items": [
112351
+ // {
112352
+ // "event_id": "692862104574106858",
112353
+ // "event_time": "1694116400173489405",
112354
+ // "event_type": "OrderCancelStarted",
112355
+ // "order_id": "692862104561289319",
112356
+ // "order_type": "stop_limit_sell",
112357
+ // "order_status": "cancel_started",
112358
+ // "trade_id": "0",
112359
+ // "trade_type":"",
112360
+ // "trade_quantity": "0",
112361
+ // "trade_price": "0",
112362
+ // "pair": "ADA_USDT",
112363
+ // "quantity": "12",
112364
+ // "price": "0.23",
112365
+ // "stop_price": "0.22",
112366
+ // "distance": "0"
112367
+ // }
112368
+ // ...
112369
+ // ]
112370
+ // }
112371
+ //
112372
+ const items = this.safeValue(responseSwap, 'items');
112373
+ const orders = this.parseOrders(items, market, since, limit, params);
112374
+ const result = [];
112375
+ for (let i = 0; i < orders.length; i++) {
112376
+ const order = orders[i];
112377
+ if (order['status'] === 'canceled') {
112378
+ result.push(order);
112379
+ }
112380
+ }
112381
+ return result;
112382
+ }
112383
+ }
112384
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
112385
+ /**
112386
+ * @method
112387
+ * @name exmo#editOrder
112388
+ * @description *margin only* edit a trade order
112389
+ * @see https://documenter.getpostman.com/view/10287440/SzYXWKPi#f27ee040-c75f-4b59-b608-d05bd45b7899 // margin
112390
+ * @param {string} id order id
112391
+ * @param {string} symbol unified CCXT market symbol
112392
+ * @param {string} type not used by exmo editOrder
112393
+ * @param {string} side not used by exmo editOrder
112394
+ * @param {float} [amount] how much of the currency you want to trade in units of the base currency
112395
+ * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
112396
+ * @param {object} [params] extra parameters specific to the exmo api endpoint
112397
+ * @param {float} [params.triggerPrice] stop price for stop-market and stop-limit orders
112398
+ * @param {string} params.marginMode must be set to isolated
112399
+ *
112400
+ * EXCHANGE SPECIFIC PARAMETERS
112401
+ * @param {int} [params.distance] distance for trailing stop orders
112402
+ * @param {int} [params.expire] expiration timestamp in UTC timezone for the order. order will not be expired if expire is 0
112403
+ * @param {string} [params.comment] optional comment for order. up to 50 latin symbols, whitespaces, underscores
112404
+ * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
112405
+ */
112406
+ await this.loadMarkets();
112407
+ const market = this.market(symbol);
112408
+ let marginMode = undefined;
112409
+ [marginMode, params] = this.handleMarginModeAndParams('editOrder', params);
112410
+ if (marginMode !== 'isolated') {
112411
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' editOrder() can only be used for isolated margin orders');
112412
+ }
112413
+ const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
112414
+ params = this.omit(params, ['triggerPrice', 'stopPrice']);
112415
+ const request = {
112416
+ 'order_id': id, // id of the open order
112417
+ };
112418
+ if (amount !== undefined) {
112419
+ request['quantity'] = amount;
112420
+ }
112421
+ if (price !== undefined) {
112422
+ request['price'] = this.priceToPrecision(market['symbol'], price);
112423
+ }
112424
+ if (triggerPrice !== undefined) {
112425
+ request['stop_price'] = this.priceToPrecision(market['symbol'], triggerPrice);
112426
+ }
112427
+ const response = await this.privatePostMarginUserOrderUpdate(this.extend(request, params));
112428
+ return this.parseOrder(response);
111907
112429
  }
111908
112430
  async fetchDepositAddress(code, params = {}) {
111909
112431
  /**
@@ -112420,11 +112942,12 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
112420
112942
  if (response === undefined) {
112421
112943
  return undefined; // fallback to default error handler
112422
112944
  }
112423
- if ('error' in response) {
112945
+ if (('error' in response) && !('result' in response)) {
112424
112946
  // error: {
112425
112947
  // code: '140434',
112426
112948
  // msg: "Your margin balance is not sufficient to place the order for '5 TON'. Please top up your margin wallet by '2.5 USDT'."
112427
112949
  // }
112950
+ //
112428
112951
  const errorCode = this.safeValue(response, 'error', {});
112429
112952
  const messageError = this.safeString(errorCode, 'msg');
112430
112953
  const code = this.safeString(errorCode, 'code');
@@ -196711,7 +197234,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
196711
197234
  'watchOrderBookForSymbols': true,
196712
197235
  'watchOrders': true,
196713
197236
  'watchTicker': true,
196714
- 'watchTickers': false,
197237
+ 'watchTickers': true,
196715
197238
  'watchTrades': true,
196716
197239
  'watchTradesForSymbols': true,
196717
197240
  },
@@ -196818,6 +197341,38 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
196818
197341
  };
196819
197342
  return await this.watchPublic(messageHash, args, params);
196820
197343
  }
197344
+ async watchTickers(symbols = undefined, params = {}) {
197345
+ /**
197346
+ * @method
197347
+ * @name bitget#watchTickers
197348
+ * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
197349
+ * @param {string[]} symbols unified symbol of the market to fetch the ticker for
197350
+ * @param {object} [params] extra parameters specific to the bitget api endpoint
197351
+ * @returns {object} a [ticker structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
197352
+ */
197353
+ await this.loadMarkets();
197354
+ symbols = this.marketSymbols(symbols, undefined, false);
197355
+ const market = this.market(symbols[0]);
197356
+ const instType = market['spot'] ? 'sp' : 'mc';
197357
+ const messageHash = 'tickers::' + symbols.join(',');
197358
+ const marketIds = this.marketIds(symbols);
197359
+ const topics = [];
197360
+ for (let i = 0; i < marketIds.length; i++) {
197361
+ const marketId = marketIds[i];
197362
+ const marketInner = this.market(marketId);
197363
+ const args = {
197364
+ 'instType': instType,
197365
+ 'channel': 'ticker',
197366
+ 'instId': this.getWsMarketId(marketInner),
197367
+ };
197368
+ topics.push(args);
197369
+ }
197370
+ const tickers = await this.watchPublicMultiple(messageHash, topics, params);
197371
+ if (this.newUpdates) {
197372
+ return tickers;
197373
+ }
197374
+ return this.filterByArray(this.tickers, 'symbol', symbols);
197375
+ }
196821
197376
  handleTicker(client, message) {
196822
197377
  //
196823
197378
  // {
@@ -196845,6 +197400,17 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
196845
197400
  this.tickers[symbol] = ticker;
196846
197401
  const messageHash = 'ticker:' + symbol;
196847
197402
  client.resolve(ticker, messageHash);
197403
+ // watchTickers part
197404
+ const messageHashes = this.findMessageHashes(client, 'tickers::');
197405
+ for (let i = 0; i < messageHashes.length; i++) {
197406
+ const messageHashTicker = messageHashes[i];
197407
+ const parts = messageHashTicker.split('::');
197408
+ const symbolsString = parts[1];
197409
+ const symbols = symbolsString.split(',');
197410
+ if (this.inArray(symbol, symbols)) {
197411
+ client.resolve(ticker, messageHashTicker);
197412
+ }
197413
+ }
196848
197414
  return message;
196849
197415
  }
196850
197416
  parseWsTicker(message, market = undefined) {
@@ -205626,12 +206192,12 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
205626
206192
  // watchTickers part
205627
206193
  const messageHashes = this.findMessageHashes(client, 'tickers::');
205628
206194
  for (let i = 0; i < messageHashes.length; i++) {
205629
- const messageHash = messageHashes[i];
205630
- const parts = messageHash.split('::');
206195
+ const messageHashTicker = messageHashes[i];
206196
+ const parts = messageHashTicker.split('::');
205631
206197
  const symbolsString = parts[1];
205632
206198
  const symbols = symbolsString.split(',');
205633
206199
  if (this.inArray(parsed['symbol'], symbols)) {
205634
- client.resolve(parsed, messageHash);
206200
+ client.resolve(parsed, messageHashTicker);
205635
206201
  }
205636
206202
  }
205637
206203
  }
@@ -236117,7 +236683,7 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
236117
236683
  return this.deepExtend(super.describe(), {
236118
236684
  'has': {
236119
236685
  'ws': true,
236120
- 'watchBalance': false,
236686
+ 'watchBalance': true,
236121
236687
  'watchMyTrades': false,
236122
236688
  'watchOHLCV': true,
236123
236689
  'watchOrderBook': true,
@@ -236708,6 +237274,73 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
236708
237274
  client.resolve(this.orders, messageHashSymbol);
236709
237275
  }
236710
237276
  }
237277
+ async watchBalance(params = {}) {
237278
+ /**
237279
+ * @method
237280
+ * @see https://docs.woo.org/#balance
237281
+ * @name woo#watchBalance
237282
+ * @description watch balance and get the amount of funds available for trading or funds locked in orders
237283
+ * @param {object} [params] extra parameters specific to the woo api endpoint
237284
+ * @returns {object} a [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
237285
+ */
237286
+ await this.loadMarkets();
237287
+ const topic = 'balance';
237288
+ const messageHash = topic;
237289
+ const request = {
237290
+ 'event': 'subscribe',
237291
+ 'topic': topic,
237292
+ };
237293
+ const message = this.extend(request, params);
237294
+ return await this.watchPrivate(messageHash, message);
237295
+ }
237296
+ handleBalance(client, message) {
237297
+ //
237298
+ // {
237299
+ // "topic": "balance",
237300
+ // "ts": 1695716888789,
237301
+ // "data": {
237302
+ // "balances": {
237303
+ // "USDT": {
237304
+ // "holding": 266.56059176,
237305
+ // "frozen": 0,
237306
+ // "interest": 0,
237307
+ // "pendingShortQty": 0,
237308
+ // "pendingExposure": 0,
237309
+ // "pendingLongQty": 0,
237310
+ // "pendingLongExposure": 0,
237311
+ // "version": 37,
237312
+ // "staked": 0,
237313
+ // "unbonding": 0,
237314
+ // "vault": 0,
237315
+ // "averageOpenPrice": 0,
237316
+ // "pnl24H": 0,
237317
+ // "fee24H": 0,
237318
+ // "markPrice": 1,
237319
+ // "pnl24HPercentage": 0
237320
+ // }
237321
+ // }
237322
+ //
237323
+ // }
237324
+ //
237325
+ const data = this.safeValue(message, 'data');
237326
+ const balances = this.safeValue(data, 'balances');
237327
+ const keys = Object.keys(balances);
237328
+ const ts = this.safeInteger(message, 'ts');
237329
+ this.balance['info'] = data;
237330
+ this.balance['timestamp'] = ts;
237331
+ this.balance['datetime'] = this.iso8601(ts);
237332
+ for (let i = 0; i < keys.length; i++) {
237333
+ const key = keys[i];
237334
+ const value = balances[key];
237335
+ const code = this.safeCurrencyCode(key);
237336
+ const account = (code in this.balance) ? this.balance[code] : this.account();
237337
+ account['total'] = this.safeString(value, 'holding');
237338
+ account['used'] = this.safeString(value, 'frozen');
237339
+ this.balance[code] = account;
237340
+ }
237341
+ this.balance = this.safeBalance(this.balance);
237342
+ client.resolve(this.balance, 'balance');
237343
+ }
236711
237344
  handleMessage(client, message) {
236712
237345
  const methods = {
236713
237346
  'ping': this.handlePing,
@@ -236720,6 +237353,7 @@ class woo extends _woo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
236720
237353
  'auth': this.handleAuth,
236721
237354
  'executionreport': this.handleOrderUpdate,
236722
237355
  'trade': this.handleTrade,
237356
+ 'balance': this.handleBalance,
236723
237357
  };
236724
237358
  const event = this.safeString(message, 'event');
236725
237359
  let method = this.safeValue(methods, event);
@@ -272543,7 +273177,7 @@ SOFTWARE.
272543
273177
 
272544
273178
  //-----------------------------------------------------------------------------
272545
273179
  // this is updated by vss.js when building
272546
- const version = '4.0.106';
273180
+ const version = '4.0.108';
272547
273181
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
272548
273182
  //-----------------------------------------------------------------------------
272549
273183