ccxt 4.4.77 → 4.4.80

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 (154) hide show
  1. package/README.md +8 -10
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +8 -4
  4. package/dist/cjs/src/abstract/ace.js +1 -1
  5. package/dist/cjs/src/abstract/apex.js +9 -0
  6. package/dist/cjs/src/ace.js +1 -1
  7. package/dist/cjs/src/apex.js +1949 -0
  8. package/dist/cjs/src/ascendex.js +25 -4
  9. package/dist/cjs/src/base/Exchange.js +42 -2
  10. package/dist/cjs/src/binance.js +9 -1
  11. package/dist/cjs/src/bingx.js +3 -3
  12. package/dist/cjs/src/bitfinex.js +64 -36
  13. package/dist/cjs/src/bitget.js +191 -138
  14. package/dist/cjs/src/bitmart.js +7 -2
  15. package/dist/cjs/src/bitmex.js +16 -8
  16. package/dist/cjs/src/bitopro.js +5 -1
  17. package/dist/cjs/src/bitrue.js +2 -1
  18. package/dist/cjs/src/bitso.js +1 -1
  19. package/dist/cjs/src/bitteam.js +2 -0
  20. package/dist/cjs/src/bitvavo.js +28 -10
  21. package/dist/cjs/src/btcalpha.js +1 -1
  22. package/dist/cjs/src/btcmarkets.js +1 -1
  23. package/dist/cjs/src/btcturk.js +1 -1
  24. package/dist/cjs/src/bybit.js +32 -16
  25. package/dist/cjs/src/cex.js +1 -1
  26. package/dist/cjs/src/coinbase.js +18 -2
  27. package/dist/cjs/src/coincatch.js +68 -0
  28. package/dist/cjs/src/coinex.js +1 -0
  29. package/dist/cjs/src/coinlist.js +1 -0
  30. package/dist/cjs/src/coinone.js +1 -0
  31. package/dist/cjs/src/delta.js +4 -0
  32. package/dist/cjs/src/deribit.js +1 -0
  33. package/dist/cjs/src/hitbtc.js +3 -0
  34. package/dist/cjs/src/hollaex.js +1 -0
  35. package/dist/cjs/src/htx.js +7 -3
  36. package/dist/cjs/src/huobijp.js +1 -0
  37. package/dist/cjs/src/hyperliquid.js +14 -4
  38. package/dist/cjs/src/kraken.js +2 -0
  39. package/dist/cjs/src/mexc.js +50 -57
  40. package/dist/cjs/src/okx.js +1 -1
  41. package/dist/cjs/src/phemex.js +2 -1
  42. package/dist/cjs/src/poloniex.js +2 -1
  43. package/dist/cjs/src/pro/apex.js +1043 -0
  44. package/dist/cjs/src/pro/binance.js +3 -3
  45. package/dist/cjs/src/pro/coinbase.js +45 -68
  46. package/dist/cjs/src/pro/gate.js +27 -2
  47. package/dist/cjs/src/pro/hollaex.js +2 -2
  48. package/dist/cjs/src/pro/p2b.js +2 -2
  49. package/dist/cjs/src/pro/tradeogre.js +283 -0
  50. package/dist/cjs/src/pro/upbit.js +43 -0
  51. package/dist/cjs/src/probit.js +1 -0
  52. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +2639 -0
  53. package/dist/cjs/src/timex.js +2 -2
  54. package/dist/cjs/src/tradeogre.js +2 -1
  55. package/dist/cjs/src/upbit.js +277 -67
  56. package/dist/cjs/src/whitebit.js +66 -12
  57. package/dist/cjs/src/woo.js +3 -1
  58. package/dist/cjs/src/xt.js +9 -0
  59. package/js/ccxt.d.ts +11 -5
  60. package/js/ccxt.js +8 -4
  61. package/js/src/abstract/apex.d.ts +34 -0
  62. package/js/src/abstract/bitmart.d.ts +1 -0
  63. package/js/src/apex.d.ts +333 -0
  64. package/js/src/apex.js +1945 -0
  65. package/js/src/ascendex.d.ts +3 -3
  66. package/js/src/ascendex.js +25 -4
  67. package/js/src/base/Exchange.d.ts +2 -0
  68. package/js/src/base/Exchange.js +42 -1
  69. package/js/src/binance.d.ts +7 -7
  70. package/js/src/binance.js +9 -1
  71. package/js/src/bingx.js +3 -3
  72. package/js/src/bitfinex.d.ts +3 -3
  73. package/js/src/bitfinex.js +64 -36
  74. package/js/src/bitflyer.d.ts +2 -2
  75. package/js/src/bitget.d.ts +2 -0
  76. package/js/src/bitget.js +191 -138
  77. package/js/src/bitmart.d.ts +5 -4
  78. package/js/src/bitmart.js +7 -2
  79. package/js/src/bitmex.d.ts +3 -3
  80. package/js/src/bitmex.js +16 -8
  81. package/js/src/bitopro.js +5 -1
  82. package/js/src/bitrue.js +2 -1
  83. package/js/src/bitso.js +1 -1
  84. package/js/src/bitteam.js +2 -0
  85. package/js/src/bitvavo.js +28 -10
  86. package/js/src/btcalpha.js +1 -1
  87. package/js/src/btcmarkets.js +1 -1
  88. package/js/src/btcturk.js +1 -1
  89. package/js/src/bybit.js +32 -16
  90. package/js/src/cex.js +1 -1
  91. package/js/src/coinbase.d.ts +4 -4
  92. package/js/src/coinbase.js +18 -2
  93. package/js/src/coinbaseexchange.d.ts +1 -1
  94. package/js/src/coincatch.d.ts +11 -0
  95. package/js/src/coincatch.js +68 -0
  96. package/js/src/coinex.js +1 -0
  97. package/js/src/coinlist.js +1 -0
  98. package/js/src/coinone.js +1 -0
  99. package/js/src/cryptocom.d.ts +4 -4
  100. package/js/src/delta.js +4 -0
  101. package/js/src/deribit.d.ts +4 -4
  102. package/js/src/deribit.js +1 -0
  103. package/js/src/derive.d.ts +3 -3
  104. package/js/src/digifinex.d.ts +4 -4
  105. package/js/src/hitbtc.js +3 -0
  106. package/js/src/hollaex.js +1 -0
  107. package/js/src/htx.d.ts +4 -4
  108. package/js/src/htx.js +7 -3
  109. package/js/src/huobijp.js +1 -0
  110. package/js/src/hyperliquid.d.ts +1 -0
  111. package/js/src/hyperliquid.js +14 -4
  112. package/js/src/kraken.d.ts +3 -3
  113. package/js/src/kraken.js +2 -0
  114. package/js/src/krakenfutures.d.ts +2 -2
  115. package/js/src/kucoinfutures.d.ts +5 -5
  116. package/js/src/mexc.d.ts +1 -0
  117. package/js/src/mexc.js +50 -57
  118. package/js/src/okx.js +1 -1
  119. package/js/src/oxfun.d.ts +3 -3
  120. package/js/src/phemex.d.ts +3 -3
  121. package/js/src/phemex.js +2 -1
  122. package/js/src/poloniex.d.ts +3 -3
  123. package/js/src/poloniex.js +2 -1
  124. package/js/src/pro/apex.d.ts +160 -0
  125. package/js/src/pro/apex.js +1038 -0
  126. package/js/src/pro/binance.js +3 -3
  127. package/js/src/pro/coinbase.d.ts +4 -3
  128. package/js/src/pro/coinbase.js +45 -66
  129. package/js/src/pro/gate.js +27 -2
  130. package/js/src/pro/hollaex.js +2 -2
  131. package/js/src/pro/p2b.js +2 -2
  132. package/js/src/pro/tradeogre.d.ts +49 -0
  133. package/js/src/pro/tradeogre.js +278 -0
  134. package/js/src/pro/upbit.d.ts +16 -1
  135. package/js/src/pro/upbit.js +43 -0
  136. package/js/src/probit.js +1 -0
  137. package/js/src/static_dependencies/zklink/zklink-sdk-web.d.ts +1279 -0
  138. package/js/src/static_dependencies/zklink/zklink-sdk-web.js +4276 -0
  139. package/js/src/timex.js +2 -2
  140. package/js/src/tradeogre.js +2 -1
  141. package/js/src/upbit.d.ts +75 -23
  142. package/js/src/upbit.js +277 -67
  143. package/js/src/vertex.d.ts +3 -3
  144. package/js/src/whitebit.js +66 -12
  145. package/js/src/woo.d.ts +4 -4
  146. package/js/src/woo.js +3 -1
  147. package/js/src/woofipro.d.ts +4 -4
  148. package/js/src/xt.d.ts +4 -4
  149. package/js/src/xt.js +9 -0
  150. package/package.json +2 -2
  151. package/js/src/abstract/ace.d.ts +0 -18
  152. package/js/src/ace.d.ts +0 -158
  153. package/js/src/ace.js +0 -1175
  154. /package/js/src/abstract/{ace.js → apex.js} +0 -0
@@ -237,6 +237,7 @@ class bitopro extends bitopro$1 {
237
237
  'BEP20': 'BSC',
238
238
  'BSC': 'BSC',
239
239
  },
240
+ 'fiatCurrencies': ['TWD'], // the only fiat currency for exchange
240
241
  },
241
242
  'features': {
242
243
  'spot': {
@@ -364,6 +365,7 @@ class bitopro extends bitopro$1 {
364
365
  // }
365
366
  //
366
367
  const result = {};
368
+ const fiatCurrencies = this.safeList(this.options, 'fiatCurrencies', []);
367
369
  for (let i = 0; i < currencies.length; i++) {
368
370
  const currency = currencies[i];
369
371
  const currencyId = this.safeString(currency, 'currency');
@@ -383,11 +385,12 @@ class bitopro extends bitopro$1 {
383
385
  'max': undefined,
384
386
  },
385
387
  };
388
+ const isFiat = this.inArray(code, fiatCurrencies);
386
389
  result[code] = {
387
390
  'id': currencyId,
388
391
  'code': code,
389
392
  'info': currency,
390
- 'type': undefined,
393
+ 'type': isFiat ? 'fiat' : 'crypto',
391
394
  'name': undefined,
392
395
  'active': deposit && withdraw,
393
396
  'deposit': deposit,
@@ -395,6 +398,7 @@ class bitopro extends bitopro$1 {
395
398
  'fee': fee,
396
399
  'precision': undefined,
397
400
  'limits': limits,
401
+ 'networks': undefined,
398
402
  };
399
403
  }
400
404
  return result;
@@ -819,7 +819,8 @@ class bitrue extends bitrue$1 {
819
819
  'withdraw': withdraw,
820
820
  'networks': networks,
821
821
  'fee': this.parseNumber(minWithdrawFeeString),
822
- // 'fees': fees,
822
+ 'fees': undefined,
823
+ 'type': 'crypto',
823
824
  'limits': {
824
825
  'withdraw': {
825
826
  'min': this.parseNumber(minWithdrawString),
@@ -751,7 +751,7 @@ class bitso extends bitso$1 {
751
751
  // {
752
752
  // "bucket_start_time":1648219140000,
753
753
  // "first_trade_time":1648219154990,
754
- // "last_trade_time":1648219189441,
754
+ // "last_trade_time":1648219189442,
755
755
  // "first_rate":"44958.60",
756
756
  // "last_rate":"44979.88",
757
757
  // "min_rate":"44957.33",
@@ -644,6 +644,7 @@ class bitteam extends bitteam$1 {
644
644
  const networkIds = Object.keys(feesByNetworkId);
645
645
  const networks = {};
646
646
  const networkPrecision = this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals')));
647
+ const typeRaw = this.safeString(currency, 'type');
647
648
  for (let j = 0; j < networkIds.length; j++) {
648
649
  const networkId = networkIds[j];
649
650
  const networkCode = this.networkIdToCode(networkId, code);
@@ -698,6 +699,7 @@ class bitteam extends bitteam$1 {
698
699
  'max': undefined,
699
700
  },
700
701
  },
702
+ 'type': typeRaw,
701
703
  'networks': networks,
702
704
  };
703
705
  }
@@ -343,6 +343,8 @@ class bitvavo extends bitvavo$1 {
343
343
  'ERC20': 'ETH',
344
344
  'TRC20': 'TRX',
345
345
  },
346
+ 'operatorId': undefined,
347
+ 'fiatCurrencies': ['EUR'], // only fiat atm
346
348
  },
347
349
  'precisionMode': number.SIGNIFICANT_DIGITS,
348
350
  'commonCurrencies': {
@@ -552,24 +554,24 @@ class bitvavo extends bitvavo$1 {
552
554
  // },
553
555
  // ]
554
556
  //
557
+ const fiatCurrencies = this.safeList(this.options, 'fiatCurrencies', []);
555
558
  const result = {};
556
559
  for (let i = 0; i < currencies.length; i++) {
557
560
  const currency = currencies[i];
558
561
  const id = this.safeString(currency, 'symbol');
559
562
  const code = this.safeCurrencyCode(id);
563
+ const isFiat = this.inArray(code, fiatCurrencies);
560
564
  const networks = {};
561
- const networksArray = this.safeValue(currency, 'networks', []);
562
- const networksLength = networksArray.length;
563
- const isOneNetwork = (networksLength === 1);
564
- const deposit = (this.safeValue(currency, 'depositStatus') === 'OK');
565
- const withdrawal = (this.safeValue(currency, 'withdrawalStatus') === 'OK');
565
+ const networksArray = this.safeList(currency, 'networks', []);
566
+ const deposit = this.safeString(currency, 'depositStatus') === 'OK';
567
+ const withdrawal = this.safeString(currency, 'withdrawalStatus') === 'OK';
566
568
  const active = deposit && withdrawal;
567
569
  const withdrawFee = this.safeNumber(currency, 'withdrawalFee');
568
570
  const precision = this.safeInteger(currency, 'decimals', 8);
569
571
  const minWithdraw = this.safeNumber(currency, 'withdrawalMinAmount');
570
- // absolutely all of them have 1 network atm - ETH. So, we can reliably assign that inside networks
571
- if (isOneNetwork) {
572
- const networkId = networksArray[0];
572
+ // btw, absolutely all of them have 1 network atm
573
+ for (let j = 0; j < networksArray.length; j++) {
574
+ const networkId = networksArray[j];
573
575
  const networkCode = this.networkIdToCode(networkId);
574
576
  networks[networkCode] = {
575
577
  'info': currency,
@@ -588,7 +590,7 @@ class bitvavo extends bitvavo$1 {
588
590
  },
589
591
  };
590
592
  }
591
- result[code] = {
593
+ result[code] = this.safeCurrencyStructure({
592
594
  'info': currency,
593
595
  'id': id,
594
596
  'code': code,
@@ -599,6 +601,7 @@ class bitvavo extends bitvavo$1 {
599
601
  'networks': networks,
600
602
  'fee': withdrawFee,
601
603
  'precision': precision,
604
+ 'type': isFiat ? 'fiat' : 'crypto',
602
605
  'limits': {
603
606
  'amount': {
604
607
  'min': undefined,
@@ -613,7 +616,7 @@ class bitvavo extends bitvavo$1 {
613
616
  'max': undefined,
614
617
  },
615
618
  },
616
- };
619
+ });
617
620
  }
618
621
  // set currencies here to avoid calling publicGetAssets twice
619
622
  this.currencies = this.deepExtend(this.currencies, result);
@@ -1183,6 +1186,11 @@ class bitvavo extends bitvavo$1 {
1183
1186
  if (postOnly) {
1184
1187
  request['postOnly'] = true;
1185
1188
  }
1189
+ let operatorId = undefined;
1190
+ [operatorId, params] = this.handleOptionAndParams(params, 'createOrder', 'operatorId');
1191
+ if (operatorId !== undefined) {
1192
+ request['operatorId'] = this.parseToInt(operatorId);
1193
+ }
1186
1194
  return this.extend(request, params);
1187
1195
  }
1188
1196
  /**
@@ -1282,6 +1290,11 @@ class bitvavo extends bitvavo$1 {
1282
1290
  if (clientOrderId === undefined) {
1283
1291
  request['orderId'] = id;
1284
1292
  }
1293
+ let operatorId = undefined;
1294
+ [operatorId, params] = this.handleOptionAndParams(params, 'editOrder', 'operatorId');
1295
+ if (operatorId !== undefined) {
1296
+ request['operatorId'] = this.parseToInt(operatorId);
1297
+ }
1285
1298
  request['market'] = market['id'];
1286
1299
  return request;
1287
1300
  }
@@ -1318,6 +1331,11 @@ class bitvavo extends bitvavo$1 {
1318
1331
  if (clientOrderId === undefined) {
1319
1332
  request['orderId'] = id;
1320
1333
  }
1334
+ let operatorId = undefined;
1335
+ [operatorId, params] = this.handleOptionAndParams(params, 'cancelOrder', 'operatorId');
1336
+ if (operatorId !== undefined) {
1337
+ request['operatorId'] = this.parseToInt(operatorId);
1338
+ }
1321
1339
  return this.extend(request, params);
1322
1340
  }
1323
1341
  /**
@@ -212,7 +212,7 @@ class btcalpha extends btcalpha$1 {
212
212
  'symbolRequired': false,
213
213
  },
214
214
  'fetchOHLCV': {
215
- 'max': 720,
215
+ 'limit': 720,
216
216
  },
217
217
  },
218
218
  'swap': {
@@ -454,7 +454,7 @@ class btcmarkets extends btcmarkets$1 {
454
454
  // "marketId":"COMP-AUD",
455
455
  // "baseAssetName":"COMP",
456
456
  // "quoteAssetName":"AUD",
457
- // "minOrderAmount":"0.00007",
457
+ // "minOrderAmount":"0.00006",
458
458
  // "maxOrderAmount":"1000000",
459
459
  // "amountDecimals":"8",
460
460
  // "priceDecimals":"2",
@@ -242,7 +242,7 @@ class btcturk extends btcturk$1 {
242
242
  // "minPrice": "0.0000000000001",
243
243
  // "maxPrice": "10000000",
244
244
  // "tickSize": "10",
245
- // "minExchangeValue": "99.91",
245
+ // "minExchangeValue": "99.92",
246
246
  // "minAmount": null,
247
247
  // "maxAmount": null
248
248
  // }
@@ -1023,9 +1023,6 @@ class bybit extends bybit$1 {
1023
1023
  'usePrivateInstrumentsInfo': false,
1024
1024
  'enableDemoTrading': false,
1025
1025
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
1026
- 'createOrder': {
1027
- 'method': 'privatePostV5OrderCreate', // 'privatePostV5PositionTradingStop'
1028
- },
1029
1026
  'enableUnifiedMargin': undefined,
1030
1027
  'enableUnifiedAccount': undefined,
1031
1028
  'unifiedMarginStatus': undefined,
@@ -2186,7 +2183,7 @@ class bybit extends bybit$1 {
2186
2183
  'quoteId': quoteId,
2187
2184
  'settleId': settleId,
2188
2185
  'type': 'option',
2189
- 'subType': 'linear',
2186
+ 'subType': undefined,
2190
2187
  'spot': false,
2191
2188
  'margin': false,
2192
2189
  'swap': false,
@@ -2194,8 +2191,8 @@ class bybit extends bybit$1 {
2194
2191
  'option': true,
2195
2192
  'active': isActive,
2196
2193
  'contract': true,
2197
- 'linear': true,
2198
- 'inverse': false,
2194
+ 'linear': undefined,
2195
+ 'inverse': undefined,
2199
2196
  'taker': this.safeNumber(market, 'takerFee', this.parseNumber('0.0006')),
2200
2197
  'maker': this.safeNumber(market, 'makerFee', this.parseNumber('0.0001')),
2201
2198
  'contractSize': this.parseNumber('1'),
@@ -3944,12 +3941,23 @@ class bybit extends bybit$1 {
3944
3941
  const parts = await this.isUnifiedEnabled();
3945
3942
  const enableUnifiedAccount = parts[1];
3946
3943
  const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
3944
+ const stopLossPrice = this.safeString(params, 'stopLossPrice');
3945
+ const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
3947
3946
  const isTrailingAmountOrder = trailingAmount !== undefined;
3947
+ const isStopLoss = stopLossPrice !== undefined;
3948
+ const isTakeProfit = takeProfitPrice !== undefined;
3948
3949
  const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params, enableUnifiedAccount);
3949
- const options = this.safeDict(this.options, 'createOrder', {});
3950
- const defaultMethod = this.safeString(options, 'method', 'privatePostV5OrderCreate');
3950
+ let defaultMethod = undefined;
3951
+ if (isTrailingAmountOrder || isStopLoss || isTakeProfit) {
3952
+ defaultMethod = 'privatePostV5PositionTradingStop';
3953
+ }
3954
+ else {
3955
+ defaultMethod = 'privatePostV5OrderCreate';
3956
+ }
3957
+ let method = undefined;
3958
+ [method, params] = this.handleOptionAndParams(params, 'createOrder', 'method', defaultMethod);
3951
3959
  let response = undefined;
3952
- if (isTrailingAmountOrder || (defaultMethod === 'privatePostV5PositionTradingStop')) {
3960
+ if (method === 'privatePostV5PositionTradingStop') {
3953
3961
  response = await this.privatePostV5PositionTradingStop(orderRequest);
3954
3962
  }
3955
3963
  else {
@@ -3977,8 +3985,6 @@ class bybit extends bybit$1 {
3977
3985
  if ((price === undefined) && (lowerCaseType === 'limit')) {
3978
3986
  throw new errors.ArgumentsRequired(this.id + ' createOrder requires a price argument for limit orders');
3979
3987
  }
3980
- let defaultMethod = undefined;
3981
- [defaultMethod, params] = this.handleOptionAndParams(params, 'createOrder', 'method', 'privatePostV5OrderCreate');
3982
3988
  const request = {
3983
3989
  'symbol': market['id'],
3984
3990
  // 'side': this.capitalize (side),
@@ -4022,7 +4028,16 @@ class bybit extends bybit$1 {
4022
4028
  const isMarket = lowerCaseType === 'market';
4023
4029
  const isLimit = lowerCaseType === 'limit';
4024
4030
  const isBuy = side === 'buy';
4025
- const isAlternativeEndpoint = defaultMethod === 'privatePostV5PositionTradingStop';
4031
+ let defaultMethod = undefined;
4032
+ if (isTrailingAmountOrder || isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
4033
+ defaultMethod = 'privatePostV5PositionTradingStop';
4034
+ }
4035
+ else {
4036
+ defaultMethod = 'privatePostV5OrderCreate';
4037
+ }
4038
+ let method = undefined;
4039
+ [method, params] = this.handleOptionAndParams(params, 'createOrder', 'method', defaultMethod);
4040
+ const isAlternativeEndpoint = method === 'privatePostV5PositionTradingStop';
4026
4041
  const amountString = this.getAmount(symbol, amount);
4027
4042
  const priceString = (price !== undefined) ? this.getPrice(symbol, this.numberToString(price)) : undefined;
4028
4043
  if (isTrailingAmountOrder || isAlternativeEndpoint) {
@@ -4092,15 +4107,15 @@ class bybit extends bybit$1 {
4092
4107
  if (market['spot']) {
4093
4108
  request['category'] = 'spot';
4094
4109
  }
4110
+ else if (market['option']) {
4111
+ request['category'] = 'option';
4112
+ }
4095
4113
  else if (market['linear']) {
4096
4114
  request['category'] = 'linear';
4097
4115
  }
4098
4116
  else if (market['inverse']) {
4099
4117
  request['category'] = 'inverse';
4100
4118
  }
4101
- else if (market['option']) {
4102
- request['category'] = 'option';
4103
- }
4104
4119
  const cost = this.safeString(params, 'cost');
4105
4120
  params = this.omit(params, 'cost');
4106
4121
  // if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
@@ -5978,7 +5993,8 @@ class bybit extends bybit$1 {
5978
5993
  [subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
5979
5994
  let response = undefined;
5980
5995
  if (enableUnified[1]) {
5981
- if (subType === 'inverse') {
5996
+ const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 5); // 3/4 uta 1.0, 5/6 uta 2.0
5997
+ if (subType === 'inverse' && (unifiedMarginStatus < 5)) {
5982
5998
  response = await this.privateGetV5AccountContractTransactionLog(this.extend(request, params));
5983
5999
  }
5984
6000
  else {
@@ -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'),
@@ -1509,7 +1509,21 @@ class coinbase extends coinbase$1 {
1509
1509
  for (let i = 0; i < perpetualData.length; i++) {
1510
1510
  result.push(this.parseContractMarket(perpetualData[i], perpetualFeeTier));
1511
1511
  }
1512
- return result;
1512
+ const newMarkets = [];
1513
+ for (let i = 0; i < result.length; i++) {
1514
+ const market = result[i];
1515
+ const info = this.safeValue(market, 'info', {});
1516
+ const realMarketIds = this.safeList(info, 'alias_to', []);
1517
+ const length = realMarketIds.length;
1518
+ if (length > 0) {
1519
+ market['alias'] = realMarketIds[0];
1520
+ }
1521
+ else {
1522
+ market['alias'] = undefined;
1523
+ }
1524
+ newMarkets.push(market);
1525
+ }
1526
+ return newMarkets;
1513
1527
  }
1514
1528
  parseSpotMarket(market, feeTier) {
1515
1529
  //
@@ -1921,6 +1935,7 @@ class coinbase extends coinbase$1 {
1921
1935
  'withdraw': undefined,
1922
1936
  'fee': undefined,
1923
1937
  'precision': undefined,
1938
+ 'networks': {},
1924
1939
  'limits': {
1925
1940
  'amount': {
1926
1941
  'min': this.safeNumber(currency, 'min_size'),
@@ -2245,10 +2260,11 @@ class coinbase extends coinbase$1 {
2245
2260
  askVolume = this.safeNumber(asks[0], 'size');
2246
2261
  }
2247
2262
  const marketId = this.safeString(ticker, 'product_id');
2263
+ market = this.safeMarket(marketId, market);
2248
2264
  const last = this.safeNumber(ticker, 'price');
2249
2265
  const datetime = this.safeString(ticker, 'time');
2250
2266
  return this.safeTicker({
2251
- 'symbol': this.safeSymbol(marketId, market),
2267
+ 'symbol': market['symbol'],
2252
2268
  'timestamp': this.parse8601(datetime),
2253
2269
  'datetime': datetime,
2254
2270
  '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
@@ -745,6 +745,7 @@ class coinex extends coinex$1 {
745
745
  },
746
746
  },
747
747
  'networks': {},
748
+ 'type': 'crypto',
748
749
  'info': coin,
749
750
  };
750
751
  for (let j = 0; j < chains.length; j++) {
@@ -474,6 +474,7 @@ class coinlist extends coinlist$1 {
474
474
  'withdraw': { 'min': minWithdrawal, 'max': undefined },
475
475
  },
476
476
  'networks': {},
477
+ 'type': 'crypto',
477
478
  };
478
479
  }
479
480
  return result;
@@ -323,6 +323,7 @@ class coinone extends coinone$1 {
323
323
  },
324
324
  },
325
325
  'networks': {},
326
+ 'type': 'crypto',
326
327
  };
327
328
  }
328
329
  return result;
@@ -348,6 +348,9 @@ class delta extends delta$1 {
348
348
  expiry = this.safeString(optionParts, 3);
349
349
  optionType = this.safeString(optionParts, 0);
350
350
  }
351
+ if (expiry !== undefined) {
352
+ expiry = expiry.slice(4) + expiry.slice(2, 4) + expiry.slice(0, 2);
353
+ }
351
354
  const settle = quote;
352
355
  const strike = this.safeString(optionParts, 2);
353
356
  const datetime = this.convertExpireDate(expiry);
@@ -563,6 +566,7 @@ class delta extends delta$1 {
563
566
  },
564
567
  },
565
568
  'networks': {},
569
+ 'type': 'crypto',
566
570
  };
567
571
  }
568
572
  return result;
@@ -649,6 +649,7 @@ class deribit extends deribit$1 {
649
649
  'active': undefined,
650
650
  'deposit': undefined,
651
651
  'withdraw': undefined,
652
+ 'type': 'crypto',
652
653
  'fee': this.safeNumber(currency, 'withdrawal_fee'),
653
654
  'precision': this.parseNumber(this.parsePrecision(this.safeString(currency, 'fee_precision'))),
654
655
  'limits': {
@@ -954,6 +954,8 @@ class hitbtc extends hitbtc$1 {
954
954
  const transferEnabled = this.safeBool(entry, 'transfer_enabled', false);
955
955
  const active = payinEnabled && payoutEnabled && transferEnabled;
956
956
  const rawNetworks = this.safeValue(entry, 'networks', []);
957
+ const isCrypto = this.safeBool(entry, 'crypto');
958
+ const type = isCrypto ? 'crypto' : 'fiat';
957
959
  const networks = {};
958
960
  let fee = undefined;
959
961
  let depositEnabled = undefined;
@@ -1016,6 +1018,7 @@ class hitbtc extends hitbtc$1 {
1016
1018
  'max': undefined,
1017
1019
  },
1018
1020
  },
1021
+ 'type': type,
1019
1022
  };
1020
1023
  }
1021
1024
  return result;
@@ -486,6 +486,7 @@ class hollaex extends hollaex$1 {
486
486
  },
487
487
  },
488
488
  'networks': {},
489
+ 'type': 'crypto',
489
490
  };
490
491
  }
491
492
  return result;
@@ -944,6 +944,7 @@ class htx extends htx$1 {
944
944
  },
945
945
  'precisionMode': number.TICK_SIZE,
946
946
  'options': {
947
+ 'include_OS_certificates': false,
947
948
  'fetchMarkets': {
948
949
  'types': {
949
950
  'spot': true,
@@ -2207,7 +2208,7 @@ class htx extends htx$1 {
2207
2208
  let ask = undefined;
2208
2209
  let askVolume = undefined;
2209
2210
  if ('bid' in ticker) {
2210
- if (Array.isArray(ticker['bid'])) {
2211
+ if (ticker['bid'] !== undefined && Array.isArray(ticker['bid'])) {
2211
2212
  bid = this.safeString(ticker['bid'], 0);
2212
2213
  bidVolume = this.safeString(ticker['bid'], 1);
2213
2214
  }
@@ -2217,7 +2218,7 @@ class htx extends htx$1 {
2217
2218
  }
2218
2219
  }
2219
2220
  if ('ask' in ticker) {
2220
- if (Array.isArray(ticker['ask'])) {
2221
+ if (ticker['ask'] !== undefined && Array.isArray(ticker['ask'])) {
2221
2222
  ask = this.safeString(ticker['ask'], 0);
2222
2223
  askVolume = this.safeString(ticker['ask'], 1);
2223
2224
  }
@@ -3423,7 +3424,7 @@ class htx extends htx$1 {
3423
3424
  // "withdrawQuotaPerYear": null,
3424
3425
  // "withdrawQuotaTotal": null,
3425
3426
  // "withdrawFeeType": "fixed",
3426
- // "transactFeeWithdraw": "11.1653",
3427
+ // "transactFeeWithdraw": "11.1654",
3427
3428
  // "addrWithTag": false,
3428
3429
  // "addrDepositTag": false
3429
3430
  // }
@@ -3446,6 +3447,8 @@ class htx extends htx$1 {
3446
3447
  const chains = this.safeValue(entry, 'chains', []);
3447
3448
  const networks = {};
3448
3449
  const instStatus = this.safeString(entry, 'instStatus');
3450
+ const assetType = this.safeString(entry, 'assetType');
3451
+ const type = assetType === '1' ? 'crypto' : 'fiat';
3449
3452
  const currencyActive = instStatus === 'normal';
3450
3453
  let minPrecision = undefined;
3451
3454
  let minDeposit = undefined;
@@ -3505,6 +3508,7 @@ class htx extends htx$1 {
3505
3508
  'withdraw': withdraw,
3506
3509
  'fee': undefined,
3507
3510
  'name': undefined,
3511
+ 'type': type,
3508
3512
  'limits': {
3509
3513
  'amount': {
3510
3514
  'min': undefined,
@@ -1140,6 +1140,7 @@ class huobijp extends huobijp$1 {
1140
1140
  'withdraw': withdrawEnabled,
1141
1141
  'fee': undefined,
1142
1142
  'precision': precision,
1143
+ 'networks': undefined,
1143
1144
  'limits': {
1144
1145
  'amount': {
1145
1146
  'min': precision,
@@ -368,6 +368,7 @@ class hyperliquid extends hyperliquid$1 {
368
368
  'withdraw': undefined,
369
369
  'networks': undefined,
370
370
  'fee': undefined,
371
+ 'type': 'crypto',
371
372
  'limits': {
372
373
  'amount': {
373
374
  'min': undefined,
@@ -771,6 +772,7 @@ class hyperliquid extends hyperliquid$1 {
771
772
  * @param {object} [params] extra parameters specific to the exchange API endpoint
772
773
  * @param {string} [params.user] user address, will default to this.walletAddress if not provided
773
774
  * @param {string} [params.type] wallet type, ['spot', 'swap'], defaults to swap
775
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for margin trading, uses this.options.defaultMarginMode if not passed, defaults to undefined/None/null
774
776
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
775
777
  */
776
778
  async fetchBalance(params = {}) {
@@ -778,6 +780,8 @@ class hyperliquid extends hyperliquid$1 {
778
780
  [userAddress, params] = this.handlePublicAddress('fetchBalance', params);
779
781
  let type = undefined;
780
782
  [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
783
+ let marginMode = undefined;
784
+ [marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
781
785
  const isSpot = (type === 'spot');
782
786
  const reqType = (isSpot) ? 'spotClearinghouseState' : 'clearinghouseState';
783
787
  const request = {
@@ -836,12 +840,18 @@ class hyperliquid extends hyperliquid$1 {
836
840
  return this.safeBalance(spotBalances);
837
841
  }
838
842
  const data = this.safeDict(response, 'marginSummary', {});
843
+ const usdcBalance = {
844
+ 'total': this.safeNumber(data, 'accountValue'),
845
+ };
846
+ if ((marginMode !== undefined) && (marginMode === 'isolated')) {
847
+ usdcBalance['free'] = this.safeNumber(response, 'withdrawable');
848
+ }
849
+ else {
850
+ usdcBalance['used'] = this.safeNumber(data, 'totalMarginUsed');
851
+ }
839
852
  const result = {
840
853
  'info': response,
841
- 'USDC': {
842
- 'total': this.safeNumber(data, 'accountValue'),
843
- 'used': this.safeNumber(data, 'totalMarginUsed'),
844
- },
854
+ 'USDC': usdcBalance,
845
855
  };
846
856
  const timestamp = this.safeInteger(response, 'time');
847
857
  result['timestamp'] = timestamp;