ccxt 4.4.92 → 4.4.93

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 (53) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ascendex.js +9 -8
  5. package/dist/cjs/src/base/Exchange.js +67 -11
  6. package/dist/cjs/src/binance.js +44 -1
  7. package/dist/cjs/src/bitmex.js +3 -3
  8. package/dist/cjs/src/bybit.js +83 -8
  9. package/dist/cjs/src/coinbaseexchange.js +53 -0
  10. package/dist/cjs/src/coincheck.js +47 -4
  11. package/dist/cjs/src/coinex.js +19 -14
  12. package/dist/cjs/src/cryptomus.js +30 -53
  13. package/dist/cjs/src/deribit.js +6 -6
  14. package/dist/cjs/src/exmo.js +66 -61
  15. package/dist/cjs/src/hyperliquid.js +2 -1
  16. package/dist/cjs/src/kucoin.js +13 -15
  17. package/dist/cjs/src/latoken.js +19 -74
  18. package/dist/cjs/src/lbank.js +2 -2
  19. package/dist/cjs/src/okx.js +156 -0
  20. package/dist/cjs/src/paradex.js +54 -0
  21. package/dist/cjs/src/phemex.js +3 -3
  22. package/dist/cjs/src/pro/bitstamp.js +55 -16
  23. package/dist/cjs/src/pro/bybit.js +2 -1
  24. package/js/ccxt.d.ts +1 -1
  25. package/js/ccxt.js +1 -1
  26. package/js/src/ascendex.js +9 -8
  27. package/js/src/base/Exchange.d.ts +3 -1
  28. package/js/src/base/Exchange.js +67 -11
  29. package/js/src/binance.d.ts +10 -0
  30. package/js/src/binance.js +44 -1
  31. package/js/src/bitmex.d.ts +1 -1
  32. package/js/src/bitmex.js +3 -3
  33. package/js/src/bybit.d.ts +12 -1
  34. package/js/src/bybit.js +83 -8
  35. package/js/src/coinbaseexchange.js +53 -0
  36. package/js/src/coincheck.js +48 -5
  37. package/js/src/coinex.js +16 -13
  38. package/js/src/cryptomus.js +30 -53
  39. package/js/src/deribit.js +6 -6
  40. package/js/src/exmo.js +66 -61
  41. package/js/src/hyperliquid.js +2 -1
  42. package/js/src/kucoin.js +13 -15
  43. package/js/src/latoken.d.ts +0 -1
  44. package/js/src/latoken.js +19 -74
  45. package/js/src/lbank.js +2 -2
  46. package/js/src/okx.d.ts +12 -0
  47. package/js/src/okx.js +156 -0
  48. package/js/src/paradex.d.ts +10 -0
  49. package/js/src/paradex.js +54 -0
  50. package/js/src/phemex.js +3 -3
  51. package/js/src/pro/bitstamp.js +55 -16
  52. package/js/src/pro/bybit.js +2 -1
  53. package/package.json +1 -1
@@ -657,6 +657,7 @@ class coinex extends coinex$1 {
657
657
  'broad': {
658
658
  'ip not allow visit': errors.PermissionDenied,
659
659
  'service too busy': errors.ExchangeNotAvailable,
660
+ 'Service is not available during funding fee settlement': errors.OperationFailed,
660
661
  },
661
662
  },
662
663
  });
@@ -721,6 +722,7 @@ class coinex extends coinex$1 {
721
722
  const canWithdraw = this.safeBool(asset, 'withdraw_enabled');
722
723
  const firstChain = this.safeDict(chains, 0, {});
723
724
  const firstPrecisionString = this.parsePrecision(this.safeString(firstChain, 'withdrawal_precision'));
725
+ const networks = {};
724
726
  for (let j = 0; j < chains.length; j++) {
725
727
  const chain = chains[j];
726
728
  const networkId = this.safeString(chain, 'chain');
@@ -733,7 +735,7 @@ class coinex extends coinex$1 {
733
735
  const minNetworkWithdrawString = this.safeString(chain, 'min_withdraw_amount');
734
736
  const canDepositChain = this.safeBool(chain, 'deposit_enabled');
735
737
  const canWithdrawChain = this.safeBool(chain, 'withdraw_enabled');
736
- ({
738
+ const network = {
737
739
  'id': networkId,
738
740
  'network': networkId,
739
741
  'name': undefined,
@@ -757,7 +759,8 @@ class coinex extends coinex$1 {
757
759
  },
758
760
  },
759
761
  'info': chain,
760
- });
762
+ };
763
+ networks[networkId] = network;
761
764
  }
762
765
  result[code] = this.safeCurrencyStructure({
763
766
  'id': currencyId,
@@ -782,7 +785,7 @@ class coinex extends coinex$1 {
782
785
  'max': undefined,
783
786
  },
784
787
  },
785
- 'networks': {},
788
+ 'networks': networks,
786
789
  'type': 'crypto',
787
790
  'info': coin,
788
791
  });
@@ -815,17 +818,19 @@ class coinex extends coinex$1 {
815
818
  // "code": 0,
816
819
  // "data": [
817
820
  // {
818
- // "base_ccy": "SORA",
821
+ // "market": "BTCUSDT",
822
+ // "taker_fee_rate": "0.002",
823
+ // "maker_fee_rate": "0.002",
824
+ // "min_amount": "0.0005",
825
+ // "base_ccy": "BTC",
826
+ // "quote_ccy": "USDT",
819
827
  // "base_ccy_precision": 8,
828
+ // "quote_ccy_precision": 2,
820
829
  // "is_amm_available": true,
821
- // "is_margin_available": false,
822
- // "maker_fee_rate": "0.003",
823
- // "market": "SORAUSDT",
824
- // "min_amount": "500",
825
- // "quote_ccy": "USDT",
826
- // "quote_ccy_precision": 6,
827
- // "taker_fee_rate": "0.003"
828
- // },
830
+ // "is_margin_available": true,
831
+ // "is_pre_trading_available": true,
832
+ // "is_api_trading_available": true
833
+ // }
829
834
  // ],
830
835
  // "message": "OK"
831
836
  // }
@@ -851,11 +856,11 @@ class coinex extends coinex$1 {
851
856
  'settleId': undefined,
852
857
  'type': 'spot',
853
858
  'spot': true,
854
- 'margin': undefined,
859
+ 'margin': this.safeBool(market, 'is_margin_available'),
855
860
  'swap': false,
856
861
  'future': false,
857
862
  'option': false,
858
- 'active': undefined,
863
+ 'active': this.safeBool(market, 'is_api_trading_available'),
859
864
  'contract': false,
860
865
  'linear': undefined,
861
866
  'inverse': undefined,
@@ -363,68 +363,45 @@ class cryptomus extends cryptomus$1 {
363
363
  // }
364
364
  //
365
365
  const coins = this.safeList(response, 'result');
366
+ const groupedById = this.groupBy(coins, 'currency_code');
367
+ const keys = Object.keys(groupedById);
366
368
  const result = {};
367
- for (let i = 0; i < coins.length; i++) {
368
- const networkEntry = coins[i];
369
- const currencyId = this.safeString(networkEntry, 'currency_code');
370
- const code = this.safeCurrencyCode(currencyId);
371
- if (!(code in result)) {
372
- result[code] = {
373
- 'id': currencyId,
374
- 'code': code,
375
- 'precision': undefined,
376
- 'type': undefined,
377
- 'name': undefined,
378
- 'active': undefined,
379
- 'deposit': undefined,
380
- 'withdraw': undefined,
381
- 'fee': undefined,
369
+ for (let i = 0; i < keys.length; i++) {
370
+ const id = keys[i];
371
+ const code = this.safeCurrencyCode(id);
372
+ const networks = {};
373
+ const networkEntries = groupedById[id];
374
+ for (let j = 0; j < networkEntries.length; j++) {
375
+ const networkEntry = networkEntries[j];
376
+ const networkId = this.safeString(networkEntry, 'network_code');
377
+ const networkCode = this.networkIdToCode(networkId);
378
+ networks[networkCode] = {
379
+ 'id': networkId,
380
+ 'network': networkCode,
382
381
  'limits': {
383
382
  'withdraw': {
384
- 'min': undefined,
385
- 'max': undefined,
383
+ 'min': this.safeNumber(networkEntry, 'min_withdraw'),
384
+ 'max': this.safeNumber(networkEntry, 'max_withdraw'),
386
385
  },
387
386
  'deposit': {
388
- 'min': undefined,
389
- 'max': undefined,
387
+ 'min': this.safeNumber(networkEntry, 'min_deposit'),
388
+ 'max': this.safeNumber(networkEntry, 'max_deposit'),
390
389
  },
391
390
  },
392
- 'networks': {},
393
- 'info': {},
391
+ 'active': undefined,
392
+ 'deposit': this.safeBool(networkEntry, 'can_withdraw'),
393
+ 'withdraw': this.safeBool(networkEntry, 'can_deposit'),
394
+ 'fee': undefined,
395
+ 'precision': undefined,
396
+ 'info': networkEntry,
394
397
  };
395
398
  }
396
- const networkId = this.safeString(networkEntry, 'network_code');
397
- const networkCode = this.networkIdToCode(networkId);
398
- result[code]['networks'][networkCode] = {
399
- 'id': networkId,
400
- 'network': networkCode,
401
- 'limits': {
402
- 'withdraw': {
403
- 'min': this.safeNumber(networkEntry, 'min_withdraw'),
404
- 'max': this.safeNumber(networkEntry, 'max_withdraw'),
405
- },
406
- 'deposit': {
407
- 'min': this.safeNumber(networkEntry, 'min_deposit'),
408
- 'max': this.safeNumber(networkEntry, 'max_deposit'),
409
- },
410
- },
411
- 'active': undefined,
412
- 'deposit': this.safeBool(networkEntry, 'can_withdraw'),
413
- 'withdraw': this.safeBool(networkEntry, 'can_deposit'),
414
- 'fee': undefined,
415
- 'precision': undefined,
416
- 'info': networkEntry,
417
- };
418
- // add entry in info
419
- const info = this.safeList(result[code], 'info', []);
420
- info.push(networkEntry);
421
- result[code]['info'] = info;
422
- }
423
- // only after all entries are formed in currencies, restructure each entry
424
- const allKeys = Object.keys(result);
425
- for (let i = 0; i < allKeys.length; i++) {
426
- const code = allKeys[i];
427
- result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
399
+ result[code] = this.safeCurrencyStructure({
400
+ 'id': id,
401
+ 'code': code,
402
+ 'networks': networks,
403
+ 'info': networkEntries,
404
+ });
428
405
  }
429
406
  return result;
430
407
  }
@@ -2691,21 +2691,21 @@ class deribit extends deribit$1 {
2691
2691
  const unrealizedPnl = this.safeString(position, 'floating_profit_loss');
2692
2692
  const initialMarginString = this.safeString(position, 'initial_margin');
2693
2693
  const notionalString = this.safeString(position, 'size_currency');
2694
+ const notionalStringAbs = Precise["default"].stringAbs(notionalString);
2694
2695
  const maintenanceMarginString = this.safeString(position, 'maintenance_margin');
2695
- const currentTime = this.milliseconds();
2696
2696
  return this.safePosition({
2697
2697
  'info': position,
2698
2698
  'id': undefined,
2699
2699
  'symbol': this.safeString(market, 'symbol'),
2700
- 'timestamp': currentTime,
2701
- 'datetime': this.iso8601(currentTime),
2700
+ 'timestamp': undefined,
2701
+ 'datetime': undefined,
2702
2702
  'lastUpdateTimestamp': undefined,
2703
2703
  'initialMargin': this.parseNumber(initialMarginString),
2704
- 'initialMarginPercentage': this.parseNumber(Precise["default"].stringMul(Precise["default"].stringDiv(initialMarginString, notionalString), '100')),
2704
+ 'initialMarginPercentage': this.parseNumber(Precise["default"].stringMul(Precise["default"].stringDiv(initialMarginString, notionalStringAbs), '100')),
2705
2705
  'maintenanceMargin': this.parseNumber(maintenanceMarginString),
2706
- 'maintenanceMarginPercentage': this.parseNumber(Precise["default"].stringMul(Precise["default"].stringDiv(maintenanceMarginString, notionalString), '100')),
2706
+ 'maintenanceMarginPercentage': this.parseNumber(Precise["default"].stringMul(Precise["default"].stringDiv(maintenanceMarginString, notionalStringAbs), '100')),
2707
2707
  'entryPrice': this.safeNumber(position, 'average_price'),
2708
- 'notional': this.parseNumber(notionalString),
2708
+ 'notional': this.parseNumber(notionalStringAbs),
2709
2709
  'leverage': this.safeInteger(position, 'leverage'),
2710
2710
  'unrealizedPnl': this.parseNumber(unrealizedPnl),
2711
2711
  'contracts': undefined,
@@ -713,86 +713,91 @@ class exmo extends exmo$1 {
713
713
  for (let i = 0; i < currencyList.length; i++) {
714
714
  const currency = currencyList[i];
715
715
  const currencyId = this.safeString(currency, 'name');
716
- const name = this.safeString(currency, 'description');
717
- const providers = this.safeValue(cryptoList, currencyId);
718
- let active = false;
716
+ const code = this.safeCurrencyCode(currencyId);
719
717
  let type = 'crypto';
720
- const limits = {
721
- 'deposit': {
722
- 'min': undefined,
723
- 'max': undefined,
724
- },
725
- 'withdraw': {
726
- 'min': undefined,
727
- 'max': undefined,
728
- },
729
- };
730
- let fee = undefined;
731
- let depositEnabled = undefined;
732
- let withdrawEnabled = undefined;
718
+ const networks = {};
719
+ const providers = this.safeList(cryptoList, currencyId);
733
720
  if (providers === undefined) {
734
- active = true;
735
721
  type = 'fiat';
736
722
  }
737
723
  else {
738
724
  for (let j = 0; j < providers.length; j++) {
739
725
  const provider = providers[j];
726
+ const name = this.safeString(provider, 'name');
727
+ // get network-id by removing extra things
728
+ let networkId = name.replace(currencyId + ' ', '');
729
+ networkId = networkId.replace('(', '');
730
+ const replaceChar = ')'; // transpiler trick
731
+ networkId = networkId.replace(replaceChar, '');
732
+ const networkCode = this.networkIdToCode(networkId);
733
+ if (!(networkCode in networks)) {
734
+ networks[networkCode] = {
735
+ 'id': networkId,
736
+ 'network': networkCode,
737
+ 'active': undefined,
738
+ 'deposit': undefined,
739
+ 'withdraw': undefined,
740
+ 'fee': undefined,
741
+ 'limits': {
742
+ 'withdraw': {
743
+ 'min': undefined,
744
+ 'max': undefined,
745
+ },
746
+ 'deposit': {
747
+ 'min': undefined,
748
+ 'max': undefined,
749
+ },
750
+ },
751
+ 'info': [], // set as array, because of multiple network sub-entries
752
+ };
753
+ }
740
754
  const typeInner = this.safeString(provider, 'type');
741
755
  const minValue = this.safeString(provider, 'min');
742
- let maxValue = this.safeString(provider, 'max');
743
- if (Precise["default"].stringEq(maxValue, '0.0')) {
744
- maxValue = undefined;
745
- }
746
- const activeProvider = this.safeValue(provider, 'enabled');
756
+ const maxValue = this.safeString(provider, 'max');
757
+ const activeProvider = this.safeBool(provider, 'enabled');
758
+ const networkEntry = networks[networkCode];
747
759
  if (typeInner === 'deposit') {
748
- if (activeProvider && !depositEnabled) {
749
- depositEnabled = true;
750
- }
751
- else if (!activeProvider) {
752
- depositEnabled = false;
753
- }
760
+ networkEntry['deposit'] = activeProvider;
761
+ networkEntry['limits']['deposit']['min'] = minValue;
762
+ networkEntry['limits']['deposit']['max'] = maxValue;
754
763
  }
755
764
  else if (typeInner === 'withdraw') {
756
- if (activeProvider && !withdrawEnabled) {
757
- withdrawEnabled = true;
758
- }
759
- else if (!activeProvider) {
760
- withdrawEnabled = false;
761
- }
762
- }
763
- if (activeProvider) {
764
- active = true;
765
- const limitMin = this.numberToString(limits[typeInner]['min']);
766
- if ((limits[typeInner]['min'] === undefined) || (Precise["default"].stringLt(minValue, limitMin))) {
767
- limits[typeInner]['min'] = minValue;
768
- limits[typeInner]['max'] = maxValue;
769
- if (typeInner === 'withdraw') {
770
- const commissionDesc = this.safeString(provider, 'commission_desc');
771
- fee = this.parseFixedFloatValue(commissionDesc);
772
- }
773
- }
765
+ networkEntry['withdraw'] = activeProvider;
766
+ networkEntry['limits']['withdraw']['min'] = minValue;
767
+ networkEntry['limits']['withdraw']['max'] = maxValue;
774
768
  }
769
+ const info = this.safeList(networkEntry, 'info');
770
+ info.push(provider);
771
+ networkEntry['info'] = info;
772
+ networks[networkCode] = networkEntry;
775
773
  }
776
774
  }
777
- const code = this.safeCurrencyCode(currencyId);
778
- const info = {
779
- 'currency': currency,
780
- 'providers': providers,
781
- };
782
- result[code] = {
775
+ result[code] = this.safeCurrencyStructure({
783
776
  'id': currencyId,
784
777
  'code': code,
785
- 'name': name,
778
+ 'name': this.safeString(currency, 'description'),
786
779
  'type': type,
787
- 'active': active,
788
- 'deposit': depositEnabled,
789
- 'withdraw': withdrawEnabled,
790
- 'fee': fee,
780
+ 'active': undefined,
781
+ 'deposit': undefined,
782
+ 'withdraw': undefined,
783
+ 'fee': undefined,
791
784
  'precision': this.parseNumber('1e-8'),
792
- 'limits': limits,
793
- 'info': info,
794
- 'networks': {},
795
- };
785
+ 'limits': {
786
+ 'withdraw': {
787
+ 'min': undefined,
788
+ 'max': undefined,
789
+ },
790
+ 'deposit': {
791
+ 'min': undefined,
792
+ 'max': undefined,
793
+ },
794
+ },
795
+ 'info': {
796
+ 'currency': currency,
797
+ 'providers': providers,
798
+ },
799
+ 'networks': networks,
800
+ });
796
801
  }
797
802
  return result;
798
803
  }
@@ -692,7 +692,8 @@ class hyperliquid extends hyperliquid$1 {
692
692
  // }
693
693
  //
694
694
  const quoteId = 'USDC';
695
- const base = this.safeString(market, 'name');
695
+ const baseName = this.safeString(market, 'name');
696
+ const base = this.safeCurrencyCode(baseName);
696
697
  const quote = this.safeCurrencyCode(quoteId);
697
698
  const baseId = this.safeString(market, 'baseId');
698
699
  const settleId = 'USDC';
@@ -1386,36 +1386,32 @@ class kucoin extends kucoin$1 {
1386
1386
  // }
1387
1387
  //
1388
1388
  const currenciesData = this.safeList(response, 'data', []);
1389
+ const brokenCurrencies = this.safeList(this.options, 'brokenCurrencies', ['00', 'OPEN_ERROR', 'HUF', 'BDT']);
1390
+ const otherFiats = this.safeList(this.options, 'fiats', ['KWD', 'IRR', 'PKR']);
1389
1391
  const result = {};
1390
1392
  for (let i = 0; i < currenciesData.length; i++) {
1391
1393
  const entry = currenciesData[i];
1392
1394
  const id = this.safeString(entry, 'currency');
1393
- const name = this.safeString(entry, 'fullName');
1395
+ if (this.inArray(id, brokenCurrencies)) {
1396
+ continue; // skip buggy entries: https://t.me/KuCoin_API/217798
1397
+ }
1394
1398
  const code = this.safeCurrencyCode(id);
1395
1399
  const networks = {};
1396
1400
  const chains = this.safeList(entry, 'chains', []);
1397
- const rawPrecision = this.safeString(entry, 'precision');
1398
- const precision = this.parseNumber(this.parsePrecision(rawPrecision));
1399
1401
  const chainsLength = chains.length;
1400
- if (!chainsLength) {
1401
- // one buggy coin, which doesn't contain info https://t.me/KuCoin_API/173118
1402
- continue;
1403
- }
1404
1402
  for (let j = 0; j < chainsLength; j++) {
1405
1403
  const chain = chains[j];
1406
1404
  const chainId = this.safeString(chain, 'chainId');
1407
1405
  const networkCode = this.networkIdToCode(chainId, code);
1408
- const chainWithdrawEnabled = this.safeBool(chain, 'isWithdrawEnabled', false);
1409
- const chainDepositEnabled = this.safeBool(chain, 'isDepositEnabled', false);
1410
1406
  networks[networkCode] = {
1411
1407
  'info': chain,
1412
1408
  'id': chainId,
1413
1409
  'name': this.safeString(chain, 'chainName'),
1414
1410
  'code': networkCode,
1415
- 'active': chainWithdrawEnabled && chainDepositEnabled,
1411
+ 'active': undefined,
1416
1412
  'fee': this.safeNumber(chain, 'withdrawalMinFee'),
1417
- 'deposit': chainDepositEnabled,
1418
- 'withdraw': chainWithdrawEnabled,
1413
+ 'deposit': this.safeBool(chain, 'isDepositEnabled'),
1414
+ 'withdraw': this.safeBool(chain, 'isWithdrawEnabled'),
1419
1415
  'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'withdrawPrecision'))),
1420
1416
  'limits': {
1421
1417
  'withdraw': {
@@ -1430,10 +1426,12 @@ class kucoin extends kucoin$1 {
1430
1426
  };
1431
1427
  }
1432
1428
  // kucoin has determined 'fiat' currencies with below logic
1433
- const isFiat = (rawPrecision === '2') && (chainsLength === 0);
1429
+ const rawPrecision = this.safeString(entry, 'precision');
1430
+ const precision = this.parseNumber(this.parsePrecision(rawPrecision));
1431
+ const isFiat = this.inArray(id, otherFiats) || ((rawPrecision === '2') && (chainsLength === 0));
1434
1432
  result[code] = this.safeCurrencyStructure({
1435
1433
  'id': id,
1436
- 'name': name,
1434
+ 'name': this.safeString(entry, 'fullName'),
1437
1435
  'code': code,
1438
1436
  'type': isFiat ? 'fiat' : 'crypto',
1439
1437
  'precision': precision,
@@ -2694,7 +2692,7 @@ class kucoin extends kucoin$1 {
2694
2692
  async cancelAllOrders(symbol = undefined, params = {}) {
2695
2693
  await this.loadMarkets();
2696
2694
  const request = {};
2697
- const trigger = this.safeBool(params, 'stop', false);
2695
+ const trigger = this.safeBool2(params, 'trigger', 'stop', false);
2698
2696
  let hf = undefined;
2699
2697
  [hf, params] = this.handleHfAndParams(params);
2700
2698
  params = this.omit(params, 'stop');
@@ -233,6 +233,8 @@ class latoken extends latoken$1 {
233
233
  'fetchTradingFee': {
234
234
  'method': 'fetchPrivateTradingFee', // or 'fetchPublicTradingFee'
235
235
  },
236
+ 'timeDifference': 0,
237
+ 'adjustForTimeDifference': true, // controls the adjustment logic upon instantiation
236
238
  },
237
239
  'features': {
238
240
  'spot': {
@@ -333,39 +335,6 @@ class latoken extends latoken$1 {
333
335
  * @returns {object[]} an array of objects representing market data
334
336
  */
335
337
  async fetchMarkets(params = {}) {
336
- const currencies = await this.fetchCurrenciesFromCache(params);
337
- //
338
- // [
339
- // {
340
- // "id":"1a075819-9e0b-48fc-8784-4dab1d186d6d",
341
- // "status":"CURRENCY_STATUS_ACTIVE",
342
- // "type":"CURRENCY_TYPE_ALTERNATIVE", // CURRENCY_TYPE_CRYPTO, CURRENCY_TYPE_IEO
343
- // "name":"MyCryptoBank",
344
- // "tag":"MCB",
345
- // "description":"",
346
- // "logo":"",
347
- // "decimals":18,
348
- // "created":1572912000000,
349
- // "tier":1,
350
- // "assetClass":"ASSET_CLASS_UNKNOWN",
351
- // "minTransferAmount":0
352
- // },
353
- // {
354
- // "id":"db02758e-2507-46a5-a805-7bc60355b3eb",
355
- // "status":"CURRENCY_STATUS_ACTIVE",
356
- // "type":"CURRENCY_TYPE_FUTURES_CONTRACT",
357
- // "name":"BTC USDT Futures Contract",
358
- // "tag":"BTCUSDT",
359
- // "description":"",
360
- // "logo":"",
361
- // "decimals":8,
362
- // "created":1589459984395,
363
- // "tier":1,
364
- // "assetClass":"ASSET_CLASS_UNKNOWN",
365
- // "minTransferAmount":0
366
- // },
367
- // ]
368
- //
369
338
  const response = await this.publicGetPair(params);
370
339
  //
371
340
  // [
@@ -387,9 +356,10 @@ class latoken extends latoken$1 {
387
356
  // }
388
357
  // ]
389
358
  //
390
- if (this.safeValue(this.options, 'adjustForTimeDifference', true)) {
359
+ if (this.safeBool(this.options, 'adjustForTimeDifference', false)) {
391
360
  await this.loadTimeDifference();
392
361
  }
362
+ const currencies = this.safeDict(this.options, 'cachedCurrencies', {});
393
363
  const currenciesById = this.indexBy(currencies, 'id');
394
364
  const result = [];
395
365
  for (let i = 0; i < response.length; i++) {
@@ -398,11 +368,13 @@ class latoken extends latoken$1 {
398
368
  // the exchange shows them inverted
399
369
  const baseId = this.safeString(market, 'baseCurrency');
400
370
  const quoteId = this.safeString(market, 'quoteCurrency');
401
- const baseCurrency = this.safeValue(currenciesById, baseId);
402
- const quoteCurrency = this.safeValue(currenciesById, quoteId);
403
- if (baseCurrency !== undefined && quoteCurrency !== undefined) {
404
- const base = this.safeCurrencyCode(this.safeString(baseCurrency, 'tag'));
405
- const quote = this.safeCurrencyCode(this.safeString(quoteCurrency, 'tag'));
371
+ const baseCurrency = this.safeDict(currenciesById, baseId);
372
+ const quoteCurrency = this.safeDict(currenciesById, quoteId);
373
+ const baseCurrencyInfo = this.safeDict(baseCurrency, 'info');
374
+ const quoteCurrencyInfo = this.safeDict(quoteCurrency, 'info');
375
+ if (baseCurrencyInfo !== undefined && quoteCurrencyInfo !== undefined) {
376
+ const base = this.safeCurrencyCode(this.safeString(baseCurrencyInfo, 'tag'));
377
+ const quote = this.safeCurrencyCode(this.safeString(quoteCurrencyInfo, 'tag'));
406
378
  const lowercaseQuote = quote.toLowerCase();
407
379
  const capitalizedQuote = this.capitalize(lowercaseQuote);
408
380
  const status = this.safeString(market, 'status');
@@ -459,22 +431,6 @@ class latoken extends latoken$1 {
459
431
  }
460
432
  return result;
461
433
  }
462
- async fetchCurrenciesFromCache(params = {}) {
463
- // this method is now redundant
464
- // currencies are now fetched before markets
465
- const options = this.safeValue(this.options, 'fetchCurrencies', {});
466
- const timestamp = this.safeInteger(options, 'timestamp');
467
- const expires = this.safeInteger(options, 'expires', 1000);
468
- const now = this.milliseconds();
469
- if ((timestamp === undefined) || ((now - timestamp) > expires)) {
470
- const response = await this.publicGetCurrency(params);
471
- this.options['fetchCurrencies'] = this.extend(options, {
472
- 'response': response,
473
- 'timestamp': now,
474
- });
475
- }
476
- return this.safeValue(this.options['fetchCurrencies'], 'response');
477
- }
478
434
  /**
479
435
  * @method
480
436
  * @name latoken#fetchCurrencies
@@ -483,7 +439,7 @@ class latoken extends latoken$1 {
483
439
  * @returns {object} an associative dictionary of currencies
484
440
  */
485
441
  async fetchCurrencies(params = {}) {
486
- const response = await this.fetchCurrenciesFromCache(params);
442
+ const response = await this.publicGetCurrency(params);
487
443
  //
488
444
  // [
489
445
  // {
@@ -522,29 +478,18 @@ class latoken extends latoken$1 {
522
478
  const id = this.safeString(currency, 'id');
523
479
  const tag = this.safeString(currency, 'tag');
524
480
  const code = this.safeCurrencyCode(tag);
525
- const fee = this.safeNumber(currency, 'fee');
526
481
  const currencyType = this.safeString(currency, 'type');
527
- let type = undefined;
528
- if (currencyType === 'CURRENCY_TYPE_ALTERNATIVE') {
529
- type = 'other';
530
- }
531
- else {
532
- // CURRENCY_TYPE_CRYPTO and CURRENCY_TYPE_IEO are all cryptos
533
- type = 'crypto';
534
- }
535
- const status = this.safeString(currency, 'status');
536
- const active = (status === 'CURRENCY_STATUS_ACTIVE');
537
- const name = this.safeString(currency, 'name');
538
- result[code] = {
482
+ const isCrypto = (currencyType === 'CURRENCY_TYPE_CRYPTO' || currencyType === 'CURRENCY_TYPE_IEO');
483
+ result[code] = this.safeCurrencyStructure({
539
484
  'id': id,
540
485
  'code': code,
541
486
  'info': currency,
542
- 'name': name,
543
- 'type': type,
544
- 'active': active,
487
+ 'name': this.safeString(currency, 'name'),
488
+ 'type': isCrypto ? 'crypto' : 'other',
489
+ 'active': this.safeString(currency, 'status') === 'CURRENCY_STATUS_ACTIVE',
545
490
  'deposit': undefined,
546
491
  'withdraw': undefined,
547
- 'fee': fee,
492
+ 'fee': this.safeNumber(currency, 'fee'),
548
493
  'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals'))),
549
494
  'limits': {
550
495
  'amount': {
@@ -557,7 +502,7 @@ class latoken extends latoken$1 {
557
502
  },
558
503
  },
559
504
  'networks': {},
560
- };
505
+ });
561
506
  }
562
507
  return result;
563
508
  }
@@ -125,7 +125,7 @@ class lbank extends lbank$1 {
125
125
  'accuracy': 2.5,
126
126
  'usdToCny': 2.5,
127
127
  'assetConfigs': 2.5,
128
- 'withdrawConfigs': 2.5,
128
+ 'withdrawConfigs': 2.5 * 1.5,
129
129
  'timestamp': 2.5,
130
130
  'ticker/24hr': 2.5,
131
131
  'ticker': 2.5,
@@ -669,7 +669,7 @@ class lbank extends lbank$1 {
669
669
  'active': true,
670
670
  'contract': true,
671
671
  'linear': true,
672
- 'inverse': undefined,
672
+ 'inverse': false,
673
673
  'contractSize': this.safeNumber(market, 'volumeMultiple'),
674
674
  'expiry': undefined,
675
675
  'expiryDatetime': undefined,