ccxt 4.5.39 → 4.5.41
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 +6 -5
- package/dist/ccxt.browser.min.js +18 -18
- package/dist/cjs/ccxt.js +6 -1
- package/dist/cjs/src/abstract/lighter.js +11 -0
- package/dist/cjs/src/ascendex.js +73 -1
- package/dist/cjs/src/base/Exchange.js +211 -22
- package/dist/cjs/src/base/functions/generic.js +1 -0
- package/dist/cjs/src/base/functions/io.js +160 -0
- package/dist/cjs/src/base/functions.js +6 -0
- package/dist/cjs/src/base/ws/Client.js +1 -0
- package/dist/cjs/src/base/ws/WsClient.js +1 -0
- package/dist/cjs/src/binance.js +143 -0
- package/dist/cjs/src/bingx.js +150 -123
- package/dist/cjs/src/bitmart.js +20 -6
- package/dist/cjs/src/bitmex.js +436 -0
- package/dist/cjs/src/blofin.js +86 -1
- package/dist/cjs/src/bybit.js +135 -0
- package/dist/cjs/src/coinspot.js +7 -2
- package/dist/cjs/src/delta.js +367 -0
- package/dist/cjs/src/gate.js +11 -4
- package/dist/cjs/src/gemini.js +76 -1
- package/dist/cjs/src/htx.js +266 -3
- package/dist/cjs/src/hyperliquid.js +20 -7
- package/dist/cjs/src/independentreserve.js +7 -7
- package/dist/cjs/src/kraken.js +1 -1
- package/dist/cjs/src/krakenfutures.js +96 -5
- package/dist/cjs/src/kucoin.js +3 -3
- package/dist/cjs/src/kucoinfutures.js +121 -0
- package/dist/cjs/src/lighter.js +2931 -0
- package/dist/cjs/src/mexc.js +9 -2
- package/dist/cjs/src/phemex.js +359 -0
- package/dist/cjs/src/poloniex.js +5 -0
- package/dist/cjs/src/pro/binance.js +2 -2
- package/dist/cjs/src/pro/bingx.js +248 -35
- package/dist/cjs/src/pro/bitget.js +49 -90
- package/dist/cjs/src/pro/bitmart.js +68 -0
- package/dist/cjs/src/pro/blofin.js +52 -1
- package/dist/cjs/src/pro/coinbaseinternational.js +5 -2
- package/dist/cjs/src/pro/defx.js +1 -1
- package/dist/cjs/src/pro/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/lighter.js +787 -0
- package/dist/cjs/src/pro/mexc.js +73 -1
- package/dist/cjs/src/pro/okx.js +7 -4
- package/dist/cjs/src/pro/paradex.js +138 -1
- package/dist/cjs/src/pro/woo.js +43 -0
- package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/address/address.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/address.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/array.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/number.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/fragments.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/index.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/interface.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/typed.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/index.js +1 -0
- package/dist/cjs/src/whitebit.js +118 -16
- package/dist/cjs/src/woo.js +103 -3
- package/js/ccxt.d.ts +9 -3
- package/js/ccxt.js +6 -2
- package/js/src/abstract/gemini.d.ts +27 -0
- package/js/src/abstract/lighter.d.ts +53 -0
- package/js/src/abstract/lighter.js +5 -0
- package/js/src/ascendex.d.ts +12 -1
- package/js/src/ascendex.js +73 -1
- package/js/src/base/Exchange.d.ts +29 -14
- package/js/src/base/Exchange.js +216 -23
- package/js/src/base/functions/generic.js +1 -0
- package/js/src/base/functions/io.d.ts +32 -0
- package/js/src/base/functions/io.js +131 -0
- package/js/src/base/functions.d.ts +1 -0
- package/js/src/base/functions.js +1 -0
- package/js/src/base/types.d.ts +9 -0
- package/js/src/binance.d.ts +27 -1
- package/js/src/binance.js +143 -0
- package/js/src/bingx.d.ts +113 -108
- package/js/src/bingx.js +150 -123
- package/js/src/bitmart.js +20 -6
- package/js/src/bitmex.d.ts +50 -1
- package/js/src/bitmex.js +436 -0
- package/js/src/blofin.d.ts +12 -1
- package/js/src/blofin.js +86 -1
- package/js/src/bybit.d.ts +12 -1
- package/js/src/bybit.js +135 -0
- package/js/src/coinspot.js +7 -2
- package/js/src/delta.d.ts +12 -1
- package/js/src/delta.js +367 -0
- package/js/src/gate.d.ts +1 -0
- package/js/src/gate.js +11 -4
- package/js/src/gemini.d.ts +11 -0
- package/js/src/gemini.js +76 -1
- package/js/src/htx.d.ts +15 -1
- package/js/src/htx.js +266 -3
- package/js/src/hyperliquid.js +20 -7
- package/js/src/independentreserve.js +7 -7
- package/js/src/kraken.js +1 -1
- package/js/src/krakenfutures.d.ts +1 -1
- package/js/src/krakenfutures.js +96 -5
- package/js/src/kucoin.d.ts +3 -3
- package/js/src/kucoin.js +3 -3
- package/js/src/kucoinfutures.d.ts +12 -1
- package/js/src/kucoinfutures.js +121 -0
- package/js/src/lighter.d.ts +424 -0
- package/js/src/lighter.js +2924 -0
- package/js/src/mexc.js +9 -2
- package/js/src/phemex.d.ts +16 -1
- package/js/src/phemex.js +359 -0
- package/js/src/poloniex.js +5 -0
- package/js/src/pro/binance.js +2 -2
- package/js/src/pro/bingx.d.ts +50 -34
- package/js/src/pro/bingx.js +249 -36
- package/js/src/pro/bitget.d.ts +6 -6
- package/js/src/pro/bitget.js +49 -90
- package/js/src/pro/bitmart.d.ts +22 -1
- package/js/src/pro/bitmart.js +69 -1
- package/js/src/pro/blofin.d.ts +12 -1
- package/js/src/pro/blofin.js +52 -1
- package/js/src/pro/coinbaseinternational.d.ts +2 -2
- package/js/src/pro/coinbaseinternational.js +6 -3
- package/js/src/pro/defx.js +1 -1
- package/js/src/pro/kucoinfutures.js +1 -1
- package/js/src/pro/lighter.d.ts +161 -0
- package/js/src/pro/lighter.js +780 -0
- package/js/src/pro/mexc.d.ts +22 -1
- package/js/src/pro/mexc.js +73 -1
- package/js/src/pro/okx.d.ts +4 -4
- package/js/src/pro/okx.js +7 -4
- package/js/src/pro/paradex.d.ts +23 -1
- package/js/src/pro/paradex.js +138 -1
- package/js/src/pro/woo.d.ts +12 -1
- package/js/src/pro/woo.js +43 -0
- package/js/src/whitebit.d.ts +2 -1
- package/js/src/whitebit.js +118 -16
- package/js/src/woo.d.ts +12 -1
- package/js/src/woo.js +103 -3
- package/package.json +1 -1
package/dist/cjs/src/gemini.js
CHANGED
|
@@ -28,7 +28,7 @@ class gemini extends gemini$1["default"] {
|
|
|
28
28
|
'has': {
|
|
29
29
|
'CORS': undefined,
|
|
30
30
|
'spot': true,
|
|
31
|
-
'margin':
|
|
31
|
+
'margin': undefined,
|
|
32
32
|
'swap': true,
|
|
33
33
|
'future': false,
|
|
34
34
|
'option': false,
|
|
@@ -134,19 +134,29 @@ class gemini extends gemini$1["default"] {
|
|
|
134
134
|
'get': {
|
|
135
135
|
'v1/symbols': 5,
|
|
136
136
|
'v1/symbols/details/{symbol}': 5,
|
|
137
|
+
'v1/network/{token}': 5,
|
|
137
138
|
'v1/staking/rates': 5,
|
|
138
139
|
'v1/pubticker/{symbol}': 5,
|
|
140
|
+
'v1/feepromos': 5,
|
|
139
141
|
'v2/ticker/{symbol}': 5,
|
|
140
142
|
'v2/candles/{symbol}/{timeframe}': 5,
|
|
141
143
|
'v1/trades/{symbol}': 5,
|
|
142
144
|
'v1/auction/{symbol}': 5,
|
|
143
145
|
'v1/auction/{symbol}/history': 5,
|
|
144
146
|
'v1/pricefeed': 5,
|
|
147
|
+
'v1/fundingamount/{symbol}': 5,
|
|
148
|
+
'v1/fundingamountreport/records.xlsx': 5,
|
|
145
149
|
'v1/book/{symbol}': 5,
|
|
146
150
|
'v1/earn/rates': 5,
|
|
151
|
+
'v2/derivatives/candles/{symbol}/{time_frame}': 5,
|
|
152
|
+
'v2/fxrate/{symbol}/{timestamp}': 5,
|
|
153
|
+
'v1/riskstats/{symbol}': 5,
|
|
147
154
|
},
|
|
148
155
|
},
|
|
149
156
|
'private': {
|
|
157
|
+
'get': {
|
|
158
|
+
'v1/perpetuals/fundingpaymentreport/records.xlsx': 1,
|
|
159
|
+
},
|
|
150
160
|
'post': {
|
|
151
161
|
'v1/staking/unstake': 1,
|
|
152
162
|
'v1/staking/stake': 1,
|
|
@@ -189,6 +199,25 @@ class gemini extends gemini$1["default"] {
|
|
|
189
199
|
'v1/account/list': 1,
|
|
190
200
|
'v1/heartbeat': 1,
|
|
191
201
|
'v1/roles': 1,
|
|
202
|
+
'v1/custodyaccountfees': 1,
|
|
203
|
+
'v1/withdraw/{currencyCodeLowerCase}/feeEstimate': 1,
|
|
204
|
+
'v1/payments/addbank/cad': 1,
|
|
205
|
+
'v1/transactions': 1,
|
|
206
|
+
'v1/margin/account': 1,
|
|
207
|
+
'v1/margin/rates': 1,
|
|
208
|
+
'v1/margin/order/preview': 1,
|
|
209
|
+
'v1/clearing/list': 1,
|
|
210
|
+
'v1/clearing/broker/list': 1,
|
|
211
|
+
'v1/clearing/broker/new': 1,
|
|
212
|
+
'v1/clearing/trades': 1,
|
|
213
|
+
'v1/instant/quote': 1,
|
|
214
|
+
'v1/instant/execute': 1,
|
|
215
|
+
'v1/account/rename': 1,
|
|
216
|
+
'v1/oauth/revokeByToken': 1,
|
|
217
|
+
'v1/margin': 1,
|
|
218
|
+
'v1/perpetuals/fundingPayment': 1,
|
|
219
|
+
'v1/perpetuals/fundingpaymentreport/records.json': 1,
|
|
220
|
+
'v1/positions': 1,
|
|
192
221
|
},
|
|
193
222
|
},
|
|
194
223
|
},
|
|
@@ -2007,6 +2036,52 @@ class gemini extends gemini$1["default"] {
|
|
|
2007
2036
|
//
|
|
2008
2037
|
return this.parseOHLCVs(response, market, timeframe, since, limit);
|
|
2009
2038
|
}
|
|
2039
|
+
/**
|
|
2040
|
+
* @method
|
|
2041
|
+
* @name gemini#fetchOpenInterest
|
|
2042
|
+
* @description retrieves the open interest of a contract trading pair
|
|
2043
|
+
* @see https://docs.gemini.com/rest/derivatives#get-risk-stats
|
|
2044
|
+
* @param {string} symbol unified CCXT market symbol
|
|
2045
|
+
* @param {object} [params] exchange specific parameters
|
|
2046
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/?id=open-interest-structure}
|
|
2047
|
+
*/
|
|
2048
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
2049
|
+
await this.loadMarkets();
|
|
2050
|
+
const market = this.market(symbol);
|
|
2051
|
+
const request = {
|
|
2052
|
+
'symbol': market['id'],
|
|
2053
|
+
};
|
|
2054
|
+
const response = await this.publicGetV1RiskstatsSymbol(this.extend(request, params));
|
|
2055
|
+
//
|
|
2056
|
+
// {
|
|
2057
|
+
// product_type: 'PerpetualSwapContract',
|
|
2058
|
+
// mark_price: '9.023',
|
|
2059
|
+
// index_price: '9.02072',
|
|
2060
|
+
// open_interest: '4681.9',
|
|
2061
|
+
// open_interest_notional: '42244.7837'
|
|
2062
|
+
// }
|
|
2063
|
+
//
|
|
2064
|
+
return this.parseOpenInterest(response, market);
|
|
2065
|
+
}
|
|
2066
|
+
parseOpenInterest(interest, market = undefined) {
|
|
2067
|
+
//
|
|
2068
|
+
// {
|
|
2069
|
+
// product_type: 'PerpetualSwapContract',
|
|
2070
|
+
// mark_price: '9.023',
|
|
2071
|
+
// index_price: '9.02072',
|
|
2072
|
+
// open_interest: '4681.9',
|
|
2073
|
+
// open_interest_notional: '42244.7837'
|
|
2074
|
+
// }
|
|
2075
|
+
//
|
|
2076
|
+
return this.safeOpenInterest({
|
|
2077
|
+
'info': interest,
|
|
2078
|
+
'symbol': this.safeString(market, 'symbol'),
|
|
2079
|
+
'openInterestAmount': this.safeString(interest, 'open_interest'),
|
|
2080
|
+
'openInterestValue': this.safeString(interest, 'open_interest_notional'),
|
|
2081
|
+
'timestamp': undefined,
|
|
2082
|
+
'datetime': undefined,
|
|
2083
|
+
}, market);
|
|
2084
|
+
}
|
|
2010
2085
|
}
|
|
2011
2086
|
|
|
2012
2087
|
exports["default"] = gemini;
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -107,8 +107,10 @@ class htx extends htx$1["default"] {
|
|
|
107
107
|
'fetchOrders': true,
|
|
108
108
|
'fetchOrderTrades': true,
|
|
109
109
|
'fetchPosition': true,
|
|
110
|
+
'fetchPositionADLRank': true,
|
|
110
111
|
'fetchPositionHistory': 'emulated',
|
|
111
112
|
'fetchPositions': true,
|
|
113
|
+
'fetchPositionsADLRank': true,
|
|
112
114
|
'fetchPositionsHistory': false,
|
|
113
115
|
'fetchPositionsRisk': false,
|
|
114
116
|
'fetchPremiumIndexOHLCV': true,
|
|
@@ -4294,7 +4296,7 @@ class htx extends htx$1["default"] {
|
|
|
4294
4296
|
// POST /linear-swap-api/v3/swap_hisorders linear isolated --------
|
|
4295
4297
|
// POST /linear-swap-api/v3/swap_cross_hisorders linear cross -----
|
|
4296
4298
|
'trade_type': 0,
|
|
4297
|
-
'status': '0', // support multiple query
|
|
4299
|
+
'status': '0', // support multiple query separated by ',',such as '3,4,5', 0: all. 3. Have submitted the orders; 4. Orders partially matched; 5. Orders cancelled with partially matched; 6. Orders fully matched; 7. Orders cancelled;
|
|
4298
4300
|
};
|
|
4299
4301
|
let response = undefined;
|
|
4300
4302
|
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
@@ -8788,9 +8790,9 @@ class htx extends htx$1["default"] {
|
|
|
8788
8790
|
}
|
|
8789
8791
|
const request = {};
|
|
8790
8792
|
let subType = undefined;
|
|
8791
|
-
[subType, params] = this.handleSubTypeAndParams('
|
|
8793
|
+
[subType, params] = this.handleSubTypeAndParams('fetchOpenInterests', market, params, 'linear');
|
|
8792
8794
|
let marketType = undefined;
|
|
8793
|
-
[marketType, params] = this.handleMarketTypeAndParams('
|
|
8795
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchOpenInterests', market, params);
|
|
8794
8796
|
let response = undefined;
|
|
8795
8797
|
if (marketType === 'future') {
|
|
8796
8798
|
response = await this.contractPublicGetApiV1ContractOpenInterest(this.extend(request, params));
|
|
@@ -9762,6 +9764,267 @@ class htx extends htx$1["default"] {
|
|
|
9762
9764
|
}
|
|
9763
9765
|
return response;
|
|
9764
9766
|
}
|
|
9767
|
+
/**
|
|
9768
|
+
* @method
|
|
9769
|
+
* @name htx#fetchPositionsADLRank
|
|
9770
|
+
* @description fetches the auto deleveraging rank and risk percentage for a list of symbols
|
|
9771
|
+
* @see https://www.htx.com/en-us/opend/newApiPages/?id=8cb81b5a-77b5-11ed-9966-0242ac110003
|
|
9772
|
+
* @see https://www.htx.com/en-us/opend/newApiPages/?id=8cb81c49-77b5-11ed-9966-0242ac110003
|
|
9773
|
+
* @see https://www.htx.com/en-us/opend/newApiPages/?id=28c2f164-77ae-11ed-9966-0242ac110003
|
|
9774
|
+
* @see https://www.htx.com/en-us/opend/newApiPages/?id=5d518648-77b6-11ed-9966-0242ac110003
|
|
9775
|
+
* @param {string[]} [symbols] a list of unified market symbols
|
|
9776
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
9777
|
+
* @returns {object[]} an array of [auto de leverage structures]{@link https://docs.ccxt.com/?id=auto-de-leverage-structure}
|
|
9778
|
+
*/
|
|
9779
|
+
async fetchPositionsADLRank(symbols = undefined, params = {}) {
|
|
9780
|
+
await this.loadMarkets();
|
|
9781
|
+
symbols = this.marketSymbols(symbols, undefined, true, true, true);
|
|
9782
|
+
let market = undefined;
|
|
9783
|
+
if (symbols !== undefined) {
|
|
9784
|
+
const symbolsLength = symbols.length;
|
|
9785
|
+
if (symbolsLength > 0) {
|
|
9786
|
+
const first = this.safeString(symbols, 0);
|
|
9787
|
+
market = this.market(first);
|
|
9788
|
+
}
|
|
9789
|
+
}
|
|
9790
|
+
let marginMode = undefined;
|
|
9791
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchPositionsADLRank', params, 'cross');
|
|
9792
|
+
let subType = undefined;
|
|
9793
|
+
[subType, params] = this.handleSubTypeAndParams('fetchPositionsADLRank', market, params, 'linear');
|
|
9794
|
+
let marketType = undefined;
|
|
9795
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchPositionsADLRank', market, params);
|
|
9796
|
+
if (marketType === 'spot') {
|
|
9797
|
+
marketType = 'future';
|
|
9798
|
+
}
|
|
9799
|
+
let response = undefined;
|
|
9800
|
+
if (subType === 'linear') {
|
|
9801
|
+
if (marginMode === 'isolated') {
|
|
9802
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapPositionInfo(params);
|
|
9803
|
+
}
|
|
9804
|
+
else if (marginMode === 'cross') {
|
|
9805
|
+
response = await this.contractPrivatePostLinearSwapApiV1SwapCrossPositionInfo(params);
|
|
9806
|
+
}
|
|
9807
|
+
else {
|
|
9808
|
+
throw new errors.NotSupported(this.id + ' fetchPositionsADLRank() not support this market type');
|
|
9809
|
+
}
|
|
9810
|
+
//
|
|
9811
|
+
// {
|
|
9812
|
+
// "status": "ok",
|
|
9813
|
+
// "data": [
|
|
9814
|
+
// {
|
|
9815
|
+
// "symbol": "BTC",
|
|
9816
|
+
// "contract_code": "BTC-USDT",
|
|
9817
|
+
// "volume": 1.000000000000000000,
|
|
9818
|
+
// "available": 1.000000000000000000,
|
|
9819
|
+
// "frozen": 0E-18,
|
|
9820
|
+
// "cost_open": 96039.700000000000000000,
|
|
9821
|
+
// "cost_hold": 96039.700000000000000000,
|
|
9822
|
+
// "profit_unreal": 0.000600000000000000,
|
|
9823
|
+
// "profit_rate": 0.000006247416432995,
|
|
9824
|
+
// "lever_rate": 1,
|
|
9825
|
+
// "position_margin": 96.040300000000000000,
|
|
9826
|
+
// "direction": "buy",
|
|
9827
|
+
// "profit": 0.000600000000000000,
|
|
9828
|
+
// "last_price": 96040.3,
|
|
9829
|
+
// "margin_asset": "USDT",
|
|
9830
|
+
// "margin_mode": "cross",
|
|
9831
|
+
// "margin_account": "USDT",
|
|
9832
|
+
// "contract_type": "swap",
|
|
9833
|
+
// "pair": "BTC-USDT",
|
|
9834
|
+
// "business_type": "swap",
|
|
9835
|
+
// "trade_partition":"USDT",
|
|
9836
|
+
// "position_mode": "single_side",
|
|
9837
|
+
// "store_time": "2023-10-08 20:05:06",
|
|
9838
|
+
// "liquidation_price": null,
|
|
9839
|
+
// "market_closing_slippage": null,
|
|
9840
|
+
// "risk_rate": 249.274066168760049797,
|
|
9841
|
+
// "new_risk_rate": 0.003995619743220614,
|
|
9842
|
+
// "risk_rate_percent": 0.003995619743220614,
|
|
9843
|
+
// "withdraw_available": null,
|
|
9844
|
+
// "open_adl": 1,
|
|
9845
|
+
// "adl_risk_percent": 3,
|
|
9846
|
+
// "tp_trigger_price": null,
|
|
9847
|
+
// "sl_trigger_price": null,
|
|
9848
|
+
// "tp_order_id": null,
|
|
9849
|
+
// "sl_order_id": null,
|
|
9850
|
+
// "tp_trigger_type": null,
|
|
9851
|
+
// "sl_trigger_type": null,
|
|
9852
|
+
// "adjust_value": null
|
|
9853
|
+
// }
|
|
9854
|
+
// ],
|
|
9855
|
+
// "ts": 1768489640285
|
|
9856
|
+
// }
|
|
9857
|
+
//
|
|
9858
|
+
}
|
|
9859
|
+
else {
|
|
9860
|
+
if (marketType === 'future') {
|
|
9861
|
+
response = await this.contractPrivatePostApiV1ContractPositionInfo(params);
|
|
9862
|
+
//
|
|
9863
|
+
// {
|
|
9864
|
+
// "status": "ok",
|
|
9865
|
+
// "data": [
|
|
9866
|
+
// {
|
|
9867
|
+
// "symbol": "BTC",
|
|
9868
|
+
// "contract_code": "BTC-USDT-260123",
|
|
9869
|
+
// "volume": 1.000000000000000000,
|
|
9870
|
+
// "available": 1.000000000000000000,
|
|
9871
|
+
// "frozen": 0E-18,
|
|
9872
|
+
// "cost_open": 96203.100000000000000000,
|
|
9873
|
+
// "cost_hold": 96203.100000000000000000,
|
|
9874
|
+
// "profit_unreal": -0.199400000000000000,
|
|
9875
|
+
// "profit_rate": -0.002072698281032524,
|
|
9876
|
+
// "lever_rate": 1,
|
|
9877
|
+
// "position_margin": 96.003700000000000000,
|
|
9878
|
+
// "direction": "buy",
|
|
9879
|
+
// "profit": -0.199400000000000000,
|
|
9880
|
+
// "last_price": 96003.7,
|
|
9881
|
+
// "margin_asset": "USDT",
|
|
9882
|
+
// "margin_mode": "cross",
|
|
9883
|
+
// "margin_account": "USDT",
|
|
9884
|
+
// "contract_type": "next_week",
|
|
9885
|
+
// "pair": "BTC-USDT",
|
|
9886
|
+
// "business_type": "futures",
|
|
9887
|
+
// "trade_partition": "USDT",
|
|
9888
|
+
// "position_mode": "single_side",
|
|
9889
|
+
// "store_time": "2026-01-15 23:45:21",
|
|
9890
|
+
// "liquidation_price": null,
|
|
9891
|
+
// "market_closing_slippage": null,
|
|
9892
|
+
// "risk_rate": 249.265098252125343196,
|
|
9893
|
+
// "new_risk_rate": 0.003995762920935011,
|
|
9894
|
+
// "risk_rate_percent": 0.003995762920935011,
|
|
9895
|
+
// "withdraw_available": null,
|
|
9896
|
+
// "open_adl": 1,
|
|
9897
|
+
// "adl_risk_percent": 2,
|
|
9898
|
+
// "tp_trigger_price": null,
|
|
9899
|
+
// "sl_trigger_price": null,
|
|
9900
|
+
// "tp_order_id": null,
|
|
9901
|
+
// "sl_order_id": null,
|
|
9902
|
+
// "tp_trigger_type": null,
|
|
9903
|
+
// "sl_trigger_type": null,
|
|
9904
|
+
// "adjust_value": null
|
|
9905
|
+
// }
|
|
9906
|
+
// ],
|
|
9907
|
+
// "ts": 1768491964551
|
|
9908
|
+
// }
|
|
9909
|
+
//
|
|
9910
|
+
}
|
|
9911
|
+
else if (marketType === 'swap') {
|
|
9912
|
+
response = await this.contractPrivatePostSwapApiV1SwapPositionInfo(params);
|
|
9913
|
+
//
|
|
9914
|
+
// {
|
|
9915
|
+
// "status": "ok"
|
|
9916
|
+
// "data": [
|
|
9917
|
+
// {
|
|
9918
|
+
// "symbol": "THETA"
|
|
9919
|
+
// "contract_code": "THETA-USD"
|
|
9920
|
+
// "volume": 20
|
|
9921
|
+
// "available": 20
|
|
9922
|
+
// "frozen": 0
|
|
9923
|
+
// "cost_open": 0.6048347107438017
|
|
9924
|
+
// "cost_hold": 0.65931
|
|
9925
|
+
// "profit_unreal": -10.5257562398811
|
|
9926
|
+
// "profit_rate": 1.0158596753357925
|
|
9927
|
+
// "lever_rate": 20
|
|
9928
|
+
// "position_margin": 15.693659761456372
|
|
9929
|
+
// "direction": "buy"
|
|
9930
|
+
// "profit": 16.795657677889032
|
|
9931
|
+
// "last_price": 0.6372
|
|
9932
|
+
// "adl_risk_percent": "3"
|
|
9933
|
+
// "liq_px": "112"
|
|
9934
|
+
// "new_risk_rate": ""
|
|
9935
|
+
// "trade_partition": ""
|
|
9936
|
+
// }
|
|
9937
|
+
// ]
|
|
9938
|
+
// "ts": 1603868312729
|
|
9939
|
+
// }
|
|
9940
|
+
//
|
|
9941
|
+
}
|
|
9942
|
+
else {
|
|
9943
|
+
throw new errors.NotSupported(this.id + ' fetchPositionsADLRank() not support this market type');
|
|
9944
|
+
}
|
|
9945
|
+
}
|
|
9946
|
+
const data = this.safeList(response, 'data', []);
|
|
9947
|
+
return this.parseADLRanks(data, symbols);
|
|
9948
|
+
}
|
|
9949
|
+
parseADLRank(info, market = undefined) {
|
|
9950
|
+
//
|
|
9951
|
+
// fetchPositionADLRank linear swap and future
|
|
9952
|
+
//
|
|
9953
|
+
// {
|
|
9954
|
+
// "symbol": "BTC",
|
|
9955
|
+
// "contract_code": "BTC-USDT",
|
|
9956
|
+
// "volume": 1.000000000000000000,
|
|
9957
|
+
// "available": 1.000000000000000000,
|
|
9958
|
+
// "frozen": 0E-18,
|
|
9959
|
+
// "cost_open": 96039.700000000000000000,
|
|
9960
|
+
// "cost_hold": 96039.700000000000000000,
|
|
9961
|
+
// "profit_unreal": 0.000600000000000000,
|
|
9962
|
+
// "profit_rate": 0.000006247416432995,
|
|
9963
|
+
// "lever_rate": 1,
|
|
9964
|
+
// "position_margin": 96.040300000000000000,
|
|
9965
|
+
// "direction": "buy",
|
|
9966
|
+
// "profit": 0.000600000000000000,
|
|
9967
|
+
// "last_price": 96040.3,
|
|
9968
|
+
// "margin_asset": "USDT",
|
|
9969
|
+
// "margin_mode": "cross",
|
|
9970
|
+
// "margin_account": "USDT",
|
|
9971
|
+
// "contract_type": "swap",
|
|
9972
|
+
// "pair": "BTC-USDT",
|
|
9973
|
+
// "business_type": "swap",
|
|
9974
|
+
// "trade_partition":"USDT",
|
|
9975
|
+
// "position_mode": "single_side",
|
|
9976
|
+
// "store_time": "2023-10-08 20:05:06",
|
|
9977
|
+
// "liquidation_price": null,
|
|
9978
|
+
// "market_closing_slippage": null,
|
|
9979
|
+
// "risk_rate": 249.274066168760049797,
|
|
9980
|
+
// "new_risk_rate": 0.003995619743220614,
|
|
9981
|
+
// "risk_rate_percent": 0.003995619743220614,
|
|
9982
|
+
// "withdraw_available": null,
|
|
9983
|
+
// "open_adl": 1,
|
|
9984
|
+
// "adl_risk_percent": 3,
|
|
9985
|
+
// "tp_trigger_price": null,
|
|
9986
|
+
// "sl_trigger_price": null,
|
|
9987
|
+
// "tp_order_id": null,
|
|
9988
|
+
// "sl_order_id": null,
|
|
9989
|
+
// "tp_trigger_type": null,
|
|
9990
|
+
// "sl_trigger_type": null,
|
|
9991
|
+
// "adjust_value": null
|
|
9992
|
+
// }
|
|
9993
|
+
//
|
|
9994
|
+
// fetchPositionADLRank inverse
|
|
9995
|
+
//
|
|
9996
|
+
// {
|
|
9997
|
+
// "symbol": "THETA"
|
|
9998
|
+
// "contract_code": "THETA-USD"
|
|
9999
|
+
// "volume": 20
|
|
10000
|
+
// "available": 20
|
|
10001
|
+
// "frozen": 0
|
|
10002
|
+
// "cost_open": 0.6048347107438017
|
|
10003
|
+
// "cost_hold": 0.65931
|
|
10004
|
+
// "profit_unreal": -10.5257562398811
|
|
10005
|
+
// "profit_rate": 1.0158596753357925
|
|
10006
|
+
// "lever_rate": 20
|
|
10007
|
+
// "position_margin": 15.693659761456372
|
|
10008
|
+
// "direction": "buy"
|
|
10009
|
+
// "profit": 16.795657677889032
|
|
10010
|
+
// "last_price": 0.6372
|
|
10011
|
+
// "adl_risk_percent": "3"
|
|
10012
|
+
// "liq_px": "112"
|
|
10013
|
+
// "new_risk_rate": ""
|
|
10014
|
+
// "trade_partition": ""
|
|
10015
|
+
// }
|
|
10016
|
+
//
|
|
10017
|
+
const marketId = this.safeString(info, 'contract_code');
|
|
10018
|
+
return {
|
|
10019
|
+
'info': info,
|
|
10020
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
10021
|
+
'rank': this.safeInteger(info, 'adl_risk_percent'),
|
|
10022
|
+
'rating': undefined,
|
|
10023
|
+
'percentage': undefined,
|
|
10024
|
+
'timestamp': undefined,
|
|
10025
|
+
'datetime': undefined,
|
|
10026
|
+
};
|
|
10027
|
+
}
|
|
9765
10028
|
}
|
|
9766
10029
|
|
|
9767
10030
|
exports["default"] = htx;
|
|
@@ -627,7 +627,7 @@ class hyperliquid extends hyperliquid$1["default"] {
|
|
|
627
627
|
// and we don't have the base/settle information and we can't assume it's USDC for hip3 markets
|
|
628
628
|
for (let j = 0; j < universe.length; j++) {
|
|
629
629
|
const data = this.extend(this.safeDict(universe, j, {}), this.safeDict(assetCtxs, j, {}));
|
|
630
|
-
data['baseId'] = j
|
|
630
|
+
data['baseId'] = this.sum(j, offset);
|
|
631
631
|
data['collateralToken'] = collateralToken;
|
|
632
632
|
data['hip3'] = true;
|
|
633
633
|
data['dex'] = dexName;
|
|
@@ -2199,7 +2199,7 @@ class hyperliquid extends hyperliquid$1["default"] {
|
|
|
2199
2199
|
const symbol = market['symbol'];
|
|
2200
2200
|
const type = this.safeStringUpper(rawOrder, 'type');
|
|
2201
2201
|
const side = this.safeStringUpper(rawOrder, 'side');
|
|
2202
|
-
|
|
2202
|
+
let amount = this.safeString(rawOrder, 'amount');
|
|
2203
2203
|
const price = this.safeString(rawOrder, 'price');
|
|
2204
2204
|
let orderParams = this.safeDict(rawOrder, 'params', {});
|
|
2205
2205
|
const slippage = this.safeString(orderParams, 'slippage', defaultSlippage);
|
|
@@ -2210,17 +2210,27 @@ class hyperliquid extends hyperliquid$1["default"] {
|
|
|
2210
2210
|
const hasTakeProfit = (takeProfit !== undefined);
|
|
2211
2211
|
orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit']);
|
|
2212
2212
|
const mainOrderObj = this.createOrderRequest(symbol, type, side, amount, price, orderParams);
|
|
2213
|
-
orderReq.push(mainOrderObj);
|
|
2214
2213
|
if (hasStopLoss || hasTakeProfit) {
|
|
2215
2214
|
// grouping opposed orders for sl/tp
|
|
2216
2215
|
const stopLossOrderTriggerPrice = this.safeStringN(stopLoss, ['triggerPrice', 'stopPrice']);
|
|
2217
|
-
|
|
2216
|
+
let stopLossOrderType = this.safeString(stopLoss, 'type', 'limit');
|
|
2218
2217
|
const stopLossOrderLimitPrice = this.safeStringN(stopLoss, ['price', 'stopLossPrice'], stopLossOrderTriggerPrice);
|
|
2219
2218
|
const takeProfitOrderTriggerPrice = this.safeStringN(takeProfit, ['triggerPrice', 'stopPrice']);
|
|
2220
|
-
|
|
2219
|
+
let takeProfitOrderType = this.safeString(takeProfit, 'type', 'limit');
|
|
2221
2220
|
const takeProfitOrderLimitPrice = this.safeStringN(takeProfit, ['price', 'takeProfitPrice'], takeProfitOrderTriggerPrice);
|
|
2222
|
-
grouping = 'normalTpsl';
|
|
2223
|
-
|
|
2221
|
+
grouping = this.safeString(orderParams, 'grouping', 'normalTpsl');
|
|
2222
|
+
if (grouping === 'positionTpsl') {
|
|
2223
|
+
amount = '0';
|
|
2224
|
+
stopLossOrderType = 'market';
|
|
2225
|
+
takeProfitOrderType = 'market';
|
|
2226
|
+
}
|
|
2227
|
+
else if (grouping === 'normalTpsl') {
|
|
2228
|
+
orderReq.push(mainOrderObj);
|
|
2229
|
+
}
|
|
2230
|
+
else {
|
|
2231
|
+
throw new errors.NotSupported(this.id + ' only support grouping normalTpsl and positionTpsl.');
|
|
2232
|
+
}
|
|
2233
|
+
orderParams = this.omit(orderParams, ['stopLoss', 'takeProfit', 'grouping']);
|
|
2224
2234
|
let triggerOrderSide = '';
|
|
2225
2235
|
if (side === 'BUY') {
|
|
2226
2236
|
triggerOrderSide = 'sell';
|
|
@@ -2243,6 +2253,9 @@ class hyperliquid extends hyperliquid$1["default"] {
|
|
|
2243
2253
|
orderReq.push(orderObj);
|
|
2244
2254
|
}
|
|
2245
2255
|
}
|
|
2256
|
+
else {
|
|
2257
|
+
orderReq.push(mainOrderObj);
|
|
2258
|
+
}
|
|
2246
2259
|
}
|
|
2247
2260
|
let vaultAddress = undefined;
|
|
2248
2261
|
[vaultAddress, params] = this.handleOptionAndParams(params, 'createOrder', 'vaultAddress');
|
|
@@ -679,7 +679,7 @@ class independentreserve extends independentreserve$1["default"] {
|
|
|
679
679
|
*/
|
|
680
680
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
681
681
|
await this.loadMarkets();
|
|
682
|
-
const request =
|
|
682
|
+
const request = {};
|
|
683
683
|
let market = undefined;
|
|
684
684
|
if (symbol !== undefined) {
|
|
685
685
|
market = this.market(symbol);
|
|
@@ -707,7 +707,7 @@ class independentreserve extends independentreserve$1["default"] {
|
|
|
707
707
|
*/
|
|
708
708
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
709
709
|
await this.loadMarkets();
|
|
710
|
-
const request =
|
|
710
|
+
const request = {};
|
|
711
711
|
let market = undefined;
|
|
712
712
|
if (symbol !== undefined) {
|
|
713
713
|
market = this.market(symbol);
|
|
@@ -739,10 +739,10 @@ class independentreserve extends independentreserve$1["default"] {
|
|
|
739
739
|
if (limit === undefined) {
|
|
740
740
|
limit = 50;
|
|
741
741
|
}
|
|
742
|
-
const request =
|
|
742
|
+
const request = {
|
|
743
743
|
'pageIndex': pageIndex,
|
|
744
744
|
'pageSize': limit,
|
|
745
|
-
}
|
|
745
|
+
};
|
|
746
746
|
const response = await this.privatePostGetTrades(this.extend(request, params));
|
|
747
747
|
let market = undefined;
|
|
748
748
|
if (symbol !== undefined) {
|
|
@@ -875,11 +875,11 @@ class independentreserve extends independentreserve$1["default"] {
|
|
|
875
875
|
const market = this.market(symbol);
|
|
876
876
|
let orderType = this.capitalize(type);
|
|
877
877
|
orderType += (side === 'sell') ? 'Offer' : 'Bid';
|
|
878
|
-
const request =
|
|
878
|
+
const request = {
|
|
879
879
|
'primaryCurrencyCode': market['baseId'],
|
|
880
880
|
'secondaryCurrencyCode': market['quoteId'],
|
|
881
881
|
'orderType': orderType,
|
|
882
|
-
}
|
|
882
|
+
};
|
|
883
883
|
let response = undefined;
|
|
884
884
|
request['volume'] = amount;
|
|
885
885
|
if (type === 'limit') {
|
|
@@ -1099,7 +1099,7 @@ class independentreserve extends independentreserve$1["default"] {
|
|
|
1099
1099
|
}
|
|
1100
1100
|
const message = auth.join(',');
|
|
1101
1101
|
const signature = this.hmac(this.encode(message), this.encode(this.secret), sha256.sha256);
|
|
1102
|
-
const query =
|
|
1102
|
+
const query = {};
|
|
1103
1103
|
query['apiKey'] = this.apiKey;
|
|
1104
1104
|
query['nonce'] = nonce;
|
|
1105
1105
|
query['signature'] = signature.toUpperCase();
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -1679,7 +1679,7 @@ class kraken extends kraken$1["default"] {
|
|
|
1679
1679
|
const result = this.safeDict(response, 'result');
|
|
1680
1680
|
result['usingCost'] = isUsingCost;
|
|
1681
1681
|
// it's impossible to know if the order was created using cost or base currency
|
|
1682
|
-
//
|
|
1682
|
+
// because kraken only returns something like this: { order: 'buy 10.00000000 LTCUSD @ market' }
|
|
1683
1683
|
// this usingCost flag is used to help the parsing but omited from the order
|
|
1684
1684
|
return this.parseOrder(result);
|
|
1685
1685
|
}
|