ccxt 4.4.13 → 4.4.14
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/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/poloniexfutures.js +37 -11
- package/dist/cjs/src/pro/okx.js +43 -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/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/poloniexfutures.d.ts +2 -0
- package/js/src/poloniexfutures.js +37 -11
- package/js/src/pro/okx.d.ts +2 -0
- package/js/src/pro/okx.js +43 -0
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
- 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
|
|
@@ -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) {
|
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,
|
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.13";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
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';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.4.
|
|
41
|
+
const version = '4.4.14';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -413,6 +413,7 @@ interface Exchange {
|
|
|
413
413
|
dapiPublicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
|
|
414
414
|
dapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
|
|
415
415
|
dapiPublicGetOpenInterest(params?: {}): Promise<implicitReturnType>;
|
|
416
|
+
dapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
416
417
|
dapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
|
|
417
418
|
dapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
|
|
418
419
|
dapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
|
|
@@ -413,6 +413,7 @@ interface binance {
|
|
|
413
413
|
dapiPublicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
|
|
414
414
|
dapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
|
|
415
415
|
dapiPublicGetOpenInterest(params?: {}): Promise<implicitReturnType>;
|
|
416
|
+
dapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
416
417
|
dapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
|
|
417
418
|
dapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
|
|
418
419
|
dapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
|
|
@@ -465,6 +465,7 @@ interface binance {
|
|
|
465
465
|
dapiPublicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
|
|
466
466
|
dapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
|
|
467
467
|
dapiPublicGetOpenInterest(params?: {}): Promise<implicitReturnType>;
|
|
468
|
+
dapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
468
469
|
dapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
|
|
469
470
|
dapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
|
|
470
471
|
dapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
|
|
@@ -413,6 +413,7 @@ interface binance {
|
|
|
413
413
|
dapiPublicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
|
|
414
414
|
dapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
|
|
415
415
|
dapiPublicGetOpenInterest(params?: {}): Promise<implicitReturnType>;
|
|
416
|
+
dapiPublicGetFundingInfo(params?: {}): Promise<implicitReturnType>;
|
|
416
417
|
dapiDataGetDeliveryPrice(params?: {}): Promise<implicitReturnType>;
|
|
417
418
|
dapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
|
|
418
419
|
dapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
|
|
@@ -10,6 +10,7 @@ interface Exchange {
|
|
|
10
10
|
v1PublicGetPublicGetValuations(params?: {}): Promise<implicitReturnType>;
|
|
11
11
|
v1PublicGetPublicGetExpiredSettlementPrice(params?: {}): Promise<implicitReturnType>;
|
|
12
12
|
v1PublicGetPublicGetInsurance(params?: {}): Promise<implicitReturnType>;
|
|
13
|
+
v1PublicGetPublicGetRiskParameters(params?: {}): Promise<implicitReturnType>;
|
|
13
14
|
v1PublicPostPublicStakingGetConversionRate(params?: {}): Promise<implicitReturnType>;
|
|
14
15
|
v1PrivatePostPrivateSetCancelOnDisconnect(params?: {}): Promise<implicitReturnType>;
|
|
15
16
|
v1PrivatePostPrivateGetCancelOnDisconnect(params?: {}): Promise<implicitReturnType>;
|
|
@@ -209,6 +209,7 @@ export default class Exchange {
|
|
|
209
209
|
flatten: (x: any[], out?: any[]) => any[];
|
|
210
210
|
unique: (x: any[]) => any[];
|
|
211
211
|
indexBy: (x: Dictionary<any>, k: IndexType, out?: Dictionary<any>) => Dictionary<any>;
|
|
212
|
+
roundTimeframe: (timeframe: string, timestamp: number, direction?: number) => number;
|
|
212
213
|
sortBy: (array: any[], key: IndexType, descending?: boolean, defaultValue?: any, direction?: number) => any[];
|
|
213
214
|
sortBy2: (array: any[], key1: IndexType, key2: IndexType, descending?: boolean, direction?: number) => any[];
|
|
214
215
|
groupBy: (x: Dictionary<any>, k: string, out?: Dictionary<any>) => Dictionary<any>;
|
|
@@ -495,6 +496,8 @@ export default class Exchange {
|
|
|
495
496
|
fetchFundingHistory: any;
|
|
496
497
|
fetchFundingRate: any;
|
|
497
498
|
fetchFundingRateHistory: any;
|
|
499
|
+
fetchFundingInterval: any;
|
|
500
|
+
fetchFundingIntervals: any;
|
|
498
501
|
fetchFundingRates: any;
|
|
499
502
|
fetchGreeks: any;
|
|
500
503
|
fetchIndexOHLCV: any;
|
|
@@ -773,6 +776,7 @@ export default class Exchange {
|
|
|
773
776
|
parseWsOrderTrade(trade: Dict, market?: Market): Trade;
|
|
774
777
|
parseWsOHLCV(ohlcv: any, market?: Market): OHLCV;
|
|
775
778
|
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
779
|
+
fetchFundingIntervals(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
776
780
|
watchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
777
781
|
watchFundingRates(symbols: string[], params?: {}): Promise<FundingRates>;
|
|
778
782
|
watchFundingRatesForSymbols(symbols: string[], params?: {}): Promise<{}>;
|
|
@@ -965,6 +969,7 @@ export default class Exchange {
|
|
|
965
969
|
handleErrors(statusCode: int, statusText: string, url: string, method: string, responseHeaders: Dict, responseBody: string, response: any, requestHeaders: any, requestBody: any): any;
|
|
966
970
|
calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
|
|
967
971
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
972
|
+
fetchMarkPrice(symbol: string, params?: {}): Promise<Ticker>;
|
|
968
973
|
fetchTickerWs(symbol: string, params?: {}): Promise<Ticker>;
|
|
969
974
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
970
975
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
@@ -1104,6 +1109,7 @@ export default class Exchange {
|
|
|
1104
1109
|
parseOpenInterest(interest: any, market?: Market): OpenInterest;
|
|
1105
1110
|
parseOpenInterests(response: any, market?: any, since?: Int, limit?: Int): OpenInterest[];
|
|
1106
1111
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
1112
|
+
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
1107
1113
|
fetchMarkOHLCV(symbol: any, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
1108
1114
|
fetchIndexOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
1109
1115
|
fetchPremiumIndexOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|