ccxt 4.4.26 → 4.4.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +133 -132
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ace.js +1 -1
  5. package/dist/cjs/src/alpaca.js +194 -5
  6. package/dist/cjs/src/ascendex.js +1 -1
  7. package/dist/cjs/src/base/Exchange.js +18 -0
  8. package/dist/cjs/src/bequant.js +1 -1
  9. package/dist/cjs/src/bigone.js +1 -1
  10. package/dist/cjs/src/binance.js +1 -1
  11. package/dist/cjs/src/binancecoinm.js +1 -1
  12. package/dist/cjs/src/binanceus.js +1 -1
  13. package/dist/cjs/src/binanceusdm.js +1 -1
  14. package/dist/cjs/src/bingx.js +25 -36
  15. package/dist/cjs/src/bit2c.js +1 -1
  16. package/dist/cjs/src/bitbank.js +1 -1
  17. package/dist/cjs/src/bitbns.js +1 -1
  18. package/dist/cjs/src/bitfinex.js +1 -1
  19. package/dist/cjs/src/bitfinex2.js +1 -1
  20. package/dist/cjs/src/bitflyer.js +1 -1
  21. package/dist/cjs/src/bitget.js +1 -1
  22. package/dist/cjs/src/bithumb.js +1 -1
  23. package/dist/cjs/src/bitmart.js +1 -1
  24. package/dist/cjs/src/bitmex.js +1 -1
  25. package/dist/cjs/src/bitopro.js +1 -1
  26. package/dist/cjs/src/bitrue.js +1 -1
  27. package/dist/cjs/src/bitso.js +1 -1
  28. package/dist/cjs/src/bitstamp.js +1 -1
  29. package/dist/cjs/src/bitteam.js +1 -1
  30. package/dist/cjs/src/bitvavo.js +1 -1
  31. package/dist/cjs/src/bl3p.js +1 -1
  32. package/dist/cjs/src/blockchaincom.js +1 -1
  33. package/dist/cjs/src/blofin.js +1 -1
  34. package/dist/cjs/src/btcalpha.js +1 -1
  35. package/dist/cjs/src/btcbox.js +1 -1
  36. package/dist/cjs/src/btcmarkets.js +1 -1
  37. package/dist/cjs/src/btcturk.js +1 -1
  38. package/dist/cjs/src/bybit.js +5 -1
  39. package/dist/cjs/src/coinbase.js +97 -11
  40. package/dist/cjs/src/coinex.js +1 -1
  41. package/dist/cjs/src/gate.js +22 -16
  42. package/dist/cjs/src/hyperliquid.js +21 -1
  43. package/dist/cjs/src/lbank.js +100 -1
  44. package/dist/cjs/src/pro/binance.js +1 -1
  45. package/dist/cjs/src/pro/lbank.js +9 -4
  46. package/dist/cjs/src/wavesexchange.js +13 -2
  47. package/examples/js/cli.js +23 -3
  48. package/js/ccxt.d.ts +1 -1
  49. package/js/ccxt.js +1 -1
  50. package/js/src/abstract/alpaca.d.ts +2 -0
  51. package/js/src/ace.js +1 -1
  52. package/js/src/alpaca.d.ts +9 -1
  53. package/js/src/alpaca.js +194 -5
  54. package/js/src/ascendex.js +1 -1
  55. package/js/src/base/Exchange.d.ts +6 -0
  56. package/js/src/base/Exchange.js +18 -0
  57. package/js/src/bequant.js +1 -1
  58. package/js/src/bigone.js +1 -1
  59. package/js/src/binance.js +1 -1
  60. package/js/src/binancecoinm.js +1 -1
  61. package/js/src/binanceus.js +1 -1
  62. package/js/src/binanceusdm.js +1 -1
  63. package/js/src/bingx.js +25 -36
  64. package/js/src/bit2c.js +1 -1
  65. package/js/src/bitbank.js +1 -1
  66. package/js/src/bitbns.js +1 -1
  67. package/js/src/bitfinex.js +1 -1
  68. package/js/src/bitfinex2.js +1 -1
  69. package/js/src/bitflyer.js +1 -1
  70. package/js/src/bitget.js +1 -1
  71. package/js/src/bithumb.js +1 -1
  72. package/js/src/bitmart.js +1 -1
  73. package/js/src/bitmex.js +1 -1
  74. package/js/src/bitopro.js +1 -1
  75. package/js/src/bitrue.js +1 -1
  76. package/js/src/bitso.js +1 -1
  77. package/js/src/bitstamp.js +1 -1
  78. package/js/src/bitteam.js +1 -1
  79. package/js/src/bitvavo.js +1 -1
  80. package/js/src/bl3p.js +1 -1
  81. package/js/src/blockchaincom.js +1 -1
  82. package/js/src/blofin.js +1 -1
  83. package/js/src/btcalpha.js +1 -1
  84. package/js/src/btcbox.js +1 -1
  85. package/js/src/btcmarkets.js +1 -1
  86. package/js/src/btcturk.js +1 -1
  87. package/js/src/bybit.js +5 -1
  88. package/js/src/coinbase.d.ts +1 -0
  89. package/js/src/coinbase.js +97 -11
  90. package/js/src/coinex.js +1 -1
  91. package/js/src/gate.js +22 -16
  92. package/js/src/hyperliquid.d.ts +1 -0
  93. package/js/src/hyperliquid.js +21 -1
  94. package/js/src/lbank.d.ts +4 -1
  95. package/js/src/lbank.js +100 -1
  96. package/js/src/pro/binance.js +1 -1
  97. package/js/src/pro/lbank.js +9 -4
  98. package/js/src/wavesexchange.js +13 -2
  99. package/package.json +1 -1
@@ -94,7 +94,7 @@ class bitstamp extends bitstamp$1 {
94
94
  'withdraw': true,
95
95
  },
96
96
  'urls': {
97
- 'logo': 'https://user-images.githubusercontent.com/1294454/27786377-8c8ab57e-5fe9-11e7-8ea4-2b05b6bcceec.jpg',
97
+ 'logo': 'https://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024',
98
98
  'api': {
99
99
  'public': 'https://www.bitstamp.net/api',
100
100
  'private': 'https://www.bitstamp.net/api',
@@ -128,7 +128,7 @@ class bitteam extends bitteam$1 {
128
128
  '1d': '1D',
129
129
  },
130
130
  'urls': {
131
- 'logo': 'https://github.com/ccxt/ccxt/assets/43336371/cf71fe3d-b8b4-40f2-a906-907661b28793',
131
+ 'logo': 'https://github.com/user-attachments/assets/b41b5e0d-98e5-4bd3-8a6e-aeb230a4a135',
132
132
  'api': {
133
133
  'history': 'https://history.bit.team',
134
134
  'public': 'https://bit.team',
@@ -109,7 +109,7 @@ class bitvavo extends bitvavo$1 {
109
109
  '1d': '1d',
110
110
  },
111
111
  'urls': {
112
- 'logo': 'https://user-images.githubusercontent.com/1294454/169202626-bd130fc5-fcf9-41bb-8d97-6093225c73cd.jpg',
112
+ 'logo': 'https://github.com/user-attachments/assets/d213155c-8c71-4701-9bd5-45351febc2a8',
113
113
  'api': {
114
114
  'public': 'https://api.bitvavo.com',
115
115
  'private': 'https://api.bitvavo.com',
@@ -80,7 +80,7 @@ class bl3p extends bl3p$1 {
80
80
  'ws': false,
81
81
  },
82
82
  'urls': {
83
- 'logo': 'https://user-images.githubusercontent.com/1294454/28501752-60c21b82-6feb-11e7-818b-055ee6d0e754.jpg',
83
+ 'logo': 'https://github.com/user-attachments/assets/75aeb14e-cd48-43c8-8492-dff002dea0be',
84
84
  'api': {
85
85
  'rest': 'https://api.bl3p.eu',
86
86
  },
@@ -76,7 +76,7 @@ class blockchaincom extends blockchaincom$1 {
76
76
  },
77
77
  'timeframes': undefined,
78
78
  'urls': {
79
- 'logo': 'https://user-images.githubusercontent.com/1294454/147515585-1296e91b-7398-45e5-9d32-f6121538533f.jpeg',
79
+ 'logo': 'https://github.com/user-attachments/assets/975e3054-3399-4363-bcee-ec3c6d63d4e8',
80
80
  'test': {
81
81
  'public': 'https://testnet-api.delta.exchange',
82
82
  'private': 'https://testnet-api.delta.exchange',
@@ -153,7 +153,7 @@ class blofin extends blofin$1 {
153
153
  },
154
154
  'hostname': 'www.blofin.com',
155
155
  'urls': {
156
- 'logo': 'https://github.com/ccxt/ccxt/assets/43336371/255a7b29-341f-4d20-8342-fbfae4932807',
156
+ 'logo': 'https://github.com/user-attachments/assets/518cdf80-f05d-4821-a3e3-d48ceb41d73b',
157
157
  'api': {
158
158
  'rest': 'https://openapi.blofin.com',
159
159
  },
@@ -99,7 +99,7 @@ class btcalpha extends btcalpha$1 {
99
99
  '1d': 'D',
100
100
  },
101
101
  'urls': {
102
- 'logo': 'https://user-images.githubusercontent.com/1294454/42625213-dabaa5da-85cf-11e8-8f99-aa8f8f7699f0.jpg',
102
+ 'logo': 'https://github.com/user-attachments/assets/dce49f3a-61e5-4ba0-a2fe-41d192fd0e5d',
103
103
  'api': {
104
104
  'rest': 'https://btc-alpha.com/api',
105
105
  },
@@ -79,7 +79,7 @@ class btcbox extends btcbox$1 {
79
79
  'ws': false,
80
80
  },
81
81
  'urls': {
82
- 'logo': 'https://user-images.githubusercontent.com/51840849/87327317-98c55400-c53c-11ea-9a11-81f7d951cc74.jpg',
82
+ 'logo': 'https://github.com/user-attachments/assets/1e2cb499-8d0f-4f8f-9464-3c015cfbc76b',
83
83
  'api': {
84
84
  'rest': 'https://www.btcbox.co.jp/api',
85
85
  },
@@ -84,7 +84,7 @@ class btcmarkets extends btcmarkets$1 {
84
84
  'withdraw': true,
85
85
  },
86
86
  'urls': {
87
- 'logo': 'https://user-images.githubusercontent.com/51840849/89731817-b3fb8480-da52-11ea-817f-783b08aaf32b.jpg',
87
+ 'logo': 'https://github.com/user-attachments/assets/8c8d6907-3873-4cc4-ad20-e22fba28247e',
88
88
  'api': {
89
89
  'public': 'https://api.btcmarkets.net',
90
90
  'private': 'https://api.btcmarkets.net',
@@ -87,7 +87,7 @@ class btcturk extends btcturk$1 {
87
87
  '1y': '1 y',
88
88
  },
89
89
  'urls': {
90
- 'logo': 'https://user-images.githubusercontent.com/51840849/87153926-efbef500-c2c0-11ea-9842-05b63612c4b9.jpg',
90
+ 'logo': 'https://github.com/user-attachments/assets/10e0a238-9f60-4b06-9dda-edfc7602f1d6',
91
91
  'api': {
92
92
  'public': 'https://api.btcturk.com/api/v2',
93
93
  'private': 'https://api.btcturk.com/api/v1',
@@ -157,7 +157,7 @@ class bybit extends bybit$1 {
157
157
  'public': 'https://api-testnet.{hostname}',
158
158
  'private': 'https://api-testnet.{hostname}',
159
159
  },
160
- 'logo': 'https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg',
160
+ 'logo': 'https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed',
161
161
  'api': {
162
162
  'spot': 'https://api.{hostname}',
163
163
  'futures': 'https://api.{hostname}',
@@ -2583,6 +2583,10 @@ class bybit extends bybit$1 {
2583
2583
  //
2584
2584
  const data = this.safeDict(response, 'result', {});
2585
2585
  const tickerList = this.safeList(data, 'list', []);
2586
+ const timestamp = this.safeInteger(response, 'time');
2587
+ for (let i = 0; i < tickerList.length; i++) {
2588
+ tickerList[i]['timestamp'] = timestamp; // will be removed inside the parser
2589
+ }
2586
2590
  const result = this.parseFundingRates(tickerList);
2587
2591
  return this.filterByArray(result, 'symbol', symbols);
2588
2592
  }
@@ -79,6 +79,7 @@ class coinbase extends coinbase$1 {
79
79
  'fetchDepositAddresses': false,
80
80
  'fetchDepositAddressesByNetwork': true,
81
81
  'fetchDeposits': true,
82
+ 'fetchDepositsWithdrawals': true,
82
83
  'fetchFundingHistory': false,
83
84
  'fetchFundingRate': false,
84
85
  'fetchFundingRateHistory': false,
@@ -773,8 +774,15 @@ class coinbase extends coinbase$1 {
773
774
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
774
775
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
775
776
  * @param {object} [params] extra parameters specific to the exchange API endpoint
777
+ * @param {string} [params.currencyType] "fiat" or "crypto"
776
778
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
777
779
  */
780
+ let currencyType = undefined;
781
+ [currencyType, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'currencyType');
782
+ if (currencyType === 'crypto') {
783
+ const results = await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params);
784
+ return this.filterByArray(results, 'type', 'withdrawal', false);
785
+ }
778
786
  return await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdWithdrawals', code, since, limit, params);
779
787
  }
780
788
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
@@ -787,10 +795,33 @@ class coinbase extends coinbase$1 {
787
795
  * @param {int} [since] the earliest time in ms to fetch deposits for
788
796
  * @param {int} [limit] the maximum number of deposits structures to retrieve
789
797
  * @param {object} [params] extra parameters specific to the exchange API endpoint
798
+ * @param {string} [params.currencyType] "fiat" or "crypto"
790
799
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
791
800
  */
801
+ let currencyType = undefined;
802
+ [currencyType, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'currencyType');
803
+ if (currencyType === 'crypto') {
804
+ const results = await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params);
805
+ return this.filterByArray(results, 'type', 'deposit', false);
806
+ }
792
807
  return await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdDeposits', code, since, limit, params);
793
808
  }
809
+ async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
810
+ /**
811
+ * @method
812
+ * @name coinbase#fetchDepositsWithdrawals
813
+ * @description fetch history of deposits and withdrawals
814
+ * @see https://docs.cdp.coinbase.com/coinbase-app/docs/api-transactions
815
+ * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
816
+ * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
817
+ * @param {int} [limit] max number of deposit/withdrawals to return, default = 50, Min: 1, Max: 100
818
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
819
+ * @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
820
+ */
821
+ await this.loadMarkets();
822
+ const results = await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params);
823
+ return this.filterByArray(results, 'type', ['deposit', 'withdrawal'], false);
824
+ }
794
825
  parseTransactionStatus(status) {
795
826
  const statuses = {
796
827
  'created': 'pending',
@@ -914,18 +945,62 @@ class coinbase extends coinbase$1 {
914
945
  // "hide_native_amount": false
915
946
  // }
916
947
  //
948
+ //
949
+ // crypto deposit & withdrawal (using `/transactions` endpoint)
950
+ // {
951
+ // "amount": {
952
+ // "amount": "0.00014200", (negative for withdrawal)
953
+ // "currency": "BTC"
954
+ // },
955
+ // "created_at": "2024-03-29T15:48:30Z",
956
+ // "id": "0031a605-241d-514d-a97b-d4b99f3225d3",
957
+ // "idem": "092a979b-017e-4403-940a-2ca57811f442", // field present only in case of withdrawal
958
+ // "native_amount": {
959
+ // "amount": "9.85", (negative for withdrawal)
960
+ // "currency": "USD"
961
+ // },
962
+ // "network": {
963
+ // "status": "pending", // if status is `off_blockchain` then no more other fields are present in this object
964
+ // "hash": "5jYuvrNsvX2DZoMnzGYzVpYxJLfYu4GSK3xetG1H5LHrSovsuFCFYdFMwNRoiht3s6fBk92MM8QLLnz65xuEFTrE",
965
+ // "network_name": "solana",
966
+ // "transaction_fee": {
967
+ // "amount": "0.000100000",
968
+ // "currency": "SOL"
969
+ // }
970
+ // },
971
+ // "resource": "transaction",
972
+ // "resource_path": "/v2/accounts/dc504b1c-248e-5b68-a3b0-b991f7fa84e6/transactions/0031a605-241d-514d-a97b-d4b99f3225d3",
973
+ // "status": "completed",
974
+ // "type": "send",
975
+ // "from": { // in some cases, field might be present for deposit
976
+ // "id": "7fd10cd7-b091-5cee-ba41-c29e49a7cccf",
977
+ // "name": "Coinbase",
978
+ // "resource": "user"
979
+ // },
980
+ // "to": { // field only present for withdrawal
981
+ // "address": "5HA12BNthAvBwNYARYf9y5MqqCpB4qhCNFCs1Qw48ACE",
982
+ // "resource": "address"
983
+ // },
984
+ // "description": "C3 - One Time BTC Credit . Reference Case # 123.", // in some cases, field might be present for deposit
985
+ // }
986
+ //
917
987
  const transactionType = this.safeString(transaction, 'type');
918
988
  let amountAndCurrencyObject = undefined;
919
989
  let feeObject = undefined;
990
+ const network = this.safeDict(transaction, 'network', {});
920
991
  if (transactionType === 'send') {
921
- const network = this.safeDict(transaction, 'network', {});
922
- amountAndCurrencyObject = this.safeDict(network, 'transaction_amount', {});
992
+ amountAndCurrencyObject = this.safeDict(network, 'transaction_amount');
923
993
  feeObject = this.safeDict(network, 'transaction_fee', {});
924
994
  }
925
995
  else {
926
- amountAndCurrencyObject = this.safeDict(transaction, 'subtotal', {});
996
+ amountAndCurrencyObject = this.safeDict(transaction, 'subtotal');
927
997
  feeObject = this.safeDict(transaction, 'fee', {});
928
998
  }
999
+ if (amountAndCurrencyObject === undefined) {
1000
+ amountAndCurrencyObject = this.safeDict(transaction, 'amount');
1001
+ }
1002
+ const amountString = this.safeString(amountAndCurrencyObject, 'amount');
1003
+ const amountStringAbs = Precise["default"].stringAbs(amountString);
929
1004
  let status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
930
1005
  if (status === undefined) {
931
1006
  const committed = this.safeBool(transaction, 'committed');
@@ -935,23 +1010,34 @@ class coinbase extends coinbase$1 {
935
1010
  const currencyId = this.safeString(amountAndCurrencyObject, 'currency');
936
1011
  const feeCurrencyId = this.safeString(feeObject, 'currency');
937
1012
  const datetime = this.safeString(transaction, 'created_at');
938
- const toObject = this.safeDict(transaction, 'to', {});
939
- const toAddress = this.safeString(toObject, 'address');
1013
+ const resource = this.safeString(transaction, 'resource');
1014
+ let type = resource;
1015
+ if (!this.inArray(type, ['deposit', 'withdrawal'])) {
1016
+ if (Precise["default"].stringGt(amountString, '0')) {
1017
+ type = 'deposit';
1018
+ }
1019
+ else if (Precise["default"].stringLt(amountString, '0')) {
1020
+ type = 'withdrawal';
1021
+ }
1022
+ }
1023
+ const toObject = this.safeDict(transaction, 'to');
1024
+ const addressTo = this.safeString(toObject, 'address');
1025
+ const networkId = this.safeString(network, 'network_name');
940
1026
  return {
941
1027
  'info': transaction,
942
1028
  'id': id,
943
- 'txid': id,
1029
+ 'txid': this.safeString(network, 'hash', id),
944
1030
  'timestamp': this.parse8601(datetime),
945
1031
  'datetime': datetime,
946
- 'network': undefined,
947
- 'address': toAddress,
948
- 'addressTo': toAddress,
1032
+ 'network': this.networkIdToCode(networkId),
1033
+ 'address': addressTo,
1034
+ 'addressTo': addressTo,
949
1035
  'addressFrom': undefined,
950
1036
  'tag': undefined,
951
1037
  'tagTo': undefined,
952
1038
  'tagFrom': undefined,
953
- 'type': this.safeString(transaction, 'resource'),
954
- 'amount': this.safeNumber(amountAndCurrencyObject, 'amount'),
1039
+ 'type': type,
1040
+ 'amount': this.parseNumber(amountStringAbs),
955
1041
  'currency': this.safeCurrencyCode(currencyId, currency),
956
1042
  'status': status,
957
1043
  'updated': this.parse8601(this.safeString(transaction, 'updated_at')),
@@ -4958,7 +4958,7 @@ class coinex extends coinex$1 {
4958
4958
  await this.loadMarkets();
4959
4959
  const currency = this.currency(code);
4960
4960
  const amountToPrecision = this.currencyToPrecision(code, amount);
4961
- const accountsByType = this.safeDict(this.options, 'accountsById', {});
4961
+ const accountsByType = this.safeDict(this.options, 'accountsByType', {});
4962
4962
  const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
4963
4963
  const toId = this.safeString(accountsByType, toAccount, toAccount);
4964
4964
  const request = {
@@ -906,22 +906,28 @@ class gate extends gate$1 {
906
906
  */
907
907
  const unifiedAccount = this.safeBool(this.options, 'unifiedAccount');
908
908
  if (unifiedAccount === undefined) {
909
- const response = await this.privateAccountGetDetail(params);
910
- //
911
- // {
912
- // "user_id": 10406147,
913
- // "ip_whitelist": [],
914
- // "currency_pairs": [],
915
- // "key": {
916
- // "mode": 1
917
- // },
918
- // "tier": 0,
919
- // "tier_expire_time": "0001-01-01T00:00:00Z",
920
- // "copy_trading_role": 0
921
- // }
922
- //
923
- const result = this.safeDict(response, 'key', {});
924
- this.options['unifiedAccount'] = this.safeInteger(result, 'mode') === 2;
909
+ try {
910
+ //
911
+ // {
912
+ // "user_id": 10406147,
913
+ // "ip_whitelist": [],
914
+ // "currency_pairs": [],
915
+ // "key": {
916
+ // "mode": 1
917
+ // },
918
+ // "tier": 0,
919
+ // "tier_expire_time": "0001-01-01T00:00:00Z",
920
+ // "copy_trading_role": 0
921
+ // }
922
+ //
923
+ const response = await this.privateAccountGetDetail(params);
924
+ const result = this.safeDict(response, 'key', {});
925
+ this.options['unifiedAccount'] = this.safeInteger(result, 'mode') === 2;
926
+ }
927
+ catch (e) {
928
+ // if the request fails, the unifiedAccount is disabled
929
+ this.options['unifiedAccount'] = false;
930
+ }
925
931
  }
926
932
  }
927
933
  async upgradeUnifiedTradeAccount(params = {}) {
@@ -150,7 +150,17 @@ class hyperliquid extends hyperliquid$1 {
150
150
  'api': {
151
151
  'public': {
152
152
  'post': {
153
- 'info': 1,
153
+ 'info': {
154
+ 'cost': 20,
155
+ 'byType': {
156
+ 'l2Book': 2,
157
+ 'allMids': 2,
158
+ 'clearinghouseState': 2,
159
+ 'orderStatus': 2,
160
+ 'spotClearinghouseState': 2,
161
+ 'exchangeStatus': 2,
162
+ },
163
+ },
154
164
  },
155
165
  },
156
166
  'private': {
@@ -3028,6 +3038,16 @@ class hyperliquid extends hyperliquid$1 {
3028
3038
  }
3029
3039
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
3030
3040
  }
3041
+ calculateRateLimiterCost(api, method, path, params, config = {}) {
3042
+ if (('byType' in config) && ('type' in params)) {
3043
+ const type = params['type'];
3044
+ const byType = config['byType'];
3045
+ if (type in byType) {
3046
+ return byType[type];
3047
+ }
3048
+ }
3049
+ return this.safeValue(config, 'cost', 1);
3050
+ }
3031
3051
  parseCreateOrderArgs(symbol, type, side, amount, price = undefined, params = {}) {
3032
3052
  const market = this.market(symbol);
3033
3053
  const vaultAddress = this.safeString(params, 'vaultAddress');
@@ -57,7 +57,7 @@ class lbank extends lbank$1 {
57
57
  'fetchFundingHistory': false,
58
58
  'fetchFundingRate': false,
59
59
  'fetchFundingRateHistory': false,
60
- 'fetchFundingRates': false,
60
+ 'fetchFundingRates': true,
61
61
  'fetchIndexOHLCV': false,
62
62
  'fetchIsolatedBorrowRate': false,
63
63
  'fetchIsolatedBorrowRates': false,
@@ -1171,6 +1171,105 @@ class lbank extends lbank$1 {
1171
1171
  }
1172
1172
  return undefined;
1173
1173
  }
1174
+ parseFundingRate(ticker, market = undefined) {
1175
+ // {
1176
+ // "symbol": "BTCUSDT",
1177
+ // "highestPrice": "69495.5",
1178
+ // "underlyingPrice": "68455.904",
1179
+ // "lowestPrice": "68182.1",
1180
+ // "openPrice": "68762.4",
1181
+ // "positionFeeRate": "0.0001",
1182
+ // "volume": "33534.2858",
1183
+ // "markedPrice": "68434.1",
1184
+ // "turnover": "1200636218.210558",
1185
+ // "positionFeeTime": "28800",
1186
+ // "lastPrice": "68427.3",
1187
+ // "nextFeeTime": "1730736000000",
1188
+ // "fundingRate": "0.0001",
1189
+ // }
1190
+ const marketId = this.safeString(ticker, 'symbol');
1191
+ const symbol = this.safeSymbol(marketId, market);
1192
+ const markPrice = this.safeNumber(ticker, 'markedPrice');
1193
+ const indexPrice = this.safeNumber(ticker, 'underlyingPrice');
1194
+ const fundingRate = this.safeNumber(ticker, 'fundingRate');
1195
+ const fundingTime = this.safeInteger(ticker, 'nextFeeTime');
1196
+ return {
1197
+ 'info': ticker,
1198
+ 'symbol': symbol,
1199
+ 'markPrice': markPrice,
1200
+ 'indexPrice': indexPrice,
1201
+ 'fundingRate': fundingRate,
1202
+ 'fundingTimestamp': fundingTime,
1203
+ 'fundingDatetime': this.iso8601(fundingTime),
1204
+ 'timestamp': undefined,
1205
+ 'datetime': undefined,
1206
+ 'nextFundingRate': undefined,
1207
+ 'nextFundingTimestamp': undefined,
1208
+ 'nextFundingDatetime': undefined,
1209
+ 'previousFundingRate': undefined,
1210
+ 'previousFundingTimestamp': undefined,
1211
+ 'previousFundingDatetime': undefined,
1212
+ 'interval': undefined,
1213
+ };
1214
+ }
1215
+ async fetchFundingRate(symbol, params = {}) {
1216
+ /**
1217
+ * @method
1218
+ * @name lbank#fetchFundingRate
1219
+ * @description fetch the current funding rate
1220
+ * @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
1221
+ * @param {string} symbol unified market symbol
1222
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1223
+ * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
1224
+ */
1225
+ await this.loadMarkets();
1226
+ const market = this.market(symbol);
1227
+ const responseForSwap = await this.fetchFundingRates([market['symbol']], params);
1228
+ return this.safeValue(responseForSwap, market['symbol']);
1229
+ }
1230
+ async fetchFundingRates(symbols = undefined, params = {}) {
1231
+ /**
1232
+ * @method
1233
+ * @name lbank#fetchFundingRates
1234
+ * @description fetch the funding rate for multiple markets
1235
+ * @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
1236
+ * @param {string[]|undefined} symbols list of unified market symbols
1237
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1238
+ * @returns {object} a dictionary of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
1239
+ */
1240
+ await this.loadMarkets();
1241
+ symbols = this.marketSymbols(symbols);
1242
+ const request = {
1243
+ 'productGroup': 'SwapU',
1244
+ };
1245
+ const response = await this.contractPublicGetCfdOpenApiV1PubMarketData(this.extend(request, params));
1246
+ // {
1247
+ // "data": [
1248
+ // {
1249
+ // "symbol": "BTCUSDT",
1250
+ // "highestPrice": "69495.5",
1251
+ // "underlyingPrice": "68455.904",
1252
+ // "lowestPrice": "68182.1",
1253
+ // "openPrice": "68762.4",
1254
+ // "positionFeeRate": "0.0001",
1255
+ // "volume": "33534.2858",
1256
+ // "markedPrice": "68434.1",
1257
+ // "turnover": "1200636218.210558",
1258
+ // "positionFeeTime": "28800",
1259
+ // "lastPrice": "68427.3",
1260
+ // "nextFeeTime": "1730736000000",
1261
+ // "fundingRate": "0.0001",
1262
+ // }
1263
+ // ],
1264
+ // "error_code": "0",
1265
+ // "msg": "Success",
1266
+ // "result": "true",
1267
+ // "success": True,
1268
+ // }
1269
+ const data = this.safeList(response, 'data', []);
1270
+ const result = this.parseFundingRates(data);
1271
+ return this.filterByArray(result, 'symbol', symbols);
1272
+ }
1174
1273
  async fetchBalance(params = {}) {
1175
1274
  /**
1176
1275
  * @method
@@ -1972,7 +1972,7 @@ class binance extends binance$1 {
1972
1972
  if (symbolsDefined) {
1973
1973
  firstMarket = this.market(symbols[0]);
1974
1974
  }
1975
- const defaultMarket = (isMarkPrice) ? 'swap' : 'spot';
1975
+ const defaultMarket = (isMarkPrice) ? 'swap' : undefined;
1976
1976
  [marketType, params] = this.handleMarketTypeAndParams(methodName, firstMarket, params, defaultMarket);
1977
1977
  let subType = undefined;
1978
1978
  [subType, params] = this.handleSubTypeAndParams(methodName, firstMarket, params);
@@ -808,10 +808,15 @@ class lbank extends lbank$1 {
808
808
  // { ping: 'a13a939c-5f25-4e06-9981-93cb3b890707', action: 'ping' }
809
809
  //
810
810
  const pingId = this.safeString(message, 'ping');
811
- await client.send({
812
- 'action': 'pong',
813
- 'pong': pingId,
814
- });
811
+ try {
812
+ await client.send({
813
+ 'action': 'pong',
814
+ 'pong': pingId,
815
+ });
816
+ }
817
+ catch (e) {
818
+ this.onError(client, e);
819
+ }
815
820
  }
816
821
  handleMessage(client, message) {
817
822
  const status = this.safeString(message, 'status');
@@ -124,7 +124,13 @@ class wavesexchange extends wavesexchange$1 {
124
124
  'forward': 'https://wx.network/api/v1/forward/matcher',
125
125
  'market': 'https://wx.network/api/v1/forward/marketdata/api/v1',
126
126
  },
127
- 'doc': 'https://docs.wx.network',
127
+ 'doc': [
128
+ 'https://docs.wx.network',
129
+ 'https://docs.waves.tech',
130
+ 'https://api.wavesplatform.com/v0/docs/',
131
+ 'https://nodes.wavesnodes.com/api-docs/index.html',
132
+ 'https://matcher.waves.exchange/api-docs/index.html',
133
+ ],
128
134
  'www': 'https://wx.network',
129
135
  },
130
136
  'api': {
@@ -598,6 +604,7 @@ class wavesexchange extends wavesexchange$1 {
598
604
  * @method
599
605
  * @name wavesexchange#fetchOrderBook
600
606
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
607
+ * @see https://matcher.waves.exchange/api-docs/index.html#/markets/getOrderBook
601
608
  * @param {string} symbol unified symbol of the market to fetch the order book for
602
609
  * @param {int} [limit] the maximum amount of order book entries to return
603
610
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -745,6 +752,7 @@ class wavesexchange extends wavesexchange$1 {
745
752
  * @method
746
753
  * @name wavesexchange#signIn
747
754
  * @description sign in, must be called prior to using other authenticated methods
755
+ * @see https://docs.wx.network/en/api/auth/oauth2-token
748
756
  * @param {object} [params] extra parameters specific to the exchange API endpoint
749
757
  * @returns response from exchange
750
758
  */
@@ -858,6 +866,7 @@ class wavesexchange extends wavesexchange$1 {
858
866
  * @method
859
867
  * @name wavesexchange#fetchTicker
860
868
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
869
+ * @see https://api.wavesplatform.com/v0/docs/#/pairs/getPairsListAll
861
870
  * @param {string} symbol unified symbol of the market to fetch the ticker for
862
871
  * @param {object} [params] extra parameters specific to the exchange API endpoint
863
872
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -901,7 +910,7 @@ class wavesexchange extends wavesexchange$1 {
901
910
  * @method
902
911
  * @name wavesexchange#fetchTickers
903
912
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
904
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
913
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
905
914
  * @param {object} [params] extra parameters specific to the exchange API endpoint
906
915
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
907
916
  */
@@ -942,6 +951,7 @@ class wavesexchange extends wavesexchange$1 {
942
951
  * @method
943
952
  * @name wavesexchange#fetchOHLCV
944
953
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
954
+ * @see https://api.wavesplatform.com/v0/docs/#/candles/getCandles
945
955
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
946
956
  * @param {string} timeframe the length of time each candle represents
947
957
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1276,6 +1286,7 @@ class wavesexchange extends wavesexchange$1 {
1276
1286
  * @method
1277
1287
  * @name wavesexchange#createOrder
1278
1288
  * @description create a trade order
1289
+ * @see https://matcher.waves.exchange/api-docs/index.html#/serialize/serializeOrder
1279
1290
  * @param {string} symbol unified symbol of the market to create an order in
1280
1291
  * @param {string} type 'market' or 'limit'
1281
1292
  * @param {string} side 'buy' or 'sell'