ccxt 4.4.82 → 4.4.85

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 (103) hide show
  1. package/README.md +5 -7
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +1 -9
  4. package/dist/cjs/src/apex.js +2 -1
  5. package/dist/cjs/src/base/Exchange.js +15 -2
  6. package/dist/cjs/src/bitget.js +1 -3
  7. package/dist/cjs/src/bitrue.js +14 -35
  8. package/dist/cjs/src/bitso.js +33 -0
  9. package/dist/cjs/src/bitstamp.js +33 -0
  10. package/dist/cjs/src/blofin.js +154 -13
  11. package/dist/cjs/src/btcbox.js +25 -5
  12. package/dist/cjs/src/bybit.js +16 -40
  13. package/dist/cjs/src/cex.js +2 -4
  14. package/dist/cjs/src/coinbase.js +56 -40
  15. package/dist/cjs/src/coinbaseexchange.js +142 -32
  16. package/dist/cjs/src/coincatch.js +14 -67
  17. package/dist/cjs/src/coinex.js +29 -32
  18. package/dist/cjs/src/coinlist.js +16 -15
  19. package/dist/cjs/src/coinmetro.js +22 -11
  20. package/dist/cjs/src/coinone.js +8 -10
  21. package/dist/cjs/src/coinsph.js +126 -1
  22. package/dist/cjs/src/cryptocom.js +111 -1
  23. package/dist/cjs/src/cryptomus.js +43 -89
  24. package/dist/cjs/src/delta.js +76 -36
  25. package/dist/cjs/src/derive.js +46 -10
  26. package/dist/cjs/src/ellipx.js +175 -79
  27. package/dist/cjs/src/gate.js +1 -1
  28. package/dist/cjs/src/gemini.js +3 -5
  29. package/dist/cjs/src/hitbtc.js +56 -69
  30. package/dist/cjs/src/hyperliquid.js +2 -2
  31. package/dist/cjs/src/kraken.js +29 -24
  32. package/dist/cjs/src/kucoinfutures.js +6 -0
  33. package/dist/cjs/src/lbank.js +1 -1
  34. package/dist/cjs/src/paradex.js +119 -3
  35. package/dist/cjs/src/pro/binance.js +31 -33
  36. package/dist/cjs/src/pro/bithumb.js +5 -3
  37. package/dist/cjs/src/pro/kraken.js +289 -79
  38. package/dist/cjs/src/pro/mexc.js +302 -8
  39. package/dist/cjs/src/pro/poloniex.js +6 -2
  40. package/examples/js/cli.js +127 -13
  41. package/js/ccxt.d.ts +2 -11
  42. package/js/ccxt.js +2 -8
  43. package/js/src/abstract/blofin.d.ts +8 -0
  44. package/js/src/abstract/btcbox.d.ts +1 -0
  45. package/js/src/apex.js +2 -1
  46. package/js/src/base/Exchange.d.ts +15 -1
  47. package/js/src/base/Exchange.js +15 -2
  48. package/js/src/base/types.d.ts +3 -0
  49. package/js/src/bitget.js +1 -3
  50. package/js/src/bitrue.js +14 -35
  51. package/js/src/bitso.js +33 -0
  52. package/js/src/bitstamp.js +33 -0
  53. package/js/src/blofin.d.ts +42 -2
  54. package/js/src/blofin.js +154 -13
  55. package/js/src/btcbox.js +25 -5
  56. package/js/src/bybit.js +16 -40
  57. package/js/src/cex.js +2 -4
  58. package/js/src/coinbase.js +56 -40
  59. package/js/src/coinbaseexchange.js +142 -32
  60. package/js/src/coincatch.js +14 -67
  61. package/js/src/coinex.js +28 -29
  62. package/js/src/coinlist.js +16 -15
  63. package/js/src/coinmetro.js +22 -11
  64. package/js/src/coinone.js +8 -10
  65. package/js/src/coinsph.d.ts +10 -1
  66. package/js/src/coinsph.js +126 -1
  67. package/js/src/cryptocom.d.ts +10 -1
  68. package/js/src/cryptocom.js +111 -1
  69. package/js/src/cryptomus.js +43 -89
  70. package/js/src/delta.js +76 -36
  71. package/js/src/derive.js +46 -10
  72. package/js/src/ellipx.d.ts +2 -3
  73. package/js/src/ellipx.js +175 -80
  74. package/js/src/gate.js +1 -1
  75. package/js/src/gemini.js +3 -5
  76. package/js/src/hitbtc.js +56 -69
  77. package/js/src/hyperliquid.js +2 -2
  78. package/js/src/kraken.js +29 -24
  79. package/js/src/kucoinfutures.d.ts +1 -0
  80. package/js/src/kucoinfutures.js +6 -0
  81. package/js/src/lbank.js +1 -1
  82. package/js/src/paradex.d.ts +12 -1
  83. package/js/src/paradex.js +119 -3
  84. package/js/src/pro/binance.d.ts +26 -26
  85. package/js/src/pro/binance.js +31 -33
  86. package/js/src/pro/bithumb.js +5 -3
  87. package/js/src/pro/kraken.d.ts +7 -6
  88. package/js/src/pro/kraken.js +290 -80
  89. package/js/src/pro/mexc.d.ts +58 -0
  90. package/js/src/pro/mexc.js +302 -8
  91. package/js/src/pro/poloniex.d.ts +1 -1
  92. package/js/src/pro/poloniex.js +6 -2
  93. package/package.json +1 -1
  94. package/js/src/abstract/bl3p.d.ts +0 -22
  95. package/js/src/abstract/bl3p.js +0 -11
  96. package/js/src/abstract/idex.d.ts +0 -29
  97. package/js/src/abstract/idex.js +0 -11
  98. package/js/src/bl3p.d.ts +0 -116
  99. package/js/src/bl3p.js +0 -552
  100. package/js/src/idex.d.ts +0 -312
  101. package/js/src/idex.js +0 -1961
  102. package/js/src/pro/idex.d.ts +0 -81
  103. package/js/src/pro/idex.js +0 -720
@@ -805,85 +805,181 @@ class ellipx extends ellipx$1 {
805
805
  'results_per_page': 100,
806
806
  '_expand': '/Crypto_Token,/Crypto_Chain',
807
807
  }, params));
808
- const currencies = {};
809
- const data = this.safeValue(response, 'data', []);
808
+ const result = {};
809
+ const data = this.safeList(response, 'data', []);
810
810
  for (let i = 0; i < data.length; i++) {
811
- const currency = this.parseCurrency(data[i]);
812
- const code = this.safeString(currency, 'code');
813
- if (code !== undefined) {
814
- currencies[code] = currency;
811
+ const networkEntry = data[i];
812
+ //
813
+ // {
814
+ // "Crypto_Token_Info__": "crtev-5nsn35-f4ir-g5hp-iaft-i4ztx6zu",
815
+ // "Crypto_Token__": "crtok-c5v3mh-grfn-hl5d-lmel-fvggbf4i",
816
+ // "Crypto_Chain__": "chain-xjbini-7wlz-dmzf-gm7z-zf7ei6fq",
817
+ // "Type": "native",
818
+ // "Symbol": null,
819
+ // "Name": null,
820
+ // "Contract_Address": null,
821
+ // "Minimum_Deposit": {
822
+ // "v": "6",
823
+ // "e": "6",
824
+ // "f": "6.0e-6"
825
+ // },
826
+ // "Minimum_Withdraw": {
827
+ // "v": "15",
828
+ // "e": "5",
829
+ // "f": "0.00015"
830
+ // },
831
+ // "Withdraw_Fee": {
832
+ // "v": "1",
833
+ // "e": "4",
834
+ // "f": "0.0001"
835
+ // },
836
+ // "Minimum_Collect": null,
837
+ // "Status": "valid",
838
+ // "Can_Deposit": "Y",
839
+ // "Decimals": null,
840
+ // "Priority": "100",
841
+ // "Created": {
842
+ // "unix": "1727552199",
843
+ // "us": "0",
844
+ // "iso": "2024-09-28 19:36:39.000000",
845
+ // "tz": "UTC",
846
+ // "full": "1727552199000000",
847
+ // "unixms": "1727552199000"
848
+ // },
849
+ // "Crypto_Token": {
850
+ // "Crypto_Token__": "crtok-c5v3mh-grfn-hl5d-lmel-fvggbf4i",
851
+ // "Name": "Bitcoin",
852
+ // "Symbol": "BTC",
853
+ // "Decimals": "8",
854
+ // "CMC_Id": "1",
855
+ // "Priority": "100",
856
+ // "Can_Deposit": "Y",
857
+ // "Category": "token",
858
+ // "Testnet": "N",
859
+ // "Created": {
860
+ // "unix": "1727552113",
861
+ // "us": "0",
862
+ // "iso": "2024-09-28 19:35:13.000000",
863
+ // "tz": "UTC",
864
+ // "full": "1727552113000000",
865
+ // "unixms": "1727552113000"
866
+ // },
867
+ // "Logo": [
868
+ // {
869
+ // "Crypto_Token_Logo__": "ctklg-aoozyr-rzm5-fphf-dhm7-5wbtetha",
870
+ // "Crypto_Token__": "crtok-c5v3mh-grfn-hl5d-lmel-fvggbf4i",
871
+ // "Blob__": "blob-d6hvgx-37s5-dh5h-ogj5-qxqvnaoy",
872
+ // "Default": "Y",
873
+ // "Format": "png",
874
+ // "Priority": "0",
875
+ // "Created": {
876
+ // "unix": "1730196627",
877
+ // "us": "929660",
878
+ // "iso": "2024-10-29 10:10:27.929660",
879
+ // "tz": "UTC",
880
+ // "full": "1730196627929660",
881
+ // "unixms": "1730196627929"
882
+ // },
883
+ // "Source": {
884
+ // "Media_Image__": "blob-d6hvgx-37s5-dh5h-ogj5-qxqvnaoy",
885
+ // "Url": "https://static.atonline.net/image/m_X7_tnmIYFCwn6EUVQuMKqrCuPB3CMl4ONTegeYpC0wIg68YZM0CuBpbjspnYwz/1a942eab068a2173e66d08c736283cfe22e1c1ed"
886
+ // }
887
+ // }
888
+ // ]
889
+ // },
890
+ // "Crypto_Chain": {
891
+ // "Crypto_Chain__": "chain-xjbini-7wlz-dmzf-gm7z-zf7ei6fq",
892
+ // "EVM_Chain__": null,
893
+ // "Crypto_Token__": "crtok-c5v3mh-grfn-hl5d-lmel-fvggbf4i",
894
+ // "Name": "Bitcoin",
895
+ // "Key": "bitcoin",
896
+ // "Type": "Bitcoin",
897
+ // "Curve": "secp256k1",
898
+ // "Backend_Url": null,
899
+ // "Wallet_Verification_Methods": {
900
+ // "signature": true
901
+ // },
902
+ // "Block_Margin": "3",
903
+ // "Created": {
904
+ // "unix": "1725340084",
905
+ // "us": "0",
906
+ // "iso": "2024-09-03 05:08:04.000000",
907
+ // "tz": "UTC",
908
+ // "full": "1725340084000000",
909
+ // "unixms": "1725340084000"
910
+ // }
911
+ // }
912
+ // }
913
+ //
914
+ const id = this.safeString(networkEntry, 'Crypto_Token__');
915
+ const token = this.safeDict(networkEntry, 'Crypto_Token', {});
916
+ const code = this.safeCurrencyCode(this.safeString(token, 'Symbol'));
917
+ if (!(code in result)) {
918
+ result[code] = {
919
+ 'id': id,
920
+ 'code': code,
921
+ 'info': [],
922
+ 'type': undefined,
923
+ 'name': this.safeString(token, 'Name'),
924
+ 'active': undefined,
925
+ 'deposit': undefined,
926
+ 'withdraw': undefined,
927
+ 'fee': undefined,
928
+ 'precision': undefined,
929
+ 'limits': {
930
+ 'amount': {
931
+ 'min': undefined,
932
+ 'max': undefined,
933
+ },
934
+ 'withdraw': {
935
+ 'min': undefined,
936
+ 'max': undefined,
937
+ },
938
+ 'deposit': {
939
+ 'min': undefined,
940
+ 'max': undefined,
941
+ },
942
+ },
943
+ 'networks': {},
944
+ };
815
945
  }
946
+ const networkId = this.safeString(networkEntry, 'Crypto_Chain__');
947
+ const cryptoChainDict = this.safeString(networkEntry, 'Crypto_Chain');
948
+ const networkName = this.safeString(cryptoChainDict, 'Type', 'default');
949
+ const networkCode = this.networkIdToCode(networkName);
950
+ result[code]['networks'][networkCode] = {
951
+ 'id': networkId,
952
+ 'network': networkCode,
953
+ 'active': this.safeString(networkEntry, 'Status') === 'valid',
954
+ 'deposit': this.safeString(networkEntry, 'Can_Deposit') === 'Y',
955
+ 'withdraw': undefined,
956
+ 'fee': this.parseNumber(this.parseAmount(networkEntry['Withdraw_Fee'])),
957
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(token, 'Decimals'))),
958
+ 'limits': {
959
+ 'amount': {
960
+ 'min': undefined,
961
+ 'max': undefined,
962
+ },
963
+ 'withdraw': {
964
+ 'min': this.parseAmount(networkEntry['Minimum_Withdraw']),
965
+ 'max': undefined,
966
+ },
967
+ 'deposit': {
968
+ 'min': this.parseAmount(networkEntry['Minimum_Deposit']),
969
+ 'max': undefined,
970
+ },
971
+ },
972
+ };
973
+ const infos = this.safeList(result[code], 'info', []);
974
+ infos.push(networkEntry);
975
+ result[code]['info'] = infos;
816
976
  }
817
- return currencies;
818
- }
819
- parseCurrency(currency) {
820
- const id = this.safeString(currency, 'Crypto_Token__');
821
- const token = this.safeValue(currency, 'Crypto_Token', {});
822
- const code = this.safeCurrencyCode(this.safeString(token, 'Symbol'));
823
- const name = this.safeString(token, 'Name');
824
- const active = this.safeString(currency, 'Status') === 'valid';
825
- const deposit = this.safeString(currency, 'Can_Deposit') === 'Y';
826
- const withdraw = this.safeString(currency, 'Status') === 'valid';
827
- let fee = undefined;
828
- if (currency['Withdraw_Fee'] !== undefined) {
829
- fee = this.parseNumber(this.parseAmount(currency['Withdraw_Fee']));
830
- }
831
- const precision = this.parseNumber(this.parsePrecision(this.safeString(token, 'Decimals')));
832
- let minDeposit = undefined;
833
- if (currency['Minimum_Deposit'] !== undefined) {
834
- minDeposit = this.parseAmount(currency['Minimum_Deposit']);
835
- }
836
- let minWithdraw = undefined;
837
- if (currency['Minimum_Withdraw'] !== undefined) {
838
- minWithdraw = this.parseAmount(currency['Minimum_Withdraw']);
977
+ // only after all entries are formed in currencies, restructure each entry
978
+ const allKeys = Object.keys(result);
979
+ for (let i = 0; i < allKeys.length; i++) {
980
+ const code = allKeys[i];
981
+ result[code] = this.safeCurrencyStructure(result[code]); // this is needed after adding network entry
839
982
  }
840
- const networkId = this.safeString(currency, 'Crypto_Chain__');
841
- const networkData = this.safeValue(currency, 'Crypto_Chain', {});
842
- const networkCode = this.safeString(networkData, 'Type', 'default');
843
- const networks = {
844
- 'string': undefined,
845
- 'info': networkCode === 'default' ? {} : networkData,
846
- 'id': networkId || id || '',
847
- 'network': networkCode,
848
- 'active': active,
849
- 'deposit': deposit,
850
- 'withdraw': withdraw,
851
- 'fee': fee,
852
- 'precision': precision,
853
- 'limits': {
854
- 'deposit': {
855
- 'min': minDeposit,
856
- 'max': undefined,
857
- },
858
- 'withdraw': {
859
- 'min': minWithdraw,
860
- 'max': undefined,
861
- },
862
- },
863
- };
864
- const result = {
865
- 'info': currency,
866
- 'id': id,
867
- 'code': code,
868
- 'name': name,
869
- 'active': active,
870
- 'deposit': deposit,
871
- 'withdraw': withdraw,
872
- 'fee': fee,
873
- 'precision': precision,
874
- 'type': undefined,
875
- 'limits': {
876
- 'amount': {
877
- 'min': undefined,
878
- 'max': undefined,
879
- },
880
- 'withdraw': {
881
- 'min': minWithdraw,
882
- 'max': undefined,
883
- },
884
- },
885
- 'networks': networks,
886
- };
887
983
  return result;
888
984
  }
889
985
  /**
@@ -1083,14 +1179,14 @@ class ellipx extends ellipx$1 {
1083
1179
  for (let i = 0; i < dataArray.length; i++) {
1084
1180
  const entry = dataArray[i];
1085
1181
  const balance = this.safeDict(entry, 'Balance', {});
1086
- const currency = this.safeString(balance, 'currency');
1087
- if (currency !== undefined) {
1182
+ const code = this.safeString(balance, 'currency');
1183
+ if (code !== undefined) {
1088
1184
  const account = {
1089
1185
  'free': this.parseAmount(entry['Unencumbered_Balance']['value_xint']),
1090
1186
  'used': this.parseAmount(entry['Liabilities']['value_xint']),
1091
1187
  'total': this.parseAmount(balance['value_xint']),
1092
1188
  };
1093
- result[currency] = account;
1189
+ result[code] = account;
1094
1190
  }
1095
1191
  }
1096
1192
  return this.safeBalance(result);
@@ -1713,7 +1809,7 @@ class ellipx extends ellipx$1 {
1713
1809
  * @name ellipx#withdraw
1714
1810
  * @description Make a withdrawal request
1715
1811
  * @see https://docs.google.com/document/d/1ZXzTQYffKE_EglTaKptxGQERRnunuLHEMmar7VC9syM/edit?tab=t.0#heading=h.zegupoa8g4t9
1716
- * @param {string} code Currency code
1812
+ * @param {string} code unified currency code
1717
1813
  * @param {number} amount Amount to withdraw
1718
1814
  * @param {string} address Destination wallet address
1719
1815
  * @param {string} [tag] Additional tag/memo for currencies that require it
@@ -1898,7 +1898,7 @@ class gate extends gate$1 {
1898
1898
  'code': code,
1899
1899
  'type': type,
1900
1900
  'precision': precision,
1901
- 'limits': this.limits,
1901
+ 'limits': undefined,
1902
1902
  'networks': {},
1903
1903
  'info': [], // will be filled below
1904
1904
  };
@@ -261,7 +261,7 @@ class gemini extends gemini$1 {
261
261
  'fetchMarketFromWebRetries': 10,
262
262
  'fetchMarketsFromAPI': {
263
263
  'fetchDetailsForAllSymbols': false,
264
- 'quoteCurrencies': ['USDT', 'GUSD', 'USD', 'DAI', 'EUR', 'GBP', 'SGD', 'BTC', 'ETH', 'LTC', 'BCH'],
264
+ 'quoteCurrencies': ['USDT', 'GUSD', 'USD', 'DAI', 'EUR', 'GBP', 'SGD', 'BTC', 'ETH', 'LTC', 'BCH', 'SOL'],
265
265
  },
266
266
  'fetchMarkets': {
267
267
  'webApiEnable': true,
@@ -421,8 +421,6 @@ class gemini extends gemini$1 {
421
421
  let networkCode = undefined;
422
422
  if (networkId !== undefined) {
423
423
  networkCode = this.networkIdToCode(networkId);
424
- }
425
- if (networkCode !== undefined) {
426
424
  networks[networkCode] = {
427
425
  'info': currency,
428
426
  'id': networkId,
@@ -444,7 +442,7 @@ class gemini extends gemini$1 {
444
442
  },
445
443
  };
446
444
  }
447
- result[code] = {
445
+ result[code] = this.safeCurrencyStructure({
448
446
  'info': currency,
449
447
  'id': id,
450
448
  'code': code,
@@ -466,7 +464,7 @@ class gemini extends gemini$1 {
466
464
  },
467
465
  },
468
466
  'networks': networks,
469
- };
467
+ });
470
468
  }
471
469
  return result;
472
470
  }
@@ -918,29 +918,46 @@ class hitbtc extends hitbtc$1 {
918
918
  async fetchCurrencies(params = {}) {
919
919
  const response = await this.publicGetPublicCurrency(params);
920
920
  //
921
- // {
922
- // "WEALTH": {
923
- // "full_name": "ConnectWealth",
924
- // "payin_enabled": false,
925
- // "payout_enabled": false,
926
- // "transfer_enabled": true,
927
- // "precision_transfer": "0.001",
928
- // "networks": [
929
- // {
930
- // "network": "ETH",
931
- // "protocol": "ERC20",
932
- // "default": true,
933
- // "payin_enabled": false,
934
- // "payout_enabled": false,
935
- // "precision_payout": "0.001",
936
- // "payout_fee": "0.016800000000",
937
- // "payout_is_payment_id": false,
938
- // "payin_payment_id": false,
939
- // "payin_confirmations": "2"
940
- // }
941
- // ]
942
- // }
943
- // }
921
+ // {
922
+ // "DFC": {
923
+ // "full_name": "DeFiScale",
924
+ // "crypto": true,
925
+ // "payin_enabled": false,
926
+ // "payout_enabled": true,
927
+ // "transfer_enabled": false,
928
+ // "transfer_to_wallet_enabled": true,
929
+ // "transfer_to_exchange_enabled": false,
930
+ // "sign": "D",
931
+ // "crypto_payment_id_name": "",
932
+ // "crypto_explorer": "https://etherscan.io/tx/{tx}",
933
+ // "precision_transfer": "0.00000001",
934
+ // "delisted": false,
935
+ // "networks": [
936
+ // {
937
+ // "code": "ETH",
938
+ // "network_name": "Ethereum",
939
+ // "network": "ETH",
940
+ // "protocol": "ERC-20",
941
+ // "default": true,
942
+ // "is_ens_available": true,
943
+ // "payin_enabled": true,
944
+ // "payout_enabled": true,
945
+ // "precision_payout": "0.000000000000000001",
946
+ // "payout_fee": "277000.0000000000",
947
+ // "payout_is_payment_id": false,
948
+ // "payin_payment_id": false,
949
+ // "payin_confirmations": "2",
950
+ // "contract_address": "0x1b2a76da77d03b7fc21189d9838f55bd849014af",
951
+ // "crypto_payment_id_name": "",
952
+ // "crypto_explorer": "https://etherscan.io/tx/{tx}",
953
+ // "is_multichain": true,
954
+ // "asset_id": {
955
+ // "contract_address": "0x1b2a76da77d03b7fc21189d9838f55bd849014af"
956
+ // }
957
+ // }
958
+ // ]
959
+ // },
960
+ // }
944
961
  //
945
962
  const result = {};
946
963
  const currencies = Object.keys(response);
@@ -948,50 +965,22 @@ class hitbtc extends hitbtc$1 {
948
965
  const currencyId = currencies[i];
949
966
  const code = this.safeCurrencyCode(currencyId);
950
967
  const entry = response[currencyId];
951
- const name = this.safeString(entry, 'full_name');
952
- const precision = this.safeNumber(entry, 'precision_transfer');
953
- const payinEnabled = this.safeBool(entry, 'payin_enabled', false);
954
- const payoutEnabled = this.safeBool(entry, 'payout_enabled', false);
955
- const transferEnabled = this.safeBool(entry, 'transfer_enabled', false);
956
- const active = payinEnabled && payoutEnabled && transferEnabled;
957
- const rawNetworks = this.safeValue(entry, 'networks', []);
958
- const isCrypto = this.safeBool(entry, 'crypto');
959
- const type = isCrypto ? 'crypto' : 'fiat';
968
+ const rawNetworks = this.safeList(entry, 'networks', []);
960
969
  const networks = {};
961
- let fee = undefined;
962
- let depositEnabled = undefined;
963
- let withdrawEnabled = undefined;
964
970
  for (let j = 0; j < rawNetworks.length; j++) {
965
971
  const rawNetwork = rawNetworks[j];
966
972
  const networkId = this.safeString2(rawNetwork, 'protocol', 'network');
967
973
  let networkCode = this.networkIdToCode(networkId);
968
- networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : undefined;
969
- fee = this.safeNumber(rawNetwork, 'payout_fee');
970
- const networkPrecision = this.safeNumber(rawNetwork, 'precision_payout');
971
- const payinEnabledNetwork = this.safeBool(rawNetwork, 'payin_enabled', false);
972
- const payoutEnabledNetwork = this.safeBool(rawNetwork, 'payout_enabled', false);
973
- const activeNetwork = payinEnabledNetwork && payoutEnabledNetwork;
974
- if (payinEnabledNetwork && !depositEnabled) {
975
- depositEnabled = true;
976
- }
977
- else if (!payinEnabledNetwork) {
978
- depositEnabled = false;
979
- }
980
- if (payoutEnabledNetwork && !withdrawEnabled) {
981
- withdrawEnabled = true;
982
- }
983
- else if (!payoutEnabledNetwork) {
984
- withdrawEnabled = false;
985
- }
974
+ networkCode = (networkCode !== undefined) ? networkCode.toUpperCase() : code; // as hitbtc is white label, ensure we safeguard from possible bugs
986
975
  networks[networkCode] = {
987
976
  'info': rawNetwork,
988
977
  'id': networkId,
989
978
  'network': networkCode,
990
- 'fee': fee,
991
- 'active': activeNetwork,
992
- 'deposit': payinEnabledNetwork,
993
- 'withdraw': payoutEnabledNetwork,
994
- 'precision': networkPrecision,
979
+ 'active': undefined,
980
+ 'fee': this.safeNumber(rawNetwork, 'payout_fee'),
981
+ 'deposit': this.safeBool(rawNetwork, 'payin_enabled'),
982
+ 'withdraw': this.safeBool(rawNetwork, 'payout_enabled'),
983
+ 'precision': this.safeNumber(rawNetwork, 'precision_payout'),
995
984
  'limits': {
996
985
  'withdraw': {
997
986
  'min': undefined,
@@ -1000,27 +989,25 @@ class hitbtc extends hitbtc$1 {
1000
989
  },
1001
990
  };
1002
991
  }
1003
- const networksKeys = Object.keys(networks);
1004
- const networksLength = networksKeys.length;
1005
- result[code] = {
992
+ result[code] = this.safeCurrencyStructure({
1006
993
  'info': entry,
1007
994
  'code': code,
1008
995
  'id': currencyId,
1009
- 'precision': precision,
1010
- 'name': name,
1011
- 'active': active,
1012
- 'deposit': depositEnabled,
1013
- 'withdraw': withdrawEnabled,
996
+ 'precision': this.safeNumber(entry, 'precision_transfer'),
997
+ 'name': this.safeString(entry, 'full_name'),
998
+ 'active': !this.safeBool(entry, 'delisted'),
999
+ 'deposit': this.safeBool(entry, 'payin_enabled'),
1000
+ 'withdraw': this.safeBool(entry, 'payout_enabled'),
1014
1001
  'networks': networks,
1015
- 'fee': (networksLength <= 1) ? fee : undefined,
1002
+ 'fee': undefined,
1016
1003
  'limits': {
1017
1004
  'amount': {
1018
1005
  'min': undefined,
1019
1006
  'max': undefined,
1020
1007
  },
1021
1008
  },
1022
- 'type': type,
1023
- };
1009
+ 'type': undefined, // 'crypto' field emits incorrect values
1010
+ });
1024
1011
  }
1025
1012
  return result;
1026
1013
  }
@@ -357,7 +357,7 @@ class hyperliquid extends hyperliquid$1 {
357
357
  const id = i;
358
358
  const name = this.safeString(data, 'name');
359
359
  const code = this.safeCurrencyCode(name);
360
- result[code] = {
360
+ result[code] = this.safeCurrencyStructure({
361
361
  'id': id,
362
362
  'name': name,
363
363
  'code': code,
@@ -379,7 +379,7 @@ class hyperliquid extends hyperliquid$1 {
379
379
  'max': undefined,
380
380
  },
381
381
  },
382
- };
382
+ });
383
383
  }
384
384
  return result;
385
385
  }
@@ -1646,6 +1646,8 @@ class kraken extends kraken$1 {
1646
1646
  'volume': this.amountToPrecision(symbol, amount),
1647
1647
  };
1648
1648
  const orderRequest = this.orderRequest('createOrder', symbol, type, request, amount, price, params);
1649
+ const flags = this.safeString(orderRequest[0], 'oflags', '');
1650
+ const isUsingCost = flags.indexOf('viqc') > -1;
1649
1651
  const response = await this.privatePostAddOrder(this.extend(orderRequest[0], orderRequest[1]));
1650
1652
  //
1651
1653
  // {
@@ -1657,6 +1659,10 @@ class kraken extends kraken$1 {
1657
1659
  // }
1658
1660
  //
1659
1661
  const result = this.safeDict(response, 'result');
1662
+ result['usingCost'] = isUsingCost;
1663
+ // it's impossible to know if the order was created using cost or base currency
1664
+ // becuase kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
1665
+ // this usingCost flag is used to help the parsing but omited from the order
1660
1666
  return this.parseOrder(result);
1661
1667
  }
1662
1668
  findMarketByAltnameOrId(id) {
@@ -1749,22 +1755,15 @@ class kraken extends kraken$1 {
1749
1755
  // }
1750
1756
  //
1751
1757
  // ws - createOrder
1752
- // {
1753
- // "descr": 'sell 0.00010000 XBTUSDT @ market',
1754
- // "event": 'addOrderStatus',
1755
- // "reqid": 1,
1756
- // "status": 'ok',
1757
- // "txid": 'OAVXZH-XIE54-JCYYDG'
1758
- // }
1758
+ // {
1759
+ // "order_id": "OXM2QD-EALR2-YBAVEU"
1760
+ // }
1761
+ //
1759
1762
  // ws - editOrder
1760
- // {
1761
- // "descr": "order edited price = 9000.00000000",
1762
- // "event": "editOrderStatus",
1763
- // "originaltxid": "O65KZW-J4AW3-VFS74A",
1764
- // "reqid": 3,
1765
- // "status": "ok",
1766
- // "txid": "OTI672-HJFAO-XOIPPK"
1767
- // }
1763
+ // {
1764
+ // "amend_id": "TJSMEH-AA67V-YUSQ6O",
1765
+ // "order_id": "OXM2QD-EALR2-YBAVEU"
1766
+ // }
1768
1767
  //
1769
1768
  // {
1770
1769
  // "error": [],
@@ -1832,6 +1831,8 @@ class kraken extends kraken$1 {
1832
1831
  // "oflags": "fciq"
1833
1832
  // }
1834
1833
  //
1834
+ const isUsingCost = this.safeBool(order, 'usingCost', false);
1835
+ order = this.omit(order, 'usingCost');
1835
1836
  const description = this.safeDict(order, 'descr', {});
1836
1837
  const orderDescriptionObj = this.safeDict(order, 'descr'); // can be null
1837
1838
  let orderDescription = undefined;
@@ -1846,11 +1847,17 @@ class kraken extends kraken$1 {
1846
1847
  let marketId = undefined;
1847
1848
  let price = undefined;
1848
1849
  let amount = undefined;
1850
+ let cost = undefined;
1849
1851
  let triggerPrice = undefined;
1850
1852
  if (orderDescription !== undefined) {
1851
1853
  const parts = orderDescription.split(' ');
1852
1854
  side = this.safeString(parts, 0);
1853
- amount = this.safeString(parts, 1);
1855
+ if (!isUsingCost) {
1856
+ amount = this.safeString(parts, 1);
1857
+ }
1858
+ else {
1859
+ cost = this.safeString(parts, 1);
1860
+ }
1854
1861
  marketId = this.safeString(parts, 2);
1855
1862
  const part4 = this.safeString(parts, 4);
1856
1863
  const part5 = this.safeString(parts, 5);
@@ -1887,15 +1894,13 @@ class kraken extends kraken$1 {
1887
1894
  // kraken truncates the cost in the api response so we will ignore it and calculate it from average & filled
1888
1895
  // const cost = this.safeString (order, 'cost');
1889
1896
  price = this.safeString(description, 'price', price);
1890
- // when type = trailling stop returns price = '+50.0000%'
1891
- if ((price !== undefined) && price.endsWith('%')) {
1897
+ // when type = trailing stop returns price = '+50.0000%'
1898
+ if ((price !== undefined) && (price.endsWith('%') || Precise["default"].stringEquals(price, '0.00000') || Precise["default"].stringEquals(price, '0'))) {
1892
1899
  price = undefined; // this is not the price we want
1893
1900
  }
1894
- if ((price === undefined) || Precise["default"].stringEquals(price, '0')) {
1901
+ if (price === undefined) {
1895
1902
  price = this.safeString(description, 'price2');
1896
- }
1897
- if ((price === undefined) || Precise["default"].stringEquals(price, '0')) {
1898
- price = this.safeString(order, 'price', price);
1903
+ price = this.safeString2(order, 'limitprice', 'price', price);
1899
1904
  }
1900
1905
  const flags = this.safeString(order, 'oflags', '');
1901
1906
  let isPostOnly = flags.indexOf('post') > -1;
@@ -1917,7 +1922,7 @@ class kraken extends kraken$1 {
1917
1922
  }
1918
1923
  }
1919
1924
  const status = this.parseOrderStatus(this.safeString(order, 'status'));
1920
- let id = this.safeStringN(order, ['id', 'txid', 'amend_id']);
1925
+ let id = this.safeStringN(order, ['id', 'txid', 'order_id', 'amend_id']);
1921
1926
  if ((id === undefined) || (id.startsWith('['))) {
1922
1927
  const txid = this.safeList(order, 'txid');
1923
1928
  id = this.safeString(txid, 0);
@@ -1985,7 +1990,7 @@ class kraken extends kraken$1 {
1985
1990
  'triggerPrice': triggerPrice,
1986
1991
  'takeProfitPrice': takeProfitPrice,
1987
1992
  'stopLossPrice': stopLossPrice,
1988
- 'cost': undefined,
1993
+ 'cost': cost,
1989
1994
  'amount': amount,
1990
1995
  'filled': filled,
1991
1996
  'average': average,
@@ -1531,6 +1531,7 @@ class kucoinfutures extends kucoinfutures$1 {
1531
1531
  * @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
1532
1532
  * @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
1533
1533
  * @param {float} [params.cost] the cost of the order in units of USDT
1534
+ * @param {string} [params.marginMode] 'cross' or 'isolated', default is 'isolated'
1534
1535
  * ----------------- Exchange Specific Parameters -----------------
1535
1536
  * @param {float} [params.leverage] Leverage size of the order (mandatory param in request, default is 1)
1536
1537
  * @param {string} [params.clientOid] client order id, defaults to uuid if not passed
@@ -1634,6 +1635,11 @@ class kucoinfutures extends kucoinfutures$1 {
1634
1635
  'type': type,
1635
1636
  'leverage': 1,
1636
1637
  };
1638
+ const marginModeUpper = this.safeStringUpper(params, 'marginMode');
1639
+ if (marginModeUpper !== undefined) {
1640
+ params = this.omit(params, 'marginMode');
1641
+ request['marginMode'] = marginModeUpper;
1642
+ }
1637
1643
  const cost = this.safeString(params, 'cost');
1638
1644
  params = this.omit(params, 'cost');
1639
1645
  if (cost !== undefined) {