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
package/js/src/kucoin.js
CHANGED
|
@@ -81,6 +81,8 @@ export default class kucoin extends Exchange {
|
|
|
81
81
|
'fetchMarketLeverageTiers': false,
|
|
82
82
|
'fetchMarkets': true,
|
|
83
83
|
'fetchMarkOHLCV': false,
|
|
84
|
+
'fetchMarkPrice': true,
|
|
85
|
+
'fetchMarkPrices': true,
|
|
84
86
|
'fetchMyTrades': true,
|
|
85
87
|
'fetchOHLCV': true,
|
|
86
88
|
'fetchOpenInterest': false,
|
|
@@ -1663,7 +1665,7 @@ export default class kucoin extends Exchange {
|
|
|
1663
1665
|
const symbol = market['symbol'];
|
|
1664
1666
|
const baseVolume = this.safeString(ticker, 'vol');
|
|
1665
1667
|
const quoteVolume = this.safeString(ticker, 'volValue');
|
|
1666
|
-
const timestamp = this.
|
|
1668
|
+
const timestamp = this.safeIntegerN(ticker, ['time', 'datetime', 'timePoint']);
|
|
1667
1669
|
return this.safeTicker({
|
|
1668
1670
|
'symbol': symbol,
|
|
1669
1671
|
'timestamp': timestamp,
|
|
@@ -1684,6 +1686,7 @@ export default class kucoin extends Exchange {
|
|
|
1684
1686
|
'average': this.safeString(ticker, 'averagePrice'),
|
|
1685
1687
|
'baseVolume': baseVolume,
|
|
1686
1688
|
'quoteVolume': quoteVolume,
|
|
1689
|
+
'markPrice': this.safeString(ticker, 'value'),
|
|
1687
1690
|
'info': ticker,
|
|
1688
1691
|
}, market);
|
|
1689
1692
|
}
|
|
@@ -1742,6 +1745,22 @@ export default class kucoin extends Exchange {
|
|
|
1742
1745
|
}
|
|
1743
1746
|
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
1744
1747
|
}
|
|
1748
|
+
async fetchMarkPrices(symbols = undefined, params = {}) {
|
|
1749
|
+
/**
|
|
1750
|
+
* @method
|
|
1751
|
+
* @name kucoin#fetchMarkPrices
|
|
1752
|
+
* @description fetches the mark price for multiple markets
|
|
1753
|
+
* @see https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices
|
|
1754
|
+
* @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1755
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1756
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1757
|
+
*/
|
|
1758
|
+
await this.loadMarkets();
|
|
1759
|
+
symbols = this.marketSymbols(symbols);
|
|
1760
|
+
const response = await this.publicGetMarkPriceAllSymbols(params);
|
|
1761
|
+
const data = this.safeList(response, 'data', []);
|
|
1762
|
+
return this.parseTickers(data);
|
|
1763
|
+
}
|
|
1745
1764
|
async fetchTicker(symbol, params = {}) {
|
|
1746
1765
|
/**
|
|
1747
1766
|
* @method
|
|
@@ -1784,6 +1803,26 @@ export default class kucoin extends Exchange {
|
|
|
1784
1803
|
const data = this.safeDict(response, 'data', {});
|
|
1785
1804
|
return this.parseTicker(data, market);
|
|
1786
1805
|
}
|
|
1806
|
+
async fetchMarkPrice(symbol, params = {}) {
|
|
1807
|
+
/**
|
|
1808
|
+
* @method
|
|
1809
|
+
* @name kucoin#fetchMarkPrice
|
|
1810
|
+
* @description fetches the mark price for a specific market
|
|
1811
|
+
* @see https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-mark-price
|
|
1812
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1813
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1814
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
1815
|
+
*/
|
|
1816
|
+
await this.loadMarkets();
|
|
1817
|
+
const market = this.market(symbol);
|
|
1818
|
+
const request = {
|
|
1819
|
+
'symbol': market['id'],
|
|
1820
|
+
};
|
|
1821
|
+
const response = await this.publicGetMarkPriceSymbolCurrent(this.extend(request, params));
|
|
1822
|
+
//
|
|
1823
|
+
const data = this.safeDict(response, 'data', {});
|
|
1824
|
+
return this.parseTicker(data, market);
|
|
1825
|
+
}
|
|
1787
1826
|
parseOHLCV(ohlcv, market = undefined) {
|
|
1788
1827
|
//
|
|
1789
1828
|
// [
|
|
@@ -26,6 +26,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
26
26
|
}>;
|
|
27
27
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
28
28
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
29
|
+
fetchMarkPrice(symbol: string, params?: {}): Promise<Ticker>;
|
|
29
30
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
30
31
|
parseTicker(ticker: Dict, market?: Market): Ticker;
|
|
31
32
|
fetchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
@@ -47,6 +48,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
47
48
|
fetchOrder(id?: Str, symbol?: Str, params?: {}): Promise<Order>;
|
|
48
49
|
parseOrder(order: Dict, market?: Market): Order;
|
|
49
50
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
51
|
+
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
52
|
+
parseFundingRate(data: any, market?: Market): FundingRate;
|
|
50
53
|
parseFundingInterval(interval: any): string;
|
|
51
54
|
parseBalance(response: any): Balances;
|
|
52
55
|
fetchBalance(params?: {}): Promise<Balances>;
|
package/js/src/kucoinfutures.js
CHANGED
|
@@ -63,6 +63,8 @@ export default class kucoinfutures extends kucoin {
|
|
|
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
|
'fetchIndexOHLCV': false,
|
|
@@ -77,6 +79,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
77
79
|
'fetchMarketLeverageTiers': true,
|
|
78
80
|
'fetchMarkets': true,
|
|
79
81
|
'fetchMarkOHLCV': false,
|
|
82
|
+
'fetchMarkPrice': true,
|
|
80
83
|
'fetchMyTrades': true,
|
|
81
84
|
'fetchOHLCV': true,
|
|
82
85
|
'fetchOpenOrders': true,
|
|
@@ -778,6 +781,25 @@ export default class kucoinfutures extends kucoin {
|
|
|
778
781
|
//
|
|
779
782
|
return this.parseTicker(response['data'], market);
|
|
780
783
|
}
|
|
784
|
+
async fetchMarkPrice(symbol, params = {}) {
|
|
785
|
+
/**
|
|
786
|
+
* @method
|
|
787
|
+
* @name kucoinfutures#fetchMarkPrice
|
|
788
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
789
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/market-data/get-current-mark-price
|
|
790
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
791
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
792
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
793
|
+
*/
|
|
794
|
+
await this.loadMarkets();
|
|
795
|
+
const market = this.market(symbol);
|
|
796
|
+
const request = {
|
|
797
|
+
'symbol': market['id'],
|
|
798
|
+
};
|
|
799
|
+
const response = await this.futuresPublicGetMarkPriceSymbolCurrent(this.extend(request, params));
|
|
800
|
+
//
|
|
801
|
+
return this.parseTicker(response['data'], market);
|
|
802
|
+
}
|
|
781
803
|
async fetchTickers(symbols = undefined, params = {}) {
|
|
782
804
|
/**
|
|
783
805
|
* @method
|
|
@@ -867,6 +889,14 @@ export default class kucoinfutures extends kucoin {
|
|
|
867
889
|
return this.filterByArrayTickers(tickers, 'symbol', symbols);
|
|
868
890
|
}
|
|
869
891
|
parseTicker(ticker, market = undefined) {
|
|
892
|
+
//
|
|
893
|
+
// {
|
|
894
|
+
// "symbol": "LTCUSDTM",
|
|
895
|
+
// "granularity": 1000,
|
|
896
|
+
// "timePoint": 1727967339000,
|
|
897
|
+
// "value": 62.37, mark price
|
|
898
|
+
// "indexPrice": 62.37
|
|
899
|
+
// }
|
|
870
900
|
//
|
|
871
901
|
// {
|
|
872
902
|
// "code": "200000",
|
|
@@ -969,7 +999,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
969
999
|
'average': undefined,
|
|
970
1000
|
'baseVolume': this.safeString(ticker, 'volumeOf24h'),
|
|
971
1001
|
'quoteVolume': this.safeString(ticker, 'turnoverOf24h'),
|
|
972
|
-
'markPrice': this.
|
|
1002
|
+
'markPrice': this.safeString2(ticker, 'markPrice', 'value'),
|
|
973
1003
|
'indexPrice': this.safeString(ticker, 'indexPrice'),
|
|
974
1004
|
'info': ticker,
|
|
975
1005
|
}, market);
|
|
@@ -2185,12 +2215,37 @@ export default class kucoinfutures extends kucoin {
|
|
|
2185
2215
|
// },
|
|
2186
2216
|
// }
|
|
2187
2217
|
//
|
|
2188
|
-
const data = this.
|
|
2189
|
-
const fundingTimestamp = this.safeInteger(data, 'timePoint');
|
|
2218
|
+
const data = this.safeDict(response, 'data', {});
|
|
2190
2219
|
// the website displayes the previous funding rate as "funding rate"
|
|
2220
|
+
return this.parseFundingRate(data, market);
|
|
2221
|
+
}
|
|
2222
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
2223
|
+
/**
|
|
2224
|
+
* @method
|
|
2225
|
+
* @name kucoinfutures#fetchFundingInterval
|
|
2226
|
+
* @description fetch the current funding rate interval
|
|
2227
|
+
* @see https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-current-funding-rate
|
|
2228
|
+
* @param {string} symbol unified market symbol
|
|
2229
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2230
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2231
|
+
*/
|
|
2232
|
+
return await this.fetchFundingRate(symbol, params);
|
|
2233
|
+
}
|
|
2234
|
+
parseFundingRate(data, market = undefined) {
|
|
2235
|
+
//
|
|
2236
|
+
// {
|
|
2237
|
+
// "symbol": ".ETHUSDTMFPI8H",
|
|
2238
|
+
// "granularity": 28800000,
|
|
2239
|
+
// "timePoint": 1637380800000,
|
|
2240
|
+
// "value": 0.0001,
|
|
2241
|
+
// "predictedValue": 0.0001,
|
|
2242
|
+
// }
|
|
2243
|
+
//
|
|
2244
|
+
const fundingTimestamp = this.safeInteger(data, 'timePoint');
|
|
2245
|
+
const marketId = this.safeString(data, 'symbol');
|
|
2191
2246
|
return {
|
|
2192
2247
|
'info': data,
|
|
2193
|
-
'symbol': market
|
|
2248
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
2194
2249
|
'markPrice': undefined,
|
|
2195
2250
|
'indexPrice': undefined,
|
|
2196
2251
|
'interestRate': undefined,
|
package/js/src/mexc.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export default class mexc extends Exchange {
|
|
|
65
65
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
66
66
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
67
67
|
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
68
|
+
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
68
69
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
69
70
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
70
71
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<LeverageTiers>;
|
package/js/src/mexc.js
CHANGED
|
@@ -78,6 +78,8 @@ export default class mexc extends Exchange {
|
|
|
78
78
|
'fetchDepositWithdrawFee': 'emulated',
|
|
79
79
|
'fetchDepositWithdrawFees': true,
|
|
80
80
|
'fetchFundingHistory': true,
|
|
81
|
+
'fetchFundingInterval': true,
|
|
82
|
+
'fetchFundingIntervals': false,
|
|
81
83
|
'fetchFundingRate': true,
|
|
82
84
|
'fetchFundingRateHistory': true,
|
|
83
85
|
'fetchFundingRates': undefined,
|
|
@@ -2623,6 +2625,7 @@ export default class mexc extends Exchange {
|
|
|
2623
2625
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
2624
2626
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
2625
2627
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2628
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
2626
2629
|
* @param {string} [params.marginMode] only 'isolated' is supported, for spot-margin trading
|
|
2627
2630
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2628
2631
|
*/
|
|
@@ -2633,6 +2636,8 @@ export default class mexc extends Exchange {
|
|
|
2633
2636
|
market = this.market(symbol);
|
|
2634
2637
|
request['symbol'] = market['id'];
|
|
2635
2638
|
}
|
|
2639
|
+
const until = this.safeInteger(params, 'until');
|
|
2640
|
+
params = this.omit(params, 'until');
|
|
2636
2641
|
const [marketType, query] = this.handleMarketTypeAndParams('fetchOrders', market, params);
|
|
2637
2642
|
if (marketType === 'spot') {
|
|
2638
2643
|
if (symbol === undefined) {
|
|
@@ -2642,6 +2647,9 @@ export default class mexc extends Exchange {
|
|
|
2642
2647
|
if (since !== undefined) {
|
|
2643
2648
|
request['startTime'] = since;
|
|
2644
2649
|
}
|
|
2650
|
+
if (until !== undefined) {
|
|
2651
|
+
request['endTime'] = until;
|
|
2652
|
+
}
|
|
2645
2653
|
if (limit !== undefined) {
|
|
2646
2654
|
request['limit'] = limit;
|
|
2647
2655
|
}
|
|
@@ -2708,10 +2716,22 @@ export default class mexc extends Exchange {
|
|
|
2708
2716
|
else {
|
|
2709
2717
|
if (since !== undefined) {
|
|
2710
2718
|
request['start_time'] = since;
|
|
2711
|
-
const end = this.safeInteger(params, 'end_time');
|
|
2719
|
+
const end = this.safeInteger(params, 'end_time', until);
|
|
2712
2720
|
if (end === undefined) {
|
|
2713
2721
|
request['end_time'] = this.sum(since, this.options['maxTimeTillEnd']);
|
|
2714
2722
|
}
|
|
2723
|
+
else {
|
|
2724
|
+
if ((end - since) > this.options['maxTimeTillEnd']) {
|
|
2725
|
+
throw new BadRequest(this.id + ' end is invalid, i.e. exceeds allowed 90 days.');
|
|
2726
|
+
}
|
|
2727
|
+
else {
|
|
2728
|
+
request['end_time'] = until;
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
else if (until !== undefined) {
|
|
2733
|
+
request['start_time'] = this.sum(until, this.options['maxTimeTillEnd'] * -1);
|
|
2734
|
+
request['end_time'] = until;
|
|
2715
2735
|
}
|
|
2716
2736
|
if (limit !== undefined) {
|
|
2717
2737
|
request['page_size'] = limit;
|
|
@@ -4218,9 +4238,13 @@ export default class mexc extends Exchange {
|
|
|
4218
4238
|
const nextFundingRate = this.safeNumber(contract, 'fundingRate');
|
|
4219
4239
|
const nextFundingTimestamp = this.safeInteger(contract, 'nextSettleTime');
|
|
4220
4240
|
const marketId = this.safeString(contract, 'symbol');
|
|
4221
|
-
const symbol = this.safeSymbol(marketId, market);
|
|
4241
|
+
const symbol = this.safeSymbol(marketId, market, undefined, 'contract');
|
|
4222
4242
|
const timestamp = this.safeInteger(contract, 'timestamp');
|
|
4223
|
-
const
|
|
4243
|
+
const interval = this.safeString(contract, 'collectCycle');
|
|
4244
|
+
let intervalString = undefined;
|
|
4245
|
+
if (interval !== undefined) {
|
|
4246
|
+
intervalString = interval + 'h';
|
|
4247
|
+
}
|
|
4224
4248
|
return {
|
|
4225
4249
|
'info': contract,
|
|
4226
4250
|
'symbol': symbol,
|
|
@@ -4229,7 +4253,7 @@ export default class mexc extends Exchange {
|
|
|
4229
4253
|
'interestRate': undefined,
|
|
4230
4254
|
'estimatedSettlePrice': undefined,
|
|
4231
4255
|
'timestamp': timestamp,
|
|
4232
|
-
'datetime':
|
|
4256
|
+
'datetime': this.iso8601(timestamp),
|
|
4233
4257
|
'fundingRate': nextFundingRate,
|
|
4234
4258
|
'fundingTimestamp': nextFundingTimestamp,
|
|
4235
4259
|
'fundingDatetime': this.iso8601(nextFundingTimestamp),
|
|
@@ -4239,9 +4263,21 @@ export default class mexc extends Exchange {
|
|
|
4239
4263
|
'previousFundingRate': undefined,
|
|
4240
4264
|
'previousFundingTimestamp': undefined,
|
|
4241
4265
|
'previousFundingDatetime': undefined,
|
|
4242
|
-
'interval':
|
|
4266
|
+
'interval': intervalString,
|
|
4243
4267
|
};
|
|
4244
4268
|
}
|
|
4269
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
4270
|
+
/**
|
|
4271
|
+
* @method
|
|
4272
|
+
* @name mexc#fetchFundingInterval
|
|
4273
|
+
* @description fetch the current funding rate interval
|
|
4274
|
+
* @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate
|
|
4275
|
+
* @param {string} symbol unified market symbol
|
|
4276
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4277
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
4278
|
+
*/
|
|
4279
|
+
return await this.fetchFundingRate(symbol, params);
|
|
4280
|
+
}
|
|
4245
4281
|
async fetchFundingRate(symbol, params = {}) {
|
|
4246
4282
|
/**
|
|
4247
4283
|
* @method
|
|
@@ -4523,7 +4559,17 @@ export default class mexc extends Exchange {
|
|
|
4523
4559
|
const networkCode = this.safeString(params, 'network');
|
|
4524
4560
|
let networkId = undefined;
|
|
4525
4561
|
if (networkCode !== undefined) {
|
|
4526
|
-
|
|
4562
|
+
// createDepositAddress and fetchDepositAddress use a different network-id compared to withdraw
|
|
4563
|
+
const networkUnified = this.networkIdToCode(networkCode, code);
|
|
4564
|
+
const networks = this.safeDict(currency, 'networks', {});
|
|
4565
|
+
if (networkUnified in networks) {
|
|
4566
|
+
const network = this.safeDict(networks, networkUnified, {});
|
|
4567
|
+
const networkInfo = this.safeValue(network, 'info', {});
|
|
4568
|
+
networkId = this.safeString(networkInfo, 'network');
|
|
4569
|
+
}
|
|
4570
|
+
else {
|
|
4571
|
+
networkId = this.networkCodeToId(networkCode, code);
|
|
4572
|
+
}
|
|
4527
4573
|
}
|
|
4528
4574
|
if (networkId !== undefined) {
|
|
4529
4575
|
request['network'] = networkId;
|
|
@@ -4564,7 +4610,18 @@ export default class mexc extends Exchange {
|
|
|
4564
4610
|
if (networkCode === undefined) {
|
|
4565
4611
|
throw new ArgumentsRequired(this.id + ' createDepositAddress requires a `network` parameter');
|
|
4566
4612
|
}
|
|
4567
|
-
|
|
4613
|
+
// createDepositAddress and fetchDepositAddress use a different network-id compared to withdraw
|
|
4614
|
+
let networkId = undefined;
|
|
4615
|
+
const networkUnified = this.networkIdToCode(networkCode, code);
|
|
4616
|
+
const networks = this.safeDict(currency, 'networks', {});
|
|
4617
|
+
if (networkUnified in networks) {
|
|
4618
|
+
const network = this.safeDict(networks, networkUnified, {});
|
|
4619
|
+
const networkInfo = this.safeValue(network, 'info', {});
|
|
4620
|
+
networkId = this.safeString(networkInfo, 'network');
|
|
4621
|
+
}
|
|
4622
|
+
else {
|
|
4623
|
+
networkId = this.networkCodeToId(networkCode, code);
|
|
4624
|
+
}
|
|
4568
4625
|
if (networkId !== undefined) {
|
|
4569
4626
|
request['network'] = networkId;
|
|
4570
4627
|
}
|
|
@@ -4590,7 +4647,6 @@ export default class mexc extends Exchange {
|
|
|
4590
4647
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
4591
4648
|
*/
|
|
4592
4649
|
const network = this.safeString(params, 'network');
|
|
4593
|
-
params = this.omit(params, ['network']);
|
|
4594
4650
|
const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
|
|
4595
4651
|
let result = undefined;
|
|
4596
4652
|
if (network !== undefined) {
|
package/js/src/okx.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ export default class okx extends Exchange {
|
|
|
91
91
|
};
|
|
92
92
|
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
93
93
|
parseFundingInterval(interval: any): string;
|
|
94
|
+
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
94
95
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
95
96
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
96
97
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
package/js/src/okx.js
CHANGED
|
@@ -82,6 +82,8 @@ export default class okx extends Exchange {
|
|
|
82
82
|
'fetchDepositWithdrawFee': 'emulated',
|
|
83
83
|
'fetchDepositWithdrawFees': true,
|
|
84
84
|
'fetchFundingHistory': true,
|
|
85
|
+
'fetchFundingInterval': true,
|
|
86
|
+
'fetchFundingIntervals': false,
|
|
85
87
|
'fetchFundingRate': true,
|
|
86
88
|
'fetchFundingRateHistory': true,
|
|
87
89
|
'fetchFundingRates': false,
|
|
@@ -6122,6 +6124,18 @@ export default class okx extends Exchange {
|
|
|
6122
6124
|
};
|
|
6123
6125
|
return this.safeString(intervals, interval, interval);
|
|
6124
6126
|
}
|
|
6127
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
6128
|
+
/**
|
|
6129
|
+
* @method
|
|
6130
|
+
* @name okx#fetchFundingInterval
|
|
6131
|
+
* @description fetch the current funding rate interval
|
|
6132
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-rest-api-get-funding-rate
|
|
6133
|
+
* @param {string} symbol unified market symbol
|
|
6134
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6135
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
6136
|
+
*/
|
|
6137
|
+
return await this.fetchFundingRate(symbol, params);
|
|
6138
|
+
}
|
|
6125
6139
|
async fetchFundingRate(symbol, params = {}) {
|
|
6126
6140
|
/**
|
|
6127
6141
|
* @method
|
|
@@ -56,6 +56,8 @@ export default class poloniexfutures extends Exchange {
|
|
|
56
56
|
fetchOrder(id?: Str, symbol?: Str, params?: {}): Promise<Order>;
|
|
57
57
|
parseOrder(order: Dict, market?: Market): Order;
|
|
58
58
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
59
|
+
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
60
|
+
parseFundingRate(data: any, market?: Market): FundingRate;
|
|
59
61
|
parseFundingInterval(interval: any): string;
|
|
60
62
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
61
63
|
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
|
|
@@ -40,6 +40,8 @@ export default class poloniexfutures extends Exchange {
|
|
|
40
40
|
'fetchDepositAddress': false,
|
|
41
41
|
'fetchDepositAddresses': false,
|
|
42
42
|
'fetchDepositAddressesByNetwork': false,
|
|
43
|
+
'fetchFundingInterval': true,
|
|
44
|
+
'fetchFundingIntervals': false,
|
|
43
45
|
'fetchFundingRate': true,
|
|
44
46
|
'fetchFundingRateHistory': false,
|
|
45
47
|
'fetchL3OrderBook': true,
|
|
@@ -1637,28 +1639,52 @@ export default class poloniexfutures extends Exchange {
|
|
|
1637
1639
|
// "predictedValue": 0.00375
|
|
1638
1640
|
// }
|
|
1639
1641
|
//
|
|
1640
|
-
const data = this.
|
|
1642
|
+
const data = this.safeDict(response, 'data', {});
|
|
1643
|
+
return this.parseFundingRate(data, market);
|
|
1644
|
+
}
|
|
1645
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
1646
|
+
/**
|
|
1647
|
+
* @method
|
|
1648
|
+
* @name poloniexfutures#fetchFundingInterval
|
|
1649
|
+
* @description fetch the current funding rate interval
|
|
1650
|
+
* @see https://api-docs.poloniex.com/futures/api/futures-index#get-premium-index
|
|
1651
|
+
* @param {string} symbol unified market symbol
|
|
1652
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1653
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
1654
|
+
*/
|
|
1655
|
+
return await this.fetchFundingRate(symbol, params);
|
|
1656
|
+
}
|
|
1657
|
+
parseFundingRate(data, market = undefined) {
|
|
1658
|
+
//
|
|
1659
|
+
// {
|
|
1660
|
+
// "symbol": ".ETHUSDTMFPI8H",
|
|
1661
|
+
// "granularity": 28800000,
|
|
1662
|
+
// "timePoint": 1637380800000,
|
|
1663
|
+
// "value": 0.0001,
|
|
1664
|
+
// "predictedValue": 0.0001,
|
|
1665
|
+
// }
|
|
1666
|
+
//
|
|
1641
1667
|
const fundingTimestamp = this.safeInteger(data, 'timePoint');
|
|
1642
|
-
|
|
1668
|
+
const marketId = this.safeString(data, 'symbol');
|
|
1643
1669
|
return {
|
|
1644
1670
|
'info': data,
|
|
1645
|
-
'symbol': market
|
|
1671
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'contract'),
|
|
1646
1672
|
'markPrice': undefined,
|
|
1647
1673
|
'indexPrice': undefined,
|
|
1648
1674
|
'interestRate': undefined,
|
|
1649
1675
|
'estimatedSettlePrice': undefined,
|
|
1650
1676
|
'timestamp': undefined,
|
|
1651
1677
|
'datetime': undefined,
|
|
1652
|
-
'fundingRate': this.safeNumber(data, '
|
|
1653
|
-
'fundingTimestamp':
|
|
1654
|
-
'fundingDatetime':
|
|
1655
|
-
'nextFundingRate':
|
|
1678
|
+
'fundingRate': this.safeNumber(data, 'value'),
|
|
1679
|
+
'fundingTimestamp': fundingTimestamp,
|
|
1680
|
+
'fundingDatetime': this.iso8601(fundingTimestamp),
|
|
1681
|
+
'nextFundingRate': this.safeNumber(data, 'predictedValue'),
|
|
1656
1682
|
'nextFundingTimestamp': undefined,
|
|
1657
1683
|
'nextFundingDatetime': undefined,
|
|
1658
|
-
'previousFundingRate':
|
|
1659
|
-
'previousFundingTimestamp':
|
|
1660
|
-
'previousFundingDatetime':
|
|
1661
|
-
'interval': this.parseFundingInterval(this.safeString(data, '
|
|
1684
|
+
'previousFundingRate': undefined,
|
|
1685
|
+
'previousFundingTimestamp': undefined,
|
|
1686
|
+
'previousFundingDatetime': undefined,
|
|
1687
|
+
'interval': this.parseFundingInterval(this.safeString(data, 'granularity')),
|
|
1662
1688
|
};
|
|
1663
1689
|
}
|
|
1664
1690
|
parseFundingInterval(interval) {
|
package/js/src/pro/okx.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export default class okx extends okxRest {
|
|
|
17
17
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
18
18
|
unWatchTicker(symbol: string, params?: {}): Promise<any>;
|
|
19
19
|
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
20
|
+
watchMarkPrice(symbol: string, params?: {}): Promise<Ticker>;
|
|
21
|
+
watchMarkPrices(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
20
22
|
unWatchTickers(symbols?: Strings, params?: {}): Promise<any>;
|
|
21
23
|
handleTicker(client: Client, message: any): void;
|
|
22
24
|
watchBidsAsks(symbols?: Strings, params?: {}): Promise<Tickers>;
|
package/js/src/pro/okx.js
CHANGED
|
@@ -16,6 +16,8 @@ export default class okx extends okxRest {
|
|
|
16
16
|
'has': {
|
|
17
17
|
'ws': true,
|
|
18
18
|
'watchTicker': true,
|
|
19
|
+
'watchMarkPrice': true,
|
|
20
|
+
'watchMarkPrices': true,
|
|
19
21
|
'watchTickers': true,
|
|
20
22
|
'watchBidsAsks': true,
|
|
21
23
|
'watchOrderBook': true,
|
|
@@ -432,6 +434,46 @@ export default class okx extends okxRest {
|
|
|
432
434
|
}
|
|
433
435
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
434
436
|
}
|
|
437
|
+
async watchMarkPrice(symbol, params = {}) {
|
|
438
|
+
/**
|
|
439
|
+
* @method
|
|
440
|
+
* @name okx#watchMarkPrice
|
|
441
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-websocket-mark-price-channel
|
|
442
|
+
* @description watches a mark price
|
|
443
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
444
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
445
|
+
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
446
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
447
|
+
*/
|
|
448
|
+
let channel = undefined;
|
|
449
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchMarkPrice', 'channel', 'mark-price');
|
|
450
|
+
params['channel'] = channel;
|
|
451
|
+
const market = this.market(symbol);
|
|
452
|
+
symbol = market['symbol'];
|
|
453
|
+
const ticker = await this.watchMarkPrices([symbol], params);
|
|
454
|
+
return ticker[symbol];
|
|
455
|
+
}
|
|
456
|
+
async watchMarkPrices(symbols = undefined, params = {}) {
|
|
457
|
+
/**
|
|
458
|
+
* @method
|
|
459
|
+
* @name okx#watchMarkPrices
|
|
460
|
+
* @see https://www.okx.com/docs-v5/en/#public-data-websocket-mark-price-channel
|
|
461
|
+
* @description watches mark prices
|
|
462
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
463
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
464
|
+
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
465
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
466
|
+
*/
|
|
467
|
+
await this.loadMarkets();
|
|
468
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
469
|
+
let channel = undefined;
|
|
470
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchMarkPrices', 'channel', 'mark-price');
|
|
471
|
+
const newTickers = await this.subscribeMultiple('public', channel, symbols, params);
|
|
472
|
+
if (this.newUpdates) {
|
|
473
|
+
return newTickers;
|
|
474
|
+
}
|
|
475
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
476
|
+
}
|
|
435
477
|
async unWatchTickers(symbols = undefined, params = {}) {
|
|
436
478
|
/**
|
|
437
479
|
* @method
|
|
@@ -2334,6 +2376,7 @@ export default class okx extends okxRest {
|
|
|
2334
2376
|
'books50-l2-tbt': this.handleOrderBook,
|
|
2335
2377
|
'books-l2-tbt': this.handleOrderBook,
|
|
2336
2378
|
'tickers': this.handleTicker,
|
|
2379
|
+
'mark-price': this.handleTicker,
|
|
2337
2380
|
'positions': this.handlePositions,
|
|
2338
2381
|
'index-tickers': this.handleTicker,
|
|
2339
2382
|
'sprd-tickers': this.handleTicker,
|
|
@@ -15,7 +15,7 @@ export declare class BigInteger {
|
|
|
15
15
|
protected intValue(): number;
|
|
16
16
|
protected byteValue(): number;
|
|
17
17
|
protected shortValue(): number;
|
|
18
|
-
protected signum():
|
|
18
|
+
protected signum(): 0 | 1 | -1;
|
|
19
19
|
toByteArray(): number[];
|
|
20
20
|
protected equals(a: BigInteger): boolean;
|
|
21
21
|
protected min(a: BigInteger): BigInteger;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Abi, FunctionAbi, RawArgs } from '../../../types/index.js';
|
|
2
2
|
import { AbiParserInterface } from './interface.js';
|
|
3
3
|
export declare function createAbiParser(abi: Abi): AbiParserInterface;
|
|
4
|
-
export declare function getAbiVersion(abi: Abi):
|
|
4
|
+
export declare function getAbiVersion(abi: Abi): 0 | 1 | 2;
|
|
5
5
|
export declare function isNoConstructorValid(method: string, argsCalldata: RawArgs, abiMethod?: FunctionAbi): boolean;
|
package/js/src/woo.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ export default class woo extends Exchange {
|
|
|
105
105
|
};
|
|
106
106
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
107
107
|
parseFundingRate(fundingRate: any, market?: Market): FundingRate;
|
|
108
|
+
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
108
109
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
109
110
|
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
110
111
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
package/js/src/woo.js
CHANGED
|
@@ -71,6 +71,8 @@ export default class woo extends Exchange {
|
|
|
71
71
|
'fetchDeposits': true,
|
|
72
72
|
'fetchDepositsWithdrawals': true,
|
|
73
73
|
'fetchFundingHistory': true,
|
|
74
|
+
'fetchFundingInterval': true,
|
|
75
|
+
'fetchFundingIntervals': false,
|
|
74
76
|
'fetchFundingRate': true,
|
|
75
77
|
'fetchFundingRateHistory': true,
|
|
76
78
|
'fetchFundingRates': true,
|
|
@@ -2792,6 +2794,18 @@ export default class woo extends Exchange {
|
|
|
2792
2794
|
'interval': intervalString + 'h',
|
|
2793
2795
|
};
|
|
2794
2796
|
}
|
|
2797
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
2798
|
+
/**
|
|
2799
|
+
* @method
|
|
2800
|
+
* @name woo#fetchFundingInterval
|
|
2801
|
+
* @description fetch the current funding rate interval
|
|
2802
|
+
* @see https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
|
|
2803
|
+
* @param {string} symbol unified market symbol
|
|
2804
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2805
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2806
|
+
*/
|
|
2807
|
+
return await this.fetchFundingRate(symbol, params);
|
|
2808
|
+
}
|
|
2795
2809
|
async fetchFundingRate(symbol, params = {}) {
|
|
2796
2810
|
/**
|
|
2797
2811
|
* @method
|
package/js/src/woofipro.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export default class woofipro extends Exchange {
|
|
|
23
23
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
24
24
|
parseFundingRate(fundingRate: any, market?: Market): FundingRate;
|
|
25
25
|
parseFundingInterval(interval: any): string;
|
|
26
|
+
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
26
27
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
27
28
|
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
28
29
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
package/js/src/woofipro.js
CHANGED
|
@@ -73,6 +73,8 @@ export default class woofipro extends Exchange {
|
|
|
73
73
|
'fetchDeposits': true,
|
|
74
74
|
'fetchDepositsWithdrawals': true,
|
|
75
75
|
'fetchFundingHistory': true,
|
|
76
|
+
'fetchFundingInterval': true,
|
|
77
|
+
'fetchFundingIntervals': false,
|
|
76
78
|
'fetchFundingRate': true,
|
|
77
79
|
'fetchFundingRateHistory': true,
|
|
78
80
|
'fetchFundingRates': true,
|
|
@@ -802,6 +804,18 @@ export default class woofipro extends Exchange {
|
|
|
802
804
|
};
|
|
803
805
|
return this.safeString(intervals, interval, interval);
|
|
804
806
|
}
|
|
807
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
808
|
+
/**
|
|
809
|
+
* @method
|
|
810
|
+
* @name woofipro#fetchFundingInterval
|
|
811
|
+
* @description fetch the current funding rate interval
|
|
812
|
+
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
|
|
813
|
+
* @param {string} symbol unified market symbol
|
|
814
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
815
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
816
|
+
*/
|
|
817
|
+
return await this.fetchFundingRate(symbol, params);
|
|
818
|
+
}
|
|
805
819
|
async fetchFundingRate(symbol, params = {}) {
|
|
806
820
|
/**
|
|
807
821
|
* @method
|