ccxt 4.3.95 → 4.3.96
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/bingx.js +2 -1
- package/dist/cjs/src/blofin.js +0 -1
- package/dist/cjs/src/bybit.js +8 -2
- 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/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/bingx.js +2 -1
- package/js/src/blofin.js +0 -1
- package/js/src/bybit.js +8 -2
- 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/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.96';
|
|
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/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
|
// {
|
|
@@ -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';
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -625,6 +625,7 @@ class kucoin extends kucoin$1 {
|
|
|
625
625
|
'KALT': 'ALT', // ALTLAYER
|
|
626
626
|
},
|
|
627
627
|
'options': {
|
|
628
|
+
'hf': false,
|
|
628
629
|
'version': 'v1',
|
|
629
630
|
'symbolSeparator': '-',
|
|
630
631
|
'fetchMyTradesMethod': 'private_get_fills',
|
|
@@ -1218,9 +1219,8 @@ class kucoin extends kucoin$1 {
|
|
|
1218
1219
|
this.options['hfMigrated'] = (status === 2);
|
|
1219
1220
|
}
|
|
1220
1221
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
const migrated = this.safeBool(this.options, 'hfMigrated');
|
|
1222
|
+
handleHfAndParams(params = {}) {
|
|
1223
|
+
const migrated = this.safeBool2(this.options, 'hfMigrated', 'hf', false);
|
|
1224
1224
|
let loadedHf = undefined;
|
|
1225
1225
|
if (migrated !== undefined) {
|
|
1226
1226
|
if (migrated) {
|
|
@@ -2119,7 +2119,7 @@ class kucoin extends kucoin$1 {
|
|
|
2119
2119
|
const testOrder = this.safeBool(params, 'test', false);
|
|
2120
2120
|
params = this.omit(params, 'test');
|
|
2121
2121
|
let hf = undefined;
|
|
2122
|
-
[hf, params] =
|
|
2122
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
2123
2123
|
let useSync = false;
|
|
2124
2124
|
[useSync, params] = this.handleOptionAndParams(params, 'createOrder', 'sync', false);
|
|
2125
2125
|
const [triggerPrice, stopLossPrice, takeProfitPrice] = this.handleTriggerPrices(params);
|
|
@@ -2257,7 +2257,7 @@ class kucoin extends kucoin$1 {
|
|
|
2257
2257
|
'orderList': ordersRequests,
|
|
2258
2258
|
};
|
|
2259
2259
|
let hf = undefined;
|
|
2260
|
-
[hf, params] =
|
|
2260
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
2261
2261
|
let useSync = false;
|
|
2262
2262
|
[useSync, params] = this.handleOptionAndParams(params, 'createOrders', 'sync', false);
|
|
2263
2263
|
let response = undefined;
|
|
@@ -2455,7 +2455,7 @@ class kucoin extends kucoin$1 {
|
|
|
2455
2455
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
2456
2456
|
const stop = this.safeBool2(params, 'stop', 'trigger', false);
|
|
2457
2457
|
let hf = undefined;
|
|
2458
|
-
[hf, params] =
|
|
2458
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
2459
2459
|
let useSync = false;
|
|
2460
2460
|
[useSync, params] = this.handleOptionAndParams(params, 'cancelOrder', 'sync', false);
|
|
2461
2461
|
if (hf || useSync) {
|
|
@@ -2577,7 +2577,7 @@ class kucoin extends kucoin$1 {
|
|
|
2577
2577
|
const request = {};
|
|
2578
2578
|
const stop = this.safeBool(params, 'stop', false);
|
|
2579
2579
|
let hf = undefined;
|
|
2580
|
-
[hf, params] =
|
|
2580
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
2581
2581
|
params = this.omit(params, 'stop');
|
|
2582
2582
|
const [marginMode, query] = this.handleMarginModeAndParams('cancelAllOrders', params);
|
|
2583
2583
|
if (symbol !== undefined) {
|
|
@@ -2636,7 +2636,7 @@ class kucoin extends kucoin$1 {
|
|
|
2636
2636
|
const until = this.safeInteger(params, 'until');
|
|
2637
2637
|
const stop = this.safeBool2(params, 'stop', 'trigger', false);
|
|
2638
2638
|
let hf = undefined;
|
|
2639
|
-
[hf, params] =
|
|
2639
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
2640
2640
|
if (hf && (symbol === undefined)) {
|
|
2641
2641
|
throw new errors.ArgumentsRequired(this.id + ' fetchOrdersByStatus() requires a symbol parameter for hf orders');
|
|
2642
2642
|
}
|
|
@@ -2819,7 +2819,7 @@ class kucoin extends kucoin$1 {
|
|
|
2819
2819
|
const clientOrderId = this.safeString2(params, 'clientOid', 'clientOrderId');
|
|
2820
2820
|
const stop = this.safeBool2(params, 'stop', 'trigger', false);
|
|
2821
2821
|
let hf = undefined;
|
|
2822
|
-
[hf, params] =
|
|
2822
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
2823
2823
|
let market = undefined;
|
|
2824
2824
|
if (symbol !== undefined) {
|
|
2825
2825
|
market = this.market(symbol);
|
|
@@ -3097,7 +3097,7 @@ class kucoin extends kucoin$1 {
|
|
|
3097
3097
|
}
|
|
3098
3098
|
let request = {};
|
|
3099
3099
|
let hf = undefined;
|
|
3100
|
-
[hf, params] =
|
|
3100
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
3101
3101
|
if (hf && symbol === undefined) {
|
|
3102
3102
|
throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol parameter for hf orders');
|
|
3103
3103
|
}
|
|
@@ -3827,7 +3827,7 @@ class kucoin extends kucoin$1 {
|
|
|
3827
3827
|
let type = this.safeString(accountsByType, requestedType, requestedType);
|
|
3828
3828
|
params = this.omit(params, 'type');
|
|
3829
3829
|
let hf = undefined;
|
|
3830
|
-
[hf, params] =
|
|
3830
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
3831
3831
|
if (hf) {
|
|
3832
3832
|
type = 'trade_hf';
|
|
3833
3833
|
}
|
|
@@ -4287,7 +4287,7 @@ class kucoin extends kucoin$1 {
|
|
|
4287
4287
|
let paginate = false;
|
|
4288
4288
|
[paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
|
|
4289
4289
|
let hf = undefined;
|
|
4290
|
-
[hf, params] =
|
|
4290
|
+
[hf, params] = this.handleHfAndParams(params);
|
|
4291
4291
|
if (paginate) {
|
|
4292
4292
|
return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
|
|
4293
4293
|
}
|
package/dist/cjs/src/mexc.js
CHANGED
|
@@ -797,6 +797,8 @@ class mexc extends mexc$1 {
|
|
|
797
797
|
* @method
|
|
798
798
|
* @name mexc#fetchStatus
|
|
799
799
|
* @description the latest known information on the availability of the exchange API
|
|
800
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#test-connectivity
|
|
801
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-server-time
|
|
800
802
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
801
803
|
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
802
804
|
*/
|
|
@@ -834,6 +836,8 @@ class mexc extends mexc$1 {
|
|
|
834
836
|
* @method
|
|
835
837
|
* @name mexc#fetchTime
|
|
836
838
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
839
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#check-server-time
|
|
840
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-server-time
|
|
837
841
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
838
842
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
839
843
|
*/
|
|
@@ -1005,6 +1009,8 @@ class mexc extends mexc$1 {
|
|
|
1005
1009
|
* @method
|
|
1006
1010
|
* @name mexc#fetchMarkets
|
|
1007
1011
|
* @description retrieves data on all markets for mexc
|
|
1012
|
+
* @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#exchange-information
|
|
1013
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information
|
|
1008
1014
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1009
1015
|
* @returns {object[]} an array of objects representing market data
|
|
1010
1016
|
*/
|
package/dist/cjs/src/okx.js
CHANGED
package/dist/cjs/src/p2b.js
CHANGED