ccxt 4.4.78 → 4.4.82

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 (99) hide show
  1. package/README.md +8 -12
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/apex.js +21 -31
  5. package/dist/cjs/src/ascendex.js +26 -5
  6. package/dist/cjs/src/base/Exchange.js +26 -3
  7. package/dist/cjs/src/base/functions/encode.js +1 -1
  8. package/dist/cjs/src/bigone.js +22 -14
  9. package/dist/cjs/src/binance.js +8 -0
  10. package/dist/cjs/src/bingx.js +16 -40
  11. package/dist/cjs/src/bitfinex.js +128 -88
  12. package/dist/cjs/src/bitget.js +60 -71
  13. package/dist/cjs/src/bitmart.js +7 -2
  14. package/dist/cjs/src/bitmex.js +12 -4
  15. package/dist/cjs/src/bitopro.js +5 -1
  16. package/dist/cjs/src/bitrue.js +2 -1
  17. package/dist/cjs/src/bitso.js +1 -1
  18. package/dist/cjs/src/bitteam.js +2 -0
  19. package/dist/cjs/src/bitvavo.js +28 -10
  20. package/dist/cjs/src/btcalpha.js +1 -1
  21. package/dist/cjs/src/btcmarkets.js +1 -1
  22. package/dist/cjs/src/btcturk.js +1 -1
  23. package/dist/cjs/src/bybit.js +34 -16
  24. package/dist/cjs/src/coinbase.js +4 -17
  25. package/dist/cjs/src/coinex.js +1 -0
  26. package/dist/cjs/src/coinlist.js +1 -0
  27. package/dist/cjs/src/coinone.js +1 -0
  28. package/dist/cjs/src/delta.js +4 -0
  29. package/dist/cjs/src/deribit.js +1 -0
  30. package/dist/cjs/src/hollaex.js +1 -0
  31. package/dist/cjs/src/htx.js +9 -5
  32. package/dist/cjs/src/huobijp.js +1 -0
  33. package/dist/cjs/src/hyperliquid.js +16 -0
  34. package/dist/cjs/src/kraken.js +2 -0
  35. package/dist/cjs/src/okx.js +2 -3
  36. package/dist/cjs/src/oxfun.js +21 -1
  37. package/dist/cjs/src/poloniex.js +1 -0
  38. package/dist/cjs/src/pro/binance.js +3 -3
  39. package/dist/cjs/src/pro/coinbase.js +43 -62
  40. package/dist/cjs/src/pro/hyperliquid.js +10 -2
  41. package/dist/cjs/src/pro/upbit.js +43 -0
  42. package/dist/cjs/src/timex.js +2 -2
  43. package/dist/cjs/src/upbit.js +43 -21
  44. package/dist/cjs/src/whitebit.js +65 -12
  45. package/js/ccxt.d.ts +1 -1
  46. package/js/ccxt.js +1 -1
  47. package/js/src/abstract/bitmart.d.ts +1 -0
  48. package/js/src/apex.js +21 -31
  49. package/js/src/ascendex.js +26 -5
  50. package/js/src/base/Exchange.d.ts +2 -1
  51. package/js/src/base/Exchange.js +26 -3
  52. package/js/src/base/functions/encode.d.ts +1 -1
  53. package/js/src/base/functions/encode.js +1 -1
  54. package/js/src/bigone.js +22 -14
  55. package/js/src/binance.js +8 -0
  56. package/js/src/bingx.d.ts +1 -1
  57. package/js/src/bingx.js +16 -40
  58. package/js/src/bitfinex.js +128 -88
  59. package/js/src/bitget.d.ts +1 -0
  60. package/js/src/bitget.js +60 -71
  61. package/js/src/bitmart.d.ts +1 -0
  62. package/js/src/bitmart.js +7 -2
  63. package/js/src/bitmex.js +12 -4
  64. package/js/src/bitopro.js +5 -1
  65. package/js/src/bitrue.js +2 -1
  66. package/js/src/bitso.js +1 -1
  67. package/js/src/bitteam.js +2 -0
  68. package/js/src/bitvavo.js +28 -10
  69. package/js/src/btcalpha.js +1 -1
  70. package/js/src/btcmarkets.js +1 -1
  71. package/js/src/btcturk.js +1 -1
  72. package/js/src/bybit.js +34 -16
  73. package/js/src/coinbase.d.ts +0 -2
  74. package/js/src/coinbase.js +4 -17
  75. package/js/src/coinex.js +1 -0
  76. package/js/src/coinlist.js +1 -0
  77. package/js/src/coinone.js +1 -0
  78. package/js/src/delta.js +4 -0
  79. package/js/src/deribit.js +1 -0
  80. package/js/src/hollaex.js +1 -0
  81. package/js/src/htx.js +9 -5
  82. package/js/src/huobijp.js +1 -0
  83. package/js/src/hyperliquid.js +16 -0
  84. package/js/src/kraken.js +2 -0
  85. package/js/src/okx.js +2 -3
  86. package/js/src/oxfun.d.ts +10 -0
  87. package/js/src/oxfun.js +21 -1
  88. package/js/src/poloniex.js +1 -0
  89. package/js/src/pro/binance.js +3 -3
  90. package/js/src/pro/coinbase.d.ts +4 -3
  91. package/js/src/pro/coinbase.js +43 -60
  92. package/js/src/pro/hyperliquid.js +10 -2
  93. package/js/src/pro/upbit.d.ts +16 -1
  94. package/js/src/pro/upbit.js +43 -0
  95. package/js/src/timex.js +2 -2
  96. package/js/src/upbit.d.ts +42 -20
  97. package/js/src/upbit.js +43 -21
  98. package/js/src/whitebit.js +65 -12
  99. package/package.json +1 -1
@@ -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,
@@ -1717,6 +1714,7 @@ class bybit extends bybit$1 {
1717
1714
  },
1718
1715
  },
1719
1716
  'networks': networks,
1717
+ 'type': 'crypto', // atm exchange api provides only cryptos
1720
1718
  };
1721
1719
  }
1722
1720
  return result;
@@ -2175,6 +2173,7 @@ class bybit extends bybit$1 {
2175
2173
  const strike = this.safeString(splitId, 2);
2176
2174
  const optionLetter = this.safeString(splitId, 3);
2177
2175
  const isActive = (status === 'Trading');
2176
+ const isInverse = base === settle;
2178
2177
  if (isActive || (this.options['loadAllOptions']) || (this.options['loadExpiredOptions'])) {
2179
2178
  result.push(this.safeMarketStructure({
2180
2179
  'id': id,
@@ -2186,7 +2185,7 @@ class bybit extends bybit$1 {
2186
2185
  'quoteId': quoteId,
2187
2186
  'settleId': settleId,
2188
2187
  'type': 'option',
2189
- 'subType': 'linear',
2188
+ 'subType': undefined,
2190
2189
  'spot': false,
2191
2190
  'margin': false,
2192
2191
  'swap': false,
@@ -2194,8 +2193,8 @@ class bybit extends bybit$1 {
2194
2193
  'option': true,
2195
2194
  'active': isActive,
2196
2195
  'contract': true,
2197
- 'linear': true,
2198
- 'inverse': false,
2196
+ 'linear': !isInverse,
2197
+ 'inverse': isInverse,
2199
2198
  'taker': this.safeNumber(market, 'takerFee', this.parseNumber('0.0006')),
2200
2199
  'maker': this.safeNumber(market, 'makerFee', this.parseNumber('0.0001')),
2201
2200
  'contractSize': this.parseNumber('1'),
@@ -3944,12 +3943,23 @@ class bybit extends bybit$1 {
3944
3943
  const parts = await this.isUnifiedEnabled();
3945
3944
  const enableUnifiedAccount = parts[1];
3946
3945
  const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
3946
+ const stopLossPrice = this.safeString(params, 'stopLossPrice');
3947
+ const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
3947
3948
  const isTrailingAmountOrder = trailingAmount !== undefined;
3949
+ const isStopLoss = stopLossPrice !== undefined;
3950
+ const isTakeProfit = takeProfitPrice !== undefined;
3948
3951
  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');
3952
+ let defaultMethod = undefined;
3953
+ if (isTrailingAmountOrder || isStopLoss || isTakeProfit) {
3954
+ defaultMethod = 'privatePostV5PositionTradingStop';
3955
+ }
3956
+ else {
3957
+ defaultMethod = 'privatePostV5OrderCreate';
3958
+ }
3959
+ let method = undefined;
3960
+ [method, params] = this.handleOptionAndParams(params, 'createOrder', 'method', defaultMethod);
3951
3961
  let response = undefined;
3952
- if (isTrailingAmountOrder || (defaultMethod === 'privatePostV5PositionTradingStop')) {
3962
+ if (method === 'privatePostV5PositionTradingStop') {
3953
3963
  response = await this.privatePostV5PositionTradingStop(orderRequest);
3954
3964
  }
3955
3965
  else {
@@ -3977,8 +3987,6 @@ class bybit extends bybit$1 {
3977
3987
  if ((price === undefined) && (lowerCaseType === 'limit')) {
3978
3988
  throw new errors.ArgumentsRequired(this.id + ' createOrder requires a price argument for limit orders');
3979
3989
  }
3980
- let defaultMethod = undefined;
3981
- [defaultMethod, params] = this.handleOptionAndParams(params, 'createOrder', 'method', 'privatePostV5OrderCreate');
3982
3990
  const request = {
3983
3991
  'symbol': market['id'],
3984
3992
  // 'side': this.capitalize (side),
@@ -4022,7 +4030,16 @@ class bybit extends bybit$1 {
4022
4030
  const isMarket = lowerCaseType === 'market';
4023
4031
  const isLimit = lowerCaseType === 'limit';
4024
4032
  const isBuy = side === 'buy';
4025
- const isAlternativeEndpoint = defaultMethod === 'privatePostV5PositionTradingStop';
4033
+ let defaultMethod = undefined;
4034
+ if (isTrailingAmountOrder || isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
4035
+ defaultMethod = 'privatePostV5PositionTradingStop';
4036
+ }
4037
+ else {
4038
+ defaultMethod = 'privatePostV5OrderCreate';
4039
+ }
4040
+ let method = undefined;
4041
+ [method, params] = this.handleOptionAndParams(params, 'createOrder', 'method', defaultMethod);
4042
+ const isAlternativeEndpoint = method === 'privatePostV5PositionTradingStop';
4026
4043
  const amountString = this.getAmount(symbol, amount);
4027
4044
  const priceString = (price !== undefined) ? this.getPrice(symbol, this.numberToString(price)) : undefined;
4028
4045
  if (isTrailingAmountOrder || isAlternativeEndpoint) {
@@ -4092,15 +4109,15 @@ class bybit extends bybit$1 {
4092
4109
  if (market['spot']) {
4093
4110
  request['category'] = 'spot';
4094
4111
  }
4112
+ else if (market['option']) {
4113
+ request['category'] = 'option';
4114
+ }
4095
4115
  else if (market['linear']) {
4096
4116
  request['category'] = 'linear';
4097
4117
  }
4098
4118
  else if (market['inverse']) {
4099
4119
  request['category'] = 'inverse';
4100
4120
  }
4101
- else if (market['option']) {
4102
- request['category'] = 'option';
4103
- }
4104
4121
  const cost = this.safeString(params, 'cost');
4105
4122
  params = this.omit(params, 'cost');
4106
4123
  // if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
@@ -5978,7 +5995,8 @@ class bybit extends bybit$1 {
5978
5995
  [subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
5979
5996
  let response = undefined;
5980
5997
  if (enableUnified[1]) {
5981
- if (subType === 'inverse') {
5998
+ const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 5); // 3/4 uta 1.0, 5/6 uta 2.0
5999
+ if (subType === 'inverse' && (unifiedMarginStatus < 5)) {
5982
6000
  response = await this.privateGetV5AccountContractTransactionLog(this.extend(request, params));
5983
6001
  }
5984
6002
  else {
@@ -375,8 +375,7 @@ class coinbase extends coinbase$1 {
375
375
  'fetchAccounts': 'fetchAccountsV3',
376
376
  'fetchBalance': 'v2PrivateGetAccounts',
377
377
  'fetchTime': 'v2PublicGetTime',
378
- 'user_native_currency': 'USD',
379
- 'aliasCbMarketIds': {},
378
+ 'user_native_currency': 'USD', // needed to get fees for v3
380
379
  },
381
380
  'features': {
382
381
  'default': {
@@ -1510,8 +1509,6 @@ class coinbase extends coinbase$1 {
1510
1509
  for (let i = 0; i < perpetualData.length; i++) {
1511
1510
  result.push(this.parseContractMarket(perpetualData[i], perpetualFeeTier));
1512
1511
  }
1513
- // remove aliases
1514
- this.options['aliasCbMarketIds'] = {};
1515
1512
  const newMarkets = [];
1516
1513
  for (let i = 0; i < result.length; i++) {
1517
1514
  const market = result[i];
@@ -1519,25 +1516,15 @@ class coinbase extends coinbase$1 {
1519
1516
  const realMarketIds = this.safeList(info, 'alias_to', []);
1520
1517
  const length = realMarketIds.length;
1521
1518
  if (length > 0) {
1522
- this.options['aliasCbMarketIds'][market['id']] = realMarketIds[0];
1523
- this.options['aliasCbMarketIds'][market['symbol']] = realMarketIds[0];
1519
+ market['alias'] = realMarketIds[0];
1524
1520
  }
1525
1521
  else {
1526
- newMarkets.push(market);
1522
+ market['alias'] = undefined;
1527
1523
  }
1524
+ newMarkets.push(market);
1528
1525
  }
1529
1526
  return newMarkets;
1530
1527
  }
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);
1540
- }
1541
1528
  parseSpotMarket(market, feeTier) {
1542
1529
  //
1543
1530
  // {
@@ -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++) {
@@ -475,6 +475,7 @@ class coinlist extends coinlist$1 {
475
475
  'withdraw': { 'min': minWithdrawal, 'max': undefined },
476
476
  },
477
477
  'networks': {},
478
+ 'type': 'crypto',
478
479
  };
479
480
  }
480
481
  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': {
@@ -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,
@@ -7494,7 +7498,7 @@ class htx extends htx$1 {
7494
7498
  request = this.extend(request, query);
7495
7499
  }
7496
7500
  const sortedRequest = this.keysort(request);
7497
- let auth = this.urlencode(sortedRequest);
7501
+ let auth = this.urlencode(sortedRequest, true); // true is a go only requirment
7498
7502
  // unfortunately, PHP demands double quotes for the escaped newline symbol
7499
7503
  const payload = [method, this.hostname, url, auth].join("\n"); // eslint-disable-line quotes
7500
7504
  const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256.sha256, 'base64');
@@ -7576,7 +7580,7 @@ class htx extends htx$1 {
7576
7580
  const sortedQuery = this.keysort(query);
7577
7581
  request = this.extend(request, sortedQuery);
7578
7582
  }
7579
- let auth = this.urlencode(request).replace('%2c', '%2C'); // in c# it manually needs to be uppercased
7583
+ let auth = this.urlencode(request, true).replace('%2c', '%2C'); // in c# it manually needs to be uppercased
7580
7584
  // unfortunately, PHP demands double quotes for the escaped newline symbol
7581
7585
  const payload = [method, hostname, url, auth].join("\n"); // eslint-disable-line quotes
7582
7586
  const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256.sha256, 'base64');
@@ -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,
@@ -2261,6 +2262,10 @@ class hyperliquid extends hyperliquid$1 {
2261
2262
  return this.parseOrder(data, market);
2262
2263
  }
2263
2264
  parseOrder(order, market = undefined) {
2265
+ //
2266
+ // createOrdersWs error
2267
+ //
2268
+ // {error: 'Insufficient margin to place order. asset=159'}
2264
2269
  //
2265
2270
  // fetchOpenOrders
2266
2271
  //
@@ -2352,6 +2357,13 @@ class hyperliquid extends hyperliquid$1 {
2352
2357
  // "triggerPx": "0.6"
2353
2358
  // }
2354
2359
  //
2360
+ const error = this.safeString(order, 'error');
2361
+ if (error !== undefined) {
2362
+ return this.safeOrder({
2363
+ 'info': order,
2364
+ 'status': 'rejected',
2365
+ });
2366
+ }
2355
2367
  let entry = this.safeDictN(order, ['order', 'resting', 'filled']);
2356
2368
  if (entry === undefined) {
2357
2369
  entry = order;
@@ -3597,10 +3609,14 @@ class hyperliquid extends hyperliquid$1 {
3597
3609
  // {"status":"ok","response":{"type":"order","data":{"statuses":[{"error":"Insufficient margin to place order. asset=84"}]}}}
3598
3610
  //
3599
3611
  const status = this.safeString(response, 'status', '');
3612
+ const error = this.safeString(response, 'error');
3600
3613
  let message = undefined;
3601
3614
  if (status === 'err') {
3602
3615
  message = this.safeString(response, 'response');
3603
3616
  }
3617
+ else if (error !== undefined) {
3618
+ message = error;
3619
+ }
3604
3620
  else {
3605
3621
  const responsePayload = this.safeDict(response, 'response', {});
3606
3622
  const data = this.safeDict(responsePayload, 'data', {});
@@ -858,12 +858,14 @@ class kraken extends kraken$1 {
858
858
  const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals')));
859
859
  // assumes all currencies are active except those listed above
860
860
  const active = this.safeString(currency, 'status') === 'enabled';
861
+ const isFiat = code.indexOf('.HOLD') >= 0;
861
862
  result[code] = {
862
863
  'id': id,
863
864
  'code': code,
864
865
  'info': currency,
865
866
  'name': this.safeString(currency, 'altname'),
866
867
  'active': active,
868
+ 'type': isFiat ? 'fiat' : 'crypto',
867
869
  'deposit': undefined,
868
870
  'withdraw': undefined,
869
871
  'fee': undefined,
@@ -1643,7 +1643,6 @@ class okx extends okx$1 {
1643
1643
  }
1644
1644
  }
1645
1645
  }
1646
- const tickSize = this.safeString(market, 'tickSz');
1647
1646
  const fees = this.safeDict2(this.fees, type, 'trading', {});
1648
1647
  let maxLeverage = this.safeString(market, 'lever', '1');
1649
1648
  maxLeverage = Precise["default"].stringMax(maxLeverage, '1');
@@ -1675,7 +1674,7 @@ class okx extends okx$1 {
1675
1674
  'created': this.safeInteger(market, 'listTime'),
1676
1675
  'precision': {
1677
1676
  'amount': this.safeNumber(market, 'lotSz'),
1678
- 'price': this.parseNumber(tickSize),
1677
+ 'price': this.safeNumber(market, 'tickSz'),
1679
1678
  },
1680
1679
  'limits': {
1681
1680
  'leverage': {
@@ -5075,7 +5074,7 @@ class okx extends okx$1 {
5075
5074
  */
5076
5075
  async fetchDepositAddress(code, params = {}) {
5077
5076
  await this.loadMarkets();
5078
- const rawNetwork = this.safeStringUpper(params, 'network');
5077
+ const rawNetwork = this.safeString(params, 'network'); // some networks are like "Dora Vota Mainnet"
5079
5078
  params = this.omit(params, 'network');
5080
5079
  code = this.safeCurrencyCode(code);
5081
5080
  const network = this.networkIdToCode(rawNetwork, code);
@@ -67,7 +67,7 @@ class oxfun extends oxfun$1 {
67
67
  'fetchDepositWithdrawFee': false,
68
68
  'fetchDepositWithdrawFees': false,
69
69
  'fetchFundingHistory': true,
70
- 'fetchFundingRate': 'emulated',
70
+ 'fetchFundingRate': true,
71
71
  'fetchFundingRateHistory': true,
72
72
  'fetchFundingRates': true,
73
73
  'fetchIndexOHLCV': false,
@@ -1101,6 +1101,26 @@ class oxfun extends oxfun$1 {
1101
1101
  const data = this.safeList(response, 'data', []);
1102
1102
  return this.parseFundingRates(data, symbols);
1103
1103
  }
1104
+ /**
1105
+ * @method
1106
+ * @name oxfun#fetchFundingRate
1107
+ * @description fetch the current funding rates for a symbol
1108
+ * @see https://docs.ox.fun/?json#get-v3-funding-estimates
1109
+ * @param {string} symbol unified market symbols
1110
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1111
+ * @returns {Order[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
1112
+ */
1113
+ async fetchFundingRate(symbol, params = {}) {
1114
+ await this.loadMarkets();
1115
+ const request = {
1116
+ 'marketCode': this.marketId(symbol),
1117
+ };
1118
+ const response = await this.publicGetV3FundingEstimates(this.extend(request, params));
1119
+ //
1120
+ const data = this.safeList(response, 'data', []);
1121
+ const first = this.safeDict(data, 0, {});
1122
+ return this.parseFundingRate(first, this.market(symbol));
1123
+ }
1104
1124
  parseFundingRate(fundingRate, market = undefined) {
1105
1125
  //
1106
1126
  // {