ccxt 4.4.28 → 4.4.30

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/alpaca.js +59 -7
  5. package/dist/cjs/src/base/Exchange.js +3 -0
  6. package/dist/cjs/src/binance.js +9 -0
  7. package/dist/cjs/src/bitbns.js +12 -12
  8. package/dist/cjs/src/bitfinex.js +9 -9
  9. package/dist/cjs/src/bitget.js +99 -6
  10. package/dist/cjs/src/bitmart.js +53 -53
  11. package/dist/cjs/src/bitopro.js +21 -21
  12. package/dist/cjs/src/bitrue.js +28 -28
  13. package/dist/cjs/src/bitvavo.js +4 -0
  14. package/dist/cjs/src/bybit.js +51 -646
  15. package/dist/cjs/src/coincatch.js +24 -4
  16. package/dist/cjs/src/deribit.js +7 -3
  17. package/dist/cjs/src/hyperliquid.js +108 -4
  18. package/dist/cjs/src/lbank.js +7 -1
  19. package/dist/cjs/src/pro/bitvavo.js +2 -1
  20. package/dist/cjs/src/pro/blofin.js +2 -1
  21. package/dist/cjs/src/pro/mexc.js +198 -30
  22. package/dist/cjs/src/vertex.js +51 -6
  23. package/examples/README.md +0 -2
  24. package/examples/js/cli.js +7 -0
  25. package/js/ccxt.d.ts +1 -1
  26. package/js/ccxt.js +1 -1
  27. package/js/src/abstract/alpaca.d.ts +1 -0
  28. package/js/src/abstract/binance.d.ts +9 -0
  29. package/js/src/abstract/binancecoinm.d.ts +9 -0
  30. package/js/src/abstract/binanceus.d.ts +9 -0
  31. package/js/src/abstract/binanceusdm.d.ts +9 -0
  32. package/js/src/abstract/bybit.d.ts +0 -13
  33. package/js/src/alpaca.d.ts +2 -0
  34. package/js/src/alpaca.js +59 -7
  35. package/js/src/base/Exchange.d.ts +1 -0
  36. package/js/src/base/Exchange.js +3 -0
  37. package/js/src/binance.js +9 -0
  38. package/js/src/bitbns.js +12 -12
  39. package/js/src/bitfinex.js +9 -9
  40. package/js/src/bitfinex2.d.ts +1 -1
  41. package/js/src/bitget.d.ts +2 -1
  42. package/js/src/bitget.js +99 -6
  43. package/js/src/bitmart.d.ts +1 -1
  44. package/js/src/bitmart.js +53 -53
  45. package/js/src/bitopro.js +21 -21
  46. package/js/src/bitrue.js +28 -28
  47. package/js/src/bitvavo.js +4 -0
  48. package/js/src/bybit.d.ts +0 -8
  49. package/js/src/bybit.js +51 -646
  50. package/js/src/coincatch.d.ts +1 -1
  51. package/js/src/coincatch.js +24 -4
  52. package/js/src/deribit.js +7 -3
  53. package/js/src/hyperliquid.d.ts +3 -1
  54. package/js/src/hyperliquid.js +108 -4
  55. package/js/src/lbank.js +7 -1
  56. package/js/src/pro/bitvavo.js +2 -1
  57. package/js/src/pro/blofin.js +2 -1
  58. package/js/src/pro/mexc.js +198 -30
  59. package/js/src/vertex.d.ts +4 -2
  60. package/js/src/vertex.js +51 -6
  61. package/js/src/whitebit.d.ts +1 -1
  62. package/package.json +1 -1
package/js/src/bitget.js CHANGED
@@ -87,7 +87,7 @@ export default class bitget extends Exchange {
87
87
  'fetchFundingIntervals': false,
88
88
  'fetchFundingRate': true,
89
89
  'fetchFundingRateHistory': true,
90
- 'fetchFundingRates': false,
90
+ 'fetchFundingRates': true,
91
91
  'fetchIndexOHLCV': true,
92
92
  'fetchIsolatedBorrowRate': true,
93
93
  'fetchIsolatedBorrowRates': false,
@@ -6849,6 +6849,71 @@ export default class bitget extends Exchange {
6849
6849
  const data = this.safeValue(response, 'data', []);
6850
6850
  return this.parseFundingRate(data[0], market);
6851
6851
  }
6852
+ async fetchFundingRates(symbols = undefined, params = {}) {
6853
+ /**
6854
+ * @method
6855
+ * @name bitget#fetchFundingRates
6856
+ * @description fetch the current funding rates for all markets
6857
+ * @see https://www.bitget.com/api-doc/contract/market/Get-All-Symbol-Ticker
6858
+ * @param {string[]} [symbols] list of unified market symbols
6859
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
6860
+ * @param {string} [params.subType] *contract only* 'linear', 'inverse'
6861
+ * @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
6862
+ * @returns {object} a dictionary of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
6863
+ */
6864
+ await this.loadMarkets();
6865
+ let market = undefined;
6866
+ if (symbols !== undefined) {
6867
+ const symbol = this.safeValue(symbols, 0);
6868
+ const sandboxMode = this.safeBool(this.options, 'sandboxMode', false);
6869
+ if (sandboxMode) {
6870
+ const sandboxSymbol = this.convertSymbolForSandbox(symbol);
6871
+ market = this.market(sandboxSymbol);
6872
+ }
6873
+ else {
6874
+ market = this.market(symbol);
6875
+ }
6876
+ }
6877
+ const request = {};
6878
+ let productType = undefined;
6879
+ [productType, params] = this.handleProductTypeAndParams(market, params);
6880
+ request['productType'] = productType;
6881
+ const response = await this.publicMixGetV2MixMarketTickers(this.extend(request, params));
6882
+ // {
6883
+ // "code": "00000",
6884
+ // "msg": "success",
6885
+ // "requestTime": 1700533773477,
6886
+ // "data": [
6887
+ // {
6888
+ // "symbol": "BTCUSD",
6889
+ // "lastPr": "29904.5",
6890
+ // "askPr": "29904.5",
6891
+ // "bidPr": "29903.5",
6892
+ // "bidSz": "0.5091",
6893
+ // "askSz": "2.2694",
6894
+ // "high24h": "0",
6895
+ // "low24h": "0",
6896
+ // "ts": "1695794271400",
6897
+ // "change24h": "0",
6898
+ // "baseVolume": "0",
6899
+ // "quoteVolume": "0",
6900
+ // "usdtVolume": "0",
6901
+ // "openUtc": "0",
6902
+ // "changeUtc24h": "0",
6903
+ // "indexPrice": "29132.353333",
6904
+ // "fundingRate": "-0.0007",
6905
+ // "holdingAmount": "125.6844",
6906
+ // "deliveryStartTime": null,
6907
+ // "deliveryTime": null,
6908
+ // "deliveryStatus": "delivery_normal",
6909
+ // "open24h": "0",
6910
+ // "markPrice": "12345"
6911
+ // },
6912
+ // ]
6913
+ // }
6914
+ const data = this.safeList(response, 'data', []);
6915
+ return this.parseFundingRates(data, market);
6916
+ }
6852
6917
  parseFundingRate(contract, market = undefined) {
6853
6918
  //
6854
6919
  // fetchFundingRate
@@ -6865,11 +6930,39 @@ export default class bitget extends Exchange {
6865
6930
  // "nextFundingTime": "1727942400000",
6866
6931
  // "ratePeriod": "8"
6867
6932
  // }
6868
- //
6933
+ // fetchFundingRates
6934
+ // {
6935
+ // "symbol": "BTCUSD",
6936
+ // "lastPr": "29904.5",
6937
+ // "askPr": "29904.5",
6938
+ // "bidPr": "29903.5",
6939
+ // "bidSz": "0.5091",
6940
+ // "askSz": "2.2694",
6941
+ // "high24h": "0",
6942
+ // "low24h": "0",
6943
+ // "ts": "1695794271400",
6944
+ // "change24h": "0",
6945
+ // "baseVolume": "0",
6946
+ // "quoteVolume": "0",
6947
+ // "usdtVolume": "0",
6948
+ // "openUtc": "0",
6949
+ // "changeUtc24h": "0",
6950
+ // "indexPrice": "29132.353333",
6951
+ // "fundingRate": "-0.0007",
6952
+ // "holdingAmount": "125.6844",
6953
+ // "deliveryStartTime": null,
6954
+ // "deliveryTime": null,
6955
+ // "deliveryStatus": "delivery_normal",
6956
+ // "open24h": "0",
6957
+ // "markPrice": "12345"
6958
+ // }
6869
6959
  const marketId = this.safeString(contract, 'symbol');
6870
6960
  const symbol = this.safeSymbol(marketId, market, undefined, 'swap');
6871
6961
  const fundingTimestamp = this.safeInteger(contract, 'nextFundingTime');
6872
6962
  const interval = this.safeString(contract, 'ratePeriod');
6963
+ const timestamp = this.safeInteger(contract, 'ts');
6964
+ const markPrice = this.safeNumber(contract, 'markPrice');
6965
+ const indexPrice = this.safeNumber(contract, 'indexPrice');
6873
6966
  let intervalString = undefined;
6874
6967
  if (interval !== undefined) {
6875
6968
  intervalString = interval + 'h';
@@ -6877,12 +6970,12 @@ export default class bitget extends Exchange {
6877
6970
  return {
6878
6971
  'info': contract,
6879
6972
  'symbol': symbol,
6880
- 'markPrice': undefined,
6881
- 'indexPrice': undefined,
6973
+ 'markPrice': markPrice,
6974
+ 'indexPrice': indexPrice,
6882
6975
  'interestRate': undefined,
6883
6976
  'estimatedSettlePrice': undefined,
6884
- 'timestamp': undefined,
6885
- 'datetime': undefined,
6977
+ 'timestamp': timestamp,
6978
+ 'datetime': this.iso8601(timestamp),
6886
6979
  'fundingRate': this.safeNumber(contract, 'fundingRate'),
6887
6980
  'fundingTimestamp': fundingTimestamp,
6888
6981
  'fundingDatetime': this.iso8601(fundingTimestamp),
@@ -69,7 +69,7 @@ export default class bitmart extends Exchange {
69
69
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
70
70
  fetchDepositAddress(code: string, params?: {}): Promise<DepositAddress>;
71
71
  parseDepositAddress(depositAddress: any, currency?: any): DepositAddress;
72
- withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<any>;
72
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
73
73
  fetchTransactionsByType(type: any, code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
74
74
  fetchDeposit(id: string, code?: Str, params?: {}): Promise<Transaction>;
75
75
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
package/js/src/bitmart.js CHANGED
@@ -709,7 +709,7 @@ export default class bitmart extends Exchange {
709
709
  // }
710
710
  // }
711
711
  //
712
- const data = this.safeValue(response, 'data', {});
712
+ const data = this.safeDict(response, 'data', {});
713
713
  return this.safeInteger(data, 'server_time');
714
714
  }
715
715
  async fetchStatus(params = {}) {
@@ -720,7 +720,7 @@ export default class bitmart extends Exchange {
720
720
  * @param {object} [params] extra parameters specific to the exchange API endpoint
721
721
  * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
722
722
  */
723
- const options = this.safeValue(this.options, 'fetchStatus', {});
723
+ const options = this.safeDict(this.options, 'fetchStatus', {});
724
724
  const defaultType = this.safeString(this.options, 'defaultType');
725
725
  let type = this.safeString(options, 'type', defaultType);
726
726
  type = this.safeString(params, 'type', type);
@@ -751,13 +751,13 @@ export default class bitmart extends Exchange {
751
751
  // }
752
752
  // }
753
753
  //
754
- const data = this.safeValue(response, 'data', {});
755
- const services = this.safeValue(data, 'service', []);
754
+ const data = this.safeDict(response, 'data', {});
755
+ const services = this.safeList(data, 'service', []);
756
756
  const servicesByType = this.indexBy(services, 'service_type');
757
757
  if (type === 'swap') {
758
758
  type = 'contract';
759
759
  }
760
- const service = this.safeValue(servicesByType, type);
760
+ const service = this.safeString(servicesByType, type);
761
761
  let status = undefined;
762
762
  let eta = undefined;
763
763
  if (service !== undefined) {
@@ -806,8 +806,8 @@ export default class bitmart extends Exchange {
806
806
  // }
807
807
  // }
808
808
  //
809
- const data = this.safeValue(response, 'data', {});
810
- const symbols = this.safeValue(data, 'symbols', []);
809
+ const data = this.safeDict(response, 'data', {});
810
+ const symbols = this.safeList(data, 'symbols', []);
811
811
  const result = [];
812
812
  for (let i = 0; i < symbols.length; i++) {
813
813
  const market = symbols[i];
@@ -916,8 +916,8 @@ export default class bitmart extends Exchange {
916
916
  // }
917
917
  // }
918
918
  //
919
- const data = this.safeValue(response, 'data', {});
920
- const symbols = this.safeValue(data, 'symbols', []);
919
+ const data = this.safeDict(response, 'data', {});
920
+ const symbols = this.safeList(data, 'symbols', []);
921
921
  const result = [];
922
922
  for (let i = 0; i < symbols.length; i++) {
923
923
  const market = symbols[i];
@@ -1025,16 +1025,16 @@ export default class bitmart extends Exchange {
1025
1025
  // }
1026
1026
  // }
1027
1027
  //
1028
- const data = this.safeValue(response, 'data', {});
1029
- const currencies = this.safeValue(data, 'currencies', []);
1028
+ const data = this.safeDict(response, 'data', {});
1029
+ const currencies = this.safeList(data, 'currencies', []);
1030
1030
  const result = {};
1031
1031
  for (let i = 0; i < currencies.length; i++) {
1032
1032
  const currency = currencies[i];
1033
1033
  const id = this.safeString(currency, 'id');
1034
1034
  const code = this.safeCurrencyCode(id);
1035
1035
  const name = this.safeString(currency, 'name');
1036
- const withdrawEnabled = this.safeValue(currency, 'withdraw_enabled');
1037
- const depositEnabled = this.safeValue(currency, 'deposit_enabled');
1036
+ const withdrawEnabled = this.safeBool(currency, 'withdraw_enabled');
1037
+ const depositEnabled = this.safeBool(currency, 'deposit_enabled');
1038
1038
  const active = withdrawEnabled && depositEnabled;
1039
1039
  result[code] = {
1040
1040
  'id': id,
@@ -1402,7 +1402,7 @@ export default class bitmart extends Exchange {
1402
1402
  else {
1403
1403
  const data = this.safeDict(response, 'data', {});
1404
1404
  tickers = this.safeList(data, 'symbols', []);
1405
- ticker = this.safeValue(tickers, 0, {});
1405
+ ticker = this.safeDict(tickers, 0, {});
1406
1406
  }
1407
1407
  return this.parseTicker(ticker, market);
1408
1408
  }
@@ -1422,7 +1422,7 @@ export default class bitmart extends Exchange {
1422
1422
  let type = undefined;
1423
1423
  let market = undefined;
1424
1424
  if (symbols !== undefined) {
1425
- const symbol = this.safeValue(symbols, 0);
1425
+ const symbol = this.safeString(symbols, 0);
1426
1426
  market = this.market(symbol);
1427
1427
  }
1428
1428
  [type, params] = this.handleMarketTypeAndParams('fetchTickers', market, params);
@@ -1597,7 +1597,7 @@ export default class bitmart extends Exchange {
1597
1597
  // "trace": "4cad855074664097ac6ba5258c47305d.72.16952643834721135"
1598
1598
  // }
1599
1599
  //
1600
- const data = this.safeValue(response, 'data', {});
1600
+ const data = this.safeDict(response, 'data', {});
1601
1601
  const timestamp = this.safeInteger2(data, 'ts', 'timestamp');
1602
1602
  return this.parseOrderBook(data, market['symbol'], timestamp);
1603
1603
  }
@@ -1953,7 +1953,7 @@ export default class bitmart extends Exchange {
1953
1953
  if (marginMode === 'isolated') {
1954
1954
  request['orderMode'] = 'iso_margin';
1955
1955
  }
1956
- const options = this.safeValue(this.options, 'fetchMyTrades', {});
1956
+ const options = this.safeDict(this.options, 'fetchMyTrades', {});
1957
1957
  const defaultLimit = this.safeInteger(options, 'limit', 200);
1958
1958
  if (limit === undefined) {
1959
1959
  limit = defaultLimit;
@@ -2058,16 +2058,16 @@ export default class bitmart extends Exchange {
2058
2058
  return this.parseTrades(data, undefined, since, limit);
2059
2059
  }
2060
2060
  customParseBalance(response, marketType) {
2061
- const data = this.safeValue(response, 'data', {});
2061
+ const data = this.safeDict(response, 'data', {});
2062
2062
  let wallet = undefined;
2063
2063
  if (marketType === 'swap') {
2064
- wallet = this.safeValue(response, 'data', []);
2064
+ wallet = this.safeList(response, 'data', []);
2065
2065
  }
2066
2066
  else if (marketType === 'margin') {
2067
- wallet = this.safeValue(data, 'symbols', []);
2067
+ wallet = this.safeList(data, 'symbols', []);
2068
2068
  }
2069
2069
  else {
2070
- wallet = this.safeValue(data, 'wallet', []);
2070
+ wallet = this.safeList(data, 'wallet', []);
2071
2071
  }
2072
2072
  const result = { 'info': response };
2073
2073
  if (marketType === 'margin') {
@@ -2075,8 +2075,8 @@ export default class bitmart extends Exchange {
2075
2075
  const entry = wallet[i];
2076
2076
  const marketId = this.safeString(entry, 'symbol');
2077
2077
  const symbol = this.safeSymbol(marketId, undefined, '_');
2078
- const base = this.safeValue(entry, 'base', {});
2079
- const quote = this.safeValue(entry, 'quote', {});
2078
+ const base = this.safeDict(entry, 'base', {});
2079
+ const quote = this.safeDict(entry, 'quote', {});
2080
2080
  const baseCode = this.safeCurrencyCode(this.safeString(base, 'currency'));
2081
2081
  const quoteCode = this.safeCurrencyCode(this.safeString(quote, 'currency'));
2082
2082
  const subResult = {};
@@ -2293,7 +2293,7 @@ export default class bitmart extends Exchange {
2293
2293
  // }
2294
2294
  // }
2295
2295
  //
2296
- const data = this.safeValue(response, 'data');
2296
+ const data = this.safeDict(response, 'data', {});
2297
2297
  return this.parseTradingFee(data);
2298
2298
  }
2299
2299
  parseOrder(order, market = undefined) {
@@ -2456,7 +2456,7 @@ export default class bitmart extends Exchange {
2456
2456
  '4': 'closed', // Completed
2457
2457
  },
2458
2458
  };
2459
- const statuses = this.safeValue(statusesByType, type, {});
2459
+ const statuses = this.safeDict(statusesByType, type, {});
2460
2460
  return this.safeString(statuses, status, status);
2461
2461
  }
2462
2462
  async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
@@ -2558,7 +2558,7 @@ export default class bitmart extends Exchange {
2558
2558
  // swap
2559
2559
  // {"code":1000,"message":"Ok","data":{"order_id":231116359426639,"price":"market price"},"trace":"7f9c94e10f9d4513bc08a7bfc2a5559a.62.16996369620521911"}
2560
2560
  //
2561
- const data = this.safeValue(response, 'data', {});
2561
+ const data = this.safeDict(response, 'data', {});
2562
2562
  const order = this.parseOrder(data, market);
2563
2563
  order['type'] = type;
2564
2564
  order['side'] = side;
@@ -2905,7 +2905,7 @@ export default class bitmart extends Exchange {
2905
2905
  response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
2906
2906
  }
2907
2907
  else {
2908
- const stop = this.safeValue2(params, 'stop', 'trigger');
2908
+ const stop = this.safeBool2(params, 'stop', 'trigger');
2909
2909
  params = this.omit(params, ['stop', 'trigger']);
2910
2910
  if (!stop) {
2911
2911
  response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
@@ -3130,7 +3130,7 @@ export default class bitmart extends Exchange {
3130
3130
  // }
3131
3131
  // }
3132
3132
  //
3133
- const data = this.safeValue(response, 'data', {});
3133
+ const data = this.safeDict(response, 'data', {});
3134
3134
  const orders = this.safeList(data, 'orders', []);
3135
3135
  return this.parseOrders(orders, market, since, limit);
3136
3136
  }
@@ -3185,7 +3185,7 @@ export default class bitmart extends Exchange {
3185
3185
  response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
3186
3186
  }
3187
3187
  else if (type === 'swap') {
3188
- const isStop = this.safeValue2(params, 'stop', 'trigger');
3188
+ const isStop = this.safeBool2(params, 'stop', 'trigger');
3189
3189
  params = this.omit(params, ['stop', 'trigger']);
3190
3190
  if (isStop) {
3191
3191
  response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
@@ -3457,7 +3457,7 @@ export default class bitmart extends Exchange {
3457
3457
  if (code === 'USDT') {
3458
3458
  const defaultNetworks = this.safeValue(this.options, 'defaultNetworks');
3459
3459
  const defaultNetwork = this.safeStringUpper(defaultNetworks, code);
3460
- const networks = this.safeValue(this.options, 'networks', {});
3460
+ const networks = this.safeDict(this.options, 'networks', {});
3461
3461
  let networkInner = this.safeStringUpper(params, 'network', defaultNetwork); // this line allows the user to specify either ERC20 or ETH
3462
3462
  networkInner = this.safeString(networks, networkInner, networkInner); // handle ERC20>ETH alias
3463
3463
  if (networkInner !== undefined) {
@@ -3544,7 +3544,7 @@ export default class bitmart extends Exchange {
3544
3544
  if (code === 'USDT') {
3545
3545
  const defaultNetworks = this.safeValue(this.options, 'defaultNetworks');
3546
3546
  const defaultNetwork = this.safeStringUpper(defaultNetworks, code);
3547
- const networks = this.safeValue(this.options, 'networks', {});
3547
+ const networks = this.safeDict(this.options, 'networks', {});
3548
3548
  let network = this.safeStringUpper(params, 'network', defaultNetwork); // this line allows the user to specify either ERC20 or ETH
3549
3549
  network = this.safeString(networks, network, network); // handle ERC20>ETH alias
3550
3550
  if (network !== undefined) {
@@ -3563,7 +3563,7 @@ export default class bitmart extends Exchange {
3563
3563
  // }
3564
3564
  // }
3565
3565
  //
3566
- const data = this.safeValue(response, 'data');
3566
+ const data = this.safeDict(response, 'data', {});
3567
3567
  const transaction = this.parseTransaction(data, currency);
3568
3568
  return this.extend(transaction, {
3569
3569
  'code': code,
@@ -3589,7 +3589,7 @@ export default class bitmart extends Exchange {
3589
3589
  if (code === 'USDT') {
3590
3590
  const defaultNetworks = this.safeValue(this.options, 'defaultNetworks');
3591
3591
  const defaultNetwork = this.safeStringUpper(defaultNetworks, code);
3592
- const networks = this.safeValue(this.options, 'networks', {});
3592
+ const networks = this.safeDict(this.options, 'networks', {});
3593
3593
  let network = this.safeStringUpper(params, 'network', defaultNetwork); // this line allows the user to specify either ERC20 or ETH
3594
3594
  network = this.safeString(networks, network, network); // handle ERC20>ETH alias
3595
3595
  if (network !== undefined) {
@@ -3623,7 +3623,7 @@ export default class bitmart extends Exchange {
3623
3623
  // }
3624
3624
  // }
3625
3625
  //
3626
- const data = this.safeValue(response, 'data', {});
3626
+ const data = this.safeDict(response, 'data', {});
3627
3627
  const records = this.safeList(data, 'records', []);
3628
3628
  return this.parseTransactions(records, currency, since, limit);
3629
3629
  }
@@ -3664,7 +3664,7 @@ export default class bitmart extends Exchange {
3664
3664
  // }
3665
3665
  // }
3666
3666
  //
3667
- const data = this.safeValue(response, 'data', {});
3667
+ const data = this.safeDict(response, 'data', {});
3668
3668
  const record = this.safeDict(data, 'record', {});
3669
3669
  return this.parseTransaction(record);
3670
3670
  }
@@ -3718,7 +3718,7 @@ export default class bitmart extends Exchange {
3718
3718
  // }
3719
3719
  // }
3720
3720
  //
3721
- const data = this.safeValue(response, 'data', {});
3721
+ const data = this.safeDict(response, 'data', {});
3722
3722
  const record = this.safeDict(data, 'record', {});
3723
3723
  return this.parseTransaction(record);
3724
3724
  }
@@ -3852,7 +3852,7 @@ export default class bitmart extends Exchange {
3852
3852
  // }
3853
3853
  // }
3854
3854
  //
3855
- const data = this.safeValue(response, 'data', {});
3855
+ const data = this.safeDict(response, 'data', {});
3856
3856
  const transaction = this.parseMarginLoan(data, currency);
3857
3857
  return this.extend(transaction, {
3858
3858
  'amount': amount,
@@ -3890,7 +3890,7 @@ export default class bitmart extends Exchange {
3890
3890
  // }
3891
3891
  // }
3892
3892
  //
3893
- const data = this.safeValue(response, 'data', {});
3893
+ const data = this.safeDict(response, 'data', {});
3894
3894
  const transaction = this.parseMarginLoan(data, currency);
3895
3895
  return this.extend(transaction, {
3896
3896
  'amount': amount,
@@ -3969,9 +3969,9 @@ export default class bitmart extends Exchange {
3969
3969
  // }
3970
3970
  // }
3971
3971
  //
3972
- const data = this.safeValue(response, 'data', {});
3973
- const symbols = this.safeValue(data, 'symbols', []);
3974
- const borrowRate = this.safeValue(symbols, 0);
3972
+ const data = this.safeDict(response, 'data', {});
3973
+ const symbols = this.safeList(data, 'symbols', []);
3974
+ const borrowRate = this.safeDict(symbols, 0, []);
3975
3975
  return this.parseIsolatedBorrowRate(borrowRate, market);
3976
3976
  }
3977
3977
  parseIsolatedBorrowRate(info, market = undefined) {
@@ -4000,8 +4000,8 @@ export default class bitmart extends Exchange {
4000
4000
  //
4001
4001
  const marketId = this.safeString(info, 'symbol');
4002
4002
  const symbol = this.safeSymbol(marketId, market);
4003
- const baseData = this.safeValue(info, 'base', {});
4004
- const quoteData = this.safeValue(info, 'quote', {});
4003
+ const baseData = this.safeDict(info, 'base', {});
4004
+ const quoteData = this.safeDict(info, 'quote', {});
4005
4005
  const baseId = this.safeString(baseData, 'currency');
4006
4006
  const quoteId = this.safeString(quoteData, 'currency');
4007
4007
  return {
@@ -4059,8 +4059,8 @@ export default class bitmart extends Exchange {
4059
4059
  // }
4060
4060
  // }
4061
4061
  //
4062
- const data = this.safeValue(response, 'data', {});
4063
- const symbols = this.safeValue(data, 'symbols', []);
4062
+ const data = this.safeDict(response, 'data', {});
4063
+ const symbols = this.safeList(data, 'symbols', []);
4064
4064
  return this.parseIsolatedBorrowRates(symbols);
4065
4065
  }
4066
4066
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
@@ -4139,7 +4139,7 @@ export default class bitmart extends Exchange {
4139
4139
  // }
4140
4140
  // }
4141
4141
  //
4142
- const data = this.safeValue(response, 'data', {});
4142
+ const data = this.safeDict(response, 'data', {});
4143
4143
  return this.extend(this.parseTransfer(data, currency), {
4144
4144
  'status': this.parseTransferStatus(this.safeString2(response, 'code', 'message')),
4145
4145
  });
@@ -4264,7 +4264,7 @@ export default class bitmart extends Exchange {
4264
4264
  // }
4265
4265
  // }
4266
4266
  //
4267
- const data = this.safeValue(response, 'data', {});
4267
+ const data = this.safeDict(response, 'data', {});
4268
4268
  const records = this.safeList(data, 'records', []);
4269
4269
  return this.parseTransfers(records, currency, since, limit);
4270
4270
  }
@@ -4317,8 +4317,8 @@ export default class bitmart extends Exchange {
4317
4317
  // }
4318
4318
  // }
4319
4319
  //
4320
- const data = this.safeValue(response, 'data', {});
4321
- const rows = this.safeValue(data, 'records', []);
4320
+ const data = this.safeDict(response, 'data', {});
4321
+ const rows = this.safeList(data, 'records', []);
4322
4322
  const interest = this.parseBorrowInterests(rows, market);
4323
4323
  return this.filterByCurrencySinceLimit(interest, code, since, limit);
4324
4324
  }
@@ -4468,7 +4468,7 @@ export default class bitmart extends Exchange {
4468
4468
  // "trace": "4cad855074654097ac7ba5257c47305d.54.16951844206655589"
4469
4469
  // }
4470
4470
  //
4471
- const data = this.safeValue(response, 'data', {});
4471
+ const data = this.safeDict(response, 'data', {});
4472
4472
  return this.parseFundingRate(data, market);
4473
4473
  }
4474
4474
  parseFundingRate(contract, market = undefined) {
@@ -4549,7 +4549,7 @@ export default class bitmart extends Exchange {
4549
4549
  // "trace":"4cad855074664097ac5ba5257c47305d.67.16963925142065945"
4550
4550
  // }
4551
4551
  //
4552
- const data = this.safeValue(response, 'data', []);
4552
+ const data = this.safeList(response, 'data', []);
4553
4553
  const first = this.safeDict(data, 0, {});
4554
4554
  return this.parsePosition(first, market);
4555
4555
  }
@@ -4607,7 +4607,7 @@ export default class bitmart extends Exchange {
4607
4607
  // "trace":"4cad855074664097ac5ba5257c47305d.67.16963925142065945"
4608
4608
  // }
4609
4609
  //
4610
- const positions = this.safeValue(response, 'data', []);
4610
+ const positions = this.safeList(response, 'data', []);
4611
4611
  const result = [];
4612
4612
  for (let i = 0; i < positions.length; i++) {
4613
4613
  result.push(this.parsePosition(positions[i]));
@@ -4733,7 +4733,7 @@ export default class bitmart extends Exchange {
4733
4733
  // "trace": "4cad855074664097ac6ba4257c47305d.71.16965658195443021"
4734
4734
  // }
4735
4735
  //
4736
- const data = this.safeValue(response, 'data', []);
4736
+ const data = this.safeList(response, 'data', []);
4737
4737
  const result = [];
4738
4738
  for (let i = 0; i < data.length; i++) {
4739
4739
  const entry = data[i];