ccxt 4.4.75 → 4.4.78

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 (114) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +8 -4
  4. package/dist/cjs/src/abstract/apex.js +9 -0
  5. package/dist/cjs/src/apex.js +1949 -0
  6. package/dist/cjs/src/base/Exchange.js +49 -3
  7. package/dist/cjs/src/binance.js +44 -220
  8. package/dist/cjs/src/bitget.js +139 -71
  9. package/dist/cjs/src/bitmex.js +4 -4
  10. package/dist/cjs/src/bitrue.js +48 -0
  11. package/dist/cjs/src/cex.js +1 -1
  12. package/dist/cjs/src/coinbase.js +32 -3
  13. package/dist/cjs/src/coincatch.js +68 -0
  14. package/dist/cjs/src/coinex.js +3 -0
  15. package/dist/cjs/src/coinlist.js +85 -1
  16. package/dist/cjs/src/hitbtc.js +3 -0
  17. package/dist/cjs/src/hyperliquid.js +13 -4
  18. package/dist/cjs/src/mexc.js +50 -57
  19. package/dist/cjs/src/okx.js +23 -8
  20. package/dist/cjs/src/paradex.js +3 -12
  21. package/dist/cjs/src/phemex.js +2 -1
  22. package/dist/cjs/src/poloniex.js +1 -1
  23. package/dist/cjs/src/pro/apex.js +1043 -0
  24. package/dist/cjs/src/pro/coinbase.js +4 -8
  25. package/dist/cjs/src/pro/gate.js +27 -2
  26. package/dist/cjs/src/pro/hollaex.js +2 -2
  27. package/dist/cjs/src/pro/hyperliquid.js +1 -1
  28. package/dist/cjs/src/pro/p2b.js +2 -2
  29. package/dist/cjs/src/pro/tradeogre.js +283 -0
  30. package/dist/cjs/src/probit.js +1 -0
  31. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +2645 -0
  32. package/dist/cjs/src/tradeogre.js +2 -1
  33. package/dist/cjs/src/upbit.js +299 -93
  34. package/dist/cjs/src/whitebit.js +1 -0
  35. package/dist/cjs/src/woo.js +3 -1
  36. package/dist/cjs/src/xt.js +131 -4
  37. package/js/ccxt.d.ts +11 -5
  38. package/js/ccxt.js +8 -4
  39. package/js/src/abstract/apex.d.ts +34 -0
  40. package/js/src/abstract/myokx.d.ts +4 -0
  41. package/js/src/abstract/okx.d.ts +4 -0
  42. package/js/src/abstract/upbit.d.ts +15 -1
  43. package/js/src/abstract/xt.d.ts +3 -0
  44. package/js/src/apex.d.ts +333 -0
  45. package/js/src/apex.js +1951 -0
  46. package/js/src/ascendex.d.ts +3 -3
  47. package/js/src/base/Exchange.d.ts +3 -0
  48. package/js/src/base/Exchange.js +49 -2
  49. package/js/src/binance.d.ts +9 -7
  50. package/js/src/binance.js +44 -220
  51. package/js/src/bitfinex.d.ts +3 -3
  52. package/js/src/bitflyer.d.ts +2 -2
  53. package/js/src/bitget.d.ts +2 -0
  54. package/js/src/bitget.js +139 -71
  55. package/js/src/bitmart.d.ts +4 -4
  56. package/js/src/bitmex.d.ts +3 -3
  57. package/js/src/bitmex.js +4 -4
  58. package/js/src/bitrue.js +48 -0
  59. package/js/src/cex.js +1 -1
  60. package/js/src/coinbase.d.ts +6 -4
  61. package/js/src/coinbase.js +32 -3
  62. package/js/src/coinbaseexchange.d.ts +1 -1
  63. package/js/src/coincatch.d.ts +11 -0
  64. package/js/src/coincatch.js +68 -0
  65. package/js/src/coinex.js +3 -0
  66. package/js/src/coinlist.d.ts +12 -1
  67. package/js/src/coinlist.js +85 -1
  68. package/js/src/cryptocom.d.ts +4 -4
  69. package/js/src/deribit.d.ts +4 -4
  70. package/js/src/derive.d.ts +3 -3
  71. package/js/src/digifinex.d.ts +4 -4
  72. package/js/src/hitbtc.js +3 -0
  73. package/js/src/htx.d.ts +4 -4
  74. package/js/src/hyperliquid.d.ts +1 -0
  75. package/js/src/hyperliquid.js +13 -4
  76. package/js/src/kraken.d.ts +3 -3
  77. package/js/src/krakenfutures.d.ts +2 -2
  78. package/js/src/kucoinfutures.d.ts +5 -5
  79. package/js/src/mexc.d.ts +1 -0
  80. package/js/src/mexc.js +50 -57
  81. package/js/src/okx.js +23 -8
  82. package/js/src/oxfun.d.ts +3 -3
  83. package/js/src/paradex.js +3 -12
  84. package/js/src/phemex.d.ts +3 -3
  85. package/js/src/phemex.js +2 -1
  86. package/js/src/poloniex.d.ts +3 -3
  87. package/js/src/poloniex.js +1 -1
  88. package/js/src/pro/apex.d.ts +160 -0
  89. package/js/src/pro/apex.js +1044 -0
  90. package/js/src/pro/coinbase.js +4 -8
  91. package/js/src/pro/gate.js +27 -2
  92. package/js/src/pro/hollaex.js +2 -2
  93. package/js/src/pro/hyperliquid.js +1 -1
  94. package/js/src/pro/p2b.js +2 -2
  95. package/js/src/pro/tradeogre.d.ts +49 -0
  96. package/js/src/pro/tradeogre.js +284 -0
  97. package/js/src/probit.js +1 -0
  98. package/js/src/static_dependencies/zklink/zklink-sdk-web.d.ts +1279 -0
  99. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +4282 -0
  100. package/js/src/tradeogre.js +2 -1
  101. package/js/src/upbit.d.ts +34 -4
  102. package/js/src/upbit.js +299 -93
  103. package/js/src/vertex.d.ts +3 -3
  104. package/js/src/whitebit.js +1 -0
  105. package/js/src/woo.d.ts +4 -4
  106. package/js/src/woo.js +3 -1
  107. package/js/src/woofipro.d.ts +4 -4
  108. package/js/src/xt.d.ts +23 -4
  109. package/js/src/xt.js +131 -4
  110. package/package.json +2 -2
  111. package/js/src/abstract/ace.d.ts +0 -18
  112. package/js/src/ace.d.ts +0 -158
  113. package/js/src/ace.js +0 -1181
  114. /package/js/src/abstract/{ace.js → apex.js} +0 -0
@@ -1371,28 +1371,44 @@ class bitget extends bitget$1 {
1371
1371
  'fillResponseFromRequest': true,
1372
1372
  },
1373
1373
  'fetchOHLCV': {
1374
- 'spot': {
1375
- 'method': 'publicSpotGetV2SpotMarketCandles', // publicSpotGetV2SpotMarketCandles or publicSpotGetV2SpotMarketHistoryCandles
1376
- },
1377
- 'swap': {
1378
- 'method': 'publicMixGetV2MixMarketCandles', // publicMixGetV2MixMarketCandles or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
1379
- },
1380
- 'maxDaysPerTimeframe': {
1374
+ // ### Timeframe settings ###
1375
+ // after testing, the below values are real ones, because the values provided by API DOCS are wrong
1376
+ // so, start timestamp should be within these thresholds to be able to call "recent" candles endpoint
1377
+ 'maxRecentDaysPerTimeframe': {
1381
1378
  '1m': 30,
1382
1379
  '3m': 30,
1383
1380
  '5m': 30,
1384
- '10m': 30,
1385
- '15m': 52,
1386
- '30m': 62,
1387
- '1h': 83,
1388
- '2h': 120,
1381
+ '15m': 30,
1382
+ '30m': 30,
1383
+ '1h': 60,
1389
1384
  '4h': 240,
1390
1385
  '6h': 360,
1391
- '12h': 360,
1392
- '1d': 300,
1393
- '3d': 300,
1394
- '1w': 300,
1395
- '1M': 300,
1386
+ '12h': 720,
1387
+ '1d': 1440,
1388
+ '3d': 1440 * 3,
1389
+ '1w': 1440 * 7,
1390
+ '1M': 1440 * 30,
1391
+ },
1392
+ 'spot': {
1393
+ 'maxLimitPerTimeframe': {
1394
+ '1d': 300,
1395
+ '3d': 100,
1396
+ '1w': 100,
1397
+ '1M': 100,
1398
+ },
1399
+ 'method': 'publicSpotGetV2SpotMarketCandles', // publicSpotGetV2SpotMarketCandles or publicSpotGetV2SpotMarketHistoryCandles
1400
+ },
1401
+ 'swap': {
1402
+ 'maxLimitPerTimeframe': {
1403
+ '4h': 540,
1404
+ '6h': 360,
1405
+ '12h': 180,
1406
+ '1d': 90,
1407
+ '3d': 30,
1408
+ '1w': 13,
1409
+ '1M': 4,
1410
+ },
1411
+ 'method': 'publicMixGetV2MixMarketCandles', // publicMixGetV2MixMarketCandles or publicMixGetV2MixMarketHistoryCandles or publicMixGetV2MixMarketHistoryIndexCandles or publicMixGetV2MixMarketHistoryMarkCandles
1396
1412
  },
1397
1413
  },
1398
1414
  'fetchTrades': {
@@ -1403,6 +1419,9 @@ class bitget extends bitget$1 {
1403
1419
  'method': 'publicMixGetV2MixMarketFillsHistory', // or publicMixGetV2MixMarketFills
1404
1420
  },
1405
1421
  },
1422
+ 'fetchFundingRate': {
1423
+ 'method': 'publicMixGetV2MixMarketCurrentFundRate', // or publicMixGetV2MixMarketFundingTime
1424
+ },
1406
1425
  'accountsByType': {
1407
1426
  'spot': 'spot',
1408
1427
  'cross': 'crossed_margin',
@@ -1599,7 +1618,7 @@ class bitget extends bitget$1 {
1599
1618
  'symbolRequired': false,
1600
1619
  },
1601
1620
  'fetchOHLCV': {
1602
- 'limit': 1000, // variable timespans for recent endpoint, 200 for historical
1621
+ 'limit': 200, // variable timespans for recent endpoint, 200 for historical
1603
1622
  },
1604
1623
  },
1605
1624
  'forPerps': {
@@ -1674,13 +1693,12 @@ class bitget extends bitget$1 {
1674
1693
  let defaultProductType = undefined;
1675
1694
  if ((subType !== undefined) && (market === undefined)) {
1676
1695
  // set default only if subType is defined and market is not defined, since there is also USDC productTypes which are also linear
1677
- const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
1678
- if (sandboxMode) {
1679
- defaultProductType = (subType === 'linear') ? 'SUSDT-FUTURES' : 'SCOIN-FUTURES';
1680
- }
1681
- else {
1682
- defaultProductType = (subType === 'linear') ? 'USDT-FUTURES' : 'COIN-FUTURES';
1683
- }
1696
+ // const sandboxMode = this.safeBool (this.options, 'sandboxMode', false);
1697
+ // if (sandboxMode) {
1698
+ // defaultProductType = (subType === 'linear') ? 'SUSDT-FUTURES' : 'SCOIN-FUTURES';
1699
+ // } else {
1700
+ defaultProductType = (subType === 'linear') ? 'USDT-FUTURES' : 'COIN-FUTURES';
1701
+ // }
1684
1702
  }
1685
1703
  let productType = this.safeString(params, 'productType', defaultProductType);
1686
1704
  if ((productType === undefined) && (market !== undefined)) {
@@ -3284,7 +3302,7 @@ class bitget extends bitget$1 {
3284
3302
  }
3285
3303
  }
3286
3304
  else {
3287
- request['businessType'] = 'contract';
3305
+ request['businessType'] = 'mix';
3288
3306
  }
3289
3307
  const response = await this.privateCommonGetV2CommonTradeRate(this.extend(request, params));
3290
3308
  //
@@ -3489,34 +3507,36 @@ class bitget extends bitget$1 {
3489
3507
  const market = this.market(symbol);
3490
3508
  const marketType = market['spot'] ? 'spot' : 'swap';
3491
3509
  const timeframes = this.options['timeframes'][marketType];
3492
- const msInDay = 86400000;
3493
- const duration = this.parseTimeframe(timeframe) * 1000;
3494
3510
  const request = {
3495
3511
  'symbol': market['id'],
3496
3512
  'granularity': this.safeString(timeframes, timeframe, timeframe),
3497
3513
  };
3514
+ const msInDay = 86400000;
3515
+ const now = this.milliseconds();
3516
+ const duration = this.parseTimeframe(timeframe) * 1000;
3498
3517
  const until = this.safeInteger(params, 'until');
3499
3518
  const limitDefined = limit !== undefined;
3500
3519
  const sinceDefined = since !== undefined;
3501
3520
  const untilDefined = until !== undefined;
3502
3521
  params = this.omit(params, ['until']);
3503
- let response = undefined;
3504
- const now = this.milliseconds();
3505
3522
  // retrievable periods listed here:
3506
3523
  // - https://www.bitget.com/api-doc/spot/market/Get-Candle-Data#request-parameters
3507
3524
  // - https://www.bitget.com/api-doc/contract/market/Get-Candle-Data#description
3508
- const ohlcOptions = this.safeDict(this.options, 'fetchOHLCV', {});
3509
- const retrievableDaysMap = this.safeDict(ohlcOptions, 'maxDaysPerTimeframe', {});
3510
- const maxRetrievableDaysForRecent = this.safeInteger(retrievableDaysMap, timeframe, 30); // default to safe minimum
3511
- const endpointTsBoundary = now - (maxRetrievableDaysForRecent - 1) * msInDay;
3525
+ const key = market['spot'] ? 'spot' : 'swap';
3526
+ const ohlcOptions = this.safeDict(this.options['fetchOHLCV'], key, {});
3527
+ const maxLimitPerTimeframe = this.safeDict(ohlcOptions, 'maxLimitPerTimeframe', {});
3528
+ const maxLimitForThisTimeframe = this.safeInteger(maxLimitPerTimeframe, timeframe, limit);
3529
+ const recentEndpointDaysMap = this.safeDict(this.options['fetchOHLCV'], 'maxRecentDaysPerTimeframe', {});
3530
+ const recentEndpointAvailableDays = this.safeInteger(recentEndpointDaysMap, timeframe);
3531
+ const recentEndpointBoundaryTs = now - (recentEndpointAvailableDays - 1) * msInDay;
3512
3532
  if (limitDefined) {
3513
3533
  limit = Math.min(limit, maxLimitForRecentEndpoint);
3514
- request['limit'] = limit;
3534
+ limit = Math.min(limit, maxLimitForThisTimeframe);
3515
3535
  }
3516
3536
  else {
3517
3537
  limit = defaultLimit;
3518
3538
  }
3519
- const limitMultipliedDuration = limit * duration;
3539
+ let limitMultipliedDuration = limit * duration;
3520
3540
  // exchange aligns from endTime, so it's important, not startTime
3521
3541
  // startTime is supported only on "recent" endpoint, not on "historical" endpoint
3522
3542
  let calculatedStartTime = undefined;
@@ -3537,17 +3557,32 @@ class bitget extends bitget$1 {
3537
3557
  // we do not need to set "startTime" here
3538
3558
  }
3539
3559
  }
3540
- const historicalEndpointNeeded = (calculatedStartTime !== undefined) && (calculatedStartTime <= endpointTsBoundary);
3541
- if (historicalEndpointNeeded) {
3560
+ // if historical endpoint is needed, we should re-set the variables
3561
+ let historicalEndpointNeeded = false;
3562
+ if ((calculatedStartTime !== undefined && calculatedStartTime <= recentEndpointBoundaryTs) || useHistoryEndpoint) {
3563
+ historicalEndpointNeeded = true;
3542
3564
  // only for "historical-candles" - ensure we use correct max limit
3543
- if (limitDefined) {
3544
- request['limit'] = Math.min(limit, maxLimitForHistoryEndpoint);
3565
+ limit = Math.min(limit, maxLimitForHistoryEndpoint);
3566
+ limitMultipliedDuration = limit * duration;
3567
+ calculatedStartTime = calculatedEndTime - limitMultipliedDuration;
3568
+ request['startTime'] = calculatedStartTime;
3569
+ // for contract, maximum 90 days allowed between start-end times
3570
+ if (!market['spot']) {
3571
+ const maxDistanceDaysForContracts = 90;
3572
+ // only correct if request is larger
3573
+ if (calculatedEndTime - calculatedStartTime > maxDistanceDaysForContracts * msInDay) {
3574
+ calculatedEndTime = this.sum(calculatedStartTime, maxDistanceDaysForContracts * msInDay);
3575
+ request['endTime'] = calculatedEndTime;
3576
+ }
3545
3577
  }
3546
3578
  }
3579
+ // we need to set limit to safely cover the period
3580
+ request['limit'] = limit;
3547
3581
  // make request
3582
+ let response = undefined;
3548
3583
  if (market['spot']) {
3549
3584
  // checks if we need history endpoint
3550
- if (historicalEndpointNeeded || useHistoryEndpoint) {
3585
+ if (historicalEndpointNeeded) {
3551
3586
  response = await this.publicSpotGetV2SpotMarketHistoryCandles(this.extend(request, params));
3552
3587
  }
3553
3588
  else {
@@ -3555,16 +3590,6 @@ class bitget extends bitget$1 {
3555
3590
  }
3556
3591
  }
3557
3592
  else {
3558
- const maxDistanceDaysForContracts = 90; // for contract, maximum 90 days allowed between start-end times
3559
- // only correct the request to fix 90 days if until was auto-calculated
3560
- if (sinceDefined) {
3561
- if (!untilDefined) {
3562
- request['endTime'] = Math.min(calculatedEndTime, this.sum(since, maxDistanceDaysForContracts * msInDay));
3563
- }
3564
- else if (calculatedEndTime - calculatedStartTime > maxDistanceDaysForContracts * msInDay) {
3565
- throw new errors.BadRequest(this.id + ' fetchOHLCV() between start and end must be less than ' + maxDistanceDaysForContracts.toString() + ' days');
3566
- }
3567
- }
3568
3593
  let priceType = undefined;
3569
3594
  [priceType, params] = this.handleParamString(params, 'price');
3570
3595
  let productType = undefined;
@@ -3579,7 +3604,7 @@ class bitget extends bitget$1 {
3579
3604
  response = await this.publicMixGetV2MixMarketHistoryIndexCandles(extended);
3580
3605
  }
3581
3606
  else {
3582
- if (historicalEndpointNeeded || useHistoryEndpoint) {
3607
+ if (historicalEndpointNeeded) {
3583
3608
  response = await this.publicMixGetV2MixMarketHistoryCandles(extended);
3584
3609
  }
3585
3610
  else {
@@ -6816,8 +6841,10 @@ class bitget extends bitget$1 {
6816
6841
  * @name bitget#fetchFundingRate
6817
6842
  * @description fetch the current funding rate
6818
6843
  * @see https://www.bitget.com/api-doc/contract/market/Get-Current-Funding-Rate
6844
+ * @see https://www.bitget.com/api-doc/contract/market/Get-Symbol-Next-Funding-Time
6819
6845
  * @param {string} symbol unified market symbol
6820
6846
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6847
+ * @param {string} [params.method] either (default) 'publicMixGetV2MixMarketCurrentFundRate' or 'publicMixGetV2MixMarketFundingTime'
6821
6848
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
6822
6849
  */
6823
6850
  async fetchFundingRate(symbol, params = {}) {
@@ -6832,21 +6859,47 @@ class bitget extends bitget$1 {
6832
6859
  'symbol': market['id'],
6833
6860
  'productType': productType,
6834
6861
  };
6835
- const response = await this.publicMixGetV2MixMarketCurrentFundRate(this.extend(request, params));
6836
- //
6837
- // {
6838
- // "code": "00000",
6839
- // "msg": "success",
6840
- // "requestTime": 1700811542124,
6841
- // "data": [
6842
- // {
6843
- // "symbol": "BTCUSDT",
6844
- // "fundingRate": "0.000106"
6845
- // }
6846
- // ]
6847
- // }
6848
- //
6849
- const data = this.safeValue(response, 'data', []);
6862
+ let method = undefined;
6863
+ [method, params] = this.handleOptionAndParams(params, 'fetchFundingRate', 'method', 'publicMixGetV2MixMarketCurrentFundRate');
6864
+ let response = undefined;
6865
+ if (method === 'publicMixGetV2MixMarketCurrentFundRate') {
6866
+ response = await this.publicMixGetV2MixMarketCurrentFundRate(this.extend(request, params));
6867
+ //
6868
+ // {
6869
+ // "code": "00000",
6870
+ // "msg": "success",
6871
+ // "requestTime": 1745500709429,
6872
+ // "data": [
6873
+ // {
6874
+ // "symbol": "BTCUSDT",
6875
+ // "fundingRate": "-0.000013",
6876
+ // "fundingRateInterval": "8",
6877
+ // "nextUpdate": "1745510400000",
6878
+ // "minFundingRate": "-0.003",
6879
+ // "maxFundingRate": "0.003"
6880
+ // }
6881
+ // ]
6882
+ // }
6883
+ //
6884
+ }
6885
+ else if (method === 'publicMixGetV2MixMarketFundingTime') {
6886
+ response = await this.publicMixGetV2MixMarketFundingTime(this.extend(request, params));
6887
+ //
6888
+ // {
6889
+ // "code": "00000",
6890
+ // "msg": "success",
6891
+ // "requestTime": 1745402092428,
6892
+ // "data": [
6893
+ // {
6894
+ // "symbol": "BTCUSDT",
6895
+ // "nextFundingTime": "1745424000000",
6896
+ // "ratePeriod": "8"
6897
+ // }
6898
+ // ]
6899
+ // }
6900
+ //
6901
+ }
6902
+ const data = this.safeList(response, 'data', []);
6850
6903
  return this.parseFundingRate(data[0], market);
6851
6904
  }
6852
6905
  /**
@@ -6910,11 +6963,23 @@ class bitget extends bitget$1 {
6910
6963
  }
6911
6964
  parseFundingRate(contract, market = undefined) {
6912
6965
  //
6913
- // fetchFundingRate
6966
+ // fetchFundingRate: publicMixGetV2MixMarketCurrentFundRate
6914
6967
  //
6915
6968
  // {
6916
6969
  // "symbol": "BTCUSDT",
6917
- // "fundingRate": "-0.000182"
6970
+ // "fundingRate": "-0.000013",
6971
+ // "fundingRateInterval": "8",
6972
+ // "nextUpdate": "1745510400000",
6973
+ // "minFundingRate": "-0.003",
6974
+ // "maxFundingRate": "0.003"
6975
+ // }
6976
+ //
6977
+ // fetchFundingRate: publicMixGetV2MixMarketFundingTime
6978
+ //
6979
+ // {
6980
+ // "symbol": "BTCUSDT",
6981
+ // "nextFundingTime": "1745424000000",
6982
+ // "ratePeriod": "8"
6918
6983
  // }
6919
6984
  //
6920
6985
  // fetchFundingInterval
@@ -6924,7 +6989,9 @@ class bitget extends bitget$1 {
6924
6989
  // "nextFundingTime": "1727942400000",
6925
6990
  // "ratePeriod": "8"
6926
6991
  // }
6992
+ //
6927
6993
  // fetchFundingRates
6994
+ //
6928
6995
  // {
6929
6996
  // "symbol": "BTCUSD",
6930
6997
  // "lastPr": "29904.5",
@@ -6950,10 +7017,11 @@ class bitget extends bitget$1 {
6950
7017
  // "open24h": "0",
6951
7018
  // "markPrice": "12345"
6952
7019
  // }
7020
+ //
6953
7021
  const marketId = this.safeString(contract, 'symbol');
6954
7022
  const symbol = this.safeSymbol(marketId, market, undefined, 'swap');
6955
- const fundingTimestamp = this.safeInteger(contract, 'nextFundingTime');
6956
- const interval = this.safeString(contract, 'ratePeriod');
7023
+ const fundingTimestamp = this.safeInteger2(contract, 'nextFundingTime', 'nextUpdate');
7024
+ const interval = this.safeString2(contract, 'ratePeriod', 'fundingRateInterval');
6957
7025
  const timestamp = this.safeInteger(contract, 'ts');
6958
7026
  const markPrice = this.safeNumber(contract, 'markPrice');
6959
7027
  const indexPrice = this.safeNumber(contract, 'indexPrice');
@@ -732,7 +732,7 @@ class bitmex extends bitmex$1 {
732
732
  const isQuanto = this.safeValue(market, 'isQuanto'); // this is true when BASE and SETTLE are different, i.e. AXS/XXX:BTC
733
733
  const linear = contract ? (!isInverse && !isQuanto) : undefined;
734
734
  const status = this.safeString(market, 'state');
735
- const active = status !== 'Unlisted';
735
+ const active = status === 'Open'; // Open, Settled, Unlisted
736
736
  let expiry = undefined;
737
737
  let expiryDatetime = undefined;
738
738
  let symbol = undefined;
@@ -749,9 +749,9 @@ class bitmex extends bitmex$1 {
749
749
  const multiplierString = Precise["default"].stringAbs(this.safeString(market, 'multiplier'));
750
750
  contractSize = this.parseNumber(multiplierString);
751
751
  }
752
- if (future) {
753
- expiryDatetime = this.safeString(market, 'expiry');
754
- expiry = this.parse8601(expiryDatetime);
752
+ expiryDatetime = this.safeString(market, 'expiry');
753
+ expiry = this.parse8601(expiryDatetime);
754
+ if (expiry !== undefined) {
755
755
  symbol = symbol + '-' + this.yymmdd(expiry);
756
756
  }
757
757
  }
@@ -30,20 +30,32 @@ class bitrue extends bitrue$1 {
30
30
  'swap': true,
31
31
  'future': false,
32
32
  'option': false,
33
+ 'addMargin': false,
34
+ 'borrowCrossMargin': false,
35
+ 'borrowIsolatedMargin': false,
36
+ 'borrowMargin': false,
33
37
  'cancelAllOrders': true,
34
38
  'cancelOrder': true,
39
+ 'closeAllPositions': false,
40
+ 'closePosition': false,
35
41
  'createMarketBuyOrderWithCost': true,
36
42
  'createMarketOrderWithCost': false,
37
43
  'createMarketSellOrderWithCost': false,
38
44
  'createOrder': true,
45
+ 'createOrderWithTakeProfitAndStopLoss': false,
46
+ 'createOrderWithTakeProfitAndStopLossWs': false,
39
47
  'createReduceOnlyOrder': true,
40
48
  'createStopLimitOrder': true,
41
49
  'createStopMarketOrder': true,
42
50
  'createStopOrder': true,
43
51
  'fetchBalance': true,
44
52
  'fetchBidsAsks': true,
53
+ 'fetchBorrowInterest': false,
54
+ 'fetchBorrowRate': false,
45
55
  'fetchBorrowRateHistories': false,
46
56
  'fetchBorrowRateHistory': false,
57
+ 'fetchBorrowRates': false,
58
+ 'fetchBorrowRatesPerSymbol': false,
47
59
  'fetchClosedOrders': true,
48
60
  'fetchCrossBorrowRate': false,
49
61
  'fetchCrossBorrowRates': false,
@@ -54,20 +66,50 @@ class bitrue extends bitrue$1 {
54
66
  'fetchDepositWithdrawFee': 'emulated',
55
67
  'fetchDepositWithdrawFees': true,
56
68
  'fetchFundingHistory': false,
69
+ 'fetchFundingInterval': false,
70
+ 'fetchFundingIntervals': false,
57
71
  'fetchFundingRate': false,
58
72
  'fetchFundingRateHistory': false,
59
73
  'fetchFundingRates': false,
74
+ 'fetchGreeks': false,
75
+ 'fetchIndexOHLCV': false,
60
76
  'fetchIsolatedBorrowRate': false,
61
77
  'fetchIsolatedBorrowRates': false,
78
+ 'fetchIsolatedPositions': false,
79
+ 'fetchLeverage': false,
80
+ 'fetchLeverages': false,
81
+ 'fetchLeverageTiers': false,
82
+ 'fetchLiquidations': false,
83
+ 'fetchLongShortRatio': false,
84
+ 'fetchLongShortRatioHistory': false,
85
+ 'fetchMarginAdjustmentHistory': false,
62
86
  'fetchMarginMode': false,
87
+ 'fetchMarginModes': false,
88
+ 'fetchMarketLeverageTiers': false,
63
89
  'fetchMarkets': true,
90
+ 'fetchMarkOHLCV': false,
91
+ 'fetchMarkPrices': false,
92
+ 'fetchMyLiquidations': false,
93
+ 'fetchMySettlementHistory': false,
64
94
  'fetchMyTrades': true,
65
95
  'fetchOHLCV': true,
96
+ 'fetchOpenInterest': false,
97
+ 'fetchOpenInterestHistory': false,
98
+ 'fetchOpenInterests': false,
66
99
  'fetchOpenOrders': true,
100
+ 'fetchOption': false,
101
+ 'fetchOptionChain': false,
67
102
  'fetchOrder': true,
68
103
  'fetchOrderBook': true,
69
104
  'fetchOrders': false,
105
+ 'fetchPosition': false,
106
+ 'fetchPositionHistory': false,
70
107
  'fetchPositionMode': false,
108
+ 'fetchPositions': false,
109
+ 'fetchPositionsHistory': false,
110
+ 'fetchPositionsRisk': false,
111
+ 'fetchPremiumIndexOHLCV': false,
112
+ 'fetchSettlementHistory': false,
71
113
  'fetchStatus': true,
72
114
  'fetchTicker': true,
73
115
  'fetchTickers': true,
@@ -78,9 +120,15 @@ class bitrue extends bitrue$1 {
78
120
  'fetchTransactionFees': false,
79
121
  'fetchTransactions': false,
80
122
  'fetchTransfers': true,
123
+ 'fetchVolatilityHistory': false,
81
124
  'fetchWithdrawals': true,
125
+ 'reduceMargin': false,
126
+ 'repayCrossMargin': false,
127
+ 'repayIsolatedMargin': false,
82
128
  'setLeverage': true,
83
129
  'setMargin': true,
130
+ 'setMarginMode': false,
131
+ 'setPositionMode': false,
84
132
  'transfer': true,
85
133
  'withdraw': true,
86
134
  },
@@ -550,7 +550,7 @@ class cex extends cex$1 {
550
550
  'askVolume': undefined,
551
551
  'vwap': undefined,
552
552
  'open': undefined,
553
- 'close': this.safeString(ticker, 'lastTradePrice'),
553
+ 'close': this.safeString(ticker, 'last'),
554
554
  'previousClose': undefined,
555
555
  'change': this.safeNumber(ticker, 'priceChange'),
556
556
  'percentage': this.safeNumber(ticker, 'priceChangePercentage'),
@@ -375,7 +375,8 @@ class coinbase extends coinbase$1 {
375
375
  'fetchAccounts': 'fetchAccountsV3',
376
376
  'fetchBalance': 'v2PrivateGetAccounts',
377
377
  'fetchTime': 'v2PublicGetTime',
378
- 'user_native_currency': 'USD', // needed to get fees for v3
378
+ 'user_native_currency': 'USD',
379
+ 'aliasCbMarketIds': {},
379
380
  },
380
381
  'features': {
381
382
  'default': {
@@ -1509,7 +1510,33 @@ class coinbase extends coinbase$1 {
1509
1510
  for (let i = 0; i < perpetualData.length; i++) {
1510
1511
  result.push(this.parseContractMarket(perpetualData[i], perpetualFeeTier));
1511
1512
  }
1512
- return result;
1513
+ // remove aliases
1514
+ this.options['aliasCbMarketIds'] = {};
1515
+ const newMarkets = [];
1516
+ for (let i = 0; i < result.length; i++) {
1517
+ const market = result[i];
1518
+ const info = this.safeValue(market, 'info', {});
1519
+ const realMarketIds = this.safeList(info, 'alias_to', []);
1520
+ const length = realMarketIds.length;
1521
+ if (length > 0) {
1522
+ this.options['aliasCbMarketIds'][market['id']] = realMarketIds[0];
1523
+ this.options['aliasCbMarketIds'][market['symbol']] = realMarketIds[0];
1524
+ }
1525
+ else {
1526
+ newMarkets.push(market);
1527
+ }
1528
+ }
1529
+ return newMarkets;
1530
+ }
1531
+ market(symbol) {
1532
+ const finalSymbol = this.safeString(this.options['aliasCbMarketIds'], symbol, symbol);
1533
+ return super.market(finalSymbol);
1534
+ }
1535
+ safeMarket(marketId = undefined, market = undefined, delimiter = undefined, marketType = undefined) {
1536
+ if (marketId in this.options['aliasCbMarketIds']) {
1537
+ return this.market(marketId);
1538
+ }
1539
+ return super.safeMarket(marketId, market, delimiter, marketType);
1513
1540
  }
1514
1541
  parseSpotMarket(market, feeTier) {
1515
1542
  //
@@ -1921,6 +1948,7 @@ class coinbase extends coinbase$1 {
1921
1948
  'withdraw': undefined,
1922
1949
  'fee': undefined,
1923
1950
  'precision': undefined,
1951
+ 'networks': {},
1924
1952
  'limits': {
1925
1953
  'amount': {
1926
1954
  'min': this.safeNumber(currency, 'min_size'),
@@ -2245,10 +2273,11 @@ class coinbase extends coinbase$1 {
2245
2273
  askVolume = this.safeNumber(asks[0], 'size');
2246
2274
  }
2247
2275
  const marketId = this.safeString(ticker, 'product_id');
2276
+ market = this.safeMarket(marketId, market);
2248
2277
  const last = this.safeNumber(ticker, 'price');
2249
2278
  const datetime = this.safeString(ticker, 'time');
2250
2279
  return this.safeTicker({
2251
- 'symbol': this.safeSymbol(marketId, market),
2280
+ 'symbol': market['symbol'],
2252
2281
  'timestamp': this.parse8601(datetime),
2253
2282
  'datetime': datetime,
2254
2283
  'bid': bid,
@@ -73,6 +73,7 @@ class coincatch extends coincatch$1 {
73
73
  'fetchDepositAddress': true,
74
74
  'fetchDeposits': true,
75
75
  'fetchDepositsWithdrawals': false,
76
+ 'fetchDepositWithdrawFees': true,
76
77
  'fetchFundingHistory': false,
77
78
  'fetchFundingRate': true,
78
79
  'fetchFundingRateHistory': true,
@@ -712,6 +713,73 @@ class coincatch extends coincatch$1 {
712
713
  }
713
714
  return result;
714
715
  }
716
+ /**
717
+ * @method
718
+ * @name coincatch#fetchDepositWithdrawFees
719
+ * @description fetch deposit and withdraw fees
720
+ * @see https://coincatch.github.io/github.io/en/spot/#get-coin-list
721
+ * @param {string[]} [codes] list of unified currency codes
722
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
723
+ * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
724
+ */
725
+ async fetchDepositWithdrawFees(codes = undefined, params = {}) {
726
+ await this.loadMarkets();
727
+ const response = await this.publicGetApiSpotV1PublicCurrencies(params);
728
+ const data = this.safeList(response, 'data', []);
729
+ return this.parseDepositWithdrawFees(data, codes, 'coinName');
730
+ }
731
+ parseDepositWithdrawFee(fee, currency = undefined) {
732
+ //
733
+ // {
734
+ // "coinId":"1",
735
+ // "coinName":"BTC",
736
+ // "transfer":"true",
737
+ // "chains":[
738
+ // {
739
+ // "chain":null,
740
+ // "needTag":"false",
741
+ // "withdrawable":"true",
742
+ // "rechargeAble":"true",
743
+ // "withdrawFee":"0.005",
744
+ // "depositConfirm":"1",
745
+ // "withdrawConfirm":"1",
746
+ // "minDepositAmount":"0.001",
747
+ // "minWithdrawAmount":"0.001",
748
+ // "browserUrl":"https://blockchair.com/bitcoin/testnet/transaction/"
749
+ // }
750
+ // ]
751
+ // }
752
+ //
753
+ const chains = this.safeList(fee, 'chains', []);
754
+ const chainsLength = chains.length;
755
+ const result = {
756
+ 'info': fee,
757
+ 'withdraw': {
758
+ 'fee': undefined,
759
+ 'percentage': undefined,
760
+ },
761
+ 'deposit': {
762
+ 'fee': undefined,
763
+ 'percentage': undefined,
764
+ },
765
+ 'networks': {},
766
+ };
767
+ for (let i = 0; i < chainsLength; i++) {
768
+ const chain = chains[i];
769
+ const networkId = this.safeString(chain, 'chain');
770
+ const currencyCode = this.safeString(currency, 'code');
771
+ const networkCode = this.networkIdToCode(networkId, currencyCode);
772
+ result['networks'][networkCode] = {
773
+ 'deposit': { 'fee': undefined, 'percentage': undefined },
774
+ 'withdraw': { 'fee': this.safeNumber(chain, 'withdrawFee'), 'percentage': false },
775
+ };
776
+ if (chainsLength === 1) {
777
+ result['withdraw']['fee'] = this.safeNumber(chain, 'withdrawFee');
778
+ result['withdraw']['percentage'] = false;
779
+ }
780
+ }
781
+ return result;
782
+ }
715
783
  /**
716
784
  * @method
717
785
  * @name coincatch#fetchMarkets
@@ -750,6 +750,9 @@ class coinex extends coinex$1 {
750
750
  for (let j = 0; j < chains.length; j++) {
751
751
  const chain = chains[j];
752
752
  const networkId = this.safeString(chain, 'chain');
753
+ if (networkId === undefined) {
754
+ continue;
755
+ }
753
756
  const precisionString = this.parsePrecision(this.safeString(chain, 'withdrawal_precision'));
754
757
  const feeString = this.safeString(chain, 'withdrawal_fee');
755
758
  const minNetworkDepositString = this.safeString(chain, 'min_deposit_amount');