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
package/js/src/bitmex.js CHANGED
@@ -492,6 +492,7 @@ export default class bitmex extends Exchange {
492
492
  const maxWithdrawal = this.parseNumber(Precise.stringMul(maxWithdrawalString, precisionString));
493
493
  const minDepositString = this.safeString(currency, 'minDepositAmount');
494
494
  const minDeposit = this.parseNumber(Precise.stringMul(minDepositString, precisionString));
495
+ const isCrypto = this.safeString(currency, 'currencyType') === 'Crypto';
495
496
  result[code] = {
496
497
  'id': id,
497
498
  'code': code,
@@ -517,6 +518,7 @@ export default class bitmex extends Exchange {
517
518
  },
518
519
  },
519
520
  'networks': networks,
521
+ 'type': isCrypto ? 'crypto' : 'other',
520
522
  };
521
523
  }
522
524
  return result;
@@ -725,11 +727,11 @@ export default class bitmex extends Exchange {
725
727
  const quote = this.safeCurrencyCode(quoteId);
726
728
  const contract = swap || future;
727
729
  let contractSize = undefined;
728
- const isInverse = this.safeValue(market, 'isInverse'); // this is true when BASE and SETTLE are same, i.e. BTC/XXX:BTC
729
- const isQuanto = this.safeValue(market, 'isQuanto'); // this is true when BASE and SETTLE are different, i.e. AXS/XXX:BTC
730
- const linear = contract ? (!isInverse && !isQuanto) : undefined;
730
+ let isInverse = this.safeValue(market, 'isInverse'); // this is true when BASE and SETTLE are same, i.e. BTC/XXX:BTC
731
+ let isQuanto = this.safeValue(market, 'isQuanto'); // this is true when BASE and SETTLE are different, i.e. AXS/XXX:BTC
732
+ let linear = contract ? (!isInverse && !isQuanto) : undefined;
731
733
  const status = this.safeString(market, 'state');
732
- const active = status !== 'Unlisted';
734
+ const active = status === 'Open'; // Open, Settled, Unlisted
733
735
  let expiry = undefined;
734
736
  let expiryDatetime = undefined;
735
737
  let symbol = undefined;
@@ -746,9 +748,9 @@ export default class bitmex extends Exchange {
746
748
  const multiplierString = Precise.stringAbs(this.safeString(market, 'multiplier'));
747
749
  contractSize = this.parseNumber(multiplierString);
748
750
  }
749
- if (future) {
750
- expiryDatetime = this.safeString(market, 'expiry');
751
- expiry = this.parse8601(expiryDatetime);
751
+ expiryDatetime = this.safeString(market, 'expiry');
752
+ expiry = this.parse8601(expiryDatetime);
753
+ if (expiry !== undefined) {
752
754
  symbol = symbol + '-' + this.yymmdd(expiry);
753
755
  }
754
756
  }
@@ -762,6 +764,12 @@ export default class bitmex extends Exchange {
762
764
  const maxOrderQty = this.safeNumber(market, 'maxOrderQty');
763
765
  const initMargin = this.safeString(market, 'initMargin', '1');
764
766
  const maxLeverage = this.parseNumber(Precise.stringDiv('1', initMargin));
767
+ // subtype should be undefined for spot markets
768
+ if (spot) {
769
+ isInverse = undefined;
770
+ isQuanto = undefined;
771
+ linear = undefined;
772
+ }
765
773
  return {
766
774
  'id': id,
767
775
  'symbol': symbol,
@@ -811,7 +819,7 @@ export default class bitmex extends Exchange {
811
819
  'max': positionIsQuote ? maxOrderQty : undefined,
812
820
  },
813
821
  },
814
- 'created': this.parse8601(this.safeString(market, 'listing')),
822
+ 'created': undefined,
815
823
  'info': market,
816
824
  };
817
825
  }
package/js/src/bitopro.js CHANGED
@@ -234,6 +234,7 @@ export default class bitopro extends Exchange {
234
234
  'BEP20': 'BSC',
235
235
  'BSC': 'BSC',
236
236
  },
237
+ 'fiatCurrencies': ['TWD'], // the only fiat currency for exchange
237
238
  },
238
239
  'features': {
239
240
  'spot': {
@@ -361,6 +362,7 @@ export default class bitopro extends Exchange {
361
362
  // }
362
363
  //
363
364
  const result = {};
365
+ const fiatCurrencies = this.safeList(this.options, 'fiatCurrencies', []);
364
366
  for (let i = 0; i < currencies.length; i++) {
365
367
  const currency = currencies[i];
366
368
  const currencyId = this.safeString(currency, 'currency');
@@ -380,11 +382,12 @@ export default class bitopro extends Exchange {
380
382
  'max': undefined,
381
383
  },
382
384
  };
385
+ const isFiat = this.inArray(code, fiatCurrencies);
383
386
  result[code] = {
384
387
  'id': currencyId,
385
388
  'code': code,
386
389
  'info': currency,
387
- 'type': undefined,
390
+ 'type': isFiat ? 'fiat' : 'crypto',
388
391
  'name': undefined,
389
392
  'active': deposit && withdraw,
390
393
  'deposit': deposit,
@@ -392,6 +395,7 @@ export default class bitopro extends Exchange {
392
395
  'fee': fee,
393
396
  'precision': undefined,
394
397
  'limits': limits,
398
+ 'networks': undefined,
395
399
  };
396
400
  }
397
401
  return result;
package/js/src/bitrue.js CHANGED
@@ -816,7 +816,8 @@ export default class bitrue extends Exchange {
816
816
  'withdraw': withdraw,
817
817
  'networks': networks,
818
818
  'fee': this.parseNumber(minWithdrawFeeString),
819
- // 'fees': fees,
819
+ 'fees': undefined,
820
+ 'type': 'crypto',
820
821
  'limits': {
821
822
  'withdraw': {
822
823
  'min': this.parseNumber(minWithdrawString),
package/js/src/bitso.js CHANGED
@@ -748,7 +748,7 @@ export default class bitso extends Exchange {
748
748
  // {
749
749
  // "bucket_start_time":1648219140000,
750
750
  // "first_trade_time":1648219154990,
751
- // "last_trade_time":1648219189441,
751
+ // "last_trade_time":1648219189442,
752
752
  // "first_rate":"44958.60",
753
753
  // "last_rate":"44979.88",
754
754
  // "min_rate":"44957.33",
package/js/src/bitteam.js CHANGED
@@ -641,6 +641,7 @@ export default class bitteam extends Exchange {
641
641
  const networkIds = Object.keys(feesByNetworkId);
642
642
  const networks = {};
643
643
  const networkPrecision = this.parseNumber(this.parsePrecision(this.safeString(currency, 'decimals')));
644
+ const typeRaw = this.safeString(currency, 'type');
644
645
  for (let j = 0; j < networkIds.length; j++) {
645
646
  const networkId = networkIds[j];
646
647
  const networkCode = this.networkIdToCode(networkId, code);
@@ -695,6 +696,7 @@ export default class bitteam extends Exchange {
695
696
  'max': undefined,
696
697
  },
697
698
  },
699
+ 'type': typeRaw,
698
700
  'networks': networks,
699
701
  };
700
702
  }
package/js/src/bitvavo.js CHANGED
@@ -340,6 +340,8 @@ export default class bitvavo extends Exchange {
340
340
  'ERC20': 'ETH',
341
341
  'TRC20': 'TRX',
342
342
  },
343
+ 'operatorId': undefined,
344
+ 'fiatCurrencies': ['EUR'], // only fiat atm
343
345
  },
344
346
  'precisionMode': SIGNIFICANT_DIGITS,
345
347
  'commonCurrencies': {
@@ -549,24 +551,24 @@ export default class bitvavo extends Exchange {
549
551
  // },
550
552
  // ]
551
553
  //
554
+ const fiatCurrencies = this.safeList(this.options, 'fiatCurrencies', []);
552
555
  const result = {};
553
556
  for (let i = 0; i < currencies.length; i++) {
554
557
  const currency = currencies[i];
555
558
  const id = this.safeString(currency, 'symbol');
556
559
  const code = this.safeCurrencyCode(id);
560
+ const isFiat = this.inArray(code, fiatCurrencies);
557
561
  const networks = {};
558
- const networksArray = this.safeValue(currency, 'networks', []);
559
- const networksLength = networksArray.length;
560
- const isOneNetwork = (networksLength === 1);
561
- const deposit = (this.safeValue(currency, 'depositStatus') === 'OK');
562
- const withdrawal = (this.safeValue(currency, 'withdrawalStatus') === 'OK');
562
+ const networksArray = this.safeList(currency, 'networks', []);
563
+ const deposit = this.safeString(currency, 'depositStatus') === 'OK';
564
+ const withdrawal = this.safeString(currency, 'withdrawalStatus') === 'OK';
563
565
  const active = deposit && withdrawal;
564
566
  const withdrawFee = this.safeNumber(currency, 'withdrawalFee');
565
567
  const precision = this.safeInteger(currency, 'decimals', 8);
566
568
  const minWithdraw = this.safeNumber(currency, 'withdrawalMinAmount');
567
- // absolutely all of them have 1 network atm - ETH. So, we can reliably assign that inside networks
568
- if (isOneNetwork) {
569
- const networkId = networksArray[0];
569
+ // btw, absolutely all of them have 1 network atm
570
+ for (let j = 0; j < networksArray.length; j++) {
571
+ const networkId = networksArray[j];
570
572
  const networkCode = this.networkIdToCode(networkId);
571
573
  networks[networkCode] = {
572
574
  'info': currency,
@@ -585,7 +587,7 @@ export default class bitvavo extends Exchange {
585
587
  },
586
588
  };
587
589
  }
588
- result[code] = {
590
+ result[code] = this.safeCurrencyStructure({
589
591
  'info': currency,
590
592
  'id': id,
591
593
  'code': code,
@@ -596,6 +598,7 @@ export default class bitvavo extends Exchange {
596
598
  'networks': networks,
597
599
  'fee': withdrawFee,
598
600
  'precision': precision,
601
+ 'type': isFiat ? 'fiat' : 'crypto',
599
602
  'limits': {
600
603
  'amount': {
601
604
  'min': undefined,
@@ -610,7 +613,7 @@ export default class bitvavo extends Exchange {
610
613
  'max': undefined,
611
614
  },
612
615
  },
613
- };
616
+ });
614
617
  }
615
618
  // set currencies here to avoid calling publicGetAssets twice
616
619
  this.currencies = this.deepExtend(this.currencies, result);
@@ -1180,6 +1183,11 @@ export default class bitvavo extends Exchange {
1180
1183
  if (postOnly) {
1181
1184
  request['postOnly'] = true;
1182
1185
  }
1186
+ let operatorId = undefined;
1187
+ [operatorId, params] = this.handleOptionAndParams(params, 'createOrder', 'operatorId');
1188
+ if (operatorId !== undefined) {
1189
+ request['operatorId'] = this.parseToInt(operatorId);
1190
+ }
1183
1191
  return this.extend(request, params);
1184
1192
  }
1185
1193
  /**
@@ -1279,6 +1287,11 @@ export default class bitvavo extends Exchange {
1279
1287
  if (clientOrderId === undefined) {
1280
1288
  request['orderId'] = id;
1281
1289
  }
1290
+ let operatorId = undefined;
1291
+ [operatorId, params] = this.handleOptionAndParams(params, 'editOrder', 'operatorId');
1292
+ if (operatorId !== undefined) {
1293
+ request['operatorId'] = this.parseToInt(operatorId);
1294
+ }
1282
1295
  request['market'] = market['id'];
1283
1296
  return request;
1284
1297
  }
@@ -1315,6 +1328,11 @@ export default class bitvavo extends Exchange {
1315
1328
  if (clientOrderId === undefined) {
1316
1329
  request['orderId'] = id;
1317
1330
  }
1331
+ let operatorId = undefined;
1332
+ [operatorId, params] = this.handleOptionAndParams(params, 'cancelOrder', 'operatorId');
1333
+ if (operatorId !== undefined) {
1334
+ request['operatorId'] = this.parseToInt(operatorId);
1335
+ }
1318
1336
  return this.extend(request, params);
1319
1337
  }
1320
1338
  /**
@@ -209,7 +209,7 @@ export default class btcalpha extends Exchange {
209
209
  'symbolRequired': false,
210
210
  },
211
211
  'fetchOHLCV': {
212
- 'max': 720,
212
+ 'limit': 720,
213
213
  },
214
214
  },
215
215
  'swap': {
@@ -451,7 +451,7 @@ export default class btcmarkets extends Exchange {
451
451
  // "marketId":"COMP-AUD",
452
452
  // "baseAssetName":"COMP",
453
453
  // "quoteAssetName":"AUD",
454
- // "minOrderAmount":"0.00007",
454
+ // "minOrderAmount":"0.00006",
455
455
  // "maxOrderAmount":"1000000",
456
456
  // "amountDecimals":"8",
457
457
  // "priceDecimals":"2",
package/js/src/btcturk.js CHANGED
@@ -239,7 +239,7 @@ export default class btcturk extends Exchange {
239
239
  // "minPrice": "0.0000000000001",
240
240
  // "maxPrice": "10000000",
241
241
  // "tickSize": "10",
242
- // "minExchangeValue": "99.91",
242
+ // "minExchangeValue": "99.92",
243
243
  // "minAmount": null,
244
244
  // "maxAmount": null
245
245
  // }
package/js/src/bybit.js CHANGED
@@ -1020,9 +1020,6 @@ export default class bybit extends Exchange {
1020
1020
  'usePrivateInstrumentsInfo': false,
1021
1021
  'enableDemoTrading': false,
1022
1022
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
1023
- 'createOrder': {
1024
- 'method': 'privatePostV5OrderCreate', // 'privatePostV5PositionTradingStop'
1025
- },
1026
1023
  'enableUnifiedMargin': undefined,
1027
1024
  'enableUnifiedAccount': undefined,
1028
1025
  'unifiedMarginStatus': undefined,
@@ -2183,7 +2180,7 @@ export default class bybit extends Exchange {
2183
2180
  'quoteId': quoteId,
2184
2181
  'settleId': settleId,
2185
2182
  'type': 'option',
2186
- 'subType': 'linear',
2183
+ 'subType': undefined,
2187
2184
  'spot': false,
2188
2185
  'margin': false,
2189
2186
  'swap': false,
@@ -2191,8 +2188,8 @@ export default class bybit extends Exchange {
2191
2188
  'option': true,
2192
2189
  'active': isActive,
2193
2190
  'contract': true,
2194
- 'linear': true,
2195
- 'inverse': false,
2191
+ 'linear': undefined,
2192
+ 'inverse': undefined,
2196
2193
  'taker': this.safeNumber(market, 'takerFee', this.parseNumber('0.0006')),
2197
2194
  'maker': this.safeNumber(market, 'makerFee', this.parseNumber('0.0001')),
2198
2195
  'contractSize': this.parseNumber('1'),
@@ -3941,12 +3938,23 @@ export default class bybit extends Exchange {
3941
3938
  const parts = await this.isUnifiedEnabled();
3942
3939
  const enableUnifiedAccount = parts[1];
3943
3940
  const trailingAmount = this.safeString2(params, 'trailingAmount', 'trailingStop');
3941
+ const stopLossPrice = this.safeString(params, 'stopLossPrice');
3942
+ const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
3944
3943
  const isTrailingAmountOrder = trailingAmount !== undefined;
3944
+ const isStopLoss = stopLossPrice !== undefined;
3945
+ const isTakeProfit = takeProfitPrice !== undefined;
3945
3946
  const orderRequest = this.createOrderRequest(symbol, type, side, amount, price, params, enableUnifiedAccount);
3946
- const options = this.safeDict(this.options, 'createOrder', {});
3947
- const defaultMethod = this.safeString(options, 'method', 'privatePostV5OrderCreate');
3947
+ let defaultMethod = undefined;
3948
+ if (isTrailingAmountOrder || isStopLoss || isTakeProfit) {
3949
+ defaultMethod = 'privatePostV5PositionTradingStop';
3950
+ }
3951
+ else {
3952
+ defaultMethod = 'privatePostV5OrderCreate';
3953
+ }
3954
+ let method = undefined;
3955
+ [method, params] = this.handleOptionAndParams(params, 'createOrder', 'method', defaultMethod);
3948
3956
  let response = undefined;
3949
- if (isTrailingAmountOrder || (defaultMethod === 'privatePostV5PositionTradingStop')) {
3957
+ if (method === 'privatePostV5PositionTradingStop') {
3950
3958
  response = await this.privatePostV5PositionTradingStop(orderRequest);
3951
3959
  }
3952
3960
  else {
@@ -3974,8 +3982,6 @@ export default class bybit extends Exchange {
3974
3982
  if ((price === undefined) && (lowerCaseType === 'limit')) {
3975
3983
  throw new ArgumentsRequired(this.id + ' createOrder requires a price argument for limit orders');
3976
3984
  }
3977
- let defaultMethod = undefined;
3978
- [defaultMethod, params] = this.handleOptionAndParams(params, 'createOrder', 'method', 'privatePostV5OrderCreate');
3979
3985
  const request = {
3980
3986
  'symbol': market['id'],
3981
3987
  // 'side': this.capitalize (side),
@@ -4019,7 +4025,16 @@ export default class bybit extends Exchange {
4019
4025
  const isMarket = lowerCaseType === 'market';
4020
4026
  const isLimit = lowerCaseType === 'limit';
4021
4027
  const isBuy = side === 'buy';
4022
- const isAlternativeEndpoint = defaultMethod === 'privatePostV5PositionTradingStop';
4028
+ let defaultMethod = undefined;
4029
+ if (isTrailingAmountOrder || isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
4030
+ defaultMethod = 'privatePostV5PositionTradingStop';
4031
+ }
4032
+ else {
4033
+ defaultMethod = 'privatePostV5OrderCreate';
4034
+ }
4035
+ let method = undefined;
4036
+ [method, params] = this.handleOptionAndParams(params, 'createOrder', 'method', defaultMethod);
4037
+ const isAlternativeEndpoint = method === 'privatePostV5PositionTradingStop';
4023
4038
  const amountString = this.getAmount(symbol, amount);
4024
4039
  const priceString = (price !== undefined) ? this.getPrice(symbol, this.numberToString(price)) : undefined;
4025
4040
  if (isTrailingAmountOrder || isAlternativeEndpoint) {
@@ -4089,15 +4104,15 @@ export default class bybit extends Exchange {
4089
4104
  if (market['spot']) {
4090
4105
  request['category'] = 'spot';
4091
4106
  }
4107
+ else if (market['option']) {
4108
+ request['category'] = 'option';
4109
+ }
4092
4110
  else if (market['linear']) {
4093
4111
  request['category'] = 'linear';
4094
4112
  }
4095
4113
  else if (market['inverse']) {
4096
4114
  request['category'] = 'inverse';
4097
4115
  }
4098
- else if (market['option']) {
4099
- request['category'] = 'option';
4100
- }
4101
4116
  const cost = this.safeString(params, 'cost');
4102
4117
  params = this.omit(params, 'cost');
4103
4118
  // if the cost is inferable, let's keep the old logic and ignore marketUnit, to minimize the impact of the changes
@@ -5975,7 +5990,8 @@ export default class bybit extends Exchange {
5975
5990
  [subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
5976
5991
  let response = undefined;
5977
5992
  if (enableUnified[1]) {
5978
- if (subType === 'inverse') {
5993
+ const unifiedMarginStatus = this.safeInteger(this.options, 'unifiedMarginStatus', 5); // 3/4 uta 1.0, 5/6 uta 2.0
5994
+ if (subType === 'inverse' && (unifiedMarginStatus < 5)) {
5979
5995
  response = await this.privateGetV5AccountContractTransactionLog(this.extend(request, params));
5980
5996
  }
5981
5997
  else {
package/js/src/cex.js CHANGED
@@ -547,7 +547,7 @@ export default class cex extends Exchange {
547
547
  'askVolume': undefined,
548
548
  'vwap': undefined,
549
549
  'open': undefined,
550
- 'close': this.safeString(ticker, 'lastTradePrice'),
550
+ 'close': this.safeString(ticker, 'last'),
551
551
  'previousClose': undefined,
552
552
  'change': this.safeNumber(ticker, 'priceChange'),
553
553
  'percentage': this.safeNumber(ticker, 'priceChangePercentage'),
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinbase.js';
2
- import type { Int, OrderSide, OrderType, Order, Trade, OHLCV, Ticker, OrderBook, Str, Transaction, Balances, Tickers, Strings, Market, Currency, Num, Account, Currencies, MarketInterface, Conversion, Dict, int, TradingFees, LedgerEntry, DepositAddress } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Order, Trade, OHLCV, Ticker, OrderBook, Str, Transaction, Balances, Tickers, Strings, Market, Currency, Num, Account, Currencies, MarketInterface, Conversion, Dict, int, TradingFees, LedgerEntry, DepositAddress, Position } from './base/types.js';
3
3
  /**
4
4
  * @class coinbase
5
5
  * @augments Exchange
@@ -575,7 +575,7 @@ export default class coinbase extends Exchange {
575
575
  * @param {string} [params.portfolio] the portfolio UUID to fetch positions for
576
576
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
577
577
  */
578
- fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
578
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
579
579
  /**
580
580
  * @method
581
581
  * @name coinbase#fetchPosition
@@ -588,8 +588,8 @@ export default class coinbase extends Exchange {
588
588
  * @param {string} [params.portfolio] *perpetual/swaps only* the portfolio UUID to fetch the position for, required for perpetual/swaps markets only
589
589
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
590
590
  */
591
- fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
592
- parsePosition(position: Dict, market?: Market): import("./base/types.js").Position;
591
+ fetchPosition(symbol: string, params?: {}): Promise<Position>;
592
+ parsePosition(position: Dict, market?: Market): Position;
593
593
  /**
594
594
  * @method
595
595
  * @name coinbase#fetchTradingFees
@@ -1506,7 +1506,21 @@ export default class coinbase extends Exchange {
1506
1506
  for (let i = 0; i < perpetualData.length; i++) {
1507
1507
  result.push(this.parseContractMarket(perpetualData[i], perpetualFeeTier));
1508
1508
  }
1509
- return result;
1509
+ const newMarkets = [];
1510
+ for (let i = 0; i < result.length; i++) {
1511
+ const market = result[i];
1512
+ const info = this.safeValue(market, 'info', {});
1513
+ const realMarketIds = this.safeList(info, 'alias_to', []);
1514
+ const length = realMarketIds.length;
1515
+ if (length > 0) {
1516
+ market['alias'] = realMarketIds[0];
1517
+ }
1518
+ else {
1519
+ market['alias'] = undefined;
1520
+ }
1521
+ newMarkets.push(market);
1522
+ }
1523
+ return newMarkets;
1510
1524
  }
1511
1525
  parseSpotMarket(market, feeTier) {
1512
1526
  //
@@ -1918,6 +1932,7 @@ export default class coinbase extends Exchange {
1918
1932
  'withdraw': undefined,
1919
1933
  'fee': undefined,
1920
1934
  'precision': undefined,
1935
+ 'networks': {},
1921
1936
  'limits': {
1922
1937
  'amount': {
1923
1938
  'min': this.safeNumber(currency, 'min_size'),
@@ -2242,10 +2257,11 @@ export default class coinbase extends Exchange {
2242
2257
  askVolume = this.safeNumber(asks[0], 'size');
2243
2258
  }
2244
2259
  const marketId = this.safeString(ticker, 'product_id');
2260
+ market = this.safeMarket(marketId, market);
2245
2261
  const last = this.safeNumber(ticker, 'price');
2246
2262
  const datetime = this.safeString(ticker, 'time');
2247
2263
  return this.safeTicker({
2248
- 'symbol': this.safeSymbol(marketId, market),
2264
+ 'symbol': market['symbol'],
2249
2265
  'timestamp': this.parse8601(datetime),
2250
2266
  'datetime': datetime,
2251
2267
  'bid': bid,
@@ -311,7 +311,7 @@ export default class coinbaseexchange extends Exchange {
311
311
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
312
312
  */
313
313
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
314
- parseTransactionStatus(transaction: any): "canceled" | "pending" | "ok" | "failed";
314
+ parseTransactionStatus(transaction: any): "pending" | "ok" | "failed" | "canceled";
315
315
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
316
316
  /**
317
317
  * @method
@@ -25,6 +25,17 @@ export default class coincatch extends Exchange {
25
25
  * @returns {object} an associative dictionary of currencies
26
26
  */
27
27
  fetchCurrencies(params?: {}): Promise<Currencies>;
28
+ /**
29
+ * @method
30
+ * @name coincatch#fetchDepositWithdrawFees
31
+ * @description fetch deposit and withdraw fees
32
+ * @see https://coincatch.github.io/github.io/en/spot/#get-coin-list
33
+ * @param {string[]} [codes] list of unified currency codes
34
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
35
+ * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
36
+ */
37
+ fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
38
+ parseDepositWithdrawFee(fee: any, currency?: Currency): Dict;
28
39
  /**
29
40
  * @method
30
41
  * @name coincatch#fetchMarkets
@@ -70,6 +70,7 @@ export default class coincatch extends Exchange {
70
70
  'fetchDepositAddress': true,
71
71
  'fetchDeposits': true,
72
72
  'fetchDepositsWithdrawals': false,
73
+ 'fetchDepositWithdrawFees': true,
73
74
  'fetchFundingHistory': false,
74
75
  'fetchFundingRate': true,
75
76
  'fetchFundingRateHistory': true,
@@ -709,6 +710,73 @@ export default class coincatch extends Exchange {
709
710
  }
710
711
  return result;
711
712
  }
713
+ /**
714
+ * @method
715
+ * @name coincatch#fetchDepositWithdrawFees
716
+ * @description fetch deposit and withdraw fees
717
+ * @see https://coincatch.github.io/github.io/en/spot/#get-coin-list
718
+ * @param {string[]} [codes] list of unified currency codes
719
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
720
+ * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
721
+ */
722
+ async fetchDepositWithdrawFees(codes = undefined, params = {}) {
723
+ await this.loadMarkets();
724
+ const response = await this.publicGetApiSpotV1PublicCurrencies(params);
725
+ const data = this.safeList(response, 'data', []);
726
+ return this.parseDepositWithdrawFees(data, codes, 'coinName');
727
+ }
728
+ parseDepositWithdrawFee(fee, currency = undefined) {
729
+ //
730
+ // {
731
+ // "coinId":"1",
732
+ // "coinName":"BTC",
733
+ // "transfer":"true",
734
+ // "chains":[
735
+ // {
736
+ // "chain":null,
737
+ // "needTag":"false",
738
+ // "withdrawable":"true",
739
+ // "rechargeAble":"true",
740
+ // "withdrawFee":"0.005",
741
+ // "depositConfirm":"1",
742
+ // "withdrawConfirm":"1",
743
+ // "minDepositAmount":"0.001",
744
+ // "minWithdrawAmount":"0.001",
745
+ // "browserUrl":"https://blockchair.com/bitcoin/testnet/transaction/"
746
+ // }
747
+ // ]
748
+ // }
749
+ //
750
+ const chains = this.safeList(fee, 'chains', []);
751
+ const chainsLength = chains.length;
752
+ const result = {
753
+ 'info': fee,
754
+ 'withdraw': {
755
+ 'fee': undefined,
756
+ 'percentage': undefined,
757
+ },
758
+ 'deposit': {
759
+ 'fee': undefined,
760
+ 'percentage': undefined,
761
+ },
762
+ 'networks': {},
763
+ };
764
+ for (let i = 0; i < chainsLength; i++) {
765
+ const chain = chains[i];
766
+ const networkId = this.safeString(chain, 'chain');
767
+ const currencyCode = this.safeString(currency, 'code');
768
+ const networkCode = this.networkIdToCode(networkId, currencyCode);
769
+ result['networks'][networkCode] = {
770
+ 'deposit': { 'fee': undefined, 'percentage': undefined },
771
+ 'withdraw': { 'fee': this.safeNumber(chain, 'withdrawFee'), 'percentage': false },
772
+ };
773
+ if (chainsLength === 1) {
774
+ result['withdraw']['fee'] = this.safeNumber(chain, 'withdrawFee');
775
+ result['withdraw']['percentage'] = false;
776
+ }
777
+ }
778
+ return result;
779
+ }
712
780
  /**
713
781
  * @method
714
782
  * @name coincatch#fetchMarkets
package/js/src/coinex.js CHANGED
@@ -742,6 +742,7 @@ export default class coinex extends Exchange {
742
742
  },
743
743
  },
744
744
  'networks': {},
745
+ 'type': 'crypto',
745
746
  'info': coin,
746
747
  };
747
748
  for (let j = 0; j < chains.length; j++) {
@@ -471,6 +471,7 @@ export default class coinlist extends Exchange {
471
471
  'withdraw': { 'min': minWithdrawal, 'max': undefined },
472
472
  },
473
473
  'networks': {},
474
+ 'type': 'crypto',
474
475
  };
475
476
  }
476
477
  return result;
package/js/src/coinone.js CHANGED
@@ -320,6 +320,7 @@ export default class coinone extends Exchange {
320
320
  },
321
321
  },
322
322
  'networks': {},
323
+ 'type': 'crypto',
323
324
  };
324
325
  }
325
326
  return result;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/cryptocom.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict, int, TradingFeeInterface, TradingFees, LedgerEntry, DepositAddress } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict, int, TradingFeeInterface, TradingFees, LedgerEntry, DepositAddress, Position } from './base/types.js';
3
3
  /**
4
4
  * @class cryptocom
5
5
  * @augments Exchange
@@ -366,7 +366,7 @@ export default class cryptocom extends Exchange {
366
366
  * @param {object} [params] extra parameters specific to the exchange API endpoint
367
367
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
368
368
  */
369
- fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
369
+ fetchPosition(symbol: string, params?: {}): Promise<Position>;
370
370
  /**
371
371
  * @method
372
372
  * @name cryptocom#fetchPositions
@@ -376,8 +376,8 @@ export default class cryptocom extends Exchange {
376
376
  * @param {object} [params] extra parameters specific to the exchange API endpoint
377
377
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
378
378
  */
379
- fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
380
- parsePosition(position: Dict, market?: Market): import("./base/types.js").Position;
379
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
380
+ parsePosition(position: Dict, market?: Market): Position;
381
381
  nonce(): number;
382
382
  paramsToString(object: any, level: any): any;
383
383
  /**