ccxt 4.4.8 → 4.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -131
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +2 -1
- package/dist/cjs/src/bigone.js +35 -86
- package/dist/cjs/src/binance.js +4 -8
- package/dist/cjs/src/bingx.js +26 -22
- package/dist/cjs/src/bitfinex2.js +5 -16
- package/dist/cjs/src/bitget.js +7 -3
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bitmex.js +4 -3
- package/dist/cjs/src/blofin.js +4 -13
- package/dist/cjs/src/bybit.js +21 -15
- package/dist/cjs/src/coinex.js +15 -1
- package/dist/cjs/src/delta.js +2 -1
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/digifinex.js +15 -1
- package/dist/cjs/src/gate.js +64 -9
- package/dist/cjs/src/hashkey.js +2 -2
- package/dist/cjs/src/hitbtc.js +2 -1
- package/dist/cjs/src/htx.js +21 -2
- package/dist/cjs/src/hyperliquid.js +6 -1
- package/dist/cjs/src/krakenfutures.js +3 -2
- package/dist/cjs/src/kucoin.js +2 -1
- package/dist/cjs/src/kucoinfutures.js +173 -2
- package/dist/cjs/src/mexc.js +1 -0
- package/dist/cjs/src/oceanex.js +83 -3
- package/dist/cjs/src/okx.js +14 -0
- package/dist/cjs/src/oxfun.js +4 -4
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/poloniexfutures.js +11 -0
- package/dist/cjs/src/pro/binance.js +4 -4
- package/dist/cjs/src/pro/deribit.js +43 -1
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/hitbtc.js +122 -48
- package/dist/cjs/src/pro/hollaex.js +5 -0
- package/dist/cjs/src/pro/okx.js +19 -3
- package/dist/cjs/src/pro/p2b.js +35 -1
- package/dist/cjs/src/pro/whitebit.js +31 -0
- package/dist/cjs/src/vertex.js +2 -1
- package/dist/cjs/src/whitebit.js +10 -9
- package/dist/cjs/src/woo.js +42 -17
- package/dist/cjs/src/woofipro.js +15 -2
- package/dist/cjs/src/xt.js +2 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bigone.d.ts +1 -1
- package/js/src/abstract/kucoinfutures.d.ts +5 -0
- package/js/src/abstract/oceanex.d.ts +5 -0
- package/js/src/ascendex.d.ts +3 -21
- package/js/src/ascendex.js +2 -1
- package/js/src/base/Exchange.d.ts +3 -3
- package/js/src/base/types.d.ts +1 -0
- package/js/src/bigone.js +35 -86
- package/js/src/binance.d.ts +4 -40
- package/js/src/binance.js +4 -8
- package/js/src/bingx.d.ts +4 -40
- package/js/src/bingx.js +26 -22
- package/js/src/bitfinex2.d.ts +3 -22
- package/js/src/bitfinex2.js +5 -16
- package/js/src/bitget.d.ts +3 -39
- package/js/src/bitget.js +7 -3
- package/js/src/bitmart.d.ts +3 -39
- package/js/src/bitmart.js +1 -0
- package/js/src/bitmex.d.ts +3 -21
- package/js/src/bitmex.js +4 -3
- package/js/src/blofin.d.ts +3 -39
- package/js/src/blofin.js +4 -13
- package/js/src/bybit.d.ts +3 -21
- package/js/src/bybit.js +21 -15
- package/js/src/coinex.d.ts +5 -40
- package/js/src/coinex.js +15 -1
- package/js/src/delta.d.ts +4 -40
- package/js/src/delta.js +2 -1
- package/js/src/deribit.d.ts +3 -39
- package/js/src/deribit.js +1 -0
- package/js/src/digifinex.d.ts +4 -21
- package/js/src/digifinex.js +15 -1
- package/js/src/gate.d.ts +6 -41
- package/js/src/gate.js +64 -9
- package/js/src/hashkey.d.ts +4 -40
- package/js/src/hashkey.js +2 -2
- package/js/src/hitbtc.d.ts +4 -40
- package/js/src/hitbtc.js +2 -1
- package/js/src/htx.d.ts +5 -40
- package/js/src/htx.js +21 -2
- package/js/src/hyperliquid.js +6 -1
- package/js/src/krakenfutures.d.ts +3 -21
- package/js/src/krakenfutures.js +3 -2
- package/js/src/kucoin.js +2 -1
- package/js/src/kucoinfutures.d.ts +9 -20
- package/js/src/kucoinfutures.js +173 -2
- package/js/src/mexc.d.ts +3 -39
- package/js/src/mexc.js +1 -0
- package/js/src/oceanex.d.ts +9 -1
- package/js/src/oceanex.js +83 -3
- package/js/src/okx.d.ts +4 -39
- package/js/src/okx.js +14 -0
- package/js/src/oxfun.d.ts +3 -21
- package/js/src/oxfun.js +4 -4
- package/js/src/phemex.d.ts +3 -39
- package/js/src/phemex.js +1 -0
- package/js/src/poloniexfutures.d.ts +3 -20
- package/js/src/poloniexfutures.js +11 -0
- package/js/src/pro/binance.js +4 -4
- package/js/src/pro/deribit.d.ts +2 -1
- package/js/src/pro/deribit.js +43 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/hitbtc.d.ts +4 -1
- package/js/src/pro/hitbtc.js +122 -48
- package/js/src/pro/hollaex.js +5 -0
- package/js/src/pro/okx.js +19 -3
- package/js/src/pro/p2b.d.ts +2 -1
- package/js/src/pro/p2b.js +35 -1
- package/js/src/pro/whitebit.d.ts +2 -1
- package/js/src/pro/whitebit.js +31 -0
- package/js/src/vertex.d.ts +4 -40
- package/js/src/vertex.js +2 -1
- package/js/src/whitebit.d.ts +4 -21
- package/js/src/whitebit.js +10 -9
- package/js/src/woo.d.ts +4 -40
- package/js/src/woo.js +42 -17
- package/js/src/woofipro.d.ts +5 -40
- package/js/src/woofipro.js +15 -2
- package/js/src/xt.d.ts +3 -39
- package/js/src/xt.js +2 -0
- package/package.json +1 -1
package/js/src/pro/whitebit.js
CHANGED
|
@@ -21,6 +21,7 @@ export default class whitebit extends whitebitRest {
|
|
|
21
21
|
'watchOrderBook': true,
|
|
22
22
|
'watchOrders': true,
|
|
23
23
|
'watchTicker': true,
|
|
24
|
+
'watchTickers': true,
|
|
24
25
|
'watchTrades': true,
|
|
25
26
|
'watchTradesForSymbols': false,
|
|
26
27
|
},
|
|
@@ -259,6 +260,36 @@ export default class whitebit extends whitebitRest {
|
|
|
259
260
|
// every time we want to subscribe to another market we have to "re-subscribe" sending it all again
|
|
260
261
|
return await this.watchMultipleSubscription(messageHash, method, symbol, false, params);
|
|
261
262
|
}
|
|
263
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
264
|
+
/**
|
|
265
|
+
* @method
|
|
266
|
+
* @name whitebit#watchTickers
|
|
267
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
268
|
+
* @see https://docs.whitebit.com/public/websocket/#market-statistics
|
|
269
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
270
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
271
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
272
|
+
*/
|
|
273
|
+
await this.loadMarkets();
|
|
274
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
275
|
+
const method = 'market_subscribe';
|
|
276
|
+
const url = this.urls['api']['ws'];
|
|
277
|
+
const id = this.nonce();
|
|
278
|
+
const messageHashes = [];
|
|
279
|
+
const args = [];
|
|
280
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
281
|
+
const market = this.market(symbols[i]);
|
|
282
|
+
messageHashes.push('ticker:' + market['symbol']);
|
|
283
|
+
args.push(market['id']);
|
|
284
|
+
}
|
|
285
|
+
const request = {
|
|
286
|
+
'id': id,
|
|
287
|
+
'method': method,
|
|
288
|
+
'params': args,
|
|
289
|
+
};
|
|
290
|
+
await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
|
|
291
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
292
|
+
}
|
|
262
293
|
handleTicker(client, message) {
|
|
263
294
|
//
|
|
264
295
|
// {
|
package/js/src/vertex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/vertex.js';
|
|
2
|
-
import type { Market, Ticker, Tickers, TradingFees, Balances, Int, OrderBook, OHLCV, Str, Order, OrderType, OrderSide, Trade, Strings, Dict, Num, Currencies } from './base/types.js';
|
|
2
|
+
import type { Market, Ticker, Tickers, TradingFees, Balances, Int, OrderBook, OHLCV, Str, Order, OrderType, OrderSide, Trade, Strings, Dict, Num, Currencies, FundingRate, FundingRates } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class vertex
|
|
5
5
|
* @augments Exchange
|
|
@@ -27,45 +27,9 @@ export default class vertex extends Exchange {
|
|
|
27
27
|
fetchTradingFees(params?: {}): Promise<TradingFees>;
|
|
28
28
|
parseOHLCV(ohlcv: any, market?: Market): OHLCV;
|
|
29
29
|
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
30
|
-
parseFundingRate(ticker: any, market?: Market):
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
markPrice: number;
|
|
34
|
-
indexPrice: number;
|
|
35
|
-
interestRate: any;
|
|
36
|
-
estimatedSettlePrice: any;
|
|
37
|
-
timestamp: any;
|
|
38
|
-
datetime: any;
|
|
39
|
-
fundingRate: number;
|
|
40
|
-
fundingTimestamp: number;
|
|
41
|
-
fundingDatetime: string;
|
|
42
|
-
nextFundingRate: any;
|
|
43
|
-
nextFundingTimestamp: any;
|
|
44
|
-
nextFundingDatetime: any;
|
|
45
|
-
previousFundingRate: any;
|
|
46
|
-
previousFundingTimestamp: any;
|
|
47
|
-
previousFundingDatetime: any;
|
|
48
|
-
};
|
|
49
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
|
50
|
-
info: any;
|
|
51
|
-
symbol: string;
|
|
52
|
-
markPrice: number;
|
|
53
|
-
indexPrice: number;
|
|
54
|
-
interestRate: any;
|
|
55
|
-
estimatedSettlePrice: any;
|
|
56
|
-
timestamp: any;
|
|
57
|
-
datetime: any;
|
|
58
|
-
fundingRate: number;
|
|
59
|
-
fundingTimestamp: number;
|
|
60
|
-
fundingDatetime: string;
|
|
61
|
-
nextFundingRate: any;
|
|
62
|
-
nextFundingTimestamp: any;
|
|
63
|
-
nextFundingDatetime: any;
|
|
64
|
-
previousFundingRate: any;
|
|
65
|
-
previousFundingTimestamp: any;
|
|
66
|
-
previousFundingDatetime: any;
|
|
67
|
-
}>;
|
|
68
|
-
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
30
|
+
parseFundingRate(ticker: any, market?: Market): FundingRate;
|
|
31
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
32
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
69
33
|
parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
|
|
70
34
|
fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
|
|
71
35
|
parseTicker(ticker: Dict, market?: Market): Ticker;
|
package/js/src/vertex.js
CHANGED
|
@@ -1245,6 +1245,7 @@ export default class vertex extends Exchange {
|
|
|
1245
1245
|
'previousFundingRate': undefined,
|
|
1246
1246
|
'previousFundingTimestamp': undefined,
|
|
1247
1247
|
'previousFundingDatetime': undefined,
|
|
1248
|
+
'interval': undefined,
|
|
1248
1249
|
};
|
|
1249
1250
|
}
|
|
1250
1251
|
async fetchFundingRate(symbol, params = {}) {
|
|
@@ -1282,7 +1283,7 @@ export default class vertex extends Exchange {
|
|
|
1282
1283
|
* @see https://docs.vertexprotocol.com/developer-resources/api/v2/contracts
|
|
1283
1284
|
* @param {string[]} symbols unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
|
|
1284
1285
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1285
|
-
* @returns {object} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
1286
|
+
* @returns {object[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
1286
1287
|
*/
|
|
1287
1288
|
await this.loadMarkets();
|
|
1288
1289
|
const request = {};
|
package/js/src/whitebit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/whitebit.js';
|
|
2
|
-
import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, TradingFees, Dict, int } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, TradingFees, Dict, int, FundingRate, FundingRates } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class whitebit
|
|
5
5
|
* @augments Exchange
|
|
@@ -75,26 +75,9 @@ export default class whitebit extends Exchange {
|
|
|
75
75
|
datetime: string;
|
|
76
76
|
info: Dict;
|
|
77
77
|
};
|
|
78
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<
|
|
79
|
-
fetchFundingRates(symbols?: Strings, params?: {}): Promise<
|
|
80
|
-
parseFundingRate(contract: any, market?: Market):
|
|
81
|
-
info: any;
|
|
82
|
-
symbol: string;
|
|
83
|
-
markPrice: number;
|
|
84
|
-
indexPrice: number;
|
|
85
|
-
interestRate: number;
|
|
86
|
-
timestamp: any;
|
|
87
|
-
datetime: any;
|
|
88
|
-
fundingRate: number;
|
|
89
|
-
fundingTimestamp: any;
|
|
90
|
-
fundingDatetime: string;
|
|
91
|
-
nextFundingRate: any;
|
|
92
|
-
nextFundingTimestamp: number;
|
|
93
|
-
nextFundingDatetime: string;
|
|
94
|
-
previousFundingRate: any;
|
|
95
|
-
previousFundingTimestamp: any;
|
|
96
|
-
previousFundingDatetime: any;
|
|
97
|
-
};
|
|
78
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
79
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
80
|
+
parseFundingRate(contract: any, market?: Market): FundingRate;
|
|
98
81
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
99
82
|
isFiat(currency: string): boolean;
|
|
100
83
|
nonce(): number;
|
package/js/src/whitebit.js
CHANGED
|
@@ -2373,8 +2373,8 @@ export default class whitebit extends Exchange {
|
|
|
2373
2373
|
/**
|
|
2374
2374
|
* @method
|
|
2375
2375
|
* @name whitebit#fetchFundingRate
|
|
2376
|
-
* @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
|
2377
2376
|
* @description fetch the current funding rate
|
|
2377
|
+
* @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
|
2378
2378
|
* @param {string} symbol unified market symbol
|
|
2379
2379
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2380
2380
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -2388,11 +2388,11 @@ export default class whitebit extends Exchange {
|
|
|
2388
2388
|
/**
|
|
2389
2389
|
* @method
|
|
2390
2390
|
* @name whitebit#fetchFundingRates
|
|
2391
|
-
* @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
|
2392
2391
|
* @description fetch the funding rate for multiple markets
|
|
2392
|
+
* @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
|
|
2393
2393
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
2394
2394
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2395
|
-
* @returns {object} a
|
|
2395
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
2396
2396
|
*/
|
|
2397
2397
|
await this.loadMarkets();
|
|
2398
2398
|
symbols = this.marketSymbols(symbols);
|
|
@@ -2441,7 +2441,7 @@ export default class whitebit extends Exchange {
|
|
|
2441
2441
|
// }
|
|
2442
2442
|
// ]
|
|
2443
2443
|
//
|
|
2444
|
-
const data = this.
|
|
2444
|
+
const data = this.safeList(response, 'result', []);
|
|
2445
2445
|
const result = this.parseFundingRates(data);
|
|
2446
2446
|
return this.filterByArray(result, 'symbol', symbols);
|
|
2447
2447
|
}
|
|
@@ -2484,7 +2484,7 @@ export default class whitebit extends Exchange {
|
|
|
2484
2484
|
const indexPrice = this.safeNumber(contract, 'indexPrice');
|
|
2485
2485
|
const interestRate = this.safeNumber(contract, 'interestRate');
|
|
2486
2486
|
const fundingRate = this.safeNumber(contract, 'funding_rate');
|
|
2487
|
-
const
|
|
2487
|
+
const fundingTime = this.safeInteger(contract, 'next_funding_rate_timestamp');
|
|
2488
2488
|
return {
|
|
2489
2489
|
'info': contract,
|
|
2490
2490
|
'symbol': symbol,
|
|
@@ -2494,14 +2494,15 @@ export default class whitebit extends Exchange {
|
|
|
2494
2494
|
'timestamp': undefined,
|
|
2495
2495
|
'datetime': undefined,
|
|
2496
2496
|
'fundingRate': fundingRate,
|
|
2497
|
-
'fundingTimestamp':
|
|
2498
|
-
'fundingDatetime': this.iso8601(
|
|
2497
|
+
'fundingTimestamp': fundingTime,
|
|
2498
|
+
'fundingDatetime': this.iso8601(fundingTime),
|
|
2499
2499
|
'nextFundingRate': undefined,
|
|
2500
|
-
'nextFundingTimestamp':
|
|
2501
|
-
'nextFundingDatetime':
|
|
2500
|
+
'nextFundingTimestamp': undefined,
|
|
2501
|
+
'nextFundingDatetime': undefined,
|
|
2502
2502
|
'previousFundingRate': undefined,
|
|
2503
2503
|
'previousFundingTimestamp': undefined,
|
|
2504
2504
|
'previousFundingDatetime': undefined,
|
|
2505
|
+
'interval': undefined,
|
|
2505
2506
|
};
|
|
2506
2507
|
}
|
|
2507
2508
|
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
package/js/src/woo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/woo.js';
|
|
2
|
-
import type { TransferEntry, Balances, Conversion, Currency, FundingRateHistory, Int, Market, MarginModification, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Dict, Strings, Trade, Transaction, Leverage, Account, Currencies, TradingFees, int, FundingHistory, LedgerEntry } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Balances, Conversion, Currency, FundingRateHistory, Int, Market, MarginModification, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Dict, Strings, Trade, Transaction, Leverage, Account, Currencies, TradingFees, int, FundingHistory, LedgerEntry, FundingRate, FundingRates } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class woo
|
|
5
5
|
* @augments Exchange
|
|
@@ -104,45 +104,9 @@ export default class woo extends Exchange {
|
|
|
104
104
|
rate: number;
|
|
105
105
|
};
|
|
106
106
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
107
|
-
parseFundingRate(fundingRate: any, market?: Market):
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
markPrice: any;
|
|
111
|
-
indexPrice: any;
|
|
112
|
-
interestRate: number;
|
|
113
|
-
estimatedSettlePrice: any;
|
|
114
|
-
timestamp: number;
|
|
115
|
-
datetime: string;
|
|
116
|
-
fundingRate: number;
|
|
117
|
-
fundingTimestamp: number;
|
|
118
|
-
fundingDatetime: string;
|
|
119
|
-
nextFundingRate: any;
|
|
120
|
-
nextFundingTimestamp: any;
|
|
121
|
-
nextFundingDatetime: any;
|
|
122
|
-
previousFundingRate: number;
|
|
123
|
-
previousFundingTimestamp: number;
|
|
124
|
-
previousFundingDatetime: string;
|
|
125
|
-
};
|
|
126
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
|
127
|
-
info: any;
|
|
128
|
-
symbol: string;
|
|
129
|
-
markPrice: any;
|
|
130
|
-
indexPrice: any;
|
|
131
|
-
interestRate: number;
|
|
132
|
-
estimatedSettlePrice: any;
|
|
133
|
-
timestamp: number;
|
|
134
|
-
datetime: string;
|
|
135
|
-
fundingRate: number;
|
|
136
|
-
fundingTimestamp: number;
|
|
137
|
-
fundingDatetime: string;
|
|
138
|
-
nextFundingRate: any;
|
|
139
|
-
nextFundingTimestamp: any;
|
|
140
|
-
nextFundingDatetime: any;
|
|
141
|
-
previousFundingRate: number;
|
|
142
|
-
previousFundingTimestamp: number;
|
|
143
|
-
previousFundingDatetime: string;
|
|
144
|
-
}>;
|
|
145
|
-
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
107
|
+
parseFundingRate(fundingRate: any, market?: Market): FundingRate;
|
|
108
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
109
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
146
110
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
147
111
|
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
|
|
148
112
|
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
package/js/src/woo.js
CHANGED
|
@@ -2752,21 +2752,25 @@ export default class woo extends Exchange {
|
|
|
2752
2752
|
}
|
|
2753
2753
|
parseFundingRate(fundingRate, market = undefined) {
|
|
2754
2754
|
//
|
|
2755
|
-
//
|
|
2756
|
-
//
|
|
2757
|
-
//
|
|
2758
|
-
//
|
|
2759
|
-
//
|
|
2760
|
-
//
|
|
2761
|
-
//
|
|
2762
|
-
//
|
|
2763
|
-
//
|
|
2755
|
+
// {
|
|
2756
|
+
// "success": true,
|
|
2757
|
+
// "timestamp": 1727427915529,
|
|
2758
|
+
// "symbol": "PERP_BTC_USDT",
|
|
2759
|
+
// "est_funding_rate": -0.00092719,
|
|
2760
|
+
// "est_funding_rate_timestamp": 1727427899060,
|
|
2761
|
+
// "last_funding_rate": -0.00092610,
|
|
2762
|
+
// "last_funding_rate_timestamp": 1727424000000,
|
|
2763
|
+
// "next_funding_time": 1727452800000,
|
|
2764
|
+
// "last_funding_rate_interval": 8,
|
|
2765
|
+
// "est_funding_rate_interval": 8
|
|
2766
|
+
// }
|
|
2764
2767
|
//
|
|
2765
2768
|
const symbol = this.safeString(fundingRate, 'symbol');
|
|
2766
2769
|
market = this.market(symbol);
|
|
2767
2770
|
const nextFundingTimestamp = this.safeInteger(fundingRate, 'next_funding_time');
|
|
2768
2771
|
const estFundingRateTimestamp = this.safeInteger(fundingRate, 'est_funding_rate_timestamp');
|
|
2769
2772
|
const lastFundingRateTimestamp = this.safeInteger(fundingRate, 'last_funding_rate_timestamp');
|
|
2773
|
+
const intervalString = this.safeString(fundingRate, 'est_funding_rate_interval');
|
|
2770
2774
|
return {
|
|
2771
2775
|
'info': fundingRate,
|
|
2772
2776
|
'symbol': market['symbol'],
|
|
@@ -2785,9 +2789,19 @@ export default class woo extends Exchange {
|
|
|
2785
2789
|
'previousFundingRate': this.safeNumber(fundingRate, 'last_funding_rate'),
|
|
2786
2790
|
'previousFundingTimestamp': lastFundingRateTimestamp,
|
|
2787
2791
|
'previousFundingDatetime': this.iso8601(lastFundingRateTimestamp),
|
|
2792
|
+
'interval': intervalString + 'h',
|
|
2788
2793
|
};
|
|
2789
2794
|
}
|
|
2790
2795
|
async fetchFundingRate(symbol, params = {}) {
|
|
2796
|
+
/**
|
|
2797
|
+
* @method
|
|
2798
|
+
* @name woo#fetchFundingRate
|
|
2799
|
+
* @description fetch the current funding rate
|
|
2800
|
+
* @see https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
|
|
2801
|
+
* @param {string} symbol unified market symbol
|
|
2802
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2803
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
2804
|
+
*/
|
|
2791
2805
|
await this.loadMarkets();
|
|
2792
2806
|
const market = this.market(symbol);
|
|
2793
2807
|
const request = {
|
|
@@ -2796,19 +2810,30 @@ export default class woo extends Exchange {
|
|
|
2796
2810
|
const response = await this.v1PublicGetFundingRateSymbol(this.extend(request, params));
|
|
2797
2811
|
//
|
|
2798
2812
|
// {
|
|
2799
|
-
// "success":true,
|
|
2800
|
-
// "timestamp":
|
|
2801
|
-
// "symbol":"PERP_BTC_USDT",
|
|
2802
|
-
// "est_funding_rate":0.
|
|
2803
|
-
// "est_funding_rate_timestamp":
|
|
2804
|
-
// "last_funding_rate":0.
|
|
2805
|
-
// "last_funding_rate_timestamp":
|
|
2806
|
-
// "next_funding_time":
|
|
2813
|
+
// "success": true,
|
|
2814
|
+
// "timestamp": 1727428037877,
|
|
2815
|
+
// "symbol": "PERP_BTC_USDT",
|
|
2816
|
+
// "est_funding_rate": -0.00092674,
|
|
2817
|
+
// "est_funding_rate_timestamp": 1727428019064,
|
|
2818
|
+
// "last_funding_rate": -0.00092610,
|
|
2819
|
+
// "last_funding_rate_timestamp": 1727424000000,
|
|
2820
|
+
// "next_funding_time": 1727452800000,
|
|
2821
|
+
// "last_funding_rate_interval": 8,
|
|
2822
|
+
// "est_funding_rate_interval": 8
|
|
2807
2823
|
// }
|
|
2808
2824
|
//
|
|
2809
2825
|
return this.parseFundingRate(response, market);
|
|
2810
2826
|
}
|
|
2811
2827
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
2828
|
+
/**
|
|
2829
|
+
* @method
|
|
2830
|
+
* @name woo#fetchFundingRates
|
|
2831
|
+
* @description fetch the funding rate for multiple markets
|
|
2832
|
+
* @see https://docs.woox.io/#get-predicted-funding-rate-for-all-markets-public
|
|
2833
|
+
* @param {string[]|undefined} symbols list of unified market symbols
|
|
2834
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2835
|
+
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
|
|
2836
|
+
*/
|
|
2812
2837
|
await this.loadMarkets();
|
|
2813
2838
|
symbols = this.marketSymbols(symbols);
|
|
2814
2839
|
const response = await this.v1PublicGetFundingRates(params);
|
package/js/src/woofipro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/woofipro.js';
|
|
2
|
-
import type { Balances, Currency, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, Leverage, Currencies, TradingFees, OrderRequest, Dict, int, LedgerEntry } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, FundingRateHistory, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, Leverage, Currencies, TradingFees, OrderRequest, Dict, int, LedgerEntry, FundingRate, FundingRates } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class woofipro
|
|
5
5
|
* @augments Exchange
|
|
@@ -21,45 +21,10 @@ export default class woofipro extends Exchange {
|
|
|
21
21
|
parseTokenAndFeeTemp(item: any, feeTokenKey: any, feeAmountKey: any): any;
|
|
22
22
|
parseTrade(trade: Dict, market?: Market): Trade;
|
|
23
23
|
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
24
|
-
parseFundingRate(fundingRate: any, market?: Market):
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
indexPrice: any;
|
|
29
|
-
interestRate: number;
|
|
30
|
-
estimatedSettlePrice: any;
|
|
31
|
-
timestamp: number;
|
|
32
|
-
datetime: string;
|
|
33
|
-
fundingRate: number;
|
|
34
|
-
fundingTimestamp: number;
|
|
35
|
-
fundingDatetime: string;
|
|
36
|
-
nextFundingRate: any;
|
|
37
|
-
nextFundingTimestamp: any;
|
|
38
|
-
nextFundingDatetime: any;
|
|
39
|
-
previousFundingRate: number;
|
|
40
|
-
previousFundingTimestamp: number;
|
|
41
|
-
previousFundingDatetime: string;
|
|
42
|
-
};
|
|
43
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
|
44
|
-
info: any;
|
|
45
|
-
symbol: string;
|
|
46
|
-
markPrice: any;
|
|
47
|
-
indexPrice: any;
|
|
48
|
-
interestRate: number;
|
|
49
|
-
estimatedSettlePrice: any;
|
|
50
|
-
timestamp: number;
|
|
51
|
-
datetime: string;
|
|
52
|
-
fundingRate: number;
|
|
53
|
-
fundingTimestamp: number;
|
|
54
|
-
fundingDatetime: string;
|
|
55
|
-
nextFundingRate: any;
|
|
56
|
-
nextFundingTimestamp: any;
|
|
57
|
-
nextFundingDatetime: any;
|
|
58
|
-
previousFundingRate: number;
|
|
59
|
-
previousFundingTimestamp: number;
|
|
60
|
-
previousFundingDatetime: string;
|
|
61
|
-
}>;
|
|
62
|
-
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
24
|
+
parseFundingRate(fundingRate: any, market?: Market): FundingRate;
|
|
25
|
+
parseFundingInterval(interval: any): string;
|
|
26
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
27
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
63
28
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
64
29
|
fetchTradingFees(params?: {}): Promise<TradingFees>;
|
|
65
30
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
package/js/src/woofipro.js
CHANGED
|
@@ -763,12 +763,14 @@ export default class woofipro extends Exchange {
|
|
|
763
763
|
// "sum_unitary_funding": 521.367
|
|
764
764
|
// }
|
|
765
765
|
//
|
|
766
|
-
//
|
|
767
766
|
const symbol = this.safeString(fundingRate, 'symbol');
|
|
768
767
|
market = this.market(symbol);
|
|
769
768
|
const nextFundingTimestamp = this.safeInteger(fundingRate, 'next_funding_time');
|
|
770
769
|
const estFundingRateTimestamp = this.safeInteger(fundingRate, 'est_funding_rate_timestamp');
|
|
771
770
|
const lastFundingRateTimestamp = this.safeInteger(fundingRate, 'last_funding_rate_timestamp');
|
|
771
|
+
const fundingTimeString = this.safeString(fundingRate, 'last_funding_rate_timestamp');
|
|
772
|
+
const nextFundingTimeString = this.safeString(fundingRate, 'next_funding_time');
|
|
773
|
+
const millisecondsInterval = Precise.stringSub(nextFundingTimeString, fundingTimeString);
|
|
772
774
|
return {
|
|
773
775
|
'info': fundingRate,
|
|
774
776
|
'symbol': market['symbol'],
|
|
@@ -787,7 +789,18 @@ export default class woofipro extends Exchange {
|
|
|
787
789
|
'previousFundingRate': this.safeNumber(fundingRate, 'last_funding_rate'),
|
|
788
790
|
'previousFundingTimestamp': lastFundingRateTimestamp,
|
|
789
791
|
'previousFundingDatetime': this.iso8601(lastFundingRateTimestamp),
|
|
792
|
+
'interval': this.parseFundingInterval(millisecondsInterval),
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
parseFundingInterval(interval) {
|
|
796
|
+
const intervals = {
|
|
797
|
+
'3600000': '1h',
|
|
798
|
+
'14400000': '4h',
|
|
799
|
+
'28800000': '8h',
|
|
800
|
+
'57600000': '16h',
|
|
801
|
+
'86400000': '24h',
|
|
790
802
|
};
|
|
803
|
+
return this.safeString(intervals, interval, interval);
|
|
791
804
|
}
|
|
792
805
|
async fetchFundingRate(symbol, params = {}) {
|
|
793
806
|
/**
|
|
@@ -827,7 +840,7 @@ export default class woofipro extends Exchange {
|
|
|
827
840
|
/**
|
|
828
841
|
* @method
|
|
829
842
|
* @name woofipro#fetchFundingRates
|
|
830
|
-
* @description fetch the current funding
|
|
843
|
+
* @description fetch the current funding rate for multiple markets
|
|
831
844
|
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets
|
|
832
845
|
* @param {string[]} symbols unified market symbols
|
|
833
846
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/js/src/xt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/xt.js';
|
|
2
|
-
import { Currencies, Currency, Dict, FundingHistory, FundingRateHistory, Int, LeverageTier, MarginModification, Market, Num, OHLCV, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry, LedgerEntry } from './base/types.js';
|
|
2
|
+
import { Currencies, Currency, Dict, FundingHistory, FundingRateHistory, Int, LeverageTier, MarginModification, Market, Num, OHLCV, Order, OrderSide, OrderType, Str, Tickers, Transaction, TransferEntry, LedgerEntry, FundingRate } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class xt
|
|
5
5
|
* @augments Exchange
|
|
@@ -73,44 +73,8 @@ export default class xt extends Exchange {
|
|
|
73
73
|
fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<LeverageTier[]>;
|
|
74
74
|
parseMarketLeverageTiers(info: any, market?: any): any[];
|
|
75
75
|
fetchFundingRateHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
76
|
-
fetchFundingRate(symbol: string, params?: {}): Promise<
|
|
77
|
-
|
|
78
|
-
symbol: string;
|
|
79
|
-
markPrice: any;
|
|
80
|
-
indexPrice: any;
|
|
81
|
-
interestRate: any;
|
|
82
|
-
estimatedSettlePrice: any;
|
|
83
|
-
timestamp: any;
|
|
84
|
-
datetime: any;
|
|
85
|
-
fundingRate: number;
|
|
86
|
-
fundingTimestamp: number;
|
|
87
|
-
fundingDatetime: string;
|
|
88
|
-
nextFundingRate: any;
|
|
89
|
-
nextFundingTimestamp: any;
|
|
90
|
-
nextFundingDatetime: any;
|
|
91
|
-
previousFundingRate: any;
|
|
92
|
-
previousFundingTimestamp: any;
|
|
93
|
-
previousFundingDatetime: any;
|
|
94
|
-
}>;
|
|
95
|
-
parseFundingRate(contract: any, market?: any): {
|
|
96
|
-
info: any;
|
|
97
|
-
symbol: string;
|
|
98
|
-
markPrice: any;
|
|
99
|
-
indexPrice: any;
|
|
100
|
-
interestRate: any;
|
|
101
|
-
estimatedSettlePrice: any;
|
|
102
|
-
timestamp: any;
|
|
103
|
-
datetime: any;
|
|
104
|
-
fundingRate: number;
|
|
105
|
-
fundingTimestamp: number;
|
|
106
|
-
fundingDatetime: string;
|
|
107
|
-
nextFundingRate: any;
|
|
108
|
-
nextFundingTimestamp: any;
|
|
109
|
-
nextFundingDatetime: any;
|
|
110
|
-
previousFundingRate: any;
|
|
111
|
-
previousFundingTimestamp: any;
|
|
112
|
-
previousFundingDatetime: any;
|
|
113
|
-
};
|
|
76
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
77
|
+
parseFundingRate(contract: any, market?: any): FundingRate;
|
|
114
78
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
115
79
|
parseFundingHistory(contract: any, market?: any): {
|
|
116
80
|
info: any;
|
package/js/src/xt.js
CHANGED
|
@@ -4350,6 +4350,7 @@ export default class xt extends Exchange {
|
|
|
4350
4350
|
const marketId = this.safeString(contract, 'symbol');
|
|
4351
4351
|
const symbol = this.safeSymbol(marketId, market, '_', 'swap');
|
|
4352
4352
|
const timestamp = this.safeInteger(contract, 'nextCollectionTime');
|
|
4353
|
+
const interval = this.safeString(contract, 'collectionInternal');
|
|
4353
4354
|
return {
|
|
4354
4355
|
'info': contract,
|
|
4355
4356
|
'symbol': symbol,
|
|
@@ -4368,6 +4369,7 @@ export default class xt extends Exchange {
|
|
|
4368
4369
|
'previousFundingRate': undefined,
|
|
4369
4370
|
'previousFundingTimestamp': undefined,
|
|
4370
4371
|
'previousFundingDatetime': undefined,
|
|
4372
|
+
'interval': interval + 'h',
|
|
4371
4373
|
};
|
|
4372
4374
|
}
|
|
4373
4375
|
async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
package/package.json
CHANGED