ccxt 4.4.13 → 4.4.15
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 +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +48 -2
- package/dist/cjs/src/binance.js +76 -11
- package/dist/cjs/src/bitget.js +112 -3
- package/dist/cjs/src/bitrue.js +1 -9
- package/dist/cjs/src/bitvavo.js +1 -3
- package/dist/cjs/src/coinex.js +15 -1
- package/dist/cjs/src/cryptocom.js +1 -0
- package/dist/cjs/src/digifinex.js +15 -1
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/huobijp.js +1 -3
- package/dist/cjs/src/kucoin.js +40 -1
- package/dist/cjs/src/kucoinfutures.js +59 -4
- package/dist/cjs/src/mexc.js +64 -8
- package/dist/cjs/src/okx.js +14 -0
- package/dist/cjs/src/onetrading.js +2 -2
- package/dist/cjs/src/poloniexfutures.js +37 -11
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/okx.js +43 -0
- package/dist/cjs/src/pro/upbit.js +46 -0
- package/dist/cjs/src/pro/vertex.js +11 -0
- package/dist/cjs/src/vertex.js +11 -0
- package/dist/cjs/src/woo.js +14 -0
- package/dist/cjs/src/woofipro.js +14 -0
- package/dist/cjs/src/xt.js +14 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/cryptocom.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +6 -0
- package/js/src/base/Exchange.js +48 -2
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +76 -11
- package/js/src/bitget.d.ts +2 -0
- package/js/src/bitget.js +112 -3
- package/js/src/bitrue.d.ts +0 -1
- package/js/src/bitrue.js +1 -9
- package/js/src/bitvavo.d.ts +0 -1
- package/js/src/bitvavo.js +1 -3
- package/js/src/coinex.d.ts +1 -0
- package/js/src/coinex.js +15 -1
- package/js/src/cryptocom.js +1 -0
- package/js/src/digifinex.d.ts +1 -0
- package/js/src/digifinex.js +15 -1
- package/js/src/htx.js +1 -1
- package/js/src/huobijp.d.ts +0 -1
- package/js/src/huobijp.js +1 -3
- package/js/src/kucoin.d.ts +2 -0
- package/js/src/kucoin.js +40 -1
- package/js/src/kucoinfutures.d.ts +3 -0
- package/js/src/kucoinfutures.js +59 -4
- package/js/src/mexc.d.ts +1 -0
- package/js/src/mexc.js +64 -8
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +14 -0
- package/js/src/onetrading.js +2 -2
- package/js/src/poloniexfutures.d.ts +2 -0
- package/js/src/poloniexfutures.js +37 -11
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/okx.d.ts +2 -0
- package/js/src/pro/okx.js +43 -0
- package/js/src/pro/upbit.d.ts +3 -1
- package/js/src/pro/upbit.js +46 -0
- package/js/src/pro/vertex.js +11 -0
- package/js/src/vertex.js +11 -0
- package/js/src/woo.d.ts +1 -0
- package/js/src/woo.js +14 -0
- package/js/src/woofipro.d.ts +1 -0
- package/js/src/woofipro.js +14 -0
- package/js/src/xt.d.ts +1 -0
- package/js/src/xt.js +14 -0
- package/package.json +1 -1
|
@@ -60,6 +60,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
60
60
|
'fetchDepositWithdrawFee': false,
|
|
61
61
|
'fetchDepositWithdrawFees': false,
|
|
62
62
|
'fetchFundingHistory': true,
|
|
63
|
+
'fetchFundingInterval': true,
|
|
64
|
+
'fetchFundingIntervals': false,
|
|
63
65
|
'fetchFundingRate': true,
|
|
64
66
|
'fetchFundingRateHistory': true,
|
|
65
67
|
'fetchIndexOHLCV': false,
|
|
@@ -74,6 +76,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
74
76
|
'fetchMarketLeverageTiers': true,
|
|
75
77
|
'fetchMarkets': true,
|
|
76
78
|
'fetchMarkOHLCV': false,
|
|
79
|
+
'fetchMarkPrice': true,
|
|
77
80
|
'fetchMyTrades': true,
|
|
78
81
|
'fetchOHLCV': true,
|
|
79
82
|
'fetchOpenOrders': true,
|
|
@@ -775,6 +778,25 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
775
778
|
//
|
|
776
779
|
return this.parseTicker(response['data'], market);
|
|
777
780
|
}
|
|
781
|
+
async fetchMarkPrice(symbol, params = {}) {
|
|
782
|
+
/**
|
|
783
|
+
* @method
|
|
784
|
+
* @name kucoinfutures#fetchMarkPrice
|
|
785
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
786
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-current-mark-price
|
|
787
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
788
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
789
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
790
|
+
*/
|
|
791
|
+
await this.loadMarkets();
|
|
792
|
+
const market = this.market(symbol);
|
|
793
|
+
const request = {
|
|
794
|
+
'symbol': market['id'],
|
|
795
|
+
};
|
|
796
|
+
const response = await this.futuresPublicGetMarkPriceSymbolCurrent(this.extend(request, params));
|
|
797
|
+
//
|
|
798
|
+
return this.parseTicker(response['data'], market);
|
|
799
|
+
}
|
|
778
800
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
779
801
|
/**
|
|
780
802
|
* @method
|
|
@@ -864,6 +886,14 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
864
886
|
return this.filterByArrayTickers(tickers, 'symbol', symbols);
|
|
865
887
|
}
|
|
866
888
|
parseTicker(ticker, market = undefined) {
|
|
889
|
+
//
|
|
890
|
+
// {
|
|
891
|
+
// "symbol": "LTCUSDTM",
|
|
892
|
+
// "granularity": 1000,
|
|
893
|
+
// "timePoint": 1727967339000,
|
|
894
|
+
// "value": 62.37, mark price
|
|
895
|
+
// "indexPrice": 62.37
|
|
896
|
+
// }
|
|
867
897
|
//
|
|
868
898
|
// {
|
|
869
899
|
// "code": "200000",
|
|
@@ -966,7 +996,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
966
996
|
'average': undefined,
|
|
967
997
|
'baseVolume': this.safeString(ticker, 'volumeOf24h'),
|
|
968
998
|
'quoteVolume': this.safeString(ticker, 'turnoverOf24h'),
|
|
969
|
-
'markPrice': this.
|
|
999
|
+
'markPrice': this.safeString2(ticker, 'markPrice', 'value'),
|
|
970
1000
|
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
971
1001
|
'info': ticker,
|
|
972
1002
|
}, market);
|
|
@@ -2182,12 +2212,37 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
2182
2212
|
// },
|
|
2183
2213
|
// }
|
|
2184
2214
|
//
|
|
2185
|
-
const data = this.
|
|
2186
|
-
const fundingTimestamp = this.safeInteger(data, 'timePoint');
|
|
2215
|
+
const data = this.safeDict(response, 'data', {});
|
|
2187
2216
|
// the website displayes the previous funding rate as "funding rate"
|
|
2217
|
+
return this.parseFundingRate(data, market);
|
|
2218
|
+
}
|
|
2219
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
2220
|
+
/**
|
|
2221
|
+
* @method
|
|
2222
|
+
* @name kucoinfutures#fetchFundingInterval
|
|
2223
|
+
* @description fetch the current funding rate interval
|
|
2224
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate
|
|
2225
|
+
* @param {string} symbol unified market symbol
|
|
2226
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2227
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2228
|
+
*/
|
|
2229
|
+
return await this.fetchFundingRate(symbol, params);
|
|
2230
|
+
}
|
|
2231
|
+
parseFundingRate(data, market = undefined) {
|
|
2232
|
+
//
|
|
2233
|
+
// {
|
|
2234
|
+
// "symbol": ".ETHUSDTMFPI8H",
|
|
2235
|
+
// "granularity": 28800000,
|
|
2236
|
+
// "timePoint": 1637380800000,
|
|
2237
|
+
// "value": 0.0001,
|
|
2238
|
+
// "predictedValue": 0.0001,
|
|
2239
|
+
// }
|
|
2240
|
+
//
|
|
2241
|
+
const fundingTimestamp = this.safeInteger(data, 'timePoint');
|
|
2242
|
+
const marketId = this.safeString(data, 'symbol');
|
|
2188
2243
|
return {
|
|
2189
2244
|
'info': data,
|
|
2190
|
-
'symbol': market
|
|
2245
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
2191
2246
|
'markPrice': undefined,
|
|
2192
2247
|
'indexPrice': undefined,
|
|
2193
2248
|
'interestRate': undefined,
|
package/dist/cjs/src/mexc.js
CHANGED
|
@@ -75,6 +75,8 @@ class mexc extends mexc$1 {
|
|
|
75
75
|
'fetchDepositWithdrawFee': 'emulated',
|
|
76
76
|
'fetchDepositWithdrawFees': true,
|
|
77
77
|
'fetchFundingHistory': true,
|
|
78
|
+
'fetchFundingInterval': true,
|
|
79
|
+
'fetchFundingIntervals': false,
|
|
78
80
|
'fetchFundingRate': true,
|
|
79
81
|
'fetchFundingRateHistory': true,
|
|
80
82
|
'fetchFundingRates': undefined,
|
|
@@ -2620,6 +2622,7 @@ class mexc extends mexc$1 {
|
|
|
2620
2622
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
2621
2623
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
2622
2624
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2625
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
2623
2626
|
* @param {string} [params.marginMode] only 'isolated' is supported, for spot-margin trading
|
|
2624
2627
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2625
2628
|
*/
|
|
@@ -2630,6 +2633,8 @@ class mexc extends mexc$1 {
|
|
|
2630
2633
|
market = this.market(symbol);
|
|
2631
2634
|
request['symbol'] = market['id'];
|
|
2632
2635
|
}
|
|
2636
|
+
const until = this.safeInteger(params, 'until');
|
|
2637
|
+
params = this.omit(params, 'until');
|
|
2633
2638
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchOrders', market, params);
|
|
2634
2639
|
if (marketType === 'spot') {
|
|
2635
2640
|
if (symbol === undefined) {
|
|
@@ -2639,6 +2644,9 @@ class mexc extends mexc$1 {
|
|
|
2639
2644
|
if (since !== undefined) {
|
|
2640
2645
|
request['startTime'] = since;
|
|
2641
2646
|
}
|
|
2647
|
+
if (until !== undefined) {
|
|
2648
|
+
request['endTime'] = until;
|
|
2649
|
+
}
|
|
2642
2650
|
if (limit !== undefined) {
|
|
2643
2651
|
request['limit'] = limit;
|
|
2644
2652
|
}
|
|
@@ -2705,10 +2713,22 @@ class mexc extends mexc$1 {
|
|
|
2705
2713
|
else {
|
|
2706
2714
|
if (since !== undefined) {
|
|
2707
2715
|
request['start_time'] = since;
|
|
2708
|
-
const end = this.safeInteger(params, 'end_time');
|
|
2716
|
+
const end = this.safeInteger(params, 'end_time', until);
|
|
2709
2717
|
if (end === undefined) {
|
|
2710
2718
|
request['end_time'] = this.sum(since, this.options['maxTimeTillEnd']);
|
|
2711
2719
|
}
|
|
2720
|
+
else {
|
|
2721
|
+
if ((end - since) > this.options['maxTimeTillEnd']) {
|
|
2722
|
+
throw new errors.BadRequest(this.id + ' end is invalid, i.e. exceeds allowed 90 days.');
|
|
2723
|
+
}
|
|
2724
|
+
else {
|
|
2725
|
+
request['end_time'] = until;
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
else if (until !== undefined) {
|
|
2730
|
+
request['start_time'] = this.sum(until, this.options['maxTimeTillEnd'] * -1);
|
|
2731
|
+
request['end_time'] = until;
|
|
2712
2732
|
}
|
|
2713
2733
|
if (limit !== undefined) {
|
|
2714
2734
|
request['page_size'] = limit;
|
|
@@ -4214,9 +4234,13 @@ class mexc extends mexc$1 {
|
|
|
4214
4234
|
const nextFundingRate = this.safeNumber(contract, 'fundingRate');
|
|
4215
4235
|
const nextFundingTimestamp = this.safeInteger(contract, 'nextSettleTime');
|
|
4216
4236
|
const marketId = this.safeString(contract, 'symbol');
|
|
4217
|
-
const symbol = this.safeSymbol(marketId, market);
|
|
4237
|
+
const symbol = this.safeSymbol(marketId, market, undefined, 'contract');
|
|
4218
4238
|
const timestamp = this.safeInteger(contract, 'timestamp');
|
|
4219
|
-
const
|
|
4239
|
+
const interval = this.safeString(contract, 'collectCycle');
|
|
4240
|
+
let intervalString = undefined;
|
|
4241
|
+
if (interval !== undefined) {
|
|
4242
|
+
intervalString = interval + 'h';
|
|
4243
|
+
}
|
|
4220
4244
|
return {
|
|
4221
4245
|
'info': contract,
|
|
4222
4246
|
'symbol': symbol,
|
|
@@ -4225,7 +4249,7 @@ class mexc extends mexc$1 {
|
|
|
4225
4249
|
'interestRate': undefined,
|
|
4226
4250
|
'estimatedSettlePrice': undefined,
|
|
4227
4251
|
'timestamp': timestamp,
|
|
4228
|
-
'datetime':
|
|
4252
|
+
'datetime': this.iso8601(timestamp),
|
|
4229
4253
|
'fundingRate': nextFundingRate,
|
|
4230
4254
|
'fundingTimestamp': nextFundingTimestamp,
|
|
4231
4255
|
'fundingDatetime': this.iso8601(nextFundingTimestamp),
|
|
@@ -4235,9 +4259,21 @@ class mexc extends mexc$1 {
|
|
|
4235
4259
|
'previousFundingRate': undefined,
|
|
4236
4260
|
'previousFundingTimestamp': undefined,
|
|
4237
4261
|
'previousFundingDatetime': undefined,
|
|
4238
|
-
'interval':
|
|
4262
|
+
'interval': intervalString,
|
|
4239
4263
|
};
|
|
4240
4264
|
}
|
|
4265
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
4266
|
+
/**
|
|
4267
|
+
* @method
|
|
4268
|
+
* @name mexc#fetchFundingInterval
|
|
4269
|
+
* @description fetch the current funding rate interval
|
|
4270
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate
|
|
4271
|
+
* @param {string} symbol unified market symbol
|
|
4272
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4273
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
4274
|
+
*/
|
|
4275
|
+
return await this.fetchFundingRate(symbol, params);
|
|
4276
|
+
}
|
|
4241
4277
|
async fetchFundingRate(symbol, params = {}) {
|
|
4242
4278
|
/**
|
|
4243
4279
|
* @method
|
|
@@ -4519,7 +4555,17 @@ class mexc extends mexc$1 {
|
|
|
4519
4555
|
const networkCode = this.safeString(params, 'network');
|
|
4520
4556
|
let networkId = undefined;
|
|
4521
4557
|
if (networkCode !== undefined) {
|
|
4522
|
-
|
|
4558
|
+
// createDepositAddress and fetchDepositAddress use a different network-id compared to withdraw
|
|
4559
|
+
const networkUnified = this.networkIdToCode(networkCode, code);
|
|
4560
|
+
const networks = this.safeDict(currency, 'networks', {});
|
|
4561
|
+
if (networkUnified in networks) {
|
|
4562
|
+
const network = this.safeDict(networks, networkUnified, {});
|
|
4563
|
+
const networkInfo = this.safeValue(network, 'info', {});
|
|
4564
|
+
networkId = this.safeString(networkInfo, 'network');
|
|
4565
|
+
}
|
|
4566
|
+
else {
|
|
4567
|
+
networkId = this.networkCodeToId(networkCode, code);
|
|
4568
|
+
}
|
|
4523
4569
|
}
|
|
4524
4570
|
if (networkId !== undefined) {
|
|
4525
4571
|
request['network'] = networkId;
|
|
@@ -4560,7 +4606,18 @@ class mexc extends mexc$1 {
|
|
|
4560
4606
|
if (networkCode === undefined) {
|
|
4561
4607
|
throw new errors.ArgumentsRequired(this.id + ' createDepositAddress requires a `network` parameter');
|
|
4562
4608
|
}
|
|
4563
|
-
|
|
4609
|
+
// createDepositAddress and fetchDepositAddress use a different network-id compared to withdraw
|
|
4610
|
+
let networkId = undefined;
|
|
4611
|
+
const networkUnified = this.networkIdToCode(networkCode, code);
|
|
4612
|
+
const networks = this.safeDict(currency, 'networks', {});
|
|
4613
|
+
if (networkUnified in networks) {
|
|
4614
|
+
const network = this.safeDict(networks, networkUnified, {});
|
|
4615
|
+
const networkInfo = this.safeValue(network, 'info', {});
|
|
4616
|
+
networkId = this.safeString(networkInfo, 'network');
|
|
4617
|
+
}
|
|
4618
|
+
else {
|
|
4619
|
+
networkId = this.networkCodeToId(networkCode, code);
|
|
4620
|
+
}
|
|
4564
4621
|
if (networkId !== undefined) {
|
|
4565
4622
|
request['network'] = networkId;
|
|
4566
4623
|
}
|
|
@@ -4586,7 +4643,6 @@ class mexc extends mexc$1 {
|
|
|
4586
4643
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4587
4644
|
*/
|
|
4588
4645
|
const network = this.safeString(params, 'network');
|
|
4589
|
-
params = this.omit(params, ['network']);
|
|
4590
4646
|
const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
|
|
4591
4647
|
let result = undefined;
|
|
4592
4648
|
if (network !== undefined) {
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -79,6 +79,8 @@ class okx extends okx$1 {
|
|
|
79
79
|
'fetchDepositWithdrawFee': 'emulated',
|
|
80
80
|
'fetchDepositWithdrawFees': true,
|
|
81
81
|
'fetchFundingHistory': true,
|
|
82
|
+
'fetchFundingInterval': true,
|
|
83
|
+
'fetchFundingIntervals': false,
|
|
82
84
|
'fetchFundingRate': true,
|
|
83
85
|
'fetchFundingRateHistory': true,
|
|
84
86
|
'fetchFundingRates': false,
|
|
@@ -6119,6 +6121,18 @@ class okx extends okx$1 {
|
|
|
6119
6121
|
};
|
|
6120
6122
|
return this.safeString(intervals, interval, interval);
|
|
6121
6123
|
}
|
|
6124
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
6125
|
+
/**
|
|
6126
|
+
* @method
|
|
6127
|
+
* @name okx#fetchFundingInterval
|
|
6128
|
+
* @description fetch the current funding rate interval
|
|
6129
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6130
|
+
* @param {string} symbol unified market symbol
|
|
6131
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6132
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6133
|
+
*/
|
|
6134
|
+
return await this.fetchFundingRate(symbol, params);
|
|
6135
|
+
}
|
|
6122
6136
|
async fetchFundingRate(symbol, params = {}) {
|
|
6123
6137
|
/**
|
|
6124
6138
|
* @method
|
|
@@ -116,8 +116,8 @@ class onetrading extends onetrading$1 {
|
|
|
116
116
|
'urls': {
|
|
117
117
|
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/bdbc26fd-02f2-4ca7-9f1e-17333690bb1c',
|
|
118
118
|
'api': {
|
|
119
|
-
'public': 'https://api.onetrading.com/
|
|
120
|
-
'private': 'https://api.onetrading.com/
|
|
119
|
+
'public': 'https://api.onetrading.com/fast',
|
|
120
|
+
'private': 'https://api.onetrading.com/fast',
|
|
121
121
|
},
|
|
122
122
|
'www': 'https://onetrading.com/',
|
|
123
123
|
'doc': [
|
|
@@ -37,6 +37,8 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
37
37
|
'fetchDepositAddress': false,
|
|
38
38
|
'fetchDepositAddresses': false,
|
|
39
39
|
'fetchDepositAddressesByNetwork': false,
|
|
40
|
+
'fetchFundingInterval': true,
|
|
41
|
+
'fetchFundingIntervals': false,
|
|
40
42
|
'fetchFundingRate': true,
|
|
41
43
|
'fetchFundingRateHistory': false,
|
|
42
44
|
'fetchL3OrderBook': true,
|
|
@@ -1634,28 +1636,52 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
1634
1636
|
// "predictedValue": 0.00375
|
|
1635
1637
|
// }
|
|
1636
1638
|
//
|
|
1637
|
-
const data = this.
|
|
1639
|
+
const data = this.safeDict(response, 'data', {});
|
|
1640
|
+
return this.parseFundingRate(data, market);
|
|
1641
|
+
}
|
|
1642
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
1643
|
+
/**
|
|
1644
|
+
* @method
|
|
1645
|
+
* @name poloniexfutures#fetchFundingInterval
|
|
1646
|
+
* @description fetch the current funding rate interval
|
|
1647
|
+
* @see https://api-docs.poloniex.com/futures/api/futures-index#get-premium-index
|
|
1648
|
+
* @param {string} symbol unified market symbol
|
|
1649
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1650
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
1651
|
+
*/
|
|
1652
|
+
return await this.fetchFundingRate(symbol, params);
|
|
1653
|
+
}
|
|
1654
|
+
parseFundingRate(data, market = undefined) {
|
|
1655
|
+
//
|
|
1656
|
+
// {
|
|
1657
|
+
// "symbol": ".ETHUSDTMFPI8H",
|
|
1658
|
+
// "granularity": 28800000,
|
|
1659
|
+
// "timePoint": 1637380800000,
|
|
1660
|
+
// "value": 0.0001,
|
|
1661
|
+
// "predictedValue": 0.0001,
|
|
1662
|
+
// }
|
|
1663
|
+
//
|
|
1638
1664
|
const fundingTimestamp = this.safeInteger(data, 'timePoint');
|
|
1639
|
-
|
|
1665
|
+
const marketId = this.safeString(data, 'symbol');
|
|
1640
1666
|
return {
|
|
1641
1667
|
'info': data,
|
|
1642
|
-
'symbol': market
|
|
1668
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
1643
1669
|
'markPrice': undefined,
|
|
1644
1670
|
'indexPrice': undefined,
|
|
1645
1671
|
'interestRate': undefined,
|
|
1646
1672
|
'estimatedSettlePrice': undefined,
|
|
1647
1673
|
'timestamp': undefined,
|
|
1648
1674
|
'datetime': undefined,
|
|
1649
|
-
'fundingRate': this.safeNumber(data, '
|
|
1650
|
-
'fundingTimestamp':
|
|
1651
|
-
'fundingDatetime':
|
|
1652
|
-
'nextFundingRate':
|
|
1675
|
+
'fundingRate': this.safeNumber(data, 'value'),
|
|
1676
|
+
'fundingTimestamp': fundingTimestamp,
|
|
1677
|
+
'fundingDatetime': this.iso8601(fundingTimestamp),
|
|
1678
|
+
'nextFundingRate': this.safeNumber(data, 'predictedValue'),
|
|
1653
1679
|
'nextFundingTimestamp': undefined,
|
|
1654
1680
|
'nextFundingDatetime': undefined,
|
|
1655
|
-
'previousFundingRate':
|
|
1656
|
-
'previousFundingTimestamp':
|
|
1657
|
-
'previousFundingDatetime':
|
|
1658
|
-
'interval': this.parseFundingInterval(this.safeString(data, '
|
|
1681
|
+
'previousFundingRate': undefined,
|
|
1682
|
+
'previousFundingTimestamp': undefined,
|
|
1683
|
+
'previousFundingDatetime': undefined,
|
|
1684
|
+
'interval': this.parseFundingInterval(this.safeString(data, 'granularity')),
|
|
1659
1685
|
};
|
|
1660
1686
|
}
|
|
1661
1687
|
parseFundingInterval(interval) {
|
|
@@ -246,7 +246,7 @@ class binance extends binance$1 {
|
|
|
246
246
|
let type = undefined;
|
|
247
247
|
[type, params] = this.handleMarketTypeAndParams('watchLiquidationsForSymbols', firstMarket, params);
|
|
248
248
|
if (type === 'spot') {
|
|
249
|
-
throw new errors.BadRequest(this.id + 'watchLiquidationsForSymbols is not supported for
|
|
249
|
+
throw new errors.BadRequest(this.id + 'watchLiquidationsForSymbols is not supported for spot symbols');
|
|
250
250
|
}
|
|
251
251
|
let subType = undefined;
|
|
252
252
|
[subType, params] = this.handleSubTypeAndParams('watchLiquidationsForSymbols', firstMarket, params);
|
package/dist/cjs/src/pro/okx.js
CHANGED
|
@@ -13,6 +13,8 @@ class okx extends okx$1 {
|
|
|
13
13
|
'has': {
|
|
14
14
|
'ws': true,
|
|
15
15
|
'watchTicker': true,
|
|
16
|
+
'watchMarkPrice': true,
|
|
17
|
+
'watchMarkPrices': true,
|
|
16
18
|
'watchTickers': true,
|
|
17
19
|
'watchBidsAsks': true,
|
|
18
20
|
'watchOrderBook': true,
|
|
@@ -429,6 +431,46 @@ class okx extends okx$1 {
|
|
|
429
431
|
}
|
|
430
432
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
431
433
|
}
|
|
434
|
+
async watchMarkPrice(symbol, params = {}) {
|
|
435
|
+
/**
|
|
436
|
+
* @method
|
|
437
|
+
* @name okx#watchMarkPrice
|
|
438
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-websocket-mark-price-channel
|
|
439
|
+
* @description watches a mark price
|
|
440
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
441
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
442
|
+
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
443
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
444
|
+
*/
|
|
445
|
+
let channel = undefined;
|
|
446
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchMarkPrice', 'channel', 'mark-price');
|
|
447
|
+
params['channel'] = channel;
|
|
448
|
+
const market = this.market(symbol);
|
|
449
|
+
symbol = market['symbol'];
|
|
450
|
+
const ticker = await this.watchMarkPrices([symbol], params);
|
|
451
|
+
return ticker[symbol];
|
|
452
|
+
}
|
|
453
|
+
async watchMarkPrices(symbols = undefined, params = {}) {
|
|
454
|
+
/**
|
|
455
|
+
* @method
|
|
456
|
+
* @name okx#watchMarkPrices
|
|
457
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-websocket-mark-price-channel
|
|
458
|
+
* @description watches mark prices
|
|
459
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
460
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
461
|
+
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
462
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
463
|
+
*/
|
|
464
|
+
await this.loadMarkets();
|
|
465
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
466
|
+
let channel = undefined;
|
|
467
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchMarkPrices', 'channel', 'mark-price');
|
|
468
|
+
const newTickers = await this.subscribeMultiple('public', channel, symbols, params);
|
|
469
|
+
if (this.newUpdates) {
|
|
470
|
+
return newTickers;
|
|
471
|
+
}
|
|
472
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
473
|
+
}
|
|
432
474
|
async unWatchTickers(symbols = undefined, params = {}) {
|
|
433
475
|
/**
|
|
434
476
|
* @method
|
|
@@ -2329,6 +2371,7 @@ class okx extends okx$1 {
|
|
|
2329
2371
|
'books50-l2-tbt': this.handleOrderBook,
|
|
2330
2372
|
'books-l2-tbt': this.handleOrderBook,
|
|
2331
2373
|
'tickers': this.handleTicker,
|
|
2374
|
+
'mark-price': this.handleTicker,
|
|
2332
2375
|
'positions': this.handlePositions,
|
|
2333
2376
|
'index-tickers': this.handleTicker,
|
|
2334
2377
|
'sprd-tickers': this.handleTicker,
|
|
@@ -14,6 +14,7 @@ class upbit extends upbit$1 {
|
|
|
14
14
|
'ws': true,
|
|
15
15
|
'watchOrderBook': true,
|
|
16
16
|
'watchTicker': true,
|
|
17
|
+
'watchTickers': true,
|
|
17
18
|
'watchTrades': true,
|
|
18
19
|
'watchTradesForSymbols': true,
|
|
19
20
|
'watchOrders': true,
|
|
@@ -56,6 +57,33 @@ class upbit extends upbit$1 {
|
|
|
56
57
|
const messageHash = channel + ':' + marketId;
|
|
57
58
|
return await this.watch(url, messageHash, request, messageHash);
|
|
58
59
|
}
|
|
60
|
+
async watchPublicMultiple(symbols, channel, params = {}) {
|
|
61
|
+
await this.loadMarkets();
|
|
62
|
+
if (symbols === undefined) {
|
|
63
|
+
symbols = this.symbols;
|
|
64
|
+
}
|
|
65
|
+
symbols = this.marketSymbols(symbols);
|
|
66
|
+
const marketIds = this.marketIds(symbols);
|
|
67
|
+
const url = this.implodeParams(this.urls['api']['ws'], {
|
|
68
|
+
'hostname': this.hostname,
|
|
69
|
+
});
|
|
70
|
+
const messageHashes = [];
|
|
71
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
72
|
+
messageHashes.push(channel + ':' + marketIds[i]);
|
|
73
|
+
}
|
|
74
|
+
const request = [
|
|
75
|
+
{
|
|
76
|
+
'ticket': this.uuid(),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
'type': channel,
|
|
80
|
+
'codes': marketIds,
|
|
81
|
+
// 'isOnlySnapshot': false,
|
|
82
|
+
// 'isOnlyRealtime': false,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
86
|
+
}
|
|
59
87
|
async watchTicker(symbol, params = {}) {
|
|
60
88
|
/**
|
|
61
89
|
* @method
|
|
@@ -68,6 +96,24 @@ class upbit extends upbit$1 {
|
|
|
68
96
|
*/
|
|
69
97
|
return await this.watchPublic(symbol, 'ticker');
|
|
70
98
|
}
|
|
99
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
100
|
+
/**
|
|
101
|
+
* @method
|
|
102
|
+
* @name upbit#watchTicker
|
|
103
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
104
|
+
* @see https://global-docs.upbit.com/reference/websocket-ticker
|
|
105
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
106
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
107
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
108
|
+
*/
|
|
109
|
+
const newTickers = await this.watchPublicMultiple(symbols, 'ticker');
|
|
110
|
+
if (this.newUpdates) {
|
|
111
|
+
const tickers = {};
|
|
112
|
+
tickers[newTickers['symbol']] = newTickers;
|
|
113
|
+
return tickers;
|
|
114
|
+
}
|
|
115
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
116
|
+
}
|
|
71
117
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
72
118
|
/**
|
|
73
119
|
* @method
|
|
@@ -45,6 +45,9 @@ class vertex extends vertex$1 {
|
|
|
45
45
|
'fetchPositionsSnapshot': true,
|
|
46
46
|
'awaitPositionsSnapshot': true, // whether to wait for the positions snapshot before providing updates
|
|
47
47
|
},
|
|
48
|
+
'ws': {
|
|
49
|
+
'inflate': true,
|
|
50
|
+
},
|
|
48
51
|
},
|
|
49
52
|
'streaming': {
|
|
50
53
|
// 'ping': this.ping,
|
|
@@ -73,6 +76,14 @@ class vertex extends vertex$1 {
|
|
|
73
76
|
'id': requestId,
|
|
74
77
|
};
|
|
75
78
|
const request = this.extend(subscribe, message);
|
|
79
|
+
const wsOptions = {
|
|
80
|
+
'headers': {
|
|
81
|
+
'Sec-WebSocket-Extensions': 'permessage-deflate',
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
this.options['ws'] = {
|
|
85
|
+
'options': wsOptions,
|
|
86
|
+
};
|
|
76
87
|
return await this.watch(url, messageHash, request, messageHash, subscribe);
|
|
77
88
|
}
|
|
78
89
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
package/dist/cjs/src/vertex.js
CHANGED
|
@@ -2948,6 +2948,17 @@ class vertex extends vertex$1 {
|
|
|
2948
2948
|
url += '?' + this.urlencode(params);
|
|
2949
2949
|
}
|
|
2950
2950
|
}
|
|
2951
|
+
if (path !== 'execute') {
|
|
2952
|
+
// required encoding for public methods
|
|
2953
|
+
if (headers !== undefined) {
|
|
2954
|
+
headers['Accept-Encoding'] = 'gzip';
|
|
2955
|
+
}
|
|
2956
|
+
else {
|
|
2957
|
+
headers = {
|
|
2958
|
+
'Accept-Encoding': 'gzip',
|
|
2959
|
+
};
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2951
2962
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
2952
2963
|
}
|
|
2953
2964
|
}
|
package/dist/cjs/src/woo.js
CHANGED
|
@@ -68,6 +68,8 @@ class woo extends woo$1 {
|
|
|
68
68
|
'fetchDeposits': true,
|
|
69
69
|
'fetchDepositsWithdrawals': true,
|
|
70
70
|
'fetchFundingHistory': true,
|
|
71
|
+
'fetchFundingInterval': true,
|
|
72
|
+
'fetchFundingIntervals': false,
|
|
71
73
|
'fetchFundingRate': true,
|
|
72
74
|
'fetchFundingRateHistory': true,
|
|
73
75
|
'fetchFundingRates': true,
|
|
@@ -2789,6 +2791,18 @@ class woo extends woo$1 {
|
|
|
2789
2791
|
'interval': intervalString + 'h',
|
|
2790
2792
|
};
|
|
2791
2793
|
}
|
|
2794
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
2795
|
+
/**
|
|
2796
|
+
* @method
|
|
2797
|
+
* @name woo#fetchFundingInterval
|
|
2798
|
+
* @description fetch the current funding rate interval
|
|
2799
|
+
* @see https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
|
|
2800
|
+
* @param {string} symbol unified market symbol
|
|
2801
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2802
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2803
|
+
*/
|
|
2804
|
+
return await this.fetchFundingRate(symbol, params);
|
|
2805
|
+
}
|
|
2792
2806
|
async fetchFundingRate(symbol, params = {}) {
|
|
2793
2807
|
/**
|
|
2794
2808
|
* @method
|
package/dist/cjs/src/woofipro.js
CHANGED
|
@@ -70,6 +70,8 @@ class woofipro extends woofipro$1 {
|
|
|
70
70
|
'fetchDeposits': true,
|
|
71
71
|
'fetchDepositsWithdrawals': true,
|
|
72
72
|
'fetchFundingHistory': true,
|
|
73
|
+
'fetchFundingInterval': true,
|
|
74
|
+
'fetchFundingIntervals': false,
|
|
73
75
|
'fetchFundingRate': true,
|
|
74
76
|
'fetchFundingRateHistory': true,
|
|
75
77
|
'fetchFundingRates': true,
|
|
@@ -799,6 +801,18 @@ class woofipro extends woofipro$1 {
|
|
|
799
801
|
};
|
|
800
802
|
return this.safeString(intervals, interval, interval);
|
|
801
803
|
}
|
|
804
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
805
|
+
/**
|
|
806
|
+
* @method
|
|
807
|
+
* @name woofipro#fetchFundingInterval
|
|
808
|
+
* @description fetch the current funding rate interval
|
|
809
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
|
|
810
|
+
* @param {string} symbol unified market symbol
|
|
811
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
812
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
813
|
+
*/
|
|
814
|
+
return await this.fetchFundingRate(symbol, params);
|
|
815
|
+
}
|
|
802
816
|
async fetchFundingRate(symbol, params = {}) {
|
|
803
817
|
/**
|
|
804
818
|
* @method
|
package/dist/cjs/src/xt.js
CHANGED
|
@@ -63,6 +63,8 @@ class xt extends xt$1 {
|
|
|
63
63
|
'fetchDepositWithdrawFee': false,
|
|
64
64
|
'fetchDepositWithdrawFees': false,
|
|
65
65
|
'fetchFundingHistory': true,
|
|
66
|
+
'fetchFundingInterval': true,
|
|
67
|
+
'fetchFundingIntervals': false,
|
|
66
68
|
'fetchFundingRate': true,
|
|
67
69
|
'fetchFundingRateHistory': true,
|
|
68
70
|
'fetchFundingRates': false,
|
|
@@ -4292,6 +4294,18 @@ class xt extends xt$1 {
|
|
|
4292
4294
|
const sorted = this.sortBy(rates, 'timestamp');
|
|
4293
4295
|
return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
|
|
4294
4296
|
}
|
|
4297
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
4298
|
+
/**
|
|
4299
|
+
* @method
|
|
4300
|
+
* @name xt#fetchFundingInterval
|
|
4301
|
+
* @description fetch the current funding rate interval
|
|
4302
|
+
* @see https://doc.xt.com/#futures_quotesgetFundingRate
|
|
4303
|
+
* @param {string} symbol unified market symbol
|
|
4304
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4305
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
4306
|
+
*/
|
|
4307
|
+
return await this.fetchFundingRate(symbol, params);
|
|
4308
|
+
}
|
|
4295
4309
|
async fetchFundingRate(symbol, params = {}) {
|
|
4296
4310
|
/**
|
|
4297
4311
|
* @method
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.4.
|
|
7
|
+
declare const version = "4.4.14";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|