ccxt 4.4.82 → 4.4.86

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 (145) hide show
  1. package/README.md +6 -9
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +6 -17
  4. package/dist/cjs/src/abstract/bittrade.js +9 -0
  5. package/dist/cjs/src/apex.js +2 -1
  6. package/dist/cjs/src/ascendex.js +189 -155
  7. package/dist/cjs/src/base/Exchange.js +15 -2
  8. package/dist/cjs/src/bequant.js +1 -1
  9. package/dist/cjs/src/bitget.js +6 -7
  10. package/dist/cjs/src/bitmart.js +1 -1
  11. package/dist/cjs/src/bitrue.js +14 -35
  12. package/dist/cjs/src/bitso.js +33 -0
  13. package/dist/cjs/src/bitstamp.js +33 -0
  14. package/dist/cjs/src/bittrade.js +2049 -0
  15. package/dist/cjs/src/blofin.js +154 -13
  16. package/dist/cjs/src/btcbox.js +25 -5
  17. package/dist/cjs/src/bybit.js +16 -40
  18. package/dist/cjs/src/cex.js +2 -4
  19. package/dist/cjs/src/coinbase.js +58 -46
  20. package/dist/cjs/src/coinbaseexchange.js +142 -32
  21. package/dist/cjs/src/coincatch.js +14 -67
  22. package/dist/cjs/src/coinex.js +29 -32
  23. package/dist/cjs/src/coinlist.js +16 -15
  24. package/dist/cjs/src/coinmetro.js +22 -11
  25. package/dist/cjs/src/coinone.js +8 -10
  26. package/dist/cjs/src/coinsph.js +126 -1
  27. package/dist/cjs/src/cryptocom.js +111 -1
  28. package/dist/cjs/src/cryptomus.js +43 -89
  29. package/dist/cjs/src/delta.js +76 -36
  30. package/dist/cjs/src/deribit.js +4 -5
  31. package/dist/cjs/src/derive.js +46 -10
  32. package/dist/cjs/src/ellipx.js +175 -79
  33. package/dist/cjs/src/gate.js +1 -1
  34. package/dist/cjs/src/gemini.js +3 -5
  35. package/dist/cjs/src/hitbtc.js +56 -69
  36. package/dist/cjs/src/hollaex.js +107 -49
  37. package/dist/cjs/src/htx.js +20 -44
  38. package/dist/cjs/src/hyperliquid.js +6 -6
  39. package/dist/cjs/src/kraken.js +29 -24
  40. package/dist/cjs/src/kucoinfutures.js +6 -0
  41. package/dist/cjs/src/lbank.js +1 -1
  42. package/dist/cjs/src/mexc.js +2 -2
  43. package/dist/cjs/src/ndax.js +25 -24
  44. package/dist/cjs/src/okcoin.js +12 -31
  45. package/dist/cjs/src/okx.js +9 -0
  46. package/dist/cjs/src/onetrading.js +9 -6
  47. package/dist/cjs/src/oxfun.js +42 -114
  48. package/dist/cjs/src/paradex.js +124 -4
  49. package/dist/cjs/src/pro/binance.js +32 -33
  50. package/dist/cjs/src/pro/bithumb.js +5 -3
  51. package/dist/cjs/src/pro/bittrade.js +605 -0
  52. package/dist/cjs/src/pro/kraken.js +289 -79
  53. package/dist/cjs/src/pro/luno.js +6 -5
  54. package/dist/cjs/src/pro/mexc.js +304 -7
  55. package/dist/cjs/src/pro/poloniex.js +6 -2
  56. package/examples/js/cli.js +127 -13
  57. package/js/ccxt.d.ts +8 -20
  58. package/js/ccxt.js +6 -14
  59. package/js/src/abstract/blofin.d.ts +8 -0
  60. package/js/src/abstract/btcbox.d.ts +1 -0
  61. package/js/src/abstract/myokx.d.ts +2 -0
  62. package/js/src/abstract/okx.d.ts +2 -0
  63. package/js/src/apex.js +2 -1
  64. package/js/src/ascendex.d.ts +2 -0
  65. package/js/src/ascendex.js +189 -155
  66. package/js/src/base/Exchange.d.ts +15 -1
  67. package/js/src/base/Exchange.js +15 -2
  68. package/js/src/base/types.d.ts +3 -0
  69. package/js/src/bequant.js +1 -1
  70. package/js/src/bitget.js +6 -7
  71. package/js/src/bitmart.js +1 -1
  72. package/js/src/bitrue.js +14 -35
  73. package/js/src/bitso.js +33 -0
  74. package/js/src/bitstamp.js +33 -0
  75. package/js/src/{huobijp.d.ts → bittrade.d.ts} +29 -29
  76. package/js/src/{huobijp.js → bittrade.js} +35 -35
  77. package/js/src/blofin.d.ts +42 -2
  78. package/js/src/blofin.js +154 -13
  79. package/js/src/btcbox.js +25 -5
  80. package/js/src/bybit.js +16 -40
  81. package/js/src/cex.js +2 -4
  82. package/js/src/coinbase.js +58 -46
  83. package/js/src/coinbaseexchange.js +142 -32
  84. package/js/src/coincatch.js +14 -67
  85. package/js/src/coinex.js +28 -29
  86. package/js/src/coinlist.js +16 -15
  87. package/js/src/coinmetro.js +22 -11
  88. package/js/src/coinone.js +8 -10
  89. package/js/src/coinsph.d.ts +10 -1
  90. package/js/src/coinsph.js +126 -1
  91. package/js/src/cryptocom.d.ts +10 -1
  92. package/js/src/cryptocom.js +111 -1
  93. package/js/src/cryptomus.js +43 -89
  94. package/js/src/delta.js +76 -36
  95. package/js/src/deribit.js +4 -5
  96. package/js/src/derive.js +46 -10
  97. package/js/src/ellipx.d.ts +2 -3
  98. package/js/src/ellipx.js +175 -80
  99. package/js/src/gate.js +1 -1
  100. package/js/src/gemini.js +3 -5
  101. package/js/src/hitbtc.js +56 -69
  102. package/js/src/hollaex.js +107 -49
  103. package/js/src/htx.js +20 -44
  104. package/js/src/hyperliquid.js +6 -6
  105. package/js/src/kraken.js +29 -24
  106. package/js/src/kucoinfutures.d.ts +1 -0
  107. package/js/src/kucoinfutures.js +6 -0
  108. package/js/src/lbank.js +1 -1
  109. package/js/src/mexc.js +2 -2
  110. package/js/src/ndax.js +25 -24
  111. package/js/src/okcoin.js +12 -31
  112. package/js/src/okx.js +9 -0
  113. package/js/src/onetrading.js +9 -6
  114. package/js/src/oxfun.js +42 -114
  115. package/js/src/paradex.d.ts +12 -1
  116. package/js/src/paradex.js +124 -4
  117. package/js/src/pro/binance.d.ts +26 -26
  118. package/js/src/pro/binance.js +32 -33
  119. package/js/src/pro/bithumb.js +5 -3
  120. package/js/src/pro/{huobijp.d.ts → bittrade.d.ts} +6 -6
  121. package/js/src/pro/{huobijp.js → bittrade.js} +7 -7
  122. package/js/src/pro/kraken.d.ts +7 -6
  123. package/js/src/pro/kraken.js +290 -80
  124. package/js/src/pro/luno.js +6 -5
  125. package/js/src/pro/mexc.d.ts +58 -0
  126. package/js/src/pro/mexc.js +304 -7
  127. package/js/src/pro/poloniex.d.ts +1 -1
  128. package/js/src/pro/poloniex.js +6 -2
  129. package/package.json +1 -1
  130. package/js/src/abstract/bl3p.d.ts +0 -22
  131. package/js/src/abstract/huobijp.js +0 -11
  132. package/js/src/abstract/idex.d.ts +0 -29
  133. package/js/src/abstract/idex.js +0 -11
  134. package/js/src/abstract/kuna.d.ts +0 -185
  135. package/js/src/abstract/kuna.js +0 -11
  136. package/js/src/bl3p.d.ts +0 -116
  137. package/js/src/bl3p.js +0 -552
  138. package/js/src/idex.d.ts +0 -312
  139. package/js/src/idex.js +0 -1961
  140. package/js/src/kuna.d.ts +0 -335
  141. package/js/src/kuna.js +0 -2006
  142. package/js/src/pro/idex.d.ts +0 -81
  143. package/js/src/pro/idex.js +0 -720
  144. /package/js/src/abstract/{huobijp.d.ts → bittrade.d.ts} +0 -0
  145. /package/js/src/abstract/{bl3p.js → bittrade.js} +0 -0
package/js/src/hitbtc.js CHANGED
@@ -920,29 +920,46 @@ export default class hitbtc extends Exchange {
920
920
  async fetchCurrencies(params = {}) {
921
921
  const response = await this.publicGetPublicCurrency(params);
922
922
  //
923
- // {
924
- // "WEALTH": {
925
- // "full_name": "ConnectWealth",
926
- // "payin_enabled": false,
927
- // "payout_enabled": false,
928
- // "transfer_enabled": true,
929
- // "precision_transfer": "0.001",
930
- // "networks": [
931
- // {
932
- // "network": "ETH",
933
- // "protocol": "ERC20",
934
- // "default": true,
935
- // "payin_enabled": false,
936
- // "payout_enabled": false,
937
- // "precision_payout": "0.001",
938
- // "payout_fee": "0.016800000000",
939
- // "payout_is_payment_id": false,
940
- // "payin_payment_id": false,
941
- // "payin_confirmations": "2"
942
- // }
943
- // ]
944
- // }
945
- // }
923
+ // {
924
+ // "DFC": {
925
+ // "full_name": "DeFiScale",
926
+ // "crypto": true,
927
+ // "payin_enabled": false,
928
+ // "payout_enabled": true,
929
+ // "transfer_enabled": false,
930
+ // "transfer_to_wallet_enabled": true,
931
+ // "transfer_to_exchange_enabled": false,
932
+ // "sign": "D",
933
+ // "crypto_payment_id_name": "",
934
+ // "crypto_explorer": "https://etherscan.io/tx/{tx}",
935
+ // "precision_transfer": "0.00000001",
936
+ // "delisted": false,
937
+ // "networks": [
938
+ // {
939
+ // "code": "ETH",
940
+ // "network_name": "Ethereum",
941
+ // "network": "ETH",
942
+ // "protocol": "ERC-20",
943
+ // "default": true,
944
+ // "is_ens_available": true,
945
+ // "payin_enabled": true,
946
+ // "payout_enabled": true,
947
+ // "precision_payout": "0.000000000000000001",
948
+ // "payout_fee": "277000.0000000000",
949
+ // "payout_is_payment_id": false,
950
+ // "payin_payment_id": false,
951
+ // "payin_confirmations": "2",
952
+ // "contract_address": "0x1b2a76da77d03b7fc21189d9838f55bd849014af",
953
+ // "crypto_payment_id_name": "",
954
+ // "crypto_explorer": "https://etherscan.io/tx/{tx}",
955
+ // "is_multichain": true,
956
+ // "asset_id": {
957
+ // "contract_address": "0x1b2a76da77d03b7fc21189d9838f55bd849014af"
958
+ // }
959
+ // }
960
+ // ]
961
+ // },
962
+ // }
946
963
  //
947
964
  const result = {};
948
965
  const currencies = Object.keys(response);
@@ -950,50 +967,22 @@ export default class hitbtc extends Exchange {
950
967
  const currencyId = currencies[i];
951
968
  const code = this.safeCurrencyCode(currencyId);
952
969
  const entry = response[currencyId];
953
- const name = this.safeString(entry, 'full_name');
954
- const precision = this.safeNumber(entry, 'precision_transfer');
955
- const payinEnabled = this.safeBool(entry, 'payin_enabled', false);
956
- const payoutEnabled = this.safeBool(entry, 'payout_enabled', false);
957
- const transferEnabled = this.safeBool(entry, 'transfer_enabled', false);
958
- const active = payinEnabled && payoutEnabled && transferEnabled;
959
- const rawNetworks = this.safeValue(entry, 'networks', []);
960
- const isCrypto = this.safeBool(entry, 'crypto');
961
- const type = isCrypto ? 'crypto' : 'fiat';
970
+ const rawNetworks = this.safeList(entry, 'networks', []);
962
971
  const networks = {};
963
- let fee = undefined;
964
- let depositEnabled = undefined;
965
- let withdrawEnabled = undefined;
966
972
  for (let j = 0; j < rawNetworks.length; j++) {
967
973
  const rawNetwork = rawNetworks[j];
968
974
  const networkId = this.safeString2(rawNetwork, 'protocol', 'network');
969
975
  let networkCode = this.networkIdToCode(networkId);
970
- networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
971
- fee = this.safeNumber(rawNetwork, 'payout_fee');
972
- const networkPrecision = this.safeNumber(rawNetwork, 'precision_payout');
973
- const payinEnabledNetwork = this.safeBool(rawNetwork, 'payin_enabled', false);
974
- const payoutEnabledNetwork = this.safeBool(rawNetwork, 'payout_enabled', false);
975
- const activeNetwork = payinEnabledNetwork && payoutEnabledNetwork;
976
- if (payinEnabledNetwork && !depositEnabled) {
977
- depositEnabled = true;
978
- }
979
- else if (!payinEnabledNetwork) {
980
- depositEnabled = false;
981
- }
982
- if (payoutEnabledNetwork && !withdrawEnabled) {
983
- withdrawEnabled = true;
984
- }
985
- else if (!payoutEnabledNetwork) {
986
- withdrawEnabled = false;
987
- }
976
+ networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : code; // as hitbtc is white label, ensure we safeguard from possible bugs
988
977
  networks[networkCode] = {
989
978
  'info': rawNetwork,
990
979
  'id': networkId,
991
980
  'network': networkCode,
992
- 'fee': fee,
993
- 'active': activeNetwork,
994
- 'deposit': payinEnabledNetwork,
995
- 'withdraw': payoutEnabledNetwork,
996
- 'precision': networkPrecision,
981
+ 'active': undefined,
982
+ 'fee': this.safeNumber(rawNetwork, 'payout_fee'),
983
+ 'deposit': this.safeBool(rawNetwork, 'payin_enabled'),
984
+ 'withdraw': this.safeBool(rawNetwork, 'payout_enabled'),
985
+ 'precision': this.safeNumber(rawNetwork, 'precision_payout'),
997
986
  'limits': {
998
987
  'withdraw': {
999
988
  'min': undefined,
@@ -1002,27 +991,25 @@ export default class hitbtc extends Exchange {
1002
991
  },
1003
992
  };
1004
993
  }
1005
- const networksKeys = Object.keys(networks);
1006
- const networksLength = networksKeys.length;
1007
- result[code] = {
994
+ result[code] = this.safeCurrencyStructure({
1008
995
  'info': entry,
1009
996
  'code': code,
1010
997
  'id': currencyId,
1011
- 'precision': precision,
1012
- 'name': name,
1013
- 'active': active,
1014
- 'deposit': depositEnabled,
1015
- 'withdraw': withdrawEnabled,
998
+ 'precision': this.safeNumber(entry, 'precision_transfer'),
999
+ 'name': this.safeString(entry, 'full_name'),
1000
+ 'active': !this.safeBool(entry, 'delisted'),
1001
+ 'deposit': this.safeBool(entry, 'payin_enabled'),
1002
+ 'withdraw': this.safeBool(entry, 'payout_enabled'),
1016
1003
  'networks': networks,
1017
- 'fee': (networksLength <= 1) ? fee : undefined,
1004
+ 'fee': undefined,
1018
1005
  'limits': {
1019
1006
  'amount': {
1020
1007
  'min': undefined,
1021
1008
  'max': undefined,
1022
1009
  },
1023
1010
  },
1024
- 'type': type,
1025
- };
1011
+ 'type': undefined, // 'crypto' field emits incorrect values
1012
+ });
1026
1013
  }
1027
1014
  return result;
1028
1015
  }
package/js/src/hollaex.js CHANGED
@@ -287,6 +287,14 @@ export default class hollaex extends Exchange {
287
287
  'BNB': 'bnb',
288
288
  'MATIC': 'matic',
289
289
  },
290
+ 'networksById': {
291
+ 'eth': 'ERC20',
292
+ 'ETH': 'ERC20',
293
+ 'ERC20': 'ERC20',
294
+ 'trx': 'TRC20',
295
+ 'TRX': 'TRC20',
296
+ 'TRC20': 'TRC20',
297
+ },
290
298
  },
291
299
  });
292
300
  }
@@ -417,66 +425,116 @@ export default class hollaex extends Exchange {
417
425
  async fetchCurrencies(params = {}) {
418
426
  const response = await this.publicGetConstants(params);
419
427
  //
420
- // {
421
- // "coins":{
422
- // "bch":{
423
- // "id":4,
424
- // "fullname":"Bitcoin Cash",
425
- // "symbol":"bch",
426
- // "active":true,
427
- // "verified":true,
428
- // "allow_deposit":true,
429
- // "allow_withdrawal":true,
430
- // "withdrawal_fee":0.0002,
431
- // "min":0.001,
432
- // "max":100000,
433
- // "increment_unit":0.001,
434
- // "logo":"https://bitholla.s3.ap-northeast-2.amazonaws.com/icon/BCH-hollaex-asset-01.svg",
435
- // "code":"bch",
436
- // "is_public":true,
437
- // "meta":{},
438
- // "estimated_price":null,
439
- // "description":null,
440
- // "type":"blockchain",
441
- // "network":null,
442
- // "standard":null,
443
- // "issuer":"HollaEx",
444
- // "withdrawal_fees":null,
445
- // "created_at":"2019-08-09T10:45:43.367Z",
446
- // "updated_at":"2021-12-13T03:08:32.372Z",
447
- // "created_by":1,
448
- // "owner_id":1
449
- // },
428
+ // {
429
+ // "coins": {
430
+ // "usdt": {
431
+ // "id": "6",
432
+ // "fullname": "USD Tether",
433
+ // "symbol": "usdt",
434
+ // "active": true,
435
+ // "verified": true,
436
+ // "allow_deposit": true,
437
+ // "allow_withdrawal": true,
438
+ // "withdrawal_fee": "20",
439
+ // "min": "1",
440
+ // "max": "10000000",
441
+ // "increment_unit": "0.0001",
442
+ // "logo": "https://hollaex-resources.s3.ap-southeast-1.amazonaws.com/icons/usdt.svg",
443
+ // "code": "usdt",
444
+ // "is_public": true,
445
+ // "meta": {
446
+ // "color": "#27a17a",
447
+ // "website": "https://tether.to",
448
+ // "explorer": "https://blockchair.com/tether",
449
+ // "decimal_points": "6"
450
+ // },
451
+ // "estimated_price": "1",
452
+ // "description": "<p>Tether (USDT) is a stablecoin pegged 1:1 to the US dollar. It is a digital currency that aims to maintain its value while allowing for fast and secure transfer of funds. It was the first stablecoin, and is the most widely used due stablecoin due to its stability and low volatility compared to other cryptocurrencies. It was launched in 2014 by Tether Limited.</p>",
453
+ // "type": "blockchain",
454
+ // "network": "eth,trx,bnb,matic",
455
+ // "standard": "",
456
+ // "issuer": "HollaEx",
457
+ // "withdrawal_fees": {
458
+ // "bnb": {
459
+ // "value": "0.8",
460
+ // "active": true,
461
+ // "symbol": "usdt"
462
+ // },
463
+ // "eth": {
464
+ // "value": "1.5",
465
+ // "active": true,
466
+ // "symbol": "usdt"
467
+ // },
468
+ // "trx": {
469
+ // "value": "4",
470
+ // "active": true,
471
+ // "symbol": "usdt"
472
+ // },
473
+ // "matic": {
474
+ // "value": "0.3",
475
+ // "active": true,
476
+ // "symbol": "usdt"
477
+ // }
478
+ // },
479
+ // "display_name": null,
480
+ // "deposit_fees": null,
481
+ // "is_risky": false,
482
+ // "market_cap": "144568098696.29",
483
+ // "category": "stable",
484
+ // "created_at": "2019-08-09T10:45:43.367Z",
485
+ // "updated_at": "2025-03-25T17:12:37.970Z",
486
+ // "created_by": "168",
487
+ // "owner_id": "1"
488
+ // },
450
489
  // },
451
490
  // "network":"https://api.hollaex.network"
452
491
  // }
453
492
  //
454
- const coins = this.safeValue(response, 'coins', {});
493
+ const coins = this.safeDict(response, 'coins', {});
455
494
  const keys = Object.keys(coins);
456
495
  const result = {};
457
496
  for (let i = 0; i < keys.length; i++) {
458
497
  const key = keys[i];
459
498
  const currency = coins[key];
460
499
  const id = this.safeString(currency, 'symbol');
461
- const numericId = this.safeInteger(currency, 'id');
462
500
  const code = this.safeCurrencyCode(id);
463
- const name = this.safeString(currency, 'fullname');
464
- const depositEnabled = this.safeValue(currency, 'allow_deposit');
465
- const withdrawEnabled = this.safeValue(currency, 'allow_withdrawal');
466
- const isActive = this.safeValue(currency, 'active');
467
- const active = isActive && depositEnabled && withdrawEnabled;
468
- const fee = this.safeNumber(currency, 'withdrawal_fee');
469
- const withdrawalLimits = this.safeValue(currency, 'withdrawal_limits', []);
470
- result[code] = {
501
+ const withdrawalLimits = this.safeList(currency, 'withdrawal_limits', []);
502
+ const rawType = this.safeString(currency, 'type');
503
+ const type = (rawType === 'blockchain') ? 'crypto' : 'other';
504
+ const rawNetworks = this.safeDict(currency, 'withdrawal_fees', {});
505
+ const networks = {};
506
+ const networkIds = Object.keys(rawNetworks);
507
+ for (let j = 0; j < networkIds.length; j++) {
508
+ const networkId = networkIds[j];
509
+ const networkEntry = this.safeDict(rawNetworks, networkId);
510
+ const networkCode = this.networkIdToCode(networkId);
511
+ networks[networkCode] = {
512
+ 'id': networkId,
513
+ 'network': networkCode,
514
+ 'active': this.safeBool(networkEntry, 'active'),
515
+ 'deposit': undefined,
516
+ 'withdraw': undefined,
517
+ 'fee': this.safeNumber(networkEntry, 'value'),
518
+ 'precision': undefined,
519
+ 'limits': {
520
+ 'withdraw': {
521
+ 'min': undefined,
522
+ 'max': undefined,
523
+ },
524
+ },
525
+ 'info': networkEntry,
526
+ };
527
+ }
528
+ result[code] = this.safeCurrencyStructure({
471
529
  'id': id,
472
- 'numericId': numericId,
530
+ 'numericId': this.safeInteger(currency, 'id'),
473
531
  'code': code,
474
532
  'info': currency,
475
- 'name': name,
476
- 'active': active,
477
- 'deposit': depositEnabled,
478
- 'withdraw': withdrawEnabled,
479
- 'fee': fee,
533
+ 'name': this.safeString(currency, 'fullname'),
534
+ 'active': this.safeBool(currency, 'active'),
535
+ 'deposit': this.safeBool(currency, 'allow_deposit'),
536
+ 'withdraw': this.safeBool(currency, 'allow_withdrawal'),
537
+ 'fee': this.safeNumber(currency, 'withdrawal_fee'),
480
538
  'precision': this.safeNumber(currency, 'increment_unit'),
481
539
  'limits': {
482
540
  'amount': {
@@ -488,9 +546,9 @@ export default class hollaex extends Exchange {
488
546
  'max': this.safeValue(withdrawalLimits, 0),
489
547
  },
490
548
  },
491
- 'networks': {},
492
- 'type': 'crypto',
493
- };
549
+ 'networks': networks,
550
+ 'type': type,
551
+ });
494
552
  }
495
553
  return result;
496
554
  }
package/js/src/htx.js CHANGED
@@ -3436,9 +3436,8 @@ export default class htx extends Exchange {
3436
3436
  // }
3437
3437
  // ]
3438
3438
  // }
3439
- // }
3440
3439
  //
3441
- const data = this.safeValue(response, 'data', []);
3440
+ const data = this.safeList(response, 'data', []);
3442
3441
  const result = {};
3443
3442
  this.options['networkChainIdsByNames'] = {};
3444
3443
  this.options['networkNamesByChainIds'] = {};
@@ -3446,19 +3445,11 @@ export default class htx extends Exchange {
3446
3445
  const entry = data[i];
3447
3446
  const currencyId = this.safeString(entry, 'currency');
3448
3447
  const code = this.safeCurrencyCode(currencyId);
3449
- this.options['networkChainIdsByNames'][code] = {};
3450
- const chains = this.safeValue(entry, 'chains', []);
3451
- const networks = {};
3452
- const instStatus = this.safeString(entry, 'instStatus');
3453
3448
  const assetType = this.safeString(entry, 'assetType');
3454
3449
  const type = assetType === '1' ? 'crypto' : 'fiat';
3455
- const currencyActive = instStatus === 'normal';
3456
- let minPrecision = undefined;
3457
- let minDeposit = undefined;
3458
- let minWithdraw = undefined;
3459
- let maxWithdraw = undefined;
3460
- let deposit = false;
3461
- let withdraw = false;
3450
+ this.options['networkChainIdsByNames'][code] = {};
3451
+ const chains = this.safeList(entry, 'chains', []);
3452
+ const networks = {};
3462
3453
  for (let j = 0; j < chains.length; j++) {
3463
3454
  const chainEntry = chains[j];
3464
3455
  const uniqueChainId = this.safeString(chainEntry, 'chain'); // i.e. usdterc20, trc20usdt ...
@@ -3466,49 +3457,34 @@ export default class htx extends Exchange {
3466
3457
  this.options['networkChainIdsByNames'][code][title] = uniqueChainId;
3467
3458
  this.options['networkNamesByChainIds'][uniqueChainId] = title;
3468
3459
  const networkCode = this.networkIdToCode(uniqueChainId);
3469
- minDeposit = this.safeNumber(chainEntry, 'minDepositAmt');
3470
- minWithdraw = this.safeNumber(chainEntry, 'minWithdrawAmt');
3471
- maxWithdraw = this.safeNumber(chainEntry, 'maxWithdrawAmt');
3472
- const withdrawStatus = this.safeString(chainEntry, 'withdrawStatus');
3473
- const depositStatus = this.safeString(chainEntry, 'depositStatus');
3474
- const withdrawEnabled = (withdrawStatus === 'allowed');
3475
- const depositEnabled = (depositStatus === 'allowed');
3476
- withdraw = (withdrawEnabled) ? withdrawEnabled : withdraw;
3477
- deposit = (depositEnabled) ? depositEnabled : deposit;
3478
- const active = withdrawEnabled && depositEnabled;
3479
- const precision = this.parsePrecision(this.safeString(chainEntry, 'withdrawPrecision'));
3480
- if (precision !== undefined) {
3481
- minPrecision = (minPrecision === undefined) ? precision : Precise.stringMin(precision, minPrecision);
3482
- }
3483
- const fee = this.safeNumber(chainEntry, 'transactFeeWithdraw');
3484
3460
  networks[networkCode] = {
3485
3461
  'info': chainEntry,
3486
3462
  'id': uniqueChainId,
3487
3463
  'network': networkCode,
3488
3464
  'limits': {
3489
3465
  'deposit': {
3490
- 'min': minDeposit,
3466
+ 'min': this.safeNumber(chainEntry, 'minDepositAmt'),
3491
3467
  'max': undefined,
3492
3468
  },
3493
3469
  'withdraw': {
3494
- 'min': minWithdraw,
3495
- 'max': maxWithdraw,
3470
+ 'min': this.safeNumber(chainEntry, 'minWithdrawAmt'),
3471
+ 'max': this.safeNumber(chainEntry, 'maxWithdrawAmt'),
3496
3472
  },
3497
3473
  },
3498
- 'active': active,
3499
- 'deposit': depositEnabled,
3500
- 'withdraw': withdrawEnabled,
3501
- 'fee': fee,
3502
- 'precision': this.parseNumber(precision),
3474
+ 'active': undefined,
3475
+ 'deposit': this.safeString(chainEntry, 'depositStatus') === 'allowed',
3476
+ 'withdraw': this.safeString(chainEntry, 'withdrawStatus') === 'allowed',
3477
+ 'fee': this.safeNumber(chainEntry, 'transactFeeWithdraw'),
3478
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(chainEntry, 'withdrawPrecision'))),
3503
3479
  };
3504
3480
  }
3505
- result[code] = {
3481
+ result[code] = this.safeCurrencyStructure({
3506
3482
  'info': entry,
3507
3483
  'code': code,
3508
3484
  'id': currencyId,
3509
- 'active': currencyActive,
3510
- 'deposit': deposit,
3511
- 'withdraw': withdraw,
3485
+ 'active': this.safeString(entry, 'instStatus') === 'normal',
3486
+ 'deposit': undefined,
3487
+ 'withdraw': undefined,
3512
3488
  'fee': undefined,
3513
3489
  'name': undefined,
3514
3490
  'type': type,
@@ -3518,17 +3494,17 @@ export default class htx extends Exchange {
3518
3494
  'max': undefined,
3519
3495
  },
3520
3496
  'withdraw': {
3521
- 'min': minWithdraw,
3522
- 'max': maxWithdraw,
3497
+ 'min': undefined,
3498
+ 'max': undefined,
3523
3499
  },
3524
3500
  'deposit': {
3525
3501
  'min': undefined,
3526
3502
  'max': undefined,
3527
3503
  },
3528
3504
  },
3529
- 'precision': this.parseNumber(minPrecision),
3505
+ 'precision': undefined,
3530
3506
  'networks': networks,
3531
- };
3507
+ });
3532
3508
  }
3533
3509
  return result;
3534
3510
  }
@@ -178,12 +178,12 @@ export default class hyperliquid extends Exchange {
178
178
  },
179
179
  'fees': {
180
180
  'swap': {
181
- 'taker': this.parseNumber('0.00035'),
182
- 'maker': this.parseNumber('0.0001'),
181
+ 'taker': this.parseNumber('0.00045'),
182
+ 'maker': this.parseNumber('0.00015'),
183
183
  },
184
184
  'spot': {
185
- 'taker': this.parseNumber('0.00035'),
186
- 'maker': this.parseNumber('0.0001'),
185
+ 'taker': this.parseNumber('0.0007'),
186
+ 'maker': this.parseNumber('0.0004'),
187
187
  },
188
188
  },
189
189
  'requiredCredentials': {
@@ -360,7 +360,7 @@ export default class hyperliquid extends Exchange {
360
360
  const id = i;
361
361
  const name = this.safeString(data, 'name');
362
362
  const code = this.safeCurrencyCode(name);
363
- result[code] = {
363
+ result[code] = this.safeCurrencyStructure({
364
364
  'id': id,
365
365
  'name': name,
366
366
  'code': code,
@@ -382,7 +382,7 @@ export default class hyperliquid extends Exchange {
382
382
  'max': undefined,
383
383
  },
384
384
  },
385
- };
385
+ });
386
386
  }
387
387
  return result;
388
388
  }
package/js/src/kraken.js CHANGED
@@ -1649,6 +1649,8 @@ export default class kraken extends Exchange {
1649
1649
  'volume': this.amountToPrecision(symbol, amount),
1650
1650
  };
1651
1651
  const orderRequest = this.orderRequest('createOrder', symbol, type, request, amount, price, params);
1652
+ const flags = this.safeString(orderRequest[0], 'oflags', '');
1653
+ const isUsingCost = flags.indexOf('viqc') > -1;
1652
1654
  const response = await this.privatePostAddOrder(this.extend(orderRequest[0], orderRequest[1]));
1653
1655
  //
1654
1656
  // {
@@ -1660,6 +1662,10 @@ export default class kraken extends Exchange {
1660
1662
  // }
1661
1663
  //
1662
1664
  const result = this.safeDict(response, 'result');
1665
+ result['usingCost'] = isUsingCost;
1666
+ // it's impossible to know if the order was created using cost or base currency
1667
+ // becuase kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
1668
+ // this usingCost flag is used to help the parsing but omited from the order
1663
1669
  return this.parseOrder(result);
1664
1670
  }
1665
1671
  findMarketByAltnameOrId(id) {
@@ -1752,22 +1758,15 @@ export default class kraken extends Exchange {
1752
1758
  // }
1753
1759
  //
1754
1760
  // ws - createOrder
1755
- // {
1756
- // "descr": 'sell 0.00010000 XBTUSDT @ market',
1757
- // "event": 'addOrderStatus',
1758
- // "reqid": 1,
1759
- // "status": 'ok',
1760
- // "txid": 'OAVXZH-XIE54-JCYYDG'
1761
- // }
1761
+ // {
1762
+ // "order_id": "OXM2QD-EALR2-YBAVEU"
1763
+ // }
1764
+ //
1762
1765
  // ws - editOrder
1763
- // {
1764
- // "descr": "order edited price = 9000.00000000",
1765
- // "event": "editOrderStatus",
1766
- // "originaltxid": "O65KZW-J4AW3-VFS74A",
1767
- // "reqid": 3,
1768
- // "status": "ok",
1769
- // "txid": "OTI672-HJFAO-XOIPPK"
1770
- // }
1766
+ // {
1767
+ // "amend_id": "TJSMEH-AA67V-YUSQ6O",
1768
+ // "order_id": "OXM2QD-EALR2-YBAVEU"
1769
+ // }
1771
1770
  //
1772
1771
  // {
1773
1772
  // "error": [],
@@ -1835,6 +1834,8 @@ export default class kraken extends Exchange {
1835
1834
  // "oflags": "fciq"
1836
1835
  // }
1837
1836
  //
1837
+ const isUsingCost = this.safeBool(order, 'usingCost', false);
1838
+ order = this.omit(order, 'usingCost');
1838
1839
  const description = this.safeDict(order, 'descr', {});
1839
1840
  const orderDescriptionObj = this.safeDict(order, 'descr'); // can be null
1840
1841
  let orderDescription = undefined;
@@ -1849,11 +1850,17 @@ export default class kraken extends Exchange {
1849
1850
  let marketId = undefined;
1850
1851
  let price = undefined;
1851
1852
  let amount = undefined;
1853
+ let cost = undefined;
1852
1854
  let triggerPrice = undefined;
1853
1855
  if (orderDescription !== undefined) {
1854
1856
  const parts = orderDescription.split(' ');
1855
1857
  side = this.safeString(parts, 0);
1856
- amount = this.safeString(parts, 1);
1858
+ if (!isUsingCost) {
1859
+ amount = this.safeString(parts, 1);
1860
+ }
1861
+ else {
1862
+ cost = this.safeString(parts, 1);
1863
+ }
1857
1864
  marketId = this.safeString(parts, 2);
1858
1865
  const part4 = this.safeString(parts, 4);
1859
1866
  const part5 = this.safeString(parts, 5);
@@ -1890,15 +1897,13 @@ export default class kraken extends Exchange {
1890
1897
  // kraken truncates the cost in the api response so we will ignore it and calculate it from average & filled
1891
1898
  // const cost = this.safeString (order, 'cost');
1892
1899
  price = this.safeString(description, 'price', price);
1893
- // when type = trailling stop returns price = '+50.0000%'
1894
- if ((price !== undefined) && price.endsWith('%')) {
1900
+ // when type = trailing stop returns price = '+50.0000%'
1901
+ if ((price !== undefined) && (price.endsWith('%') || Precise.stringEquals(price, '0.00000') || Precise.stringEquals(price, '0'))) {
1895
1902
  price = undefined; // this is not the price we want
1896
1903
  }
1897
- if ((price === undefined) || Precise.stringEquals(price, '0')) {
1904
+ if (price === undefined) {
1898
1905
  price = this.safeString(description, 'price2');
1899
- }
1900
- if ((price === undefined) || Precise.stringEquals(price, '0')) {
1901
- price = this.safeString(order, 'price', price);
1906
+ price = this.safeString2(order, 'limitprice', 'price', price);
1902
1907
  }
1903
1908
  const flags = this.safeString(order, 'oflags', '');
1904
1909
  let isPostOnly = flags.indexOf('post') > -1;
@@ -1920,7 +1925,7 @@ export default class kraken extends Exchange {
1920
1925
  }
1921
1926
  }
1922
1927
  const status = this.parseOrderStatus(this.safeString(order, 'status'));
1923
- let id = this.safeStringN(order, ['id', 'txid', 'amend_id']);
1928
+ let id = this.safeStringN(order, ['id', 'txid', 'order_id', 'amend_id']);
1924
1929
  if ((id === undefined) || (id.startsWith('['))) {
1925
1930
  const txid = this.safeList(order, 'txid');
1926
1931
  id = this.safeString(txid, 0);
@@ -1988,7 +1993,7 @@ export default class kraken extends Exchange {
1988
1993
  'triggerPrice': triggerPrice,
1989
1994
  'takeProfitPrice': takeProfitPrice,
1990
1995
  'stopLossPrice': stopLossPrice,
1991
- 'cost': undefined,
1996
+ 'cost': cost,
1992
1997
  'amount': amount,
1993
1998
  'filled': filled,
1994
1999
  'average': average,
@@ -184,6 +184,7 @@ export default class kucoinfutures extends kucoin {
184
184
  * @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
185
185
  * @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
186
186
  * @param {float} [params.cost] the cost of the order in units of USDT
187
+ * @param {string} [params.marginMode] 'cross' or 'isolated', default is 'isolated'
187
188
  * ----------------- Exchange Specific Parameters -----------------
188
189
  * @param {float} [params.leverage] Leverage size of the order (mandatory param in request, default is 1)
189
190
  * @param {string} [params.clientOid] client order id, defaults to uuid if not passed