ccxt 4.3.95 → 4.3.97
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.
- package/README.md +4 -4
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -7
- package/dist/cjs/src/base/Exchange.js +0 -4
- package/dist/cjs/src/binance.js +3 -0
- package/dist/cjs/src/bingx.js +2 -1
- package/dist/cjs/src/blofin.js +0 -1
- package/dist/cjs/src/bybit.js +8 -2
- package/dist/cjs/src/coinex.js +16 -3
- package/dist/cjs/src/hyperliquid.js +262 -32
- package/dist/cjs/src/kucoin.js +12 -12
- package/dist/cjs/src/mexc.js +6 -0
- package/dist/cjs/src/okx.js +0 -1
- package/dist/cjs/src/p2b.js +0 -1
- package/dist/cjs/src/pro/binance.js +100 -2
- package/dist/cjs/src/pro/bybit.js +65 -4
- package/dist/cjs/src/pro/cryptocom.js +224 -0
- package/dist/cjs/src/pro/gate.js +179 -0
- package/dist/cjs/src/pro/kucoin.js +132 -0
- package/dist/cjs/src/pro/okx.js +264 -35
- package/dist/cjs/src/tradeogre.js +0 -1
- package/js/ccxt.d.ts +2 -8
- package/js/ccxt.js +2 -6
- package/js/src/base/Exchange.d.ts +0 -2
- package/js/src/base/Exchange.js +0 -4
- package/js/src/binance.js +3 -0
- package/js/src/bingx.js +2 -1
- package/js/src/blofin.js +0 -1
- package/js/src/bybit.js +8 -2
- package/js/src/coinex.js +16 -3
- package/js/src/hyperliquid.d.ts +22 -0
- package/js/src/hyperliquid.js +262 -32
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +12 -12
- package/js/src/mexc.js +6 -0
- package/js/src/okx.js +0 -1
- package/js/src/p2b.js +0 -1
- package/js/src/pro/binance.d.ts +2 -0
- package/js/src/pro/binance.js +100 -2
- package/js/src/pro/bybit.d.ts +3 -1
- package/js/src/pro/bybit.js +65 -4
- package/js/src/pro/cryptocom.d.ts +10 -1
- package/js/src/pro/cryptocom.js +225 -1
- package/js/src/pro/gate.d.ts +7 -1
- package/js/src/pro/gate.js +180 -1
- package/js/src/pro/kucoin.d.ts +5 -1
- package/js/src/pro/kucoin.js +133 -1
- package/js/src/pro/okx.d.ts +10 -1
- package/js/src/pro/okx.js +264 -35
- package/js/src/tradeogre.js +0 -1
- package/package.json +1 -1
- package/js/src/abstract/bitbay.d.ts +0 -56
- package/js/src/abstract/bitbay.js +0 -11
- package/js/src/abstract/hitbtc3.d.ts +0 -118
- package/js/src/abstract/hitbtc3.js +0 -11
package/dist/cjs/ccxt.js
CHANGED
|
@@ -24,7 +24,6 @@ var binanceusdm = require('./src/binanceusdm.js');
|
|
|
24
24
|
var bingx = require('./src/bingx.js');
|
|
25
25
|
var bit2c = require('./src/bit2c.js');
|
|
26
26
|
var bitbank = require('./src/bitbank.js');
|
|
27
|
-
var bitbay = require('./src/bitbay.js');
|
|
28
27
|
var bitbns = require('./src/bitbns.js');
|
|
29
28
|
var bitcoincom = require('./src/bitcoincom.js');
|
|
30
29
|
var bitfinex = require('./src/bitfinex.js');
|
|
@@ -74,7 +73,6 @@ var gateio = require('./src/gateio.js');
|
|
|
74
73
|
var gemini = require('./src/gemini.js');
|
|
75
74
|
var hashkey = require('./src/hashkey.js');
|
|
76
75
|
var hitbtc = require('./src/hitbtc.js');
|
|
77
|
-
var hitbtc3 = require('./src/hitbtc3.js');
|
|
78
76
|
var hollaex = require('./src/hollaex.js');
|
|
79
77
|
var htx = require('./src/htx.js');
|
|
80
78
|
var huobi = require('./src/huobi.js');
|
|
@@ -196,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
196
194
|
|
|
197
195
|
//-----------------------------------------------------------------------------
|
|
198
196
|
// this is updated by vss.js when building
|
|
199
|
-
const version = '4.3.
|
|
197
|
+
const version = '4.3.97';
|
|
200
198
|
Exchange["default"].ccxtVersion = version;
|
|
201
199
|
const exchanges = {
|
|
202
200
|
'ace': ace,
|
|
@@ -211,7 +209,6 @@ const exchanges = {
|
|
|
211
209
|
'bingx': bingx,
|
|
212
210
|
'bit2c': bit2c,
|
|
213
211
|
'bitbank': bitbank,
|
|
214
|
-
'bitbay': bitbay,
|
|
215
212
|
'bitbns': bitbns,
|
|
216
213
|
'bitcoincom': bitcoincom,
|
|
217
214
|
'bitfinex': bitfinex,
|
|
@@ -261,7 +258,6 @@ const exchanges = {
|
|
|
261
258
|
'gemini': gemini,
|
|
262
259
|
'hashkey': hashkey,
|
|
263
260
|
'hitbtc': hitbtc,
|
|
264
|
-
'hitbtc3': hitbtc3,
|
|
265
261
|
'hollaex': hollaex,
|
|
266
262
|
'htx': htx,
|
|
267
263
|
'huobi': huobi,
|
|
@@ -445,7 +441,6 @@ exports.binanceusdm = binanceusdm;
|
|
|
445
441
|
exports.bingx = bingx;
|
|
446
442
|
exports.bit2c = bit2c;
|
|
447
443
|
exports.bitbank = bitbank;
|
|
448
|
-
exports.bitbay = bitbay;
|
|
449
444
|
exports.bitbns = bitbns;
|
|
450
445
|
exports.bitcoincom = bitcoincom;
|
|
451
446
|
exports.bitfinex = bitfinex;
|
|
@@ -495,7 +490,6 @@ exports.gateio = gateio;
|
|
|
495
490
|
exports.gemini = gemini;
|
|
496
491
|
exports.hashkey = hashkey;
|
|
497
492
|
exports.hitbtc = hitbtc;
|
|
498
|
-
exports.hitbtc3 = hitbtc3;
|
|
499
493
|
exports.hollaex = hollaex;
|
|
500
494
|
exports.htx = htx;
|
|
501
495
|
exports.huobi = huobi;
|
|
@@ -1437,7 +1437,6 @@ class Exchange {
|
|
|
1437
1437
|
'fetchOrdersWs': undefined,
|
|
1438
1438
|
'fetchOrderTrades': undefined,
|
|
1439
1439
|
'fetchOrderWs': undefined,
|
|
1440
|
-
'fetchPermissions': undefined,
|
|
1441
1440
|
'fetchPosition': undefined,
|
|
1442
1441
|
'fetchPositionHistory': undefined,
|
|
1443
1442
|
'fetchPositionsHistory': undefined,
|
|
@@ -4000,9 +3999,6 @@ class Exchange {
|
|
|
4000
3999
|
await this.cancelOrderWs(id, symbol);
|
|
4001
4000
|
return await this.createOrderWs(symbol, type, side, amount, price, params);
|
|
4002
4001
|
}
|
|
4003
|
-
async fetchPermissions(params = {}) {
|
|
4004
|
-
throw new errors.NotSupported(this.id + ' fetchPermissions() is not supported yet');
|
|
4005
|
-
}
|
|
4006
4002
|
async fetchPosition(symbol, params = {}) {
|
|
4007
4003
|
throw new errors.NotSupported(this.id + ' fetchPosition() is not supported yet');
|
|
4008
4004
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -4249,6 +4249,9 @@ class binance extends binance$1 {
|
|
|
4249
4249
|
const price = this.safeString(params, 'price');
|
|
4250
4250
|
const until = this.safeInteger(params, 'until');
|
|
4251
4251
|
params = this.omit(params, ['price', 'until']);
|
|
4252
|
+
if (since !== undefined && until !== undefined && limit === undefined) {
|
|
4253
|
+
limit = maxLimit;
|
|
4254
|
+
}
|
|
4252
4255
|
limit = (limit === undefined) ? defaultLimit : Math.min(limit, maxLimit);
|
|
4253
4256
|
const request = {
|
|
4254
4257
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
package/dist/cjs/src/bingx.js
CHANGED
package/dist/cjs/src/blofin.js
CHANGED
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -5928,11 +5928,17 @@ class bybit extends bybit$1 {
|
|
|
5928
5928
|
* @param {string} code unified currency code, default is undefined
|
|
5929
5929
|
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
|
|
5930
5930
|
* @param {int} [limit] max number of ledger entrys to return, default is undefined
|
|
5931
|
-
* @param {
|
|
5931
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
5932
5932
|
* @param {string} [params.subType] if inverse will use v5/account/contract-transaction-log
|
|
5933
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5933
5934
|
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
5934
5935
|
*/
|
|
5935
5936
|
await this.loadMarkets();
|
|
5937
|
+
let paginate = false;
|
|
5938
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
5939
|
+
if (paginate) {
|
|
5940
|
+
return await this.fetchPaginatedCallCursor('fetchLedger', code, since, limit, params, 'nextPageCursor', 'cursor', undefined, 50);
|
|
5941
|
+
}
|
|
5936
5942
|
const request = {
|
|
5937
5943
|
// 'coin': currency['id'],
|
|
5938
5944
|
// 'currency': currency['id'], // alias
|
|
@@ -5985,7 +5991,7 @@ class bybit extends bybit$1 {
|
|
|
5985
5991
|
}
|
|
5986
5992
|
}
|
|
5987
5993
|
else {
|
|
5988
|
-
response = await this.
|
|
5994
|
+
response = await this.privateGetV5AccountContractTransactionLog(this.extend(request, params));
|
|
5989
5995
|
}
|
|
5990
5996
|
//
|
|
5991
5997
|
// {
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -1210,7 +1210,10 @@ class coinex extends coinex$1 {
|
|
|
1210
1210
|
// "side": "buy",
|
|
1211
1211
|
// "order_id": 136915589622,
|
|
1212
1212
|
// "price": "64376",
|
|
1213
|
-
// "amount": "0.0001"
|
|
1213
|
+
// "amount": "0.0001",
|
|
1214
|
+
// "role": "taker",
|
|
1215
|
+
// "fee": "0.0299",
|
|
1216
|
+
// "fee_ccy": "USDT"
|
|
1214
1217
|
// }
|
|
1215
1218
|
//
|
|
1216
1219
|
const timestamp = this.safeInteger(trade, 'created_at');
|
|
@@ -1220,6 +1223,16 @@ class coinex extends coinex$1 {
|
|
|
1220
1223
|
}
|
|
1221
1224
|
const marketId = this.safeString(trade, 'market');
|
|
1222
1225
|
market = this.safeMarket(marketId, market, undefined, defaultType);
|
|
1226
|
+
const feeCostString = this.safeString(trade, 'fee');
|
|
1227
|
+
let fee = undefined;
|
|
1228
|
+
if (feeCostString !== undefined) {
|
|
1229
|
+
const feeCurrencyId = this.safeString(trade, 'fee_ccy');
|
|
1230
|
+
const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
|
|
1231
|
+
fee = {
|
|
1232
|
+
'cost': feeCostString,
|
|
1233
|
+
'currency': feeCurrencyCode,
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1223
1236
|
return this.safeTrade({
|
|
1224
1237
|
'info': trade,
|
|
1225
1238
|
'timestamp': timestamp,
|
|
@@ -1229,11 +1242,11 @@ class coinex extends coinex$1 {
|
|
|
1229
1242
|
'order': this.safeString(trade, 'order_id'),
|
|
1230
1243
|
'type': undefined,
|
|
1231
1244
|
'side': this.safeString(trade, 'side'),
|
|
1232
|
-
'takerOrMaker':
|
|
1245
|
+
'takerOrMaker': this.safeString(trade, 'role'),
|
|
1233
1246
|
'price': this.safeString(trade, 'price'),
|
|
1234
1247
|
'amount': this.safeString(trade, 'amount'),
|
|
1235
1248
|
'cost': this.safeString(trade, 'deal_money'),
|
|
1236
|
-
'fee':
|
|
1249
|
+
'fee': fee,
|
|
1237
1250
|
}, market);
|
|
1238
1251
|
}
|
|
1239
1252
|
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
@@ -54,15 +54,15 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
54
54
|
'fetchBorrowInterest': false,
|
|
55
55
|
'fetchBorrowRateHistories': false,
|
|
56
56
|
'fetchBorrowRateHistory': false,
|
|
57
|
+
'fetchCanceledAndClosedOrders': true,
|
|
57
58
|
'fetchCanceledOrders': true,
|
|
58
59
|
'fetchClosedOrders': true,
|
|
59
|
-
'fetchCanceledAndClosedOrders': true,
|
|
60
60
|
'fetchCrossBorrowRate': false,
|
|
61
61
|
'fetchCrossBorrowRates': false,
|
|
62
62
|
'fetchCurrencies': true,
|
|
63
63
|
'fetchDepositAddress': false,
|
|
64
64
|
'fetchDepositAddresses': false,
|
|
65
|
-
'fetchDeposits':
|
|
65
|
+
'fetchDeposits': true,
|
|
66
66
|
'fetchDepositWithdrawFee': 'emulated',
|
|
67
67
|
'fetchDepositWithdrawFees': false,
|
|
68
68
|
'fetchFundingHistory': false,
|
|
@@ -72,7 +72,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
72
72
|
'fetchIndexOHLCV': false,
|
|
73
73
|
'fetchIsolatedBorrowRate': false,
|
|
74
74
|
'fetchIsolatedBorrowRates': false,
|
|
75
|
-
'fetchLedger':
|
|
75
|
+
'fetchLedger': true,
|
|
76
76
|
'fetchLeverage': false,
|
|
77
77
|
'fetchLeverageTiers': false,
|
|
78
78
|
'fetchLiquidations': false,
|
|
@@ -104,7 +104,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
104
104
|
'fetchTransfer': false,
|
|
105
105
|
'fetchTransfers': false,
|
|
106
106
|
'fetchWithdrawal': false,
|
|
107
|
-
'fetchWithdrawals':
|
|
107
|
+
'fetchWithdrawals': true,
|
|
108
108
|
'reduceMargin': true,
|
|
109
109
|
'repayCrossMargin': false,
|
|
110
110
|
'repayIsolatedMargin': false,
|
|
@@ -1982,12 +1982,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
1982
1982
|
const coin = this.safeString(entry, 'coin');
|
|
1983
1983
|
let marketId = undefined;
|
|
1984
1984
|
if (coin !== undefined) {
|
|
1985
|
-
|
|
1986
|
-
marketId = coin;
|
|
1987
|
-
}
|
|
1988
|
-
else {
|
|
1989
|
-
marketId = coin + '/USDC:USDC';
|
|
1990
|
-
}
|
|
1985
|
+
marketId = this.coinToMarketId(coin);
|
|
1991
1986
|
}
|
|
1992
1987
|
if (this.safeString(entry, 'id') === undefined) {
|
|
1993
1988
|
market = this.safeMarket(marketId, undefined);
|
|
@@ -2124,7 +2119,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2124
2119
|
const price = this.safeString(trade, 'px');
|
|
2125
2120
|
const amount = this.safeString(trade, 'sz');
|
|
2126
2121
|
const coin = this.safeString(trade, 'coin');
|
|
2127
|
-
const marketId = coin
|
|
2122
|
+
const marketId = this.coinToMarketId(coin);
|
|
2128
2123
|
market = this.safeMarket(marketId, undefined);
|
|
2129
2124
|
const symbol = market['symbol'];
|
|
2130
2125
|
const id = this.safeString(trade, 'tid');
|
|
@@ -2264,7 +2259,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2264
2259
|
//
|
|
2265
2260
|
const entry = this.safeDict(position, 'position', {});
|
|
2266
2261
|
const coin = this.safeString(entry, 'coin');
|
|
2267
|
-
const marketId = coin
|
|
2262
|
+
const marketId = this.coinToMarketId(coin);
|
|
2268
2263
|
market = this.safeMarket(marketId, undefined);
|
|
2269
2264
|
const symbol = market['symbol'];
|
|
2270
2265
|
const leverage = this.safeDict(entry, 'leverage', {});
|
|
@@ -2577,11 +2572,13 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2577
2572
|
* @name hyperliquid#withdraw
|
|
2578
2573
|
* @description make a withdrawal (only support USDC)
|
|
2579
2574
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
|
2575
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
|
|
2580
2576
|
* @param {string} code unified currency code
|
|
2581
2577
|
* @param {float} amount the amount to withdraw
|
|
2582
2578
|
* @param {string} address the address to withdraw to
|
|
2583
2579
|
* @param {string} tag
|
|
2584
2580
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2581
|
+
* @param {string} [params.vaultAddress] vault address withdraw from
|
|
2585
2582
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2586
2583
|
*/
|
|
2587
2584
|
this.checkRequiredCredentials();
|
|
@@ -2593,24 +2590,40 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2593
2590
|
throw new errors.NotSupported(this.id + 'withdraw() only support USDC');
|
|
2594
2591
|
}
|
|
2595
2592
|
}
|
|
2596
|
-
const
|
|
2593
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
2594
|
+
params = this.omit(params, 'vaultAddress');
|
|
2597
2595
|
const nonce = this.milliseconds();
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2596
|
+
let action = {};
|
|
2597
|
+
let sig = undefined;
|
|
2598
|
+
if (vaultAddress !== undefined) {
|
|
2599
|
+
action = {
|
|
2600
|
+
'type': 'vaultTransfer',
|
|
2601
|
+
'vaultAddress': '0x' + vaultAddress,
|
|
2602
|
+
'isDeposit': false,
|
|
2603
|
+
'usd': amount,
|
|
2604
|
+
};
|
|
2605
|
+
sig = this.signL1Action(action, nonce);
|
|
2606
|
+
}
|
|
2607
|
+
else {
|
|
2608
|
+
const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
|
|
2609
|
+
const payload = {
|
|
2610
|
+
'hyperliquidChain': isSandboxMode ? 'Testnet' : 'Mainnet',
|
|
2611
|
+
'destination': address,
|
|
2612
|
+
'amount': amount.toString(),
|
|
2613
|
+
'time': nonce,
|
|
2614
|
+
};
|
|
2615
|
+
sig = this.buildWithdrawSig(payload);
|
|
2616
|
+
action = {
|
|
2607
2617
|
'hyperliquidChain': payload['hyperliquidChain'],
|
|
2608
2618
|
'signatureChainId': '0x66eee',
|
|
2609
2619
|
'destination': address,
|
|
2610
2620
|
'amount': amount.toString(),
|
|
2611
2621
|
'time': nonce,
|
|
2612
2622
|
'type': 'withdraw3',
|
|
2613
|
-
}
|
|
2623
|
+
};
|
|
2624
|
+
}
|
|
2625
|
+
const request = {
|
|
2626
|
+
'action': action,
|
|
2614
2627
|
'nonce': nonce,
|
|
2615
2628
|
'signature': sig,
|
|
2616
2629
|
};
|
|
@@ -2621,27 +2634,53 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2621
2634
|
//
|
|
2622
2635
|
// { status: 'ok', response: { type: 'default' } }
|
|
2623
2636
|
//
|
|
2637
|
+
// fetchDeposits / fetchWithdrawals
|
|
2638
|
+
// {
|
|
2639
|
+
// "time":1724762307531,
|
|
2640
|
+
// "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
|
2641
|
+
// "delta":{
|
|
2642
|
+
// "type":"accountClassTransfer",
|
|
2643
|
+
// "usdc":"50.0",
|
|
2644
|
+
// "toPerp":false
|
|
2645
|
+
// }
|
|
2646
|
+
// }
|
|
2647
|
+
//
|
|
2648
|
+
const timestamp = this.safeInteger(transaction, 'time');
|
|
2649
|
+
const delta = this.safeDict(transaction, 'delta', {});
|
|
2650
|
+
let fee = undefined;
|
|
2651
|
+
const feeCost = this.safeInteger(delta, 'fee');
|
|
2652
|
+
if (feeCost !== undefined) {
|
|
2653
|
+
fee = {
|
|
2654
|
+
'currency': 'USDC',
|
|
2655
|
+
'cost': feeCost,
|
|
2656
|
+
};
|
|
2657
|
+
}
|
|
2658
|
+
let internal = undefined;
|
|
2659
|
+
const type = this.safeString(delta, 'type');
|
|
2660
|
+
if (type !== undefined) {
|
|
2661
|
+
internal = (type === 'internalTransfer');
|
|
2662
|
+
}
|
|
2624
2663
|
return {
|
|
2625
2664
|
'info': transaction,
|
|
2626
2665
|
'id': undefined,
|
|
2627
|
-
'txid':
|
|
2628
|
-
'timestamp':
|
|
2629
|
-
'datetime':
|
|
2666
|
+
'txid': this.safeString(transaction, 'hash'),
|
|
2667
|
+
'timestamp': timestamp,
|
|
2668
|
+
'datetime': this.iso8601(timestamp),
|
|
2630
2669
|
'network': undefined,
|
|
2631
2670
|
'address': undefined,
|
|
2632
|
-
'addressTo':
|
|
2633
|
-
'addressFrom':
|
|
2671
|
+
'addressTo': this.safeString(delta, 'destination'),
|
|
2672
|
+
'addressFrom': this.safeString(delta, 'user'),
|
|
2634
2673
|
'tag': undefined,
|
|
2635
2674
|
'tagTo': undefined,
|
|
2636
2675
|
'tagFrom': undefined,
|
|
2637
2676
|
'type': undefined,
|
|
2638
|
-
'amount':
|
|
2677
|
+
'amount': this.safeInteger(delta, 'usdc'),
|
|
2639
2678
|
'currency': undefined,
|
|
2640
2679
|
'status': this.safeString(transaction, 'status'),
|
|
2641
2680
|
'updated': undefined,
|
|
2642
2681
|
'comment': undefined,
|
|
2643
|
-
'internal':
|
|
2644
|
-
'fee':
|
|
2682
|
+
'internal': internal,
|
|
2683
|
+
'fee': fee,
|
|
2645
2684
|
};
|
|
2646
2685
|
}
|
|
2647
2686
|
async fetchTradingFee(symbol, params = {}) {
|
|
@@ -2750,6 +2789,197 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2750
2789
|
'tierBased': undefined,
|
|
2751
2790
|
};
|
|
2752
2791
|
}
|
|
2792
|
+
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2793
|
+
/**
|
|
2794
|
+
* @method
|
|
2795
|
+
* @name hyperliquid#fetchLedger
|
|
2796
|
+
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
2797
|
+
* @param {string} code unified currency code
|
|
2798
|
+
* @param {int} [since] timestamp in ms of the earliest ledger entry
|
|
2799
|
+
* @param {int} [limit] max number of ledger entrys to return
|
|
2800
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2801
|
+
* @param {int} [params.until] timestamp in ms of the latest ledger entry
|
|
2802
|
+
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
|
|
2803
|
+
*/
|
|
2804
|
+
await this.loadMarkets();
|
|
2805
|
+
let userAddress = undefined;
|
|
2806
|
+
[userAddress, params] = this.handlePublicAddress('fetchLedger', params);
|
|
2807
|
+
const request = {
|
|
2808
|
+
'type': 'userNonFundingLedgerUpdates',
|
|
2809
|
+
'user': userAddress,
|
|
2810
|
+
};
|
|
2811
|
+
if (since !== undefined) {
|
|
2812
|
+
request['startTime'] = since;
|
|
2813
|
+
}
|
|
2814
|
+
const until = this.safeInteger(params, 'until');
|
|
2815
|
+
if (until !== undefined) {
|
|
2816
|
+
request['endTime'] = until;
|
|
2817
|
+
params = this.omit(params, ['until']);
|
|
2818
|
+
}
|
|
2819
|
+
const response = await this.publicPostInfo(this.extend(request, params));
|
|
2820
|
+
//
|
|
2821
|
+
// [
|
|
2822
|
+
// {
|
|
2823
|
+
// "time":1724762307531,
|
|
2824
|
+
// "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
|
2825
|
+
// "delta":{
|
|
2826
|
+
// "type":"accountClassTransfer",
|
|
2827
|
+
// "usdc":"50.0",
|
|
2828
|
+
// "toPerp":false
|
|
2829
|
+
// }
|
|
2830
|
+
// }
|
|
2831
|
+
// ]
|
|
2832
|
+
//
|
|
2833
|
+
return this.parseLedger(response, undefined, since, limit);
|
|
2834
|
+
}
|
|
2835
|
+
parseLedgerEntry(item, currency = undefined) {
|
|
2836
|
+
//
|
|
2837
|
+
// {
|
|
2838
|
+
// "time":1724762307531,
|
|
2839
|
+
// "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
|
2840
|
+
// "delta":{
|
|
2841
|
+
// "type":"accountClassTransfer",
|
|
2842
|
+
// "usdc":"50.0",
|
|
2843
|
+
// "toPerp":false
|
|
2844
|
+
// }
|
|
2845
|
+
// }
|
|
2846
|
+
//
|
|
2847
|
+
const timestamp = this.safeInteger(item, 'time');
|
|
2848
|
+
const delta = this.safeDict(item, 'delta', {});
|
|
2849
|
+
let fee = undefined;
|
|
2850
|
+
const feeCost = this.safeInteger(delta, 'fee');
|
|
2851
|
+
if (feeCost !== undefined) {
|
|
2852
|
+
fee = {
|
|
2853
|
+
'currency': 'USDC',
|
|
2854
|
+
'cost': feeCost,
|
|
2855
|
+
};
|
|
2856
|
+
}
|
|
2857
|
+
const type = this.safeString(delta, 'type');
|
|
2858
|
+
const amount = this.safeString(delta, 'usdc');
|
|
2859
|
+
return {
|
|
2860
|
+
'id': this.safeString(item, 'hash'),
|
|
2861
|
+
'direction': undefined,
|
|
2862
|
+
'account': undefined,
|
|
2863
|
+
'referenceAccount': this.safeString(delta, 'user'),
|
|
2864
|
+
'referenceId': this.safeString(item, 'hash'),
|
|
2865
|
+
'type': this.parseLedgerEntryType(type),
|
|
2866
|
+
'currency': undefined,
|
|
2867
|
+
'amount': this.parseNumber(amount),
|
|
2868
|
+
'timestamp': timestamp,
|
|
2869
|
+
'datetime': this.iso8601(timestamp),
|
|
2870
|
+
'before': undefined,
|
|
2871
|
+
'after': undefined,
|
|
2872
|
+
'status': undefined,
|
|
2873
|
+
'fee': fee,
|
|
2874
|
+
'info': item,
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
parseLedgerEntryType(type) {
|
|
2878
|
+
const ledgerType = {
|
|
2879
|
+
'internalTransfer': 'transfer',
|
|
2880
|
+
'accountClassTransfer': 'transfer',
|
|
2881
|
+
};
|
|
2882
|
+
return this.safeString(ledgerType, type, type);
|
|
2883
|
+
}
|
|
2884
|
+
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2885
|
+
/**
|
|
2886
|
+
* @method
|
|
2887
|
+
* @name hyperliquid#fetchDeposits
|
|
2888
|
+
* @description fetch all deposits made to an account
|
|
2889
|
+
* @param {string} code unified currency code
|
|
2890
|
+
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
2891
|
+
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
2892
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2893
|
+
* @param {int} [params.until] the latest time in ms to fetch withdrawals for
|
|
2894
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2895
|
+
*/
|
|
2896
|
+
await this.loadMarkets();
|
|
2897
|
+
let userAddress = undefined;
|
|
2898
|
+
[userAddress, params] = this.handlePublicAddress('fetchDepositsWithdrawals', params);
|
|
2899
|
+
const request = {
|
|
2900
|
+
'type': 'userNonFundingLedgerUpdates',
|
|
2901
|
+
'user': userAddress,
|
|
2902
|
+
};
|
|
2903
|
+
if (since !== undefined) {
|
|
2904
|
+
request['startTime'] = since;
|
|
2905
|
+
}
|
|
2906
|
+
const until = this.safeInteger(params, 'until');
|
|
2907
|
+
if (until !== undefined) {
|
|
2908
|
+
request['endTime'] = until;
|
|
2909
|
+
params = this.omit(params, ['until']);
|
|
2910
|
+
}
|
|
2911
|
+
const response = await this.publicPostInfo(this.extend(request, params));
|
|
2912
|
+
//
|
|
2913
|
+
// [
|
|
2914
|
+
// {
|
|
2915
|
+
// "time":1724762307531,
|
|
2916
|
+
// "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
|
2917
|
+
// "delta":{
|
|
2918
|
+
// "type":"accountClassTransfer",
|
|
2919
|
+
// "usdc":"50.0",
|
|
2920
|
+
// "toPerp":false
|
|
2921
|
+
// }
|
|
2922
|
+
// }
|
|
2923
|
+
// ]
|
|
2924
|
+
//
|
|
2925
|
+
const records = this.extractTypeFromDelta(response);
|
|
2926
|
+
const deposits = this.filterByArray(records, 'type', ['deposit'], false);
|
|
2927
|
+
return this.parseTransactions(deposits, undefined, since, limit);
|
|
2928
|
+
}
|
|
2929
|
+
async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2930
|
+
/**
|
|
2931
|
+
* @method
|
|
2932
|
+
* @name hyperliquid#fetchWithdrawals
|
|
2933
|
+
* @description fetch all withdrawals made from an account
|
|
2934
|
+
* @param {string} code unified currency code
|
|
2935
|
+
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
2936
|
+
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
2937
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2938
|
+
* @param {int} [params.until] the latest time in ms to fetch withdrawals for
|
|
2939
|
+
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
2940
|
+
*/
|
|
2941
|
+
await this.loadMarkets();
|
|
2942
|
+
let userAddress = undefined;
|
|
2943
|
+
[userAddress, params] = this.handlePublicAddress('fetchDepositsWithdrawals', params);
|
|
2944
|
+
const request = {
|
|
2945
|
+
'type': 'userNonFundingLedgerUpdates',
|
|
2946
|
+
'user': userAddress,
|
|
2947
|
+
};
|
|
2948
|
+
if (since !== undefined) {
|
|
2949
|
+
request['startTime'] = since;
|
|
2950
|
+
}
|
|
2951
|
+
const until = this.safeInteger(params, 'until');
|
|
2952
|
+
if (until !== undefined) {
|
|
2953
|
+
request['endTime'] = until;
|
|
2954
|
+
params = this.omit(params, ['until']);
|
|
2955
|
+
}
|
|
2956
|
+
const response = await this.publicPostInfo(this.extend(request, params));
|
|
2957
|
+
//
|
|
2958
|
+
// [
|
|
2959
|
+
// {
|
|
2960
|
+
// "time":1724762307531,
|
|
2961
|
+
// "hash":"0x620a234a7e0eb7930575040f59482a01050058b0802163b4767bfd9033e77781",
|
|
2962
|
+
// "delta":{
|
|
2963
|
+
// "type":"accountClassTransfer",
|
|
2964
|
+
// "usdc":"50.0",
|
|
2965
|
+
// "toPerp":false
|
|
2966
|
+
// }
|
|
2967
|
+
// }
|
|
2968
|
+
// ]
|
|
2969
|
+
//
|
|
2970
|
+
const records = this.extractTypeFromDelta(response);
|
|
2971
|
+
const withdrawals = this.filterByArray(records, 'type', ['withdraw'], false);
|
|
2972
|
+
return this.parseTransactions(withdrawals, undefined, since, limit);
|
|
2973
|
+
}
|
|
2974
|
+
extractTypeFromDelta(data = []) {
|
|
2975
|
+
const records = [];
|
|
2976
|
+
for (let i = 0; i < data.length; i++) {
|
|
2977
|
+
const record = data[i];
|
|
2978
|
+
record['type'] = record['delta']['type'];
|
|
2979
|
+
records.push(record);
|
|
2980
|
+
}
|
|
2981
|
+
return records;
|
|
2982
|
+
}
|
|
2753
2983
|
formatVaultAddress(address = undefined) {
|
|
2754
2984
|
if (address === undefined) {
|
|
2755
2985
|
return undefined;
|
|
@@ -2773,7 +3003,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2773
3003
|
throw new errors.ArgumentsRequired(this.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set');
|
|
2774
3004
|
}
|
|
2775
3005
|
coinToMarketId(coin) {
|
|
2776
|
-
if (coin.indexOf('/') > -1) {
|
|
3006
|
+
if (coin.indexOf('/') > -1 || coin.indexOf('@') > -1) {
|
|
2777
3007
|
return coin; // spot
|
|
2778
3008
|
}
|
|
2779
3009
|
return coin + '/USDC:USDC';
|