ccxt 4.0.81 → 4.0.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +167 -84
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +0 -1
  6. package/dist/cjs/src/bigone.js +1 -1
  7. package/dist/cjs/src/binance.js +2 -1
  8. package/dist/cjs/src/bitfinex2.js +2 -1
  9. package/dist/cjs/src/bitmart.js +9 -6
  10. package/dist/cjs/src/bittrex.js +14 -1
  11. package/dist/cjs/src/bybit.js +68 -53
  12. package/dist/cjs/src/exmo.js +41 -3
  13. package/dist/cjs/src/gate.js +1 -5
  14. package/dist/cjs/src/kucoin.js +7 -2
  15. package/dist/cjs/src/latoken.js +8 -4
  16. package/dist/cjs/src/lykke.js +2 -1
  17. package/dist/cjs/src/ndax.js +6 -1
  18. package/dist/cjs/src/pro/gate.js +5 -2
  19. package/dist/cjs/src/yobit.js +0 -1
  20. package/js/ccxt.d.ts +1 -1
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/binance.d.ts +1 -0
  23. package/js/src/abstract/binancecoinm.d.ts +1 -0
  24. package/js/src/abstract/binanceus.d.ts +1 -0
  25. package/js/src/abstract/binanceusdm.d.ts +1 -0
  26. package/js/src/base/Exchange.d.ts +0 -1
  27. package/js/src/base/Exchange.js +0 -1
  28. package/js/src/bigone.js +1 -1
  29. package/js/src/binance.js +2 -1
  30. package/js/src/bitfinex2.js +2 -1
  31. package/js/src/bitmart.js +9 -6
  32. package/js/src/bittrex.js +14 -1
  33. package/js/src/bybit.js +68 -53
  34. package/js/src/exmo.js +41 -3
  35. package/js/src/gate.js +1 -5
  36. package/js/src/kucoin.js +7 -2
  37. package/js/src/latoken.js +8 -4
  38. package/js/src/lykke.js +2 -1
  39. package/js/src/ndax.js +6 -1
  40. package/js/src/pro/gate.js +5 -2
  41. package/js/src/yobit.js +0 -1
  42. package/package.json +1 -1
package/README.md CHANGED
@@ -215,13 +215,13 @@ console.log(version, Object.keys(exchanges));
215
215
 
216
216
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
217
217
 
218
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.81/dist/ccxt.browser.js
219
- * unpkg: https://unpkg.com/ccxt@4.0.81/dist/ccxt.browser.js
218
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.83/dist/ccxt.browser.js
219
+ * unpkg: https://unpkg.com/ccxt@4.0.83/dist/ccxt.browser.js
220
220
 
221
221
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
222
222
 
223
223
  ```HTML
224
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.81/dist/ccxt.browser.js"></script>
224
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.83/dist/ccxt.browser.js"></script>
225
225
  ```
226
226
 
227
227
  Creates a global `ccxt` object:
@@ -7039,7 +7039,6 @@ class Exchange {
7039
7039
  'commonCurrencies': {
7040
7040
  'XBT': 'BTC',
7041
7041
  'BCC': 'BCH',
7042
- 'BCHABC': 'BCH',
7043
7042
  'BCHSV': 'BSV',
7044
7043
  },
7045
7044
  'precisionMode': DECIMAL_PLACES,
@@ -14088,7 +14087,6 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
14088
14087
  networks[networkCode] = {
14089
14088
  'id': networkId,
14090
14089
  'network': networkCode,
14091
- 'type': type,
14092
14090
  'margin': undefined,
14093
14091
  'deposit': deposit,
14094
14092
  'withdraw': withdraw,
@@ -14117,6 +14115,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
14117
14115
  'code': code,
14118
14116
  'info': currency,
14119
14117
  'name': name,
14118
+ 'type': type,
14120
14119
  'active': undefined,
14121
14120
  'deposit': currencyDepositEnabled,
14122
14121
  'withdraw': currencyWithdrawEnabled,
@@ -15783,6 +15782,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
15783
15782
  'margin/exchange-small-liability': 0.6667,
15784
15783
  'margin/exchange-small-liability-history': 0.6667,
15785
15784
  'margin/next-hourly-interest-rate': 0.6667,
15785
+ 'margin/capital-flow': 10,
15786
15786
  'margin/delist-schedule': 0.6667,
15787
15787
  'loan/vip/loanable/data': 40,
15788
15788
  'loan/vip/collateral/data': 40,
@@ -15819,7 +15819,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
15819
15819
  'capital/deposit/hisrec': 0.1,
15820
15820
  'capital/deposit/subAddress': 0.1,
15821
15821
  'capital/deposit/subHisrec': 0.1,
15822
- 'capital/withdraw/history': 0.1,
15822
+ 'capital/withdraw/history': 1800,
15823
15823
  'capital/contract/convertible-coins': 4.0002,
15824
15824
  'convert/tradeFlow': 20.001,
15825
15825
  'convert/exchangeInfo': 50,
@@ -33041,7 +33041,8 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
33041
33041
  const label = this.safeValue(indexed['label'], id, []);
33042
33042
  const name = this.safeString(label, 1);
33043
33043
  const pool = this.safeValue(indexed['pool'], id, []);
33044
- const type = this.safeString(pool, 1);
33044
+ const rawType = this.safeString(pool, 1);
33045
+ const type = (rawType === undefined) ? 'other' : 'crypto';
33045
33046
  const feeValues = this.safeValue(indexed['fees'], id, []);
33046
33047
  const fees = this.safeValue(feeValues, 1, []);
33047
33048
  const fee = this.safeNumber(fees, 1);
@@ -44742,11 +44743,13 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
44742
44743
  request[fromRequest] = start;
44743
44744
  request[toRequest] = Math.min(end, now);
44744
44745
  }
44745
- let method = 'publicGetSpotV1SymbolsKline';
44746
+ let response = undefined;
44746
44747
  if (type === 'swap') {
44747
- method = 'publicGetContractPublicKline';
44748
+ response = await this.publicGetContractPublicKline(this.extend(request, params));
44749
+ }
44750
+ else {
44751
+ response = await this.publicGetSpotQuotationV3Klines(this.extend(request, params));
44748
44752
  }
44749
- const response = await this[method](this.extend(request, params));
44750
44753
  //
44751
44754
  // spot
44752
44755
  //
@@ -44783,8 +44786,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
44783
44786
  // }
44784
44787
  //
44785
44788
  const data = this.safeValue(response, 'data', {});
44786
- const klines = this.safeValue(data, 'klines', []);
44787
- const ohlcv = (type === 'spot') ? klines : data;
44789
+ const ohlcv = this.safeValue(data, 'klines', data);
44788
44790
  return this.parseOHLCVs(ohlcv, market, timeframe, since, limit);
44789
44791
  }
44790
44792
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -46485,8 +46487,10 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46485
46487
  // {"errno":"OK","message":"INVALID_PARAMETER","code":49998,"trace":"eb5ebb54-23cd-4de2-9064-e090b6c3b2e3","data":null}
46486
46488
  //
46487
46489
  const message = this.safeStringLower(response, 'message');
46490
+ const isErrorMessage = (message !== undefined) && (message !== 'ok') && (message !== 'success');
46488
46491
  const errorCode = this.safeString(response, 'code');
46489
- if (((errorCode !== undefined) && (errorCode !== '1000')) || ((message !== undefined) && (message !== 'ok'))) {
46492
+ const isErrorCode = (errorCode !== undefined) && (errorCode !== '1000');
46493
+ if (isErrorCode || isErrorMessage) {
46490
46494
  const feedback = this.id + ' ' + body;
46491
46495
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
46492
46496
  this.throwBroadlyMatchedException(this.exceptions['broad'], errorCode, feedback);
@@ -59759,11 +59763,24 @@ class bittrex extends _abstract_bittrex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
59759
59763
  const precision = this.parseNumber('1e-8'); // default precision, seems exchange has same amount-precision across all pairs in UI too. todo: fix "magic constants"
59760
59764
  const fee = this.safeNumber(currency, 'txFee'); // todo: redesign
59761
59765
  const isActive = this.safeString(currency, 'status');
59766
+ const coinType = this.safeString(currency, 'coinType');
59767
+ let type = undefined;
59768
+ if (coinType === 'FIAT') {
59769
+ type = 'fiat';
59770
+ }
59771
+ else if (coinType === 'Award') {
59772
+ // these are exchange credits
59773
+ type = 'other';
59774
+ }
59775
+ else {
59776
+ // all others are cryptos
59777
+ type = 'crypto';
59778
+ }
59762
59779
  result[code] = {
59763
59780
  'id': id,
59764
59781
  'code': code,
59765
59782
  'info': currency,
59766
- 'type': this.safeString(currency, 'coinType'),
59783
+ 'type': type,
59767
59784
  'name': this.safeString(currency, 'name'),
59768
59785
  'active': (isActive === 'ONLINE'),
59769
59786
  'deposit': undefined,
@@ -75254,11 +75271,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75254
75271
  else if (timeInForce === 'ioc') {
75255
75272
  request['timeInForce'] = 'IOC';
75256
75273
  }
75257
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75258
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
75259
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75260
- const stopLoss = this.safeNumber(params, 'stopLoss');
75261
- const takeProfit = this.safeNumber(params, 'takeProfit');
75274
+ let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
75275
+ const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
75276
+ const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
75277
+ const stopLoss = this.safeValue(params, 'stopLoss');
75278
+ const takeProfit = this.safeValue(params, 'takeProfit');
75262
75279
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75263
75280
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75264
75281
  const isStopLoss = stopLoss !== undefined;
@@ -75277,15 +75294,20 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75277
75294
  }
75278
75295
  else if (isStopLoss || isTakeProfit) {
75279
75296
  if (isStopLoss) {
75280
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75297
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75298
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75281
75299
  }
75282
75300
  if (isTakeProfit) {
75283
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75301
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75302
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75284
75303
  }
75285
75304
  }
75286
75305
  if (market['spot']) {
75287
75306
  // only works for spot market
75288
- if (triggerPrice !== undefined || stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
75307
+ if (triggerPrice !== undefined) {
75308
+ request['orderFilter'] = 'StopOrder';
75309
+ }
75310
+ else if (stopLossTriggerPrice !== undefined || takeProfitTriggerPrice !== undefined || isStopLoss || isTakeProfit) {
75289
75311
  request['orderFilter'] = 'tpslOrder';
75290
75312
  }
75291
75313
  }
@@ -75464,11 +75486,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75464
75486
  else if (timeInForce === 'ioc') {
75465
75487
  request['timeInForce'] = 'ImmediateOrCancel';
75466
75488
  }
75467
- const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
75468
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice', triggerPrice);
75469
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75470
- const stopLoss = this.safeNumber(params, 'stopLoss');
75471
- const takeProfit = this.safeNumber(params, 'takeProfit');
75489
+ const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
75490
+ const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice', triggerPrice);
75491
+ const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
75492
+ const stopLoss = this.safeValue(params, 'stopLoss');
75493
+ const takeProfit = this.safeValue(params, 'takeProfit');
75472
75494
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75473
75495
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75474
75496
  const isStopLoss = stopLoss !== undefined;
@@ -75486,10 +75508,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75486
75508
  }
75487
75509
  else if (isStopLoss || isTakeProfit) {
75488
75510
  if (isStopLoss) {
75489
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75511
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75512
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75490
75513
  }
75491
75514
  if (isTakeProfit) {
75492
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75515
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75516
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75493
75517
  }
75494
75518
  }
75495
75519
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -75569,11 +75593,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75569
75593
  else if (timeInForce === 'ioc') {
75570
75594
  request['timeInForce'] = 'ImmediateOrCancel';
75571
75595
  }
75572
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75573
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice', triggerPrice);
75574
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75575
- const stopLoss = this.safeNumber(params, 'stopLoss');
75576
- const takeProfit = this.safeNumber(params, 'takeProfit');
75596
+ let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
75597
+ const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
75598
+ const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
75599
+ const stopLoss = this.safeValue(params, 'stopLoss');
75600
+ const takeProfit = this.safeValue(params, 'takeProfit');
75577
75601
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75578
75602
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75579
75603
  const isStopLoss = stopLoss !== undefined;
@@ -75592,10 +75616,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75592
75616
  }
75593
75617
  else if (isStopLoss || isTakeProfit) {
75594
75618
  if (isStopLoss) {
75595
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75619
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75620
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75596
75621
  }
75597
75622
  if (isTakeProfit) {
75598
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75623
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75624
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75599
75625
  }
75600
75626
  }
75601
75627
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -75672,11 +75698,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75672
75698
  request['time_in_force'] = 'ImmediateOrCancel';
75673
75699
  }
75674
75700
  if (market['swap']) {
75675
- const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
75676
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice', triggerPrice);
75677
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75678
- const stopLoss = this.safeNumber(params, 'stopLoss');
75679
- const takeProfit = this.safeNumber(params, 'takeProfit');
75701
+ const triggerPrice = this.safeValue2(params, 'stopPrice', 'triggerPrice');
75702
+ const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice', triggerPrice);
75703
+ const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
75704
+ const stopLoss = this.safeValue(params, 'stopLoss');
75705
+ const takeProfit = this.safeValue(params, 'takeProfit');
75680
75706
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75681
75707
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75682
75708
  const isStopLoss = stopLoss !== undefined;
@@ -75693,10 +75719,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75693
75719
  }
75694
75720
  else if (isStopLoss || isTakeProfit) {
75695
75721
  if (isStopLoss) {
75696
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75722
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75723
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75697
75724
  }
75698
75725
  if (isTakeProfit) {
75699
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75726
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75727
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75700
75728
  }
75701
75729
  }
75702
75730
  else {
@@ -75778,11 +75806,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75778
75806
  if (amount !== undefined) {
75779
75807
  request['qty'] = this.amountToPrecision(symbol, amount);
75780
75808
  }
75781
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75782
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
75783
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75784
- const stopLoss = this.safeNumber(params, 'stopLoss');
75785
- const takeProfit = this.safeNumber(params, 'takeProfit');
75809
+ let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
75810
+ const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
75811
+ const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
75812
+ const stopLoss = this.safeValue(params, 'stopLoss');
75813
+ const takeProfit = this.safeValue(params, 'takeProfit');
75786
75814
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75787
75815
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75788
75816
  const isStopLoss = stopLoss !== undefined;
@@ -75795,10 +75823,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75795
75823
  }
75796
75824
  if (isStopLoss || isTakeProfit) {
75797
75825
  if (isStopLoss) {
75798
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75826
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75827
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75799
75828
  }
75800
75829
  if (isTakeProfit) {
75801
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75830
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75831
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75802
75832
  }
75803
75833
  }
75804
75834
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -75879,11 +75909,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75879
75909
  else if (timeInForce === 'ioc') {
75880
75910
  request['timeInForce'] = 'ImmediateOrCancel';
75881
75911
  }
75882
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75883
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
75884
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75885
- const stopLoss = this.safeNumber(params, 'stopLoss');
75886
- const takeProfit = this.safeNumber(params, 'takeProfit');
75912
+ let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
75913
+ const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
75914
+ const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
75915
+ const stopLoss = this.safeValue(params, 'stopLoss');
75916
+ const takeProfit = this.safeValue(params, 'takeProfit');
75887
75917
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75888
75918
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75889
75919
  const isStopLoss = stopLoss !== undefined;
@@ -75896,10 +75926,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75896
75926
  }
75897
75927
  if (isStopLoss || isTakeProfit) {
75898
75928
  if (isStopLoss) {
75899
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75929
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75930
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75900
75931
  }
75901
75932
  if (isTakeProfit) {
75902
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75933
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75934
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75903
75935
  }
75904
75936
  }
75905
75937
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -75941,11 +75973,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75941
75973
  if (amount !== undefined) {
75942
75974
  request['qty'] = this.amountToPrecision(symbol, amount);
75943
75975
  }
75944
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75945
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
75946
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75947
- const stopLoss = this.safeNumber(params, 'stopLoss');
75948
- const takeProfit = this.safeNumber(params, 'takeProfit');
75976
+ let triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
75977
+ const stopLossTriggerPrice = this.safeValue(params, 'stopLossPrice');
75978
+ const takeProfitTriggerPrice = this.safeValue(params, 'takeProfitPrice');
75979
+ const stopLoss = this.safeValue(params, 'stopLoss');
75980
+ const takeProfit = this.safeValue(params, 'takeProfit');
75949
75981
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75950
75982
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75951
75983
  const isStopLoss = stopLoss !== undefined;
@@ -75958,10 +75990,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75958
75990
  }
75959
75991
  if (isStopLoss || isTakeProfit) {
75960
75992
  if (isStopLoss) {
75961
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75993
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75994
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75962
75995
  }
75963
75996
  if (isTakeProfit) {
75964
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75997
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75998
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75965
75999
  }
75966
76000
  }
75967
76001
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -76007,9 +76041,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
76007
76041
  * @param {object} [params] extra parameters specific to the bybit api endpoint
76008
76042
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
76009
76043
  */
76010
- if (symbol === undefined) {
76011
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' editOrder() requires an symbol argument');
76012
- }
76044
+ this.checkRequiredSymbol('editOrder', symbol);
76013
76045
  await this.loadMarkets();
76014
76046
  const market = this.market(symbol);
76015
76047
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
@@ -113875,17 +113907,55 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
113875
113907
  // },
113876
113908
  // }
113877
113909
  //
113910
+ let marginPairsDict = {};
113911
+ if (this.checkRequiredCredentials(false)) {
113912
+ const marginPairs = await this.privatePostMarginPairList(params);
113913
+ //
113914
+ // {
113915
+ // "pairs": [
113916
+ // {
113917
+ // "buy_price": "55978.85",
113918
+ // "default_leverage": "3",
113919
+ // "is_fair_price": true,
113920
+ // "last_trade_price": "55999.23",
113921
+ // "liquidation_fee": "2",
113922
+ // "liquidation_level": "10",
113923
+ // "margin_call_level": "15",
113924
+ // "max_leverage": "3",
113925
+ // "max_order_price": "150000",
113926
+ // "max_order_quantity": "1",
113927
+ // "max_position_quantity": "1",
113928
+ // "max_price_precision": 2,
113929
+ // "min_order_price": "1",
113930
+ // "min_order_quantity": "0.00002",
113931
+ // "name": "BTC_USD",
113932
+ // "position": 1,
113933
+ // "sell_price": "55985.51",
113934
+ // "ticker_updated": "1619019818936107989",
113935
+ // "trade_maker_fee": "0",
113936
+ // "trade_taker_fee": "0.05",
113937
+ // "updated": "1619008608955599013"
113938
+ // }
113939
+ // ]
113940
+ // }
113941
+ //
113942
+ const pairs = this.safeValue(marginPairs, 'pairs');
113943
+ marginPairsDict = this.indexBy(pairs, 'name');
113944
+ }
113878
113945
  const keys = Object.keys(response);
113879
113946
  const result = [];
113880
113947
  for (let i = 0; i < keys.length; i++) {
113881
113948
  const id = keys[i];
113882
113949
  const market = response[id];
113950
+ const marginMarket = this.safeValue(marginPairsDict, id);
113883
113951
  const symbol = id.replace('_', '/');
113884
113952
  const [baseId, quoteId] = symbol.split('/');
113885
113953
  const base = this.safeCurrencyCode(baseId);
113886
113954
  const quote = this.safeCurrencyCode(quoteId);
113887
113955
  const takerString = this.safeString(market, 'commission_taker_percent');
113888
113956
  const makerString = this.safeString(market, 'commission_maker_percent');
113957
+ const maxQuantity = this.safeString(market, 'max_quantity');
113958
+ const marginMaxQuantity = this.safeString(marginMarket, 'max_order_quantity');
113889
113959
  result.push({
113890
113960
  'id': id,
113891
113961
  'symbol': symbol,
@@ -113897,7 +113967,7 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
113897
113967
  'settleId': undefined,
113898
113968
  'type': 'spot',
113899
113969
  'spot': true,
113900
- 'margin': true,
113970
+ 'margin': marginMarket !== undefined,
113901
113971
  'swap': false,
113902
113972
  'future': false,
113903
113973
  'option': false,
@@ -113919,11 +113989,11 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
113919
113989
  'limits': {
113920
113990
  'leverage': {
113921
113991
  'min': undefined,
113922
- 'max': undefined,
113992
+ 'max': this.safeNumber(market, 'leverage'),
113923
113993
  },
113924
113994
  'amount': {
113925
113995
  'min': this.safeNumber(market, 'min_quantity'),
113926
- 'max': this.safeNumber(market, 'max_quantity'),
113996
+ 'max': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMax */ .O.stringMax(maxQuantity, marginMaxQuantity)),
113927
113997
  },
113928
113998
  'price': {
113929
113999
  'min': this.safeNumber(market, 'min_price'),
@@ -119492,7 +119562,6 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
119492
119562
  let remainingString = this.safeString(order, 'left');
119493
119563
  let cost = this.safeString(order, 'filled_total');
119494
119564
  const triggerPrice = this.safeNumber(trigger, 'price');
119495
- let rawStatus = undefined;
119496
119565
  let average = this.safeNumber2(order, 'avg_deal_price', 'fill_price');
119497
119566
  if (triggerPrice) {
119498
119567
  remainingString = amount;
@@ -119502,11 +119571,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
119502
119571
  const isMarketOrder = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringEquals */ .O.stringEquals(price, '0') && (timeInForce === 'IOC');
119503
119572
  type = isMarketOrder ? 'market' : 'limit';
119504
119573
  side = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringGt */ .O.stringGt(amount, '0') ? 'buy' : 'sell';
119505
- rawStatus = this.safeString(order, 'finish_as', 'open');
119506
- }
119507
- else {
119508
- rawStatus = this.safeString(order, 'status');
119509
119574
  }
119575
+ const rawStatus = this.safeStringN(order, ['status', 'finish_as', 'open']);
119510
119576
  let timestamp = this.safeInteger(order, 'create_time_ms');
119511
119577
  if (timestamp === undefined) {
119512
119578
  timestamp = this.safeTimestamp2(order, 'create_time', 'ctime');
@@ -148029,8 +148095,10 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
148029
148095
  const networks = {};
148030
148096
  const chains = this.safeValue(entry, 'chains', []);
148031
148097
  const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
148032
- const precision = this.parseNumber(this.parsePrecision(this.safeString(entry, 'precision')));
148033
- for (let j = 0; j < chains.length; j++) {
148098
+ const rawPrecision = this.safeString(entry, 'precision');
148099
+ const precision = this.parseNumber(this.parsePrecision(rawPrecision));
148100
+ const chainsLength = chains.length;
148101
+ for (let j = 0; j < chainsLength; j++) {
148034
148102
  const chain = chains[j];
148035
148103
  const chainId = this.safeString(chain, 'chain');
148036
148104
  const networkCode = this.networkIdToCode(chainId);
@@ -148071,10 +148139,13 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
148071
148139
  },
148072
148140
  };
148073
148141
  }
148142
+ // kucoin has determined 'fiat' currencies with below logic
148143
+ const isFiat = (rawPrecision === '2') && (chainsLength === 0);
148074
148144
  result[code] = {
148075
148145
  'id': id,
148076
148146
  'name': name,
148077
148147
  'code': code,
148148
+ 'type': isFiat ? 'fiat' : 'crypto',
148078
148149
  'precision': precision,
148079
148150
  'info': entry,
148080
148151
  'active': (isDepositEnabled || isWithdrawEnabled),
@@ -154823,10 +154894,14 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
154823
154894
  const code = this.safeCurrencyCode(tag);
154824
154895
  const fee = this.safeNumber(currency, 'fee');
154825
154896
  const currencyType = this.safeString(currency, 'type');
154826
- const parts = currencyType.split('_');
154827
- const numParts = parts.length;
154828
- const lastPart = this.safeValue(parts, numParts - 1);
154829
- const type = lastPart.toLowerCase();
154897
+ let type = undefined;
154898
+ if (currencyType === 'CURRENCY_TYPE_ALTERNATIVE') {
154899
+ type = 'other';
154900
+ }
154901
+ else {
154902
+ // CURRENCY_TYPE_CRYPTO and CURRENCY_TYPE_IEO are all cryptos
154903
+ type = 'crypto';
154904
+ }
154830
154905
  const status = this.safeString(currency, 'status');
154831
154906
  const active = (status === 'CURRENCY_STATUS_ACTIVE');
154832
154907
  const name = this.safeString(currency, 'name');
@@ -160957,7 +161032,8 @@ class lykke extends _abstract_lykke_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
160957
161032
  const id = this.safeString(currency, 'assetId');
160958
161033
  const code = this.safeString(currency, 'symbol');
160959
161034
  const name = this.safeString(currency, 'name');
160960
- const type = this.safeString(currency, 'type');
161035
+ const rawType = this.safeString(currency, 'type');
161036
+ const type = (rawType === 'erc20Token') ? 'crypto' : 'other';
160961
161037
  const deposit = this.safeValue(currency, 'blockchainDepositEnabled');
160962
161038
  const withdraw = this.safeValue(currency, 'blockchainWithdrawal');
160963
161039
  const isDisabled = this.safeValue(currency, 'isDisabled');
@@ -168609,7 +168685,12 @@ class ndax extends _abstract_ndax_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
168609
168685
  const currency = response[i];
168610
168686
  const id = this.safeString(currency, 'ProductId');
168611
168687
  const name = this.safeString(currency, 'ProductFullName');
168612
- const type = this.safeString(currency, 'ProductType');
168688
+ const ProductType = this.safeString(currency, 'ProductType');
168689
+ let type = (ProductType === 'NationalCurrency') ? 'fiat' : 'crypto';
168690
+ if (ProductType === 'Unknown') {
168691
+ // such currency is just a blanket entry
168692
+ type = 'other';
168693
+ }
168613
168694
  const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
168614
168695
  const isDisabled = this.safeValue(currency, 'IsDisabled');
168615
168696
  const active = !isDisabled;
@@ -216644,8 +216725,11 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
216644
216725
  parsed['status'] = 'open';
216645
216726
  }
216646
216727
  else if (event === 'finish') {
216647
- const left = this.safeNumber(info, 'left');
216648
- parsed['status'] = (left === 0) ? 'closed' : 'canceled';
216728
+ const status = this.safeString(parsed, 'status');
216729
+ if (status === undefined) {
216730
+ const left = this.safeNumber(info, 'left');
216731
+ parsed['status'] = (left === 0) ? 'closed' : 'canceled';
216732
+ }
216649
216733
  }
216650
216734
  stored.append(parsed);
216651
216735
  const symbol = parsed['symbol'];
@@ -264240,7 +264324,6 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
264240
264324
  'PAC': '$PAC',
264241
264325
  'PLAY': 'PlayCoin',
264242
264326
  'PIVX': 'Darknet',
264243
- 'PRS': 'PRE',
264244
264327
  'PURE': 'PurePOS',
264245
264328
  'PUTIN': 'PutinCoin',
264246
264329
  'SPACE': 'Spacecoin',
@@ -273559,7 +273642,7 @@ SOFTWARE.
273559
273642
 
273560
273643
  //-----------------------------------------------------------------------------
273561
273644
  // this is updated by vss.js when building
273562
- const version = '4.0.81';
273645
+ const version = '4.0.83';
273563
273646
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
273564
273647
  //-----------------------------------------------------------------------------
273565
273648