ccxt 4.4.13 → 4.4.14

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 (66) 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/base/Exchange.js +48 -2
  5. package/dist/cjs/src/binance.js +76 -11
  6. package/dist/cjs/src/bitget.js +112 -3
  7. package/dist/cjs/src/bitrue.js +1 -9
  8. package/dist/cjs/src/bitvavo.js +1 -3
  9. package/dist/cjs/src/coinex.js +15 -1
  10. package/dist/cjs/src/cryptocom.js +1 -0
  11. package/dist/cjs/src/digifinex.js +15 -1
  12. package/dist/cjs/src/huobijp.js +1 -3
  13. package/dist/cjs/src/kucoin.js +40 -1
  14. package/dist/cjs/src/kucoinfutures.js +59 -4
  15. package/dist/cjs/src/mexc.js +64 -8
  16. package/dist/cjs/src/okx.js +14 -0
  17. package/dist/cjs/src/poloniexfutures.js +37 -11
  18. package/dist/cjs/src/pro/okx.js +43 -0
  19. package/dist/cjs/src/woo.js +14 -0
  20. package/dist/cjs/src/woofipro.js +14 -0
  21. package/dist/cjs/src/xt.js +14 -0
  22. package/js/ccxt.d.ts +1 -1
  23. package/js/ccxt.js +1 -1
  24. package/js/src/abstract/binance.d.ts +1 -0
  25. package/js/src/abstract/binancecoinm.d.ts +1 -0
  26. package/js/src/abstract/binanceus.d.ts +1 -0
  27. package/js/src/abstract/binanceusdm.d.ts +1 -0
  28. package/js/src/abstract/cryptocom.d.ts +1 -0
  29. package/js/src/base/Exchange.d.ts +6 -0
  30. package/js/src/base/Exchange.js +48 -2
  31. package/js/src/binance.d.ts +1 -0
  32. package/js/src/binance.js +76 -11
  33. package/js/src/bitget.d.ts +2 -0
  34. package/js/src/bitget.js +112 -3
  35. package/js/src/bitrue.d.ts +0 -1
  36. package/js/src/bitrue.js +1 -9
  37. package/js/src/bitvavo.d.ts +0 -1
  38. package/js/src/bitvavo.js +1 -3
  39. package/js/src/coinex.d.ts +1 -0
  40. package/js/src/coinex.js +15 -1
  41. package/js/src/cryptocom.js +1 -0
  42. package/js/src/digifinex.d.ts +1 -0
  43. package/js/src/digifinex.js +15 -1
  44. package/js/src/huobijp.d.ts +0 -1
  45. package/js/src/huobijp.js +1 -3
  46. package/js/src/kucoin.d.ts +2 -0
  47. package/js/src/kucoin.js +40 -1
  48. package/js/src/kucoinfutures.d.ts +3 -0
  49. package/js/src/kucoinfutures.js +59 -4
  50. package/js/src/mexc.d.ts +1 -0
  51. package/js/src/mexc.js +64 -8
  52. package/js/src/okx.d.ts +1 -0
  53. package/js/src/okx.js +14 -0
  54. package/js/src/poloniexfutures.d.ts +2 -0
  55. package/js/src/poloniexfutures.js +37 -11
  56. package/js/src/pro/okx.d.ts +2 -0
  57. package/js/src/pro/okx.js +43 -0
  58. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  59. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  60. package/js/src/woo.d.ts +1 -0
  61. package/js/src/woo.js +14 -0
  62. package/js/src/woofipro.d.ts +1 -0
  63. package/js/src/woofipro.js +14 -0
  64. package/js/src/xt.d.ts +1 -0
  65. package/js/src/xt.js +14 -0
  66. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.4.13';
197
+ const version = '4.4.14';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -50,7 +50,7 @@ function _interopNamespace(e) {
50
50
  }
51
51
 
52
52
  // ----------------------------------------------------------------------------
53
- const { isNode, selfIsDefined, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS, sleep } = functions;
53
+ const { isNode, selfIsDefined, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, roundTimeframe, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS, sleep } = functions;
54
54
  // ----------------------------------------------------------------------------
55
55
  /**
56
56
  * @class Exchange
@@ -159,6 +159,7 @@ class Exchange {
159
159
  this.flatten = flatten;
160
160
  this.unique = unique;
161
161
  this.indexBy = indexBy;
162
+ this.roundTimeframe = roundTimeframe;
162
163
  this.sortBy = sortBy;
163
164
  this.sortBy2 = sortBy2;
164
165
  this.groupBy = groupBy;
@@ -1400,6 +1401,8 @@ class Exchange {
1400
1401
  'fetchFundingHistory': undefined,
1401
1402
  'fetchFundingRate': undefined,
1402
1403
  'fetchFundingRateHistory': undefined,
1404
+ 'fetchFundingInterval': undefined,
1405
+ 'fetchFundingIntervals': undefined,
1403
1406
  'fetchFundingRates': undefined,
1404
1407
  'fetchGreeks': undefined,
1405
1408
  'fetchIndexOHLCV': undefined,
@@ -2148,6 +2151,9 @@ class Exchange {
2148
2151
  async fetchFundingRates(symbols = undefined, params = {}) {
2149
2152
  throw new errors.NotSupported(this.id + ' fetchFundingRates() is not supported yet');
2150
2153
  }
2154
+ async fetchFundingIntervals(symbols = undefined, params = {}) {
2155
+ throw new errors.NotSupported(this.id + ' fetchFundingIntervals() is not supported yet');
2156
+ }
2151
2157
  async watchFundingRate(symbol, params = {}) {
2152
2158
  throw new errors.NotSupported(this.id + ' watchFundingRate() is not supported yet');
2153
2159
  }
@@ -4417,6 +4423,24 @@ class Exchange {
4417
4423
  throw new errors.NotSupported(this.id + ' fetchTicker() is not supported yet');
4418
4424
  }
4419
4425
  }
4426
+ async fetchMarkPrice(symbol, params = {}) {
4427
+ if (this.has['fetchMarkPrices']) {
4428
+ await this.loadMarkets();
4429
+ const market = this.market(symbol);
4430
+ symbol = market['symbol'];
4431
+ const tickers = await this.fetchMarkPrices([symbol], params);
4432
+ const ticker = this.safeDict(tickers, symbol);
4433
+ if (ticker === undefined) {
4434
+ throw new errors.NullResponse(this.id + ' fetchMarkPrices() could not find a ticker for ' + symbol);
4435
+ }
4436
+ else {
4437
+ return ticker;
4438
+ }
4439
+ }
4440
+ else {
4441
+ throw new errors.NotSupported(this.id + ' fetchMarkPrices() is not supported yet');
4442
+ }
4443
+ }
4420
4444
  async fetchTickerWs(symbol, params = {}) {
4421
4445
  if (this.has['fetchTickersWs']) {
4422
4446
  await this.loadMarkets();
@@ -5201,7 +5225,8 @@ class Exchange {
5201
5225
  return this.forceString(fee);
5202
5226
  }
5203
5227
  else {
5204
- return this.decimalToPrecision(fee, ROUND, precision, this.precisionMode, this.paddingMode);
5228
+ const roundingMode = this.safeInteger(this.options, 'currencyToPrecisionRoundingMode', ROUND);
5229
+ return this.decimalToPrecision(fee, roundingMode, precision, this.precisionMode, this.paddingMode);
5205
5230
  }
5206
5231
  }
5207
5232
  forceString(value) {
@@ -5649,6 +5674,27 @@ class Exchange {
5649
5674
  throw new errors.NotSupported(this.id + ' fetchFundingRate () is not supported yet');
5650
5675
  }
5651
5676
  }
5677
+ async fetchFundingInterval(symbol, params = {}) {
5678
+ if (this.has['fetchFundingIntervals']) {
5679
+ await this.loadMarkets();
5680
+ const market = this.market(symbol);
5681
+ symbol = market['symbol'];
5682
+ if (!market['contract']) {
5683
+ throw new errors.BadSymbol(this.id + ' fetchFundingInterval() supports contract markets only');
5684
+ }
5685
+ const rates = await this.fetchFundingIntervals([symbol], params);
5686
+ const rate = this.safeValue(rates, symbol);
5687
+ if (rate === undefined) {
5688
+ throw new errors.NullResponse(this.id + ' fetchFundingInterval() returned no data for ' + symbol);
5689
+ }
5690
+ else {
5691
+ return rate;
5692
+ }
5693
+ }
5694
+ else {
5695
+ throw new errors.NotSupported(this.id + ' fetchFundingInterval() is not supported yet');
5696
+ }
5697
+ }
5652
5698
  async fetchMarkOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
5653
5699
  /**
5654
5700
  * @method
@@ -88,6 +88,8 @@ class binance extends binance$1 {
88
88
  'fetchDepositWithdrawFee': 'emulated',
89
89
  'fetchDepositWithdrawFees': true,
90
90
  'fetchFundingHistory': true,
91
+ 'fetchFundingInterval': 'emulated',
92
+ 'fetchFundingIntervals': true,
91
93
  'fetchFundingRate': true,
92
94
  'fetchFundingRateHistory': true,
93
95
  'fetchFundingRates': true,
@@ -711,6 +713,7 @@ class binance extends binance$1 {
711
713
  'ticker/bookTicker': { 'cost': 2, 'noSymbol': 5 },
712
714
  'constituents': 2,
713
715
  'openInterest': 1,
716
+ 'fundingInfo': 1,
714
717
  },
715
718
  },
716
719
  'dapiData': {
@@ -9501,16 +9504,28 @@ class binance extends binance$1 {
9501
9504
  parseFundingRate(contract, market = undefined) {
9502
9505
  // ensure it matches with https://www.binance.com/en/futures/funding-history/0
9503
9506
  //
9504
- // {
9505
- // "symbol": "BTCUSDT",
9506
- // "markPrice": "45802.81129892",
9507
- // "indexPrice": "45745.47701915",
9508
- // "estimatedSettlePrice": "45133.91753671",
9509
- // "lastFundingRate": "0.00063521",
9510
- // "interestRate": "0.00010000",
9511
- // "nextFundingTime": "1621267200000",
9512
- // "time": "1621252344001"
9513
- // }
9507
+ // fetchFundingRate, fetchFundingRates
9508
+ //
9509
+ // {
9510
+ // "symbol": "BTCUSDT",
9511
+ // "markPrice": "45802.81129892",
9512
+ // "indexPrice": "45745.47701915",
9513
+ // "estimatedSettlePrice": "45133.91753671",
9514
+ // "lastFundingRate": "0.00063521",
9515
+ // "interestRate": "0.00010000",
9516
+ // "nextFundingTime": "1621267200000",
9517
+ // "time": "1621252344001"
9518
+ // }
9519
+ //
9520
+ // fetchFundingInterval, fetchFundingIntervals
9521
+ //
9522
+ // {
9523
+ // "symbol": "BLZUSDT",
9524
+ // "adjustedFundingRateCap": "0.03000000",
9525
+ // "adjustedFundingRateFloor": "-0.03000000",
9526
+ // "fundingIntervalHours": 4,
9527
+ // "disclaimer": false
9528
+ // }
9514
9529
  //
9515
9530
  const timestamp = this.safeInteger(contract, 'time');
9516
9531
  const marketId = this.safeString(contract, 'symbol');
@@ -9521,6 +9536,11 @@ class binance extends binance$1 {
9521
9536
  const estimatedSettlePrice = this.safeNumber(contract, 'estimatedSettlePrice');
9522
9537
  const fundingRate = this.safeNumber(contract, 'lastFundingRate');
9523
9538
  const fundingTime = this.safeInteger(contract, 'nextFundingTime');
9539
+ const interval = this.safeString(contract, 'fundingIntervalHours');
9540
+ let intervalString = undefined;
9541
+ if (interval !== undefined) {
9542
+ intervalString = interval + 'h';
9543
+ }
9524
9544
  return {
9525
9545
  'info': contract,
9526
9546
  'symbol': symbol,
@@ -9539,7 +9559,7 @@ class binance extends binance$1 {
9539
9559
  'previousFundingRate': undefined,
9540
9560
  'previousFundingTimestamp': undefined,
9541
9561
  'previousFundingDatetime': undefined,
9542
- 'interval': undefined,
9562
+ 'interval': intervalString,
9543
9563
  };
9544
9564
  }
9545
9565
  parseAccountPositions(account, filterClosed = false) {
@@ -13680,6 +13700,51 @@ class binance extends binance$1 {
13680
13700
  'fee': undefined,
13681
13701
  };
13682
13702
  }
13703
+ async fetchFundingIntervals(symbols = undefined, params = {}) {
13704
+ /**
13705
+ * @method
13706
+ * @name binance#fetchFundingIntervals
13707
+ * @description fetch the funding rate interval for multiple markets
13708
+ * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Get-Funding-Info
13709
+ * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Get-Funding-Info
13710
+ * @param {string[]} [symbols] list of unified market symbols
13711
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
13712
+ * @param {string} [params.subType] "linear" or "inverse"
13713
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
13714
+ */
13715
+ await this.loadMarkets();
13716
+ let market = undefined;
13717
+ if (symbols !== undefined) {
13718
+ symbols = this.marketSymbols(symbols);
13719
+ market = this.market(symbols[0]);
13720
+ }
13721
+ const type = 'swap';
13722
+ let subType = undefined;
13723
+ [subType, params] = this.handleSubTypeAndParams('fetchFundingIntervals', market, params, 'linear');
13724
+ let response = undefined;
13725
+ if (this.isLinear(type, subType)) {
13726
+ response = await this.fapiPublicGetFundingInfo(params);
13727
+ }
13728
+ else if (this.isInverse(type, subType)) {
13729
+ response = await this.dapiPublicGetFundingInfo(params);
13730
+ }
13731
+ else {
13732
+ throw new errors.NotSupported(this.id + ' fetchFundingIntervals() supports linear and inverse swap contracts only');
13733
+ }
13734
+ //
13735
+ // [
13736
+ // {
13737
+ // "symbol": "BLZUSDT",
13738
+ // "adjustedFundingRateCap": "0.03000000",
13739
+ // "adjustedFundingRateFloor": "-0.03000000",
13740
+ // "fundingIntervalHours": 4,
13741
+ // "disclaimer": false
13742
+ // },
13743
+ // ]
13744
+ //
13745
+ const result = this.parseFundingRates(response, market);
13746
+ return this.filterByArray(result, 'symbol', symbols);
13747
+ }
13683
13748
  }
13684
13749
 
13685
13750
  module.exports = binance;
@@ -79,6 +79,8 @@ class bitget extends bitget$1 {
79
79
  'fetchDepositWithdrawFee': 'emulated',
80
80
  'fetchDepositWithdrawFees': true,
81
81
  'fetchFundingHistory': true,
82
+ 'fetchFundingInterval': true,
83
+ 'fetchFundingIntervals': false,
82
84
  'fetchFundingRate': true,
83
85
  'fetchFundingRateHistory': true,
84
86
  'fetchFundingRates': false,
@@ -94,6 +96,7 @@ class bitget extends bitget$1 {
94
96
  'fetchMarketLeverageTiers': true,
95
97
  'fetchMarkets': true,
96
98
  'fetchMarkOHLCV': true,
99
+ 'fetchMarkPrice': true,
97
100
  'fetchMyLiquidations': true,
98
101
  'fetchMyTrades': true,
99
102
  'fetchOHLCV': true,
@@ -2534,6 +2537,14 @@ class bitget extends bitget$1 {
2534
2537
  return this.parseOrderBook(data, market['symbol'], timestamp);
2535
2538
  }
2536
2539
  parseTicker(ticker, market = undefined) {
2540
+ //
2541
+ // {
2542
+ // "symbol": "BTCUSDT",
2543
+ // "price": "26242",
2544
+ // "indexPrice": "34867",
2545
+ // "markPrice": "25555",
2546
+ // "ts": "1695793390482"
2547
+ // }
2537
2548
  //
2538
2549
  // spot: fetchTicker, fetchTickers
2539
2550
  //
@@ -2641,6 +2652,7 @@ class bitget extends bitget$1 {
2641
2652
  'baseVolume': this.safeString(ticker, 'baseVolume'),
2642
2653
  'quoteVolume': this.safeString(ticker, 'quoteVolume'),
2643
2654
  'indexPrice': this.safeString(ticker, 'indexPrice'),
2655
+ 'markPrice': this.safeString(ticker, 'markPrice'),
2644
2656
  'info': ticker,
2645
2657
  }, market);
2646
2658
  }
@@ -2744,6 +2756,42 @@ class bitget extends bitget$1 {
2744
2756
  const data = this.safeList(response, 'data', []);
2745
2757
  return this.parseTicker(data[0], market);
2746
2758
  }
2759
+ async fetchMarkPrice(symbol, params = {}) {
2760
+ /**
2761
+ * @method
2762
+ * @name bitget#fetchMarkPrice
2763
+ * @description fetches the mark price for a specific market
2764
+ * @see https://www.bitget.com/api-doc/contract/market/Get-Symbol-Price
2765
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
2766
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2767
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
2768
+ */
2769
+ await this.loadMarkets();
2770
+ const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
2771
+ let market = undefined;
2772
+ if (sandboxMode) {
2773
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
2774
+ market = this.market(sandboxSymbol);
2775
+ }
2776
+ else {
2777
+ market = this.market(symbol);
2778
+ }
2779
+ const request = {
2780
+ 'symbol': market['id'],
2781
+ };
2782
+ let response = undefined;
2783
+ if (market['spot']) {
2784
+ throw new errors.NotSupported(this.id + ' fetchMarkPrice() is not supported for spot markets');
2785
+ }
2786
+ else {
2787
+ let productType = undefined;
2788
+ [productType, params] = this.handleProductTypeAndParams(market, params);
2789
+ request['productType'] = productType;
2790
+ response = await this.publicMixGetV2MixMarketSymbolPrice(this.extend(request, params));
2791
+ }
2792
+ const data = this.safeList(response, 'data', []);
2793
+ return this.parseTicker(data[0], market);
2794
+ }
2747
2795
  async fetchTickers(symbols = undefined, params = {}) {
2748
2796
  /**
2749
2797
  * @method
@@ -6793,14 +6841,30 @@ class bitget extends bitget$1 {
6793
6841
  return this.parseFundingRate(data[0], market);
6794
6842
  }
6795
6843
  parseFundingRate(contract, market = undefined) {
6844
+ //
6845
+ // fetchFundingRate
6796
6846
  //
6797
6847
  // {
6798
6848
  // "symbol": "BTCUSDT",
6799
6849
  // "fundingRate": "-0.000182"
6800
6850
  // }
6801
6851
  //
6852
+ // fetchFundingInterval
6853
+ //
6854
+ // {
6855
+ // "symbol": "BTCUSDT",
6856
+ // "nextFundingTime": "1727942400000",
6857
+ // "ratePeriod": "8"
6858
+ // }
6859
+ //
6802
6860
  const marketId = this.safeString(contract, 'symbol');
6803
6861
  const symbol = this.safeSymbol(marketId, market, undefined, 'swap');
6862
+ const fundingTimestamp = this.safeInteger(contract, 'nextFundingTime');
6863
+ const interval = this.safeString(contract, 'ratePeriod');
6864
+ let intervalString = undefined;
6865
+ if (interval !== undefined) {
6866
+ intervalString = interval + 'h';
6867
+ }
6804
6868
  return {
6805
6869
  'info': contract,
6806
6870
  'symbol': symbol,
@@ -6811,15 +6875,15 @@ class bitget extends bitget$1 {
6811
6875
  'timestamp': undefined,
6812
6876
  'datetime': undefined,
6813
6877
  'fundingRate': this.safeNumber(contract, 'fundingRate'),
6814
- 'fundingTimestamp': undefined,
6815
- 'fundingDatetime': undefined,
6878
+ 'fundingTimestamp': fundingTimestamp,
6879
+ 'fundingDatetime': this.iso8601(fundingTimestamp),
6816
6880
  'nextFundingRate': undefined,
6817
6881
  'nextFundingTimestamp': undefined,
6818
6882
  'nextFundingDatetime': undefined,
6819
6883
  'previousFundingRate': undefined,
6820
6884
  'previousFundingTimestamp': undefined,
6821
6885
  'previousFundingDatetime': undefined,
6822
- 'interval': undefined,
6886
+ 'interval': intervalString,
6823
6887
  };
6824
6888
  }
6825
6889
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -8790,6 +8854,51 @@ class bitget extends bitget$1 {
8790
8854
  }
8791
8855
  return result;
8792
8856
  }
8857
+ async fetchFundingInterval(symbol, params = {}) {
8858
+ /**
8859
+ * @method
8860
+ * @name bitget#fetchFundingInterval
8861
+ * @description fetch the current funding rate interval
8862
+ * @see https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time
8863
+ * @param {string} symbol unified market symbol
8864
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8865
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
8866
+ */
8867
+ await this.loadMarkets();
8868
+ const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
8869
+ let market = undefined;
8870
+ if (sandboxMode) {
8871
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
8872
+ market = this.market(sandboxSymbol);
8873
+ }
8874
+ else {
8875
+ market = this.market(symbol);
8876
+ }
8877
+ let productType = undefined;
8878
+ [productType, params] = this.handleProductTypeAndParams(market, params);
8879
+ const request = {
8880
+ 'symbol': market['id'],
8881
+ 'productType': productType,
8882
+ };
8883
+ const response = await this.publicMixGetV2MixMarketFundingTime(this.extend(request, params));
8884
+ //
8885
+ // {
8886
+ // "code": "00000",
8887
+ // "msg": "success",
8888
+ // "requestTime": 1727930153888,
8889
+ // "data": [
8890
+ // {
8891
+ // "symbol": "BTCUSDT",
8892
+ // "nextFundingTime": "1727942400000",
8893
+ // "ratePeriod": "8"
8894
+ // }
8895
+ // ]
8896
+ // }
8897
+ //
8898
+ const data = this.safeList(response, 'data', []);
8899
+ const first = this.safeDict(data, 0, {});
8900
+ return this.parseFundingRate(first, market);
8901
+ }
8793
8902
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
8794
8903
  if (!response) {
8795
8904
  return undefined; // fallback to default error handler
@@ -324,6 +324,7 @@ class bitrue extends bitrue$1 {
324
324
  // 'fetchTradesMethod': 'publicGetAggTrades', // publicGetTrades, publicGetHistoricalTrades
325
325
  'fetchMyTradesMethod': 'v2PrivateGetMyTrades',
326
326
  'hasAlreadyAuthenticatedSuccessfully': false,
327
+ 'currencyToPrecisionRoundingMode': number.TRUNCATE,
327
328
  'recvWindow': 5 * 1000,
328
329
  'timeDifference': 0,
329
330
  'adjustForTimeDifference': false,
@@ -513,15 +514,6 @@ class bitrue extends bitrue$1 {
513
514
  },
514
515
  });
515
516
  }
516
- currencyToPrecision(code, fee, networkCode = undefined) {
517
- // info is available in currencies only if the user has configured his api keys
518
- if (this.safeValue(this.currencies[code], 'precision') !== undefined) {
519
- return this.decimalToPrecision(fee, number.TRUNCATE, this.currencies[code]['precision'], this.precisionMode, this.paddingMode);
520
- }
521
- else {
522
- return this.numberToString(fee);
523
- }
524
- }
525
517
  nonce() {
526
518
  return this.milliseconds() - this.options['timeDifference'];
527
519
  }
@@ -266,6 +266,7 @@ class bitvavo extends bitvavo$1 {
266
266
  },
267
267
  },
268
268
  'options': {
269
+ 'currencyToPrecisionRoundingMode': number.TRUNCATE,
269
270
  'BITVAVO-ACCESS-WINDOW': 10000,
270
271
  'networks': {
271
272
  'ERC20': 'ETH',
@@ -278,9 +279,6 @@ class bitvavo extends bitvavo$1 {
278
279
  },
279
280
  });
280
281
  }
281
- currencyToPrecision(code, fee, networkCode = undefined) {
282
- return this.decimalToPrecision(fee, 0, this.currencies[code]['precision'], number.DECIMAL_PLACES);
283
- }
284
282
  amountToPrecision(symbol, amount) {
285
283
  // https://docs.bitfinex.com/docs/introduction#amount-precision
286
284
  // The amount field allows up to 8 decimals.
@@ -71,6 +71,8 @@ class coinex extends coinex$1 {
71
71
  'fetchDepositWithdrawFee': true,
72
72
  'fetchDepositWithdrawFees': false,
73
73
  'fetchFundingHistory': true,
74
+ 'fetchFundingInterval': true,
75
+ 'fetchFundingIntervals': false,
74
76
  'fetchFundingRate': true,
75
77
  'fetchFundingRateHistory': true,
76
78
  'fetchFundingRates': true,
@@ -4555,9 +4557,21 @@ class coinex extends coinex$1 {
4555
4557
  const first = this.safeDict(data, 0, {});
4556
4558
  return this.parseFundingRate(first, market);
4557
4559
  }
4560
+ async fetchFundingInterval(symbol, params = {}) {
4561
+ /**
4562
+ * @method
4563
+ * @name coinex#fetchFundingInterval
4564
+ * @description fetch the current funding rate interval
4565
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-funding-rate
4566
+ * @param {string} symbol unified market symbol
4567
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4568
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
4569
+ */
4570
+ return await this.fetchFundingRate(symbol, params);
4571
+ }
4558
4572
  parseFundingRate(contract, market = undefined) {
4559
4573
  //
4560
- // fetchFundingRate, fetchFundingRates
4574
+ // fetchFundingRate, fetchFundingRates, fetchFundingInterval
4561
4575
  //
4562
4576
  // {
4563
4577
  // "latest_funding_rate": "0",
@@ -160,6 +160,7 @@ class cryptocom extends cryptocom$1 {
160
160
  'public/get-valuations': 1,
161
161
  'public/get-expired-settlement-price': 10 / 3,
162
162
  'public/get-insurance': 1,
163
+ 'public/get-risk-parameters': 1,
163
164
  },
164
165
  'post': {
165
166
  'public/staking/get-conversion-rate': 2,
@@ -52,6 +52,8 @@ class digifinex extends digifinex$1 {
52
52
  'fetchDepositWithdrawFee': 'emulated',
53
53
  'fetchDepositWithdrawFees': true,
54
54
  'fetchFundingHistory': true,
55
+ 'fetchFundingInterval': true,
56
+ 'fetchFundingIntervals': false,
55
57
  'fetchFundingRate': true,
56
58
  'fetchFundingRateHistory': true,
57
59
  'fetchFundingRates': false,
@@ -3249,9 +3251,21 @@ class digifinex extends digifinex$1 {
3249
3251
  // }
3250
3252
  // }
3251
3253
  //
3252
- const data = this.safeValue(response, 'data', {});
3254
+ const data = this.safeDict(response, 'data', {});
3253
3255
  return this.parseFundingRate(data, market);
3254
3256
  }
3257
+ async fetchFundingInterval(symbol, params = {}) {
3258
+ /**
3259
+ * @method
3260
+ * @name digifinex#fetchFundingInterval
3261
+ * @description fetch the current funding rate interval
3262
+ * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#currentfundingrate
3263
+ * @param {string} symbol unified market symbol
3264
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3265
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
3266
+ */
3267
+ return await this.fetchFundingRate(symbol, params);
3268
+ }
3255
3269
  parseFundingRate(contract, market = undefined) {
3256
3270
  //
3257
3271
  // {
@@ -307,6 +307,7 @@ class huobijp extends huobijp$1 {
307
307
  'fetchMarketsMethod': 'publicGetCommonSymbols',
308
308
  'fetchBalanceMethod': 'privateGetAccountAccountsIdBalance',
309
309
  'createOrderMethod': 'privatePostOrderOrdersPlace',
310
+ 'currencyToPrecisionRoundingMode': number.TRUNCATE,
310
311
  'language': 'en-US',
311
312
  'broker': {
312
313
  'id': 'AA03022abc',
@@ -1645,9 +1646,6 @@ class huobijp extends huobijp$1 {
1645
1646
  }),
1646
1647
  ];
1647
1648
  }
1648
- currencyToPrecision(code, fee, networkCode = undefined) {
1649
- return this.decimalToPrecision(fee, 0, this.currencies[code]['precision'], this.precisionMode);
1650
- }
1651
1649
  parseDepositAddress(depositAddress, currency = undefined) {
1652
1650
  //
1653
1651
  // {
@@ -78,6 +78,8 @@ class kucoin extends kucoin$1 {
78
78
  'fetchMarketLeverageTiers': false,
79
79
  'fetchMarkets': true,
80
80
  'fetchMarkOHLCV': false,
81
+ 'fetchMarkPrice': true,
82
+ 'fetchMarkPrices': true,
81
83
  'fetchMyTrades': true,
82
84
  'fetchOHLCV': true,
83
85
  'fetchOpenInterest': false,
@@ -1660,7 +1662,7 @@ class kucoin extends kucoin$1 {
1660
1662
  const symbol = market['symbol'];
1661
1663
  const baseVolume = this.safeString(ticker, 'vol');
1662
1664
  const quoteVolume = this.safeString(ticker, 'volValue');
1663
- const timestamp = this.safeInteger2(ticker, 'time', 'datetime');
1665
+ const timestamp = this.safeIntegerN(ticker, ['time', 'datetime', 'timePoint']);
1664
1666
  return this.safeTicker({
1665
1667
  'symbol': symbol,
1666
1668
  'timestamp': timestamp,
@@ -1681,6 +1683,7 @@ class kucoin extends kucoin$1 {
1681
1683
  'average': this.safeString(ticker, 'averagePrice'),
1682
1684
  'baseVolume': baseVolume,
1683
1685
  'quoteVolume': quoteVolume,
1686
+ 'markPrice': this.safeString(ticker, 'value'),
1684
1687
  'info': ticker,
1685
1688
  }, market);
1686
1689
  }
@@ -1739,6 +1742,22 @@ class kucoin extends kucoin$1 {
1739
1742
  }
1740
1743
  return this.filterByArrayTickers(result, 'symbol', symbols);
1741
1744
  }
1745
+ async fetchMarkPrices(symbols = undefined, params = {}) {
1746
+ /**
1747
+ * @method
1748
+ * @name kucoin#fetchMarkPrices
1749
+ * @description fetches the mark price for multiple markets
1750
+ * @see https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices
1751
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1752
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1753
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1754
+ */
1755
+ await this.loadMarkets();
1756
+ symbols = this.marketSymbols(symbols);
1757
+ const response = await this.publicGetMarkPriceAllSymbols(params);
1758
+ const data = this.safeList(response, 'data', []);
1759
+ return this.parseTickers(data);
1760
+ }
1742
1761
  async fetchTicker(symbol, params = {}) {
1743
1762
  /**
1744
1763
  * @method
@@ -1781,6 +1800,26 @@ class kucoin extends kucoin$1 {
1781
1800
  const data = this.safeDict(response, 'data', {});
1782
1801
  return this.parseTicker(data, market);
1783
1802
  }
1803
+ async fetchMarkPrice(symbol, params = {}) {
1804
+ /**
1805
+ * @method
1806
+ * @name kucoin#fetchMarkPrice
1807
+ * @description fetches the mark price for a specific market
1808
+ * @see https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-mark-price
1809
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
1810
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1811
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
1812
+ */
1813
+ await this.loadMarkets();
1814
+ const market = this.market(symbol);
1815
+ const request = {
1816
+ 'symbol': market['id'],
1817
+ };
1818
+ const response = await this.publicGetMarkPriceSymbolCurrent(this.extend(request, params));
1819
+ //
1820
+ const data = this.safeDict(response, 'data', {});
1821
+ return this.parseTicker(data, market);
1822
+ }
1784
1823
  parseOHLCV(ohlcv, market = undefined) {
1785
1824
  //
1786
1825
  // [