ccxt 4.0.82 → 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.
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.82/dist/ccxt.browser.js
219
- * unpkg: https://unpkg.com/ccxt@4.0.82/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.82/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,
@@ -15820,7 +15819,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
15820
15819
  'capital/deposit/hisrec': 0.1,
15821
15820
  'capital/deposit/subAddress': 0.1,
15822
15821
  'capital/deposit/subHisrec': 0.1,
15823
- 'capital/withdraw/history': 0.1,
15822
+ 'capital/withdraw/history': 1800,
15824
15823
  'capital/contract/convertible-coins': 4.0002,
15825
15824
  'convert/tradeFlow': 20.001,
15826
15825
  'convert/exchangeInfo': 50,
@@ -33042,7 +33041,8 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
33042
33041
  const label = this.safeValue(indexed['label'], id, []);
33043
33042
  const name = this.safeString(label, 1);
33044
33043
  const pool = this.safeValue(indexed['pool'], id, []);
33045
- const type = this.safeString(pool, 1);
33044
+ const rawType = this.safeString(pool, 1);
33045
+ const type = (rawType === undefined) ? 'other' : 'crypto';
33046
33046
  const feeValues = this.safeValue(indexed['fees'], id, []);
33047
33047
  const fees = this.safeValue(feeValues, 1, []);
33048
33048
  const fee = this.safeNumber(fees, 1);
@@ -44743,11 +44743,13 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
44743
44743
  request[fromRequest] = start;
44744
44744
  request[toRequest] = Math.min(end, now);
44745
44745
  }
44746
- let method = 'publicGetSpotV1SymbolsKline';
44746
+ let response = undefined;
44747
44747
  if (type === 'swap') {
44748
- method = 'publicGetContractPublicKline';
44748
+ response = await this.publicGetContractPublicKline(this.extend(request, params));
44749
+ }
44750
+ else {
44751
+ response = await this.publicGetSpotQuotationV3Klines(this.extend(request, params));
44749
44752
  }
44750
- const response = await this[method](this.extend(request, params));
44751
44753
  //
44752
44754
  // spot
44753
44755
  //
@@ -44784,8 +44786,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
44784
44786
  // }
44785
44787
  //
44786
44788
  const data = this.safeValue(response, 'data', {});
44787
- const klines = this.safeValue(data, 'klines', []);
44788
- const ohlcv = (type === 'spot') ? klines : data;
44789
+ const ohlcv = this.safeValue(data, 'klines', data);
44789
44790
  return this.parseOHLCVs(ohlcv, market, timeframe, since, limit);
44790
44791
  }
44791
44792
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -46486,8 +46487,10 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46486
46487
  // {"errno":"OK","message":"INVALID_PARAMETER","code":49998,"trace":"eb5ebb54-23cd-4de2-9064-e090b6c3b2e3","data":null}
46487
46488
  //
46488
46489
  const message = this.safeStringLower(response, 'message');
46490
+ const isErrorMessage = (message !== undefined) && (message !== 'ok') && (message !== 'success');
46489
46491
  const errorCode = this.safeString(response, 'code');
46490
- if (((errorCode !== undefined) && (errorCode !== '1000')) || ((message !== undefined) && (message !== 'ok'))) {
46492
+ const isErrorCode = (errorCode !== undefined) && (errorCode !== '1000');
46493
+ if (isErrorCode || isErrorMessage) {
46491
46494
  const feedback = this.id + ' ' + body;
46492
46495
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
46493
46496
  this.throwBroadlyMatchedException(this.exceptions['broad'], errorCode, feedback);
@@ -59760,11 +59763,24 @@ class bittrex extends _abstract_bittrex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
59760
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"
59761
59764
  const fee = this.safeNumber(currency, 'txFee'); // todo: redesign
59762
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
+ }
59763
59779
  result[code] = {
59764
59780
  'id': id,
59765
59781
  'code': code,
59766
59782
  'info': currency,
59767
- 'type': this.safeString(currency, 'coinType'),
59783
+ 'type': type,
59768
59784
  'name': this.safeString(currency, 'name'),
59769
59785
  'active': (isActive === 'ONLINE'),
59770
59786
  'deposit': undefined,
@@ -75255,11 +75271,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75255
75271
  else if (timeInForce === 'ioc') {
75256
75272
  request['timeInForce'] = 'IOC';
75257
75273
  }
75258
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75259
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
75260
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75261
- const stopLoss = this.safeNumber(params, 'stopLoss');
75262
- 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');
75263
75279
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75264
75280
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75265
75281
  const isStopLoss = stopLoss !== undefined;
@@ -75278,15 +75294,20 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75278
75294
  }
75279
75295
  else if (isStopLoss || isTakeProfit) {
75280
75296
  if (isStopLoss) {
75281
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75297
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75298
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75282
75299
  }
75283
75300
  if (isTakeProfit) {
75284
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75301
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75302
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75285
75303
  }
75286
75304
  }
75287
75305
  if (market['spot']) {
75288
75306
  // only works for spot market
75289
- 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) {
75290
75311
  request['orderFilter'] = 'tpslOrder';
75291
75312
  }
75292
75313
  }
@@ -75465,11 +75486,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75465
75486
  else if (timeInForce === 'ioc') {
75466
75487
  request['timeInForce'] = 'ImmediateOrCancel';
75467
75488
  }
75468
- const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
75469
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice', triggerPrice);
75470
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75471
- const stopLoss = this.safeNumber(params, 'stopLoss');
75472
- 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');
75473
75494
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75474
75495
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75475
75496
  const isStopLoss = stopLoss !== undefined;
@@ -75487,10 +75508,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75487
75508
  }
75488
75509
  else if (isStopLoss || isTakeProfit) {
75489
75510
  if (isStopLoss) {
75490
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75511
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75512
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75491
75513
  }
75492
75514
  if (isTakeProfit) {
75493
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75515
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75516
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75494
75517
  }
75495
75518
  }
75496
75519
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -75570,11 +75593,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75570
75593
  else if (timeInForce === 'ioc') {
75571
75594
  request['timeInForce'] = 'ImmediateOrCancel';
75572
75595
  }
75573
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75574
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice', triggerPrice);
75575
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75576
- const stopLoss = this.safeNumber(params, 'stopLoss');
75577
- 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');
75578
75601
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75579
75602
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75580
75603
  const isStopLoss = stopLoss !== undefined;
@@ -75593,10 +75616,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75593
75616
  }
75594
75617
  else if (isStopLoss || isTakeProfit) {
75595
75618
  if (isStopLoss) {
75596
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75619
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75620
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75597
75621
  }
75598
75622
  if (isTakeProfit) {
75599
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75623
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75624
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75600
75625
  }
75601
75626
  }
75602
75627
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -75673,11 +75698,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75673
75698
  request['time_in_force'] = 'ImmediateOrCancel';
75674
75699
  }
75675
75700
  if (market['swap']) {
75676
- const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
75677
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice', triggerPrice);
75678
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75679
- const stopLoss = this.safeNumber(params, 'stopLoss');
75680
- 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');
75681
75706
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75682
75707
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75683
75708
  const isStopLoss = stopLoss !== undefined;
@@ -75694,10 +75719,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75694
75719
  }
75695
75720
  else if (isStopLoss || isTakeProfit) {
75696
75721
  if (isStopLoss) {
75697
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75722
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75723
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75698
75724
  }
75699
75725
  if (isTakeProfit) {
75700
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75726
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75727
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75701
75728
  }
75702
75729
  }
75703
75730
  else {
@@ -75779,11 +75806,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75779
75806
  if (amount !== undefined) {
75780
75807
  request['qty'] = this.amountToPrecision(symbol, amount);
75781
75808
  }
75782
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75783
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
75784
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75785
- const stopLoss = this.safeNumber(params, 'stopLoss');
75786
- 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');
75787
75814
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75788
75815
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75789
75816
  const isStopLoss = stopLoss !== undefined;
@@ -75796,10 +75823,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75796
75823
  }
75797
75824
  if (isStopLoss || isTakeProfit) {
75798
75825
  if (isStopLoss) {
75799
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75826
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75827
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75800
75828
  }
75801
75829
  if (isTakeProfit) {
75802
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75830
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75831
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75803
75832
  }
75804
75833
  }
75805
75834
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -75880,11 +75909,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75880
75909
  else if (timeInForce === 'ioc') {
75881
75910
  request['timeInForce'] = 'ImmediateOrCancel';
75882
75911
  }
75883
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75884
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
75885
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75886
- const stopLoss = this.safeNumber(params, 'stopLoss');
75887
- 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');
75888
75917
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75889
75918
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75890
75919
  const isStopLoss = stopLoss !== undefined;
@@ -75897,10 +75926,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75897
75926
  }
75898
75927
  if (isStopLoss || isTakeProfit) {
75899
75928
  if (isStopLoss) {
75900
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75929
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75930
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75901
75931
  }
75902
75932
  if (isTakeProfit) {
75903
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75933
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75934
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75904
75935
  }
75905
75936
  }
75906
75937
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -75942,11 +75973,11 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75942
75973
  if (amount !== undefined) {
75943
75974
  request['qty'] = this.amountToPrecision(symbol, amount);
75944
75975
  }
75945
- let triggerPrice = this.safeNumber2(params, 'triggerPrice', 'stopPrice');
75946
- const stopLossTriggerPrice = this.safeNumber(params, 'stopLossPrice');
75947
- const takeProfitTriggerPrice = this.safeNumber(params, 'takeProfitPrice');
75948
- const stopLoss = this.safeNumber(params, 'stopLoss');
75949
- 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');
75950
75981
  const isStopLossTriggerOrder = stopLossTriggerPrice !== undefined;
75951
75982
  const isTakeProfitTriggerOrder = takeProfitTriggerPrice !== undefined;
75952
75983
  const isStopLoss = stopLoss !== undefined;
@@ -75959,10 +75990,12 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
75959
75990
  }
75960
75991
  if (isStopLoss || isTakeProfit) {
75961
75992
  if (isStopLoss) {
75962
- request['stopLoss'] = this.priceToPrecision(symbol, stopLoss);
75993
+ const stopLossTriggerPrice = this.safeValue2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss);
75994
+ request['stopLoss'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
75963
75995
  }
75964
75996
  if (isTakeProfit) {
75965
- request['takeProfit'] = this.priceToPrecision(symbol, takeProfit);
75997
+ const takeProfitTriggerPrice = this.safeValue2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit);
75998
+ request['takeProfit'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
75966
75999
  }
75967
76000
  }
75968
76001
  const clientOrderId = this.safeString(params, 'clientOrderId');
@@ -76008,9 +76041,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
76008
76041
  * @param {object} [params] extra parameters specific to the bybit api endpoint
76009
76042
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
76010
76043
  */
76011
- if (symbol === undefined) {
76012
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' editOrder() requires an symbol argument');
76013
- }
76044
+ this.checkRequiredSymbol('editOrder', symbol);
76014
76045
  await this.loadMarkets();
76015
76046
  const market = this.market(symbol);
76016
76047
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
@@ -113876,17 +113907,55 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
113876
113907
  // },
113877
113908
  // }
113878
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
+ }
113879
113945
  const keys = Object.keys(response);
113880
113946
  const result = [];
113881
113947
  for (let i = 0; i < keys.length; i++) {
113882
113948
  const id = keys[i];
113883
113949
  const market = response[id];
113950
+ const marginMarket = this.safeValue(marginPairsDict, id);
113884
113951
  const symbol = id.replace('_', '/');
113885
113952
  const [baseId, quoteId] = symbol.split('/');
113886
113953
  const base = this.safeCurrencyCode(baseId);
113887
113954
  const quote = this.safeCurrencyCode(quoteId);
113888
113955
  const takerString = this.safeString(market, 'commission_taker_percent');
113889
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');
113890
113959
  result.push({
113891
113960
  'id': id,
113892
113961
  'symbol': symbol,
@@ -113898,7 +113967,7 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
113898
113967
  'settleId': undefined,
113899
113968
  'type': 'spot',
113900
113969
  'spot': true,
113901
- 'margin': true,
113970
+ 'margin': marginMarket !== undefined,
113902
113971
  'swap': false,
113903
113972
  'future': false,
113904
113973
  'option': false,
@@ -113920,11 +113989,11 @@ class exmo extends _abstract_exmo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
113920
113989
  'limits': {
113921
113990
  'leverage': {
113922
113991
  'min': undefined,
113923
- 'max': undefined,
113992
+ 'max': this.safeNumber(market, 'leverage'),
113924
113993
  },
113925
113994
  'amount': {
113926
113995
  'min': this.safeNumber(market, 'min_quantity'),
113927
- 'max': this.safeNumber(market, 'max_quantity'),
113996
+ 'max': this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMax */ .O.stringMax(maxQuantity, marginMaxQuantity)),
113928
113997
  },
113929
113998
  'price': {
113930
113999
  'min': this.safeNumber(market, 'min_price'),
@@ -119493,7 +119562,6 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
119493
119562
  let remainingString = this.safeString(order, 'left');
119494
119563
  let cost = this.safeString(order, 'filled_total');
119495
119564
  const triggerPrice = this.safeNumber(trigger, 'price');
119496
- let rawStatus = undefined;
119497
119565
  let average = this.safeNumber2(order, 'avg_deal_price', 'fill_price');
119498
119566
  if (triggerPrice) {
119499
119567
  remainingString = amount;
@@ -119503,11 +119571,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
119503
119571
  const isMarketOrder = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringEquals */ .O.stringEquals(price, '0') && (timeInForce === 'IOC');
119504
119572
  type = isMarketOrder ? 'market' : 'limit';
119505
119573
  side = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringGt */ .O.stringGt(amount, '0') ? 'buy' : 'sell';
119506
- rawStatus = this.safeString(order, 'finish_as', 'open');
119507
- }
119508
- else {
119509
- rawStatus = this.safeString(order, 'status');
119510
119574
  }
119575
+ const rawStatus = this.safeStringN(order, ['status', 'finish_as', 'open']);
119511
119576
  let timestamp = this.safeInteger(order, 'create_time_ms');
119512
119577
  if (timestamp === undefined) {
119513
119578
  timestamp = this.safeTimestamp2(order, 'create_time', 'ctime');
@@ -148030,8 +148095,10 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
148030
148095
  const networks = {};
148031
148096
  const chains = this.safeValue(entry, 'chains', []);
148032
148097
  const extraChainsData = this.indexBy(this.safeValue(additionalDataGrouped, id, []), 'chain');
148033
- const precision = this.parseNumber(this.parsePrecision(this.safeString(entry, 'precision')));
148034
- 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++) {
148035
148102
  const chain = chains[j];
148036
148103
  const chainId = this.safeString(chain, 'chain');
148037
148104
  const networkCode = this.networkIdToCode(chainId);
@@ -148072,10 +148139,13 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
148072
148139
  },
148073
148140
  };
148074
148141
  }
148142
+ // kucoin has determined 'fiat' currencies with below logic
148143
+ const isFiat = (rawPrecision === '2') && (chainsLength === 0);
148075
148144
  result[code] = {
148076
148145
  'id': id,
148077
148146
  'name': name,
148078
148147
  'code': code,
148148
+ 'type': isFiat ? 'fiat' : 'crypto',
148079
148149
  'precision': precision,
148080
148150
  'info': entry,
148081
148151
  'active': (isDepositEnabled || isWithdrawEnabled),
@@ -154824,10 +154894,14 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
154824
154894
  const code = this.safeCurrencyCode(tag);
154825
154895
  const fee = this.safeNumber(currency, 'fee');
154826
154896
  const currencyType = this.safeString(currency, 'type');
154827
- const parts = currencyType.split('_');
154828
- const numParts = parts.length;
154829
- const lastPart = this.safeValue(parts, numParts - 1);
154830
- 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
+ }
154831
154905
  const status = this.safeString(currency, 'status');
154832
154906
  const active = (status === 'CURRENCY_STATUS_ACTIVE');
154833
154907
  const name = this.safeString(currency, 'name');
@@ -160958,7 +161032,8 @@ class lykke extends _abstract_lykke_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
160958
161032
  const id = this.safeString(currency, 'assetId');
160959
161033
  const code = this.safeString(currency, 'symbol');
160960
161034
  const name = this.safeString(currency, 'name');
160961
- const type = this.safeString(currency, 'type');
161035
+ const rawType = this.safeString(currency, 'type');
161036
+ const type = (rawType === 'erc20Token') ? 'crypto' : 'other';
160962
161037
  const deposit = this.safeValue(currency, 'blockchainDepositEnabled');
160963
161038
  const withdraw = this.safeValue(currency, 'blockchainWithdrawal');
160964
161039
  const isDisabled = this.safeValue(currency, 'isDisabled');
@@ -168610,7 +168685,12 @@ class ndax extends _abstract_ndax_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
168610
168685
  const currency = response[i];
168611
168686
  const id = this.safeString(currency, 'ProductId');
168612
168687
  const name = this.safeString(currency, 'ProductFullName');
168613
- 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
+ }
168614
168694
  const code = this.safeCurrencyCode(this.safeString(currency, 'Product'));
168615
168695
  const isDisabled = this.safeValue(currency, 'IsDisabled');
168616
168696
  const active = !isDisabled;
@@ -216645,8 +216725,11 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
216645
216725
  parsed['status'] = 'open';
216646
216726
  }
216647
216727
  else if (event === 'finish') {
216648
- const left = this.safeNumber(info, 'left');
216649
- 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
+ }
216650
216733
  }
216651
216734
  stored.append(parsed);
216652
216735
  const symbol = parsed['symbol'];
@@ -264241,7 +264324,6 @@ class yobit extends _abstract_yobit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
264241
264324
  'PAC': '$PAC',
264242
264325
  'PLAY': 'PlayCoin',
264243
264326
  'PIVX': 'Darknet',
264244
- 'PRS': 'PRE',
264245
264327
  'PURE': 'PurePOS',
264246
264328
  'PUTIN': 'PutinCoin',
264247
264329
  'SPACE': 'Spacecoin',
@@ -273560,7 +273642,7 @@ SOFTWARE.
273560
273642
 
273561
273643
  //-----------------------------------------------------------------------------
273562
273644
  // this is updated by vss.js when building
273563
- const version = '4.0.82';
273645
+ const version = '4.0.83';
273564
273646
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
273565
273647
  //-----------------------------------------------------------------------------
273566
273648