ccxt 4.4.92 → 4.4.94

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 (62) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  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 +118 -33
  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 +85 -10
  9. package/dist/cjs/src/coinbase.js +3 -1
  10. package/dist/cjs/src/coinbaseexchange.js +53 -0
  11. package/dist/cjs/src/coincheck.js +47 -4
  12. package/dist/cjs/src/coinex.js +19 -14
  13. package/dist/cjs/src/coinmetro.js +16 -3
  14. package/dist/cjs/src/cryptomus.js +30 -53
  15. package/dist/cjs/src/deribit.js +6 -6
  16. package/dist/cjs/src/exmo.js +66 -61
  17. package/dist/cjs/src/htx.js +7 -1
  18. package/dist/cjs/src/hyperliquid.js +134 -33
  19. package/dist/cjs/src/kucoin.js +13 -15
  20. package/dist/cjs/src/latoken.js +19 -74
  21. package/dist/cjs/src/lbank.js +2 -2
  22. package/dist/cjs/src/okx.js +169 -4
  23. package/dist/cjs/src/paradex.js +54 -0
  24. package/dist/cjs/src/phemex.js +3 -3
  25. package/dist/cjs/src/pro/bitstamp.js +55 -16
  26. package/dist/cjs/src/pro/bybit.js +2 -1
  27. package/dist/cjs/src/wavesexchange.js +15 -2
  28. package/js/ccxt.d.ts +1 -1
  29. package/js/ccxt.js +1 -1
  30. package/js/src/ascendex.js +9 -8
  31. package/js/src/base/Exchange.d.ts +3 -1
  32. package/js/src/base/Exchange.js +118 -33
  33. package/js/src/binance.d.ts +10 -0
  34. package/js/src/binance.js +44 -1
  35. package/js/src/bitmex.d.ts +1 -1
  36. package/js/src/bitmex.js +3 -3
  37. package/js/src/bybit.d.ts +12 -1
  38. package/js/src/bybit.js +85 -10
  39. package/js/src/coinbase.js +4 -2
  40. package/js/src/coinbaseexchange.js +53 -0
  41. package/js/src/coincheck.js +48 -5
  42. package/js/src/coinex.js +16 -13
  43. package/js/src/coinmetro.js +16 -3
  44. package/js/src/cryptomus.js +30 -53
  45. package/js/src/deribit.js +6 -6
  46. package/js/src/exmo.js +66 -61
  47. package/js/src/htx.js +7 -1
  48. package/js/src/hyperliquid.d.ts +31 -0
  49. package/js/src/hyperliquid.js +134 -33
  50. package/js/src/kucoin.js +13 -15
  51. package/js/src/latoken.d.ts +0 -1
  52. package/js/src/latoken.js +19 -74
  53. package/js/src/lbank.js +2 -2
  54. package/js/src/okx.d.ts +12 -0
  55. package/js/src/okx.js +169 -4
  56. package/js/src/paradex.d.ts +10 -0
  57. package/js/src/paradex.js +54 -0
  58. package/js/src/phemex.js +3 -3
  59. package/js/src/pro/bitstamp.js +55 -16
  60. package/js/src/pro/bybit.js +2 -1
  61. package/js/src/wavesexchange.js +15 -2
  62. package/package.json +1 -1
@@ -28,31 +28,73 @@ class coinbaseexchange extends coinbaseexchange$1 {
28
28
  'swap': false,
29
29
  'future': false,
30
30
  'option': false,
31
+ 'addMargin': false,
32
+ 'borrowCrossMargin': false,
33
+ 'borrowIsolatedMargin': false,
34
+ 'borrowMargin': false,
31
35
  'cancelAllOrders': true,
32
36
  'cancelOrder': true,
37
+ 'closeAllPositions': false,
38
+ 'closePosition': false,
33
39
  'createDepositAddress': true,
34
40
  'createOrder': true,
41
+ 'createOrderWithTakeProfitAndStopLoss': false,
42
+ 'createOrderWithTakeProfitAndStopLossWs': false,
43
+ 'createPostOnlyOrder': false,
35
44
  'createReduceOnlyOrder': false,
36
45
  'createStopLimitOrder': true,
37
46
  'createStopMarketOrder': true,
38
47
  'createStopOrder': true,
39
48
  'fetchAccounts': true,
40
49
  'fetchBalance': true,
50
+ 'fetchBorrowInterest': false,
51
+ 'fetchBorrowRate': false,
52
+ 'fetchBorrowRateHistories': false,
53
+ 'fetchBorrowRateHistory': false,
54
+ 'fetchBorrowRates': false,
55
+ 'fetchBorrowRatesPerSymbol': false,
41
56
  'fetchClosedOrders': true,
57
+ 'fetchCrossBorrowRate': false,
58
+ 'fetchCrossBorrowRates': false,
42
59
  'fetchCurrencies': true,
43
60
  'fetchDepositAddress': false,
44
61
  'fetchDeposits': true,
45
62
  'fetchDepositsWithdrawals': true,
46
63
  'fetchFundingHistory': false,
64
+ 'fetchFundingInterval': false,
65
+ 'fetchFundingIntervals': false,
47
66
  'fetchFundingRate': false,
48
67
  'fetchFundingRateHistory': false,
49
68
  'fetchFundingRates': false,
69
+ 'fetchGreeks': false,
70
+ 'fetchIndexOHLCV': false,
71
+ 'fetchIsolatedBorrowRate': false,
72
+ 'fetchIsolatedBorrowRates': false,
73
+ 'fetchIsolatedPositions': false,
50
74
  'fetchLedger': true,
75
+ 'fetchLeverage': false,
76
+ 'fetchLeverages': false,
77
+ 'fetchLeverageTiers': false,
78
+ 'fetchLiquidations': false,
79
+ 'fetchLongShortRatio': false,
80
+ 'fetchLongShortRatioHistory': false,
81
+ 'fetchMarginAdjustmentHistory': false,
51
82
  'fetchMarginMode': false,
83
+ 'fetchMarginModes': false,
84
+ 'fetchMarketLeverageTiers': false,
52
85
  'fetchMarkets': true,
86
+ 'fetchMarkOHLCV': false,
87
+ 'fetchMarkPrices': false,
88
+ 'fetchMyLiquidations': false,
89
+ 'fetchMySettlementHistory': false,
53
90
  'fetchMyTrades': true,
54
91
  'fetchOHLCV': true,
92
+ 'fetchOpenInterest': false,
93
+ 'fetchOpenInterestHistory': false,
94
+ 'fetchOpenInterests': false,
55
95
  'fetchOpenOrders': true,
96
+ 'fetchOption': false,
97
+ 'fetchOptionChain': false,
56
98
  'fetchOrder': true,
57
99
  'fetchOrderBook': true,
58
100
  'fetchOrders': true,
@@ -64,6 +106,8 @@ class coinbaseexchange extends coinbaseexchange$1 {
64
106
  'fetchPositionsForSymbol': false,
65
107
  'fetchPositionsHistory': false,
66
108
  'fetchPositionsRisk': false,
109
+ 'fetchPremiumIndexOHLCV': false,
110
+ 'fetchSettlementHistory': false,
67
111
  'fetchTicker': true,
68
112
  'fetchTickers': true,
69
113
  'fetchTime': true,
@@ -71,7 +115,16 @@ class coinbaseexchange extends coinbaseexchange$1 {
71
115
  'fetchTradingFee': false,
72
116
  'fetchTradingFees': true,
73
117
  'fetchTransactions': 'emulated',
118
+ 'fetchVolatilityHistory': false,
74
119
  'fetchWithdrawals': true,
120
+ 'reduceMargin': false,
121
+ 'repayCrossMargin': false,
122
+ 'repayIsolatedMargin': false,
123
+ 'repayMargin': false,
124
+ 'setLeverage': false,
125
+ 'setMargin': false,
126
+ 'setMarginMode': false,
127
+ 'setPositionMode': false,
75
128
  'withdraw': true,
76
129
  },
77
130
  'timeframes': {
@@ -26,30 +26,59 @@ class coincheck extends coincheck$1 {
26
26
  'future': false,
27
27
  'option': false,
28
28
  'addMargin': false,
29
+ 'borrowCrossMargin': false,
30
+ 'borrowIsolatedMargin': false,
31
+ 'borrowMargin': false,
29
32
  'cancelOrder': true,
30
33
  'closeAllPositions': false,
31
34
  'closePosition': false,
32
35
  'createOrder': true,
36
+ 'createOrderWithTakeProfitAndStopLoss': false,
37
+ 'createOrderWithTakeProfitAndStopLossWs': false,
38
+ 'createPostOnlyOrder': false,
33
39
  'createReduceOnlyOrder': false,
34
40
  'fetchBalance': true,
41
+ 'fetchBorrowInterest': false,
42
+ 'fetchBorrowRate': false,
35
43
  'fetchBorrowRateHistories': false,
36
44
  'fetchBorrowRateHistory': false,
45
+ 'fetchBorrowRates': false,
46
+ 'fetchBorrowRatesPerSymbol': false,
37
47
  'fetchCrossBorrowRate': false,
38
48
  'fetchCrossBorrowRates': false,
39
49
  'fetchDeposits': true,
40
50
  'fetchFundingHistory': false,
51
+ 'fetchFundingInterval': false,
52
+ 'fetchFundingIntervals': false,
41
53
  'fetchFundingRate': false,
42
54
  'fetchFundingRateHistory': false,
43
55
  'fetchFundingRates': false,
56
+ 'fetchGreeks': false,
44
57
  'fetchIndexOHLCV': false,
45
58
  'fetchIsolatedBorrowRate': false,
46
59
  'fetchIsolatedBorrowRates': false,
60
+ 'fetchIsolatedPositions': false,
47
61
  'fetchLeverage': false,
62
+ 'fetchLeverages': false,
63
+ 'fetchLeverageTiers': false,
64
+ 'fetchLiquidations': false,
65
+ 'fetchLongShortRatio': false,
66
+ 'fetchLongShortRatioHistory': false,
67
+ 'fetchMarginAdjustmentHistory': false,
48
68
  'fetchMarginMode': false,
69
+ 'fetchMarginModes': false,
70
+ 'fetchMarketLeverageTiers': false,
49
71
  'fetchMarkOHLCV': false,
72
+ 'fetchMarkPrices': false,
73
+ 'fetchMyLiquidations': false,
74
+ 'fetchMySettlementHistory': false,
50
75
  'fetchMyTrades': true,
76
+ 'fetchOpenInterest': false,
51
77
  'fetchOpenInterestHistory': false,
78
+ 'fetchOpenInterests': false,
52
79
  'fetchOpenOrders': true,
80
+ 'fetchOption': false,
81
+ 'fetchOptionChain': false,
53
82
  'fetchOrderBook': true,
54
83
  'fetchPosition': false,
55
84
  'fetchPositionHistory': false,
@@ -59,13 +88,19 @@ class coincheck extends coincheck$1 {
59
88
  'fetchPositionsHistory': false,
60
89
  'fetchPositionsRisk': false,
61
90
  'fetchPremiumIndexOHLCV': false,
91
+ 'fetchSettlementHistory': false,
62
92
  'fetchTicker': true,
63
93
  'fetchTrades': true,
64
94
  'fetchTradingFee': false,
65
95
  'fetchTradingFees': true,
96
+ 'fetchVolatilityHistory': false,
66
97
  'fetchWithdrawals': true,
67
98
  'reduceMargin': false,
99
+ 'repayCrossMargin': false,
100
+ 'repayIsolatedMargin': false,
101
+ 'repayMargin': false,
68
102
  'setLeverage': false,
103
+ 'setMargin': false,
69
104
  'setMarginMode': false,
70
105
  'setPositionMode': false,
71
106
  'ws': true,
@@ -645,10 +680,18 @@ class coincheck extends coincheck$1 {
645
680
  'pair': market['id'],
646
681
  };
647
682
  if (type === 'market') {
648
- const order_type = type + '_' + side;
649
- request['order_type'] = order_type;
650
- const prefix = (side === 'buy') ? (order_type + '_') : '';
651
- request[prefix + 'amount'] = amount;
683
+ request['order_type'] = type + '_' + side;
684
+ if (side === 'sell') {
685
+ request['amount'] = amount;
686
+ }
687
+ else {
688
+ const cost = this.safeNumber(params, 'cost');
689
+ params = this.omit(params, 'cost');
690
+ if (cost !== undefined) {
691
+ throw new errors.ArgumentsRequired(this.id + ' createOrder() : you should use "cost" parameter instead of "amount" argument to create market buy orders');
692
+ }
693
+ request['market_buy_amount'] = cost;
694
+ }
652
695
  }
653
696
  else {
654
697
  request['order_type'] = side;
@@ -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,
@@ -210,6 +210,7 @@ class coinmetro extends coinmetro$1 {
210
210
  'options': {
211
211
  'currenciesByIdForParseMarket': undefined,
212
212
  'currencyIdsListForParseMarket': ['QRDO'],
213
+ 'skippedMarkets': ['VXVUSDT'], // broken markets which do not have enough info in API
213
214
  },
214
215
  'features': {
215
216
  'spot': {
@@ -435,10 +436,13 @@ class coinmetro extends coinmetro$1 {
435
436
  * @returns {object[]} an array of objects representing market data
436
437
  */
437
438
  async fetchMarkets(params = {}) {
438
- const response = await this.publicGetMarkets(params);
439
+ const promises = [];
440
+ promises.push(this.publicGetMarkets(params));
439
441
  if (this.safeValue(this.options, 'currenciesByIdForParseMarket') === undefined) {
440
- await this.fetchCurrencies();
442
+ promises.push(this.fetchCurrencies());
441
443
  }
444
+ const responses = await Promise.all(promises);
445
+ const response = responses[0];
442
446
  //
443
447
  // [
444
448
  // {
@@ -454,7 +458,16 @@ class coinmetro extends coinmetro$1 {
454
458
  // ...
455
459
  // ]
456
460
  //
457
- return this.parseMarkets(response);
461
+ const skippedMarkets = this.safeList(this.options, 'skippedMarkets', []);
462
+ const result = [];
463
+ for (let i = 0; i < response.length; i++) {
464
+ const market = this.parseMarket(response[i]);
465
+ if (this.inArray(market['id'], skippedMarkets)) {
466
+ continue;
467
+ }
468
+ result.push(market);
469
+ }
470
+ return result;
458
471
  }
459
472
  parseMarket(market) {
460
473
  const id = this.safeString(market, 'pair');
@@ -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
  }
@@ -7107,13 +7107,19 @@ class htx extends htx$1 {
7107
7107
  let paginate = false;
7108
7108
  [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
7109
7109
  if (paginate) {
7110
- return await this.fetchPaginatedCallCursor('fetchFundingRateHistory', symbol, since, limit, params, 'page_index', 'current_page', 1, 50);
7110
+ return await this.fetchPaginatedCallCursor('fetchFundingRateHistory', symbol, since, limit, params, 'current_page', 'page_index', 1, 50);
7111
7111
  }
7112
7112
  await this.loadMarkets();
7113
7113
  const market = this.market(symbol);
7114
7114
  const request = {
7115
7115
  'contract_code': market['id'],
7116
7116
  };
7117
+ if (limit !== undefined) {
7118
+ request['page_size'] = limit;
7119
+ }
7120
+ else {
7121
+ request['page_size'] = 50; // max
7122
+ }
7117
7123
  let response = undefined;
7118
7124
  if (market['inverse']) {
7119
7125
  response = await this.contractPublicGetSwapApiV1SwapHistoricalFundingRate(this.extend(request, params));