ccxt 4.4.8 → 4.4.10
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 +131 -131
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +2 -1
- package/dist/cjs/src/bigone.js +35 -86
- package/dist/cjs/src/binance.js +4 -8
- package/dist/cjs/src/bingx.js +26 -22
- package/dist/cjs/src/bitfinex2.js +5 -16
- package/dist/cjs/src/bitget.js +7 -3
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bitmex.js +4 -3
- package/dist/cjs/src/blofin.js +4 -13
- package/dist/cjs/src/bybit.js +21 -15
- package/dist/cjs/src/coinex.js +15 -1
- package/dist/cjs/src/delta.js +2 -1
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/digifinex.js +15 -1
- package/dist/cjs/src/gate.js +64 -9
- package/dist/cjs/src/hashkey.js +2 -2
- package/dist/cjs/src/hitbtc.js +2 -1
- package/dist/cjs/src/htx.js +21 -2
- package/dist/cjs/src/hyperliquid.js +6 -1
- package/dist/cjs/src/krakenfutures.js +3 -2
- package/dist/cjs/src/kucoin.js +2 -1
- package/dist/cjs/src/kucoinfutures.js +173 -2
- package/dist/cjs/src/mexc.js +1 -0
- package/dist/cjs/src/oceanex.js +83 -3
- package/dist/cjs/src/okx.js +14 -0
- package/dist/cjs/src/oxfun.js +4 -4
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/poloniexfutures.js +11 -0
- package/dist/cjs/src/pro/binance.js +4 -4
- package/dist/cjs/src/pro/deribit.js +43 -1
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/hitbtc.js +122 -48
- package/dist/cjs/src/pro/hollaex.js +5 -0
- package/dist/cjs/src/pro/okx.js +19 -3
- package/dist/cjs/src/pro/p2b.js +35 -1
- package/dist/cjs/src/pro/whitebit.js +31 -0
- package/dist/cjs/src/vertex.js +2 -1
- package/dist/cjs/src/whitebit.js +10 -9
- package/dist/cjs/src/woo.js +42 -17
- package/dist/cjs/src/woofipro.js +15 -2
- package/dist/cjs/src/xt.js +2 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bigone.d.ts +1 -1
- package/js/src/abstract/kucoinfutures.d.ts +5 -0
- package/js/src/abstract/oceanex.d.ts +5 -0
- package/js/src/ascendex.d.ts +3 -21
- package/js/src/ascendex.js +2 -1
- package/js/src/base/Exchange.d.ts +3 -3
- package/js/src/base/types.d.ts +1 -0
- package/js/src/bigone.js +35 -86
- package/js/src/binance.d.ts +4 -40
- package/js/src/binance.js +4 -8
- package/js/src/bingx.d.ts +4 -40
- package/js/src/bingx.js +26 -22
- package/js/src/bitfinex2.d.ts +3 -22
- package/js/src/bitfinex2.js +5 -16
- package/js/src/bitget.d.ts +3 -39
- package/js/src/bitget.js +7 -3
- package/js/src/bitmart.d.ts +3 -39
- package/js/src/bitmart.js +1 -0
- package/js/src/bitmex.d.ts +3 -21
- package/js/src/bitmex.js +4 -3
- package/js/src/blofin.d.ts +3 -39
- package/js/src/blofin.js +4 -13
- package/js/src/bybit.d.ts +3 -21
- package/js/src/bybit.js +21 -15
- package/js/src/coinex.d.ts +5 -40
- package/js/src/coinex.js +15 -1
- package/js/src/delta.d.ts +4 -40
- package/js/src/delta.js +2 -1
- package/js/src/deribit.d.ts +3 -39
- package/js/src/deribit.js +1 -0
- package/js/src/digifinex.d.ts +4 -21
- package/js/src/digifinex.js +15 -1
- package/js/src/gate.d.ts +6 -41
- package/js/src/gate.js +64 -9
- package/js/src/hashkey.d.ts +4 -40
- package/js/src/hashkey.js +2 -2
- package/js/src/hitbtc.d.ts +4 -40
- package/js/src/hitbtc.js +2 -1
- package/js/src/htx.d.ts +5 -40
- package/js/src/htx.js +21 -2
- package/js/src/hyperliquid.js +6 -1
- package/js/src/krakenfutures.d.ts +3 -21
- package/js/src/krakenfutures.js +3 -2
- package/js/src/kucoin.js +2 -1
- package/js/src/kucoinfutures.d.ts +9 -20
- package/js/src/kucoinfutures.js +173 -2
- package/js/src/mexc.d.ts +3 -39
- package/js/src/mexc.js +1 -0
- package/js/src/oceanex.d.ts +9 -1
- package/js/src/oceanex.js +83 -3
- package/js/src/okx.d.ts +4 -39
- package/js/src/okx.js +14 -0
- package/js/src/oxfun.d.ts +3 -21
- package/js/src/oxfun.js +4 -4
- package/js/src/phemex.d.ts +3 -39
- package/js/src/phemex.js +1 -0
- package/js/src/poloniexfutures.d.ts +3 -20
- package/js/src/poloniexfutures.js +11 -0
- package/js/src/pro/binance.js +4 -4
- package/js/src/pro/deribit.d.ts +2 -1
- package/js/src/pro/deribit.js +43 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/hitbtc.d.ts +4 -1
- package/js/src/pro/hitbtc.js +122 -48
- package/js/src/pro/hollaex.js +5 -0
- package/js/src/pro/okx.js +19 -3
- package/js/src/pro/p2b.d.ts +2 -1
- package/js/src/pro/p2b.js +35 -1
- package/js/src/pro/whitebit.d.ts +2 -1
- package/js/src/pro/whitebit.js +31 -0
- package/js/src/vertex.d.ts +4 -40
- package/js/src/vertex.js +2 -1
- package/js/src/whitebit.d.ts +4 -21
- package/js/src/whitebit.js +10 -9
- package/js/src/woo.d.ts +4 -40
- package/js/src/woo.js +42 -17
- package/js/src/woofipro.d.ts +5 -40
- package/js/src/woofipro.js +15 -2
- package/js/src/xt.d.ts +3 -39
- package/js/src/xt.js +2 -0
- package/package.json +1 -1
package/dist/cjs/src/delta.js
CHANGED
|
@@ -2452,7 +2452,7 @@ class delta extends delta$1 {
|
|
|
2452
2452
|
* @see https://docs.delta.exchange/#get-tickers-for-products
|
|
2453
2453
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
2454
2454
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2455
|
-
* @returns {object} a
|
|
2455
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
2456
2456
|
*/
|
|
2457
2457
|
await this.loadMarkets();
|
|
2458
2458
|
symbols = this.marketSymbols(symbols);
|
|
@@ -2576,6 +2576,7 @@ class delta extends delta$1 {
|
|
|
2576
2576
|
'previousFundingRate': undefined,
|
|
2577
2577
|
'previousFundingTimestamp': undefined,
|
|
2578
2578
|
'previousFundingDatetime': undefined,
|
|
2579
|
+
'interval': undefined,
|
|
2579
2580
|
};
|
|
2580
2581
|
}
|
|
2581
2582
|
async addMargin(symbol, amount, params = {}) {
|
package/dist/cjs/src/deribit.js
CHANGED
|
@@ -3137,6 +3137,7 @@ class deribit extends deribit$1 {
|
|
|
3137
3137
|
'previousFundingRate': undefined,
|
|
3138
3138
|
'previousFundingTimestamp': undefined,
|
|
3139
3139
|
'previousFundingDatetime': undefined,
|
|
3140
|
+
'interval': '8h',
|
|
3140
3141
|
};
|
|
3141
3142
|
}
|
|
3142
3143
|
async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
@@ -3263,6 +3263,9 @@ class digifinex extends digifinex$1 {
|
|
|
3263
3263
|
const marketId = this.safeString(contract, 'instrument_id');
|
|
3264
3264
|
const timestamp = this.safeInteger(contract, 'funding_time');
|
|
3265
3265
|
const nextTimestamp = this.safeInteger(contract, 'next_funding_time');
|
|
3266
|
+
const fundingTimeString = this.safeString(contract, 'funding_time');
|
|
3267
|
+
const nextFundingTimeString = this.safeString(contract, 'next_funding_time');
|
|
3268
|
+
const millisecondsInterval = Precise["default"].stringSub(nextFundingTimeString, fundingTimeString);
|
|
3266
3269
|
return {
|
|
3267
3270
|
'info': contract,
|
|
3268
3271
|
'symbol': this.safeSymbol(marketId, market),
|
|
@@ -3275,14 +3278,25 @@ class digifinex extends digifinex$1 {
|
|
|
3275
3278
|
'fundingRate': this.safeNumber(contract, 'funding_rate'),
|
|
3276
3279
|
'fundingTimestamp': timestamp,
|
|
3277
3280
|
'fundingDatetime': this.iso8601(timestamp),
|
|
3278
|
-
'nextFundingRate': this.
|
|
3281
|
+
'nextFundingRate': this.safeNumber(contract, 'next_funding_rate'),
|
|
3279
3282
|
'nextFundingTimestamp': nextTimestamp,
|
|
3280
3283
|
'nextFundingDatetime': this.iso8601(nextTimestamp),
|
|
3281
3284
|
'previousFundingRate': undefined,
|
|
3282
3285
|
'previousFundingTimestamp': undefined,
|
|
3283
3286
|
'previousFundingDatetime': undefined,
|
|
3287
|
+
'interval': this.parseFundingInterval(millisecondsInterval),
|
|
3284
3288
|
};
|
|
3285
3289
|
}
|
|
3290
|
+
parseFundingInterval(interval) {
|
|
3291
|
+
const intervals = {
|
|
3292
|
+
'3600000': '1h',
|
|
3293
|
+
'14400000': '4h',
|
|
3294
|
+
'28800000': '8h',
|
|
3295
|
+
'57600000': '16h',
|
|
3296
|
+
'86400000': '24h',
|
|
3297
|
+
};
|
|
3298
|
+
return this.safeString(intervals, interval, interval);
|
|
3299
|
+
}
|
|
3286
3300
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3287
3301
|
/**
|
|
3288
3302
|
* @method
|
package/dist/cjs/src/gate.js
CHANGED
|
@@ -593,6 +593,8 @@ class gate extends gate$1 {
|
|
|
593
593
|
},
|
|
594
594
|
// copied from gatev2
|
|
595
595
|
'commonCurrencies': {
|
|
596
|
+
'ORT': 'XREATORS',
|
|
597
|
+
'ASS': 'ASSF',
|
|
596
598
|
'88MPH': 'MPH',
|
|
597
599
|
'AXIS': 'AXISDEFI',
|
|
598
600
|
'BIFI': 'BITCOINFILE',
|
|
@@ -627,6 +629,8 @@ class gate extends gate$1 {
|
|
|
627
629
|
},
|
|
628
630
|
'createMarketBuyOrderRequiresPrice': true,
|
|
629
631
|
'networks': {
|
|
632
|
+
'LINEA': 'LINEAETH',
|
|
633
|
+
'KON': 'KONET',
|
|
630
634
|
'AVAXC': 'AVAX_C',
|
|
631
635
|
'BEP20': 'BSC',
|
|
632
636
|
'EOS': 'EOS',
|
|
@@ -1743,7 +1747,7 @@ class gate extends gate$1 {
|
|
|
1743
1747
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
1744
1748
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
1745
1749
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1746
|
-
* @returns {object} a
|
|
1750
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
1747
1751
|
*/
|
|
1748
1752
|
await this.loadMarkets();
|
|
1749
1753
|
symbols = this.marketSymbols(symbols);
|
|
@@ -1847,6 +1851,7 @@ class gate extends gate$1 {
|
|
|
1847
1851
|
const fundingRate = this.safeNumber(contract, 'funding_rate');
|
|
1848
1852
|
const fundingTime = this.safeTimestamp(contract, 'funding_next_apply');
|
|
1849
1853
|
const fundingRateIndicative = this.safeNumber(contract, 'funding_rate_indicative');
|
|
1854
|
+
const fundingInterval = Precise["default"].stringMul('1000', this.safeString(contract, 'funding_interval'));
|
|
1850
1855
|
return {
|
|
1851
1856
|
'info': contract,
|
|
1852
1857
|
'symbol': symbol,
|
|
@@ -1865,8 +1870,19 @@ class gate extends gate$1 {
|
|
|
1865
1870
|
'previousFundingRate': undefined,
|
|
1866
1871
|
'previousFundingTimestamp': undefined,
|
|
1867
1872
|
'previousFundingDatetime': undefined,
|
|
1873
|
+
'interval': this.parseFundingInterval(fundingInterval),
|
|
1868
1874
|
};
|
|
1869
1875
|
}
|
|
1876
|
+
parseFundingInterval(interval) {
|
|
1877
|
+
const intervals = {
|
|
1878
|
+
'3600000': '1h',
|
|
1879
|
+
'14400000': '4h',
|
|
1880
|
+
'28800000': '8h',
|
|
1881
|
+
'57600000': '16h',
|
|
1882
|
+
'86400000': '24h',
|
|
1883
|
+
};
|
|
1884
|
+
return this.safeString(intervals, interval, interval);
|
|
1885
|
+
}
|
|
1870
1886
|
async fetchNetworkDepositAddress(code, params = {}) {
|
|
1871
1887
|
await this.loadMarkets();
|
|
1872
1888
|
const currency = this.currency(code);
|
|
@@ -4709,6 +4725,7 @@ class gate extends gate$1 {
|
|
|
4709
4725
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
|
|
4710
4726
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
|
|
4711
4727
|
* @see https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
|
|
4728
|
+
* @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-by-time-range
|
|
4712
4729
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4713
4730
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4714
4731
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -4716,11 +4733,40 @@ class gate extends gate$1 {
|
|
|
4716
4733
|
* @param {bool} [params.stop] true for fetching stop orders
|
|
4717
4734
|
* @param {string} [params.type] spot, swap or future, if not provided this.options['defaultType'] is used
|
|
4718
4735
|
* @param {string} [params.marginMode] 'cross' or 'isolated' - marginMode for margin trading if not provided this.options['defaultMarginMode'] is used
|
|
4736
|
+
* @param {boolean} [params.historical] *swap only* true for using historical endpoint
|
|
4719
4737
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4720
4738
|
*/
|
|
4721
|
-
|
|
4739
|
+
await this.loadMarkets();
|
|
4740
|
+
const until = this.safeInteger(params, 'until');
|
|
4741
|
+
let market = undefined;
|
|
4742
|
+
if (symbol !== undefined) {
|
|
4743
|
+
market = this.market(symbol);
|
|
4744
|
+
symbol = market['symbol'];
|
|
4745
|
+
}
|
|
4746
|
+
const res = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
|
|
4747
|
+
const type = this.safeString(res, 0);
|
|
4748
|
+
let useHistorical = false;
|
|
4749
|
+
[useHistorical, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'historical', false);
|
|
4750
|
+
if (!useHistorical && ((since === undefined && until === undefined) || (type !== 'swap'))) {
|
|
4751
|
+
return await this.fetchOrdersByStatus('finished', symbol, since, limit, params);
|
|
4752
|
+
}
|
|
4753
|
+
params = this.omit(params, 'type');
|
|
4754
|
+
let request = {};
|
|
4755
|
+
[request, params] = this.prepareRequest(market, type, params);
|
|
4756
|
+
if (since !== undefined) {
|
|
4757
|
+
request['from'] = this.parseToInt(since / 1000);
|
|
4758
|
+
}
|
|
4759
|
+
if (until !== undefined) {
|
|
4760
|
+
params = this.omit(params, 'until');
|
|
4761
|
+
request['to'] = this.parseToInt(until / 1000);
|
|
4762
|
+
}
|
|
4763
|
+
if (limit !== undefined) {
|
|
4764
|
+
request['limit'] = limit;
|
|
4765
|
+
}
|
|
4766
|
+
const response = await this.privateFuturesGetSettleOrdersTimerange(this.extend(request, params));
|
|
4767
|
+
return this.parseOrders(response, market, since, limit);
|
|
4722
4768
|
}
|
|
4723
|
-
|
|
4769
|
+
prepareOrdersByStatusRequest(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4724
4770
|
let market = undefined;
|
|
4725
4771
|
if (symbol !== undefined) {
|
|
4726
4772
|
market = this.market(symbol);
|
|
@@ -4728,9 +4774,11 @@ class gate extends gate$1 {
|
|
|
4728
4774
|
}
|
|
4729
4775
|
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
4730
4776
|
params = this.omit(params, ['stop', 'trigger']);
|
|
4731
|
-
|
|
4777
|
+
let type = undefined;
|
|
4778
|
+
[type, params] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
4732
4779
|
const spot = (type === 'spot') || (type === 'margin');
|
|
4733
|
-
|
|
4780
|
+
let request = {};
|
|
4781
|
+
[request, params] = spot ? this.multiOrderSpotPrepareRequest(market, stop, params) : this.prepareRequest(market, type, params);
|
|
4734
4782
|
if (status === 'closed') {
|
|
4735
4783
|
status = 'finished';
|
|
4736
4784
|
}
|
|
@@ -4738,10 +4786,17 @@ class gate extends gate$1 {
|
|
|
4738
4786
|
if (limit !== undefined) {
|
|
4739
4787
|
request['limit'] = limit;
|
|
4740
4788
|
}
|
|
4741
|
-
if (
|
|
4742
|
-
|
|
4789
|
+
if (spot) {
|
|
4790
|
+
if (since !== undefined) {
|
|
4791
|
+
request['from'] = this.parseToInt(since / 1000);
|
|
4792
|
+
}
|
|
4793
|
+
const until = this.safeInteger(params, 'until');
|
|
4794
|
+
if (until !== undefined) {
|
|
4795
|
+
params = this.omit(params, 'until');
|
|
4796
|
+
request['to'] = this.parseToInt(until / 1000);
|
|
4797
|
+
}
|
|
4743
4798
|
}
|
|
4744
|
-
const [lastId, finalParams] = this.handleParamString2(
|
|
4799
|
+
const [lastId, finalParams] = this.handleParamString2(params, 'lastId', 'last_id');
|
|
4745
4800
|
if (lastId !== undefined) {
|
|
4746
4801
|
request['last_id'] = lastId;
|
|
4747
4802
|
}
|
|
@@ -4759,7 +4814,7 @@ class gate extends gate$1 {
|
|
|
4759
4814
|
const res = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
|
|
4760
4815
|
const type = this.safeString(res, 0);
|
|
4761
4816
|
params['type'] = type;
|
|
4762
|
-
const [request, requestParams] = this.
|
|
4817
|
+
const [request, requestParams] = this.prepareOrdersByStatusRequest(status, symbol, since, limit, params);
|
|
4763
4818
|
const spot = (type === 'spot') || (type === 'margin');
|
|
4764
4819
|
const openSpotOrders = spot && (status === 'open') && !stop;
|
|
4765
4820
|
let response = undefined;
|
package/dist/cjs/src/hashkey.js
CHANGED
|
@@ -3739,7 +3739,7 @@ class hashkey extends hashkey$1 {
|
|
|
3739
3739
|
* @see https://hashkeyglobal-apidoc.readme.io/reference/get-futures-funding-rate
|
|
3740
3740
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
3741
3741
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3742
|
-
* @returns {object} a
|
|
3742
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
3743
3743
|
*/
|
|
3744
3744
|
await this.loadMarkets();
|
|
3745
3745
|
symbols = this.marketSymbols(symbols);
|
|
@@ -3758,7 +3758,6 @@ class hashkey extends hashkey$1 {
|
|
|
3758
3758
|
}
|
|
3759
3759
|
parseFundingRate(contract, market = undefined) {
|
|
3760
3760
|
//
|
|
3761
|
-
// fetchFundingRates
|
|
3762
3761
|
// {
|
|
3763
3762
|
// "symbol": "ETHUSDT-PERPETUAL",
|
|
3764
3763
|
// "rate": "0.0001",
|
|
@@ -3787,6 +3786,7 @@ class hashkey extends hashkey$1 {
|
|
|
3787
3786
|
'previousFundingRate': undefined,
|
|
3788
3787
|
'previousFundingTimestamp': undefined,
|
|
3789
3788
|
'previousFundingDatetime': undefined,
|
|
3789
|
+
'interval': undefined,
|
|
3790
3790
|
};
|
|
3791
3791
|
}
|
|
3792
3792
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
package/dist/cjs/src/hitbtc.js
CHANGED
|
@@ -2738,7 +2738,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
2738
2738
|
* @see https://api.hitbtc.com/#futures-info
|
|
2739
2739
|
* @param {string[]} symbols unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
|
|
2740
2740
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2741
|
-
* @returns {object}
|
|
2741
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2742
2742
|
*/
|
|
2743
2743
|
await this.loadMarkets();
|
|
2744
2744
|
let market = undefined;
|
|
@@ -3234,6 +3234,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
3234
3234
|
'previousFundingRate': undefined,
|
|
3235
3235
|
'previousFundingTimestamp': undefined,
|
|
3236
3236
|
'previousFundingDatetime': undefined,
|
|
3237
|
+
'interval': undefined,
|
|
3237
3238
|
};
|
|
3238
3239
|
}
|
|
3239
3240
|
async modifyMarginHelper(symbol, amount, type, params = {}) {
|
package/dist/cjs/src/htx.js
CHANGED
|
@@ -184,7 +184,7 @@ class htx extends htx$1 {
|
|
|
184
184
|
},
|
|
185
185
|
'www': 'https://www.huobi.com',
|
|
186
186
|
'referral': {
|
|
187
|
-
'url': 'https://www.
|
|
187
|
+
'url': 'https://www.htx.com.vc/invite/en-us/1h?invite_code=6rmm2223',
|
|
188
188
|
'discount': 0.15,
|
|
189
189
|
},
|
|
190
190
|
'doc': [
|
|
@@ -3124,6 +3124,7 @@ class htx extends htx$1 {
|
|
|
3124
3124
|
* @method
|
|
3125
3125
|
* @name htx#fetchAccounts
|
|
3126
3126
|
* @description fetch all the accounts associated with a profile
|
|
3127
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user
|
|
3127
3128
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3128
3129
|
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
|
|
3129
3130
|
*/
|
|
@@ -3197,6 +3198,7 @@ class htx extends htx$1 {
|
|
|
3197
3198
|
* @method
|
|
3198
3199
|
* @name htx#fetchCurrencies
|
|
3199
3200
|
* @description fetches all available currencies on an exchange
|
|
3201
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#apiv2-currency-amp-chains
|
|
3200
3202
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3201
3203
|
* @returns {object} an associative dictionary of currencies
|
|
3202
3204
|
*/
|
|
@@ -6995,6 +6997,9 @@ class htx extends htx$1 {
|
|
|
6995
6997
|
const nextFundingRate = this.safeNumber(contract, 'estimated_rate');
|
|
6996
6998
|
const fundingTimestamp = this.safeInteger(contract, 'funding_time');
|
|
6997
6999
|
const nextFundingTimestamp = this.safeInteger(contract, 'next_funding_time');
|
|
7000
|
+
const fundingTimeString = this.safeString(contract, 'funding_time');
|
|
7001
|
+
const nextFundingTimeString = this.safeString(contract, 'next_funding_time');
|
|
7002
|
+
const millisecondsInterval = Precise["default"].stringSub(nextFundingTimeString, fundingTimeString);
|
|
6998
7003
|
const marketId = this.safeString(contract, 'contract_code');
|
|
6999
7004
|
const symbol = this.safeSymbol(marketId, market);
|
|
7000
7005
|
return {
|
|
@@ -7015,8 +7020,19 @@ class htx extends htx$1 {
|
|
|
7015
7020
|
'previousFundingRate': undefined,
|
|
7016
7021
|
'previousFundingTimestamp': undefined,
|
|
7017
7022
|
'previousFundingDatetime': undefined,
|
|
7023
|
+
'interval': this.parseFundingInterval(millisecondsInterval),
|
|
7018
7024
|
};
|
|
7019
7025
|
}
|
|
7026
|
+
parseFundingInterval(interval) {
|
|
7027
|
+
const intervals = {
|
|
7028
|
+
'3600000': '1h',
|
|
7029
|
+
'14400000': '4h',
|
|
7030
|
+
'28800000': '8h',
|
|
7031
|
+
'57600000': '16h',
|
|
7032
|
+
'86400000': '24h',
|
|
7033
|
+
};
|
|
7034
|
+
return this.safeString(intervals, interval, interval);
|
|
7035
|
+
}
|
|
7020
7036
|
async fetchFundingRate(symbol, params = {}) {
|
|
7021
7037
|
/**
|
|
7022
7038
|
* @method
|
|
@@ -7066,7 +7082,7 @@ class htx extends htx$1 {
|
|
|
7066
7082
|
* @description fetch the funding rate for multiple markets
|
|
7067
7083
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
7068
7084
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
7069
|
-
* @returns {object} a
|
|
7085
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
7070
7086
|
*/
|
|
7071
7087
|
await this.loadMarkets();
|
|
7072
7088
|
symbols = this.marketSymbols(symbols);
|
|
@@ -8833,6 +8849,9 @@ class htx extends htx$1 {
|
|
|
8833
8849
|
* @method
|
|
8834
8850
|
* @name htx#fetchSettlementHistory
|
|
8835
8851
|
* @description Fetches historical settlement records
|
|
8852
|
+
* @see https://huobiapi.github.io/docs/dm/v1/en/#query-historical-settlement-records-of-the-platform-interface
|
|
8853
|
+
* @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#query-historical-settlement-records-of-the-platform-interface
|
|
8854
|
+
* @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#general-query-historical-settlement-records-of-the-platform-interface
|
|
8836
8855
|
* @param {string} symbol unified symbol of the market to fetch the settlement history for
|
|
8837
8856
|
* @param {int} [since] timestamp in ms, value range = current time - 90 days,default = current time - 90 days
|
|
8838
8857
|
* @param {int} [limit] page items, default 20, shall not exceed 50
|
|
@@ -2035,6 +2035,7 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2035
2035
|
// "crossed": true,
|
|
2036
2036
|
// "dir": "Close Long",
|
|
2037
2037
|
// "fee": "0.050062",
|
|
2038
|
+
// "feeToken": "USDC",
|
|
2038
2039
|
// "hash": "0x09d77c96791e98b5775a04092584ab010d009445119c71e4005c0d634ea322bc",
|
|
2039
2040
|
// "liquidationMarkPx": null,
|
|
2040
2041
|
// "oid": 3929354691,
|
|
@@ -2094,7 +2095,11 @@ class hyperliquid extends hyperliquid$1 {
|
|
|
2094
2095
|
'price': price,
|
|
2095
2096
|
'amount': amount,
|
|
2096
2097
|
'cost': undefined,
|
|
2097
|
-
'fee': {
|
|
2098
|
+
'fee': {
|
|
2099
|
+
'cost': fee,
|
|
2100
|
+
'currency': this.safeString(trade, 'feeToken'),
|
|
2101
|
+
'rate': undefined,
|
|
2102
|
+
},
|
|
2098
2103
|
}, market);
|
|
2099
2104
|
}
|
|
2100
2105
|
async fetchPosition(symbol, params = {}) {
|
|
@@ -2162,8 +2162,8 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
2162
2162
|
/**
|
|
2163
2163
|
* @method
|
|
2164
2164
|
* @name krakenfutures#fetchFundingRates
|
|
2165
|
+
* @description fetch the current funding rates for multiple markets
|
|
2165
2166
|
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
|
|
2166
|
-
* @description fetch the current funding rates
|
|
2167
2167
|
* @param {string[]} symbols unified market symbols
|
|
2168
2168
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2169
2169
|
* @returns {Order[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -2171,7 +2171,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
2171
2171
|
await this.loadMarkets();
|
|
2172
2172
|
const marketIds = this.marketIds(symbols);
|
|
2173
2173
|
const response = await this.publicGetTickers(params);
|
|
2174
|
-
const tickers = this.
|
|
2174
|
+
const tickers = this.safeList(response, 'tickers', []);
|
|
2175
2175
|
const fundingRates = [];
|
|
2176
2176
|
for (let i = 0; i < tickers.length; i++) {
|
|
2177
2177
|
const entry = tickers[i];
|
|
@@ -2241,6 +2241,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
2241
2241
|
'previousFundingRate': undefined,
|
|
2242
2242
|
'previousFundingTimestamp': undefined,
|
|
2243
2243
|
'previousFundingDatetime': undefined,
|
|
2244
|
+
'interval': undefined,
|
|
2244
2245
|
};
|
|
2245
2246
|
}
|
|
2246
2247
|
async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
package/dist/cjs/src/kucoin.js
CHANGED
|
@@ -67,9 +67,10 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
67
67
|
'fetchIsolatedBorrowRates': false,
|
|
68
68
|
'fetchL3OrderBook': true,
|
|
69
69
|
'fetchLedger': true,
|
|
70
|
+
'fetchLeverage': true,
|
|
70
71
|
'fetchLeverageTiers': false,
|
|
71
72
|
'fetchMarginAdjustmentHistory': false,
|
|
72
|
-
'fetchMarginMode':
|
|
73
|
+
'fetchMarginMode': true,
|
|
73
74
|
'fetchMarketLeverageTiers': true,
|
|
74
75
|
'fetchMarkets': true,
|
|
75
76
|
'fetchMarkOHLCV': false,
|
|
@@ -93,7 +94,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
93
94
|
'fetchTransactionFee': false,
|
|
94
95
|
'fetchWithdrawals': true,
|
|
95
96
|
'setLeverage': false,
|
|
96
|
-
'setMarginMode':
|
|
97
|
+
'setMarginMode': true,
|
|
97
98
|
'transfer': true,
|
|
98
99
|
'withdraw': undefined,
|
|
99
100
|
},
|
|
@@ -170,12 +171,15 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
170
171
|
'trade-fees': 1,
|
|
171
172
|
'history-positions': 1,
|
|
172
173
|
'getMaxOpenSize': 1,
|
|
174
|
+
'getCrossUserLeverage': 1,
|
|
175
|
+
'position/getMarginMode': 1,
|
|
173
176
|
},
|
|
174
177
|
'post': {
|
|
175
178
|
'withdrawals': 1,
|
|
176
179
|
'transfer-out': 1,
|
|
177
180
|
'transfer-in': 1,
|
|
178
181
|
'orders': 1.33,
|
|
182
|
+
'st-orders': 1.33,
|
|
179
183
|
'orders/test': 1.33,
|
|
180
184
|
'position/margin/auto-deposit-status': 1,
|
|
181
185
|
'position/margin/deposit-margin': 1,
|
|
@@ -183,6 +187,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
183
187
|
'bullet-private': 1,
|
|
184
188
|
'sub/api-key': 1,
|
|
185
189
|
'sub/api-key/update': 1,
|
|
190
|
+
'changeCrossUserLeverage': 1,
|
|
191
|
+
'position/changeMarginMode': 1,
|
|
186
192
|
},
|
|
187
193
|
'delete': {
|
|
188
194
|
'withdrawals/{withdrawalId}': 1,
|
|
@@ -317,9 +323,13 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
317
323
|
'futuresPrivate': {
|
|
318
324
|
'GET': {
|
|
319
325
|
'getMaxOpenSize': 'v2',
|
|
326
|
+
'getCrossUserLeverage': 'v2',
|
|
327
|
+
'position/getMarginMode': 'v2',
|
|
320
328
|
},
|
|
321
329
|
'POST': {
|
|
322
330
|
'transfer-out': 'v2',
|
|
331
|
+
'changeCrossUserLeverage': 'v2',
|
|
332
|
+
'position/changeMarginMode': 'v2',
|
|
323
333
|
},
|
|
324
334
|
},
|
|
325
335
|
'futuresPublic': {
|
|
@@ -2191,8 +2201,19 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
2191
2201
|
'previousFundingRate': undefined,
|
|
2192
2202
|
'previousFundingTimestamp': undefined,
|
|
2193
2203
|
'previousFundingDatetime': undefined,
|
|
2204
|
+
'interval': this.parseFundingInterval(this.safeString(data, 'granularity')),
|
|
2194
2205
|
};
|
|
2195
2206
|
}
|
|
2207
|
+
parseFundingInterval(interval) {
|
|
2208
|
+
const intervals = {
|
|
2209
|
+
'3600000': '1h',
|
|
2210
|
+
'14400000': '4h',
|
|
2211
|
+
'28800000': '8h',
|
|
2212
|
+
'57600000': '16h',
|
|
2213
|
+
'86400000': '24h',
|
|
2214
|
+
};
|
|
2215
|
+
return this.safeString(intervals, interval, interval);
|
|
2216
|
+
}
|
|
2196
2217
|
parseBalance(response) {
|
|
2197
2218
|
const result = {
|
|
2198
2219
|
'info': response,
|
|
@@ -2878,6 +2899,156 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
2878
2899
|
'tierBased': true,
|
|
2879
2900
|
};
|
|
2880
2901
|
}
|
|
2902
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
2903
|
+
/**
|
|
2904
|
+
* @method
|
|
2905
|
+
* @name kucoinfutures#fetchMarginMode
|
|
2906
|
+
* @description fetches the margin mode of a trading pair
|
|
2907
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/get-margin-mode
|
|
2908
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
2909
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2910
|
+
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
2911
|
+
*/
|
|
2912
|
+
await this.loadMarkets();
|
|
2913
|
+
const market = this.market(symbol);
|
|
2914
|
+
const request = {
|
|
2915
|
+
'symbol': market['id'],
|
|
2916
|
+
};
|
|
2917
|
+
const response = await this.futuresPrivateGetPositionGetMarginMode(this.extend(request, params));
|
|
2918
|
+
//
|
|
2919
|
+
// {
|
|
2920
|
+
// "code": "200000",
|
|
2921
|
+
// "data": {
|
|
2922
|
+
// "symbol": "XBTUSDTM",
|
|
2923
|
+
// "marginMode": "ISOLATED"
|
|
2924
|
+
// }
|
|
2925
|
+
// }
|
|
2926
|
+
//
|
|
2927
|
+
const data = this.safeDict(response, 'data', {});
|
|
2928
|
+
return this.parseMarginMode(data, market);
|
|
2929
|
+
}
|
|
2930
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
2931
|
+
let marginType = this.safeString(marginMode, 'marginMode');
|
|
2932
|
+
marginType = (marginType === 'ISOLATED') ? 'isolated' : 'cross';
|
|
2933
|
+
return {
|
|
2934
|
+
'info': marginMode,
|
|
2935
|
+
'symbol': market['symbol'],
|
|
2936
|
+
'marginMode': marginType,
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2939
|
+
async setMarginMode(marginMode, symbol = undefined, params = {}) {
|
|
2940
|
+
/**
|
|
2941
|
+
* @method
|
|
2942
|
+
* @name kucoinfutures#setMarginMode
|
|
2943
|
+
* @description set margin mode to 'cross' or 'isolated'
|
|
2944
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/modify-margin-mode
|
|
2945
|
+
* @param {string} marginMode 'cross' or 'isolated'
|
|
2946
|
+
* @param {string} symbol unified market symbol
|
|
2947
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2948
|
+
* @returns {object} response from the exchange
|
|
2949
|
+
*/
|
|
2950
|
+
if (symbol === undefined) {
|
|
2951
|
+
throw new errors.ArgumentsRequired(this.id + ' setMarginMode() requires a symbol argument');
|
|
2952
|
+
}
|
|
2953
|
+
this.checkRequiredArgument('setMarginMode', marginMode, 'marginMode', ['cross', 'isolated']);
|
|
2954
|
+
await this.loadMarkets();
|
|
2955
|
+
const market = this.market(symbol);
|
|
2956
|
+
const request = {
|
|
2957
|
+
'symbol': market['id'],
|
|
2958
|
+
'marginMode': marginMode.toUpperCase(),
|
|
2959
|
+
};
|
|
2960
|
+
const response = await this.futuresPrivatePostPositionChangeMarginMode(this.extend(request, params));
|
|
2961
|
+
//
|
|
2962
|
+
// {
|
|
2963
|
+
// "code": "200000",
|
|
2964
|
+
// "data": {
|
|
2965
|
+
// "symbol": "XBTUSDTM",
|
|
2966
|
+
// "marginMode": "ISOLATED"
|
|
2967
|
+
// }
|
|
2968
|
+
// }
|
|
2969
|
+
//
|
|
2970
|
+
const data = this.safeDict(response, 'data', {});
|
|
2971
|
+
return this.parseMarginMode(data, market);
|
|
2972
|
+
}
|
|
2973
|
+
async fetchLeverage(symbol, params = {}) {
|
|
2974
|
+
/**
|
|
2975
|
+
* @method
|
|
2976
|
+
* @name kucoin#fetchLeverage
|
|
2977
|
+
* @description fetch the set leverage for a market
|
|
2978
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/get-cross-margin-leverage
|
|
2979
|
+
* @param {string} symbol unified market symbol
|
|
2980
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2981
|
+
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
|
|
2982
|
+
*/
|
|
2983
|
+
let marginMode = undefined;
|
|
2984
|
+
[marginMode, params] = this.handleMarginModeAndParams(symbol, params);
|
|
2985
|
+
if (marginMode !== 'cross') {
|
|
2986
|
+
throw new errors.NotSupported(this.id + ' fetchLeverage() currently supports only params["marginMode"] = "cross"');
|
|
2987
|
+
}
|
|
2988
|
+
await this.loadMarkets();
|
|
2989
|
+
const market = this.market(symbol);
|
|
2990
|
+
const request = {
|
|
2991
|
+
'symbol': market['id'],
|
|
2992
|
+
};
|
|
2993
|
+
const response = await this.futuresPrivateGetGetCrossUserLeverage(this.extend(request, params));
|
|
2994
|
+
//
|
|
2995
|
+
// {
|
|
2996
|
+
// "code": "200000",
|
|
2997
|
+
// "data": {
|
|
2998
|
+
// "symbol": "XBTUSDTM",
|
|
2999
|
+
// "leverage": "3"
|
|
3000
|
+
// }
|
|
3001
|
+
// }
|
|
3002
|
+
//
|
|
3003
|
+
const data = this.safeDict(response, 'data', {});
|
|
3004
|
+
const parsed = this.parseLeverage(data, market);
|
|
3005
|
+
return this.extend(parsed, {
|
|
3006
|
+
'marginMode': marginMode,
|
|
3007
|
+
});
|
|
3008
|
+
}
|
|
3009
|
+
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
3010
|
+
/**
|
|
3011
|
+
* @method
|
|
3012
|
+
* @name kucoinfutures#setLeverage
|
|
3013
|
+
* @description set the level of leverage for a market
|
|
3014
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/positions/modify-cross-margin-leverage
|
|
3015
|
+
* @param {float} leverage the rate of leverage
|
|
3016
|
+
* @param {string} symbol unified market symbol
|
|
3017
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3018
|
+
* @returns {object} response from the exchange
|
|
3019
|
+
*/
|
|
3020
|
+
let marginMode = undefined;
|
|
3021
|
+
[marginMode, params] = this.handleMarginModeAndParams(symbol, params);
|
|
3022
|
+
if (marginMode !== 'cross') {
|
|
3023
|
+
throw new errors.NotSupported(this.id + ' setLeverage() currently supports only params["marginMode"] = "cross"');
|
|
3024
|
+
}
|
|
3025
|
+
await this.loadMarkets();
|
|
3026
|
+
const market = this.market(symbol);
|
|
3027
|
+
const request = {
|
|
3028
|
+
'symbol': market['id'],
|
|
3029
|
+
'leverage': leverage.toString(),
|
|
3030
|
+
};
|
|
3031
|
+
const response = await this.futuresPrivatePostChangeCrossUserLeverage(this.extend(request, params));
|
|
3032
|
+
//
|
|
3033
|
+
// {
|
|
3034
|
+
// "code": "200000",
|
|
3035
|
+
// "data": true
|
|
3036
|
+
// }
|
|
3037
|
+
//
|
|
3038
|
+
return this.parseLeverage(response, market);
|
|
3039
|
+
}
|
|
3040
|
+
parseLeverage(leverage, market = undefined) {
|
|
3041
|
+
const marketId = this.safeString(leverage, 'symbol');
|
|
3042
|
+
market = this.safeMarket(marketId, market);
|
|
3043
|
+
const leverageNum = this.safeInteger(leverage, 'leverage');
|
|
3044
|
+
return {
|
|
3045
|
+
'info': leverage,
|
|
3046
|
+
'symbol': market['symbol'],
|
|
3047
|
+
'marginMode': undefined,
|
|
3048
|
+
'longLeverage': leverageNum,
|
|
3049
|
+
'shortLeverage': leverageNum,
|
|
3050
|
+
};
|
|
3051
|
+
}
|
|
2881
3052
|
}
|
|
2882
3053
|
|
|
2883
3054
|
module.exports = kucoinfutures;
|
package/dist/cjs/src/mexc.js
CHANGED
|
@@ -4213,6 +4213,7 @@ class mexc extends mexc$1 {
|
|
|
4213
4213
|
'previousFundingRate': undefined,
|
|
4214
4214
|
'previousFundingTimestamp': undefined,
|
|
4215
4215
|
'previousFundingDatetime': undefined,
|
|
4216
|
+
'interval': undefined,
|
|
4216
4217
|
};
|
|
4217
4218
|
}
|
|
4218
4219
|
async fetchFundingRate(symbol, params = {}) {
|