ccxt 4.4.13 → 4.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +48 -2
- package/dist/cjs/src/binance.js +76 -11
- package/dist/cjs/src/bitget.js +112 -3
- package/dist/cjs/src/bitrue.js +1 -9
- package/dist/cjs/src/bitvavo.js +1 -3
- package/dist/cjs/src/coinex.js +15 -1
- package/dist/cjs/src/cryptocom.js +1 -0
- package/dist/cjs/src/digifinex.js +15 -1
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/huobijp.js +1 -3
- package/dist/cjs/src/kucoin.js +40 -1
- package/dist/cjs/src/kucoinfutures.js +59 -4
- package/dist/cjs/src/mexc.js +64 -8
- package/dist/cjs/src/okx.js +14 -0
- package/dist/cjs/src/onetrading.js +2 -2
- package/dist/cjs/src/poloniexfutures.js +37 -11
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/okx.js +43 -0
- package/dist/cjs/src/pro/upbit.js +46 -0
- package/dist/cjs/src/pro/vertex.js +11 -0
- package/dist/cjs/src/vertex.js +11 -0
- package/dist/cjs/src/woo.js +14 -0
- package/dist/cjs/src/woofipro.js +14 -0
- package/dist/cjs/src/xt.js +14 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/cryptocom.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +6 -0
- package/js/src/base/Exchange.js +48 -2
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +76 -11
- package/js/src/bitget.d.ts +2 -0
- package/js/src/bitget.js +112 -3
- package/js/src/bitrue.d.ts +0 -1
- package/js/src/bitrue.js +1 -9
- package/js/src/bitvavo.d.ts +0 -1
- package/js/src/bitvavo.js +1 -3
- package/js/src/coinex.d.ts +1 -0
- package/js/src/coinex.js +15 -1
- package/js/src/cryptocom.js +1 -0
- package/js/src/digifinex.d.ts +1 -0
- package/js/src/digifinex.js +15 -1
- package/js/src/htx.js +1 -1
- package/js/src/huobijp.d.ts +0 -1
- package/js/src/huobijp.js +1 -3
- package/js/src/kucoin.d.ts +2 -0
- package/js/src/kucoin.js +40 -1
- package/js/src/kucoinfutures.d.ts +3 -0
- package/js/src/kucoinfutures.js +59 -4
- package/js/src/mexc.d.ts +1 -0
- package/js/src/mexc.js +64 -8
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +14 -0
- package/js/src/onetrading.js +2 -2
- package/js/src/poloniexfutures.d.ts +2 -0
- package/js/src/poloniexfutures.js +37 -11
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/okx.d.ts +2 -0
- package/js/src/pro/okx.js +43 -0
- package/js/src/pro/upbit.d.ts +3 -1
- package/js/src/pro/upbit.js +46 -0
- package/js/src/pro/vertex.js +11 -0
- package/js/src/vertex.js +11 -0
- package/js/src/woo.d.ts +1 -0
- package/js/src/woo.js +14 -0
- package/js/src/woofipro.d.ts +1 -0
- package/js/src/woofipro.js +14 -0
- package/js/src/xt.d.ts +1 -0
- package/js/src/xt.js +14 -0
- package/package.json +1 -1
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,
|
package/js/src/pro/upbit.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import upbitRest from '../upbit.js';
|
|
2
|
-
import type { Int, Str, Order, OrderBook, Trade, Ticker, Balances } from '../base/types.js';
|
|
2
|
+
import type { Int, Str, Order, OrderBook, Trade, Ticker, Balances, Tickers, Strings } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
4
|
export default class upbit extends upbitRest {
|
|
5
5
|
describe(): any;
|
|
6
6
|
watchPublic(symbol: string, channel: any, params?: {}): Promise<any>;
|
|
7
|
+
watchPublicMultiple(symbols: Strings, channel: any, params?: {}): Promise<any>;
|
|
7
8
|
watchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
9
|
+
watchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
8
10
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
9
11
|
watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
10
12
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
package/js/src/pro/upbit.js
CHANGED
|
@@ -17,6 +17,7 @@ export default class upbit extends upbitRest {
|
|
|
17
17
|
'ws': true,
|
|
18
18
|
'watchOrderBook': true,
|
|
19
19
|
'watchTicker': true,
|
|
20
|
+
'watchTickers': true,
|
|
20
21
|
'watchTrades': true,
|
|
21
22
|
'watchTradesForSymbols': true,
|
|
22
23
|
'watchOrders': true,
|
|
@@ -59,6 +60,33 @@ export default class upbit extends upbitRest {
|
|
|
59
60
|
const messageHash = channel + ':' + marketId;
|
|
60
61
|
return await this.watch(url, messageHash, request, messageHash);
|
|
61
62
|
}
|
|
63
|
+
async watchPublicMultiple(symbols, channel, params = {}) {
|
|
64
|
+
await this.loadMarkets();
|
|
65
|
+
if (symbols === undefined) {
|
|
66
|
+
symbols = this.symbols;
|
|
67
|
+
}
|
|
68
|
+
symbols = this.marketSymbols(symbols);
|
|
69
|
+
const marketIds = this.marketIds(symbols);
|
|
70
|
+
const url = this.implodeParams(this.urls['api']['ws'], {
|
|
71
|
+
'hostname': this.hostname,
|
|
72
|
+
});
|
|
73
|
+
const messageHashes = [];
|
|
74
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
75
|
+
messageHashes.push(channel + ':' + marketIds[i]);
|
|
76
|
+
}
|
|
77
|
+
const request = [
|
|
78
|
+
{
|
|
79
|
+
'ticket': this.uuid(),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
'type': channel,
|
|
83
|
+
'codes': marketIds,
|
|
84
|
+
// 'isOnlySnapshot': false,
|
|
85
|
+
// 'isOnlyRealtime': false,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
89
|
+
}
|
|
62
90
|
async watchTicker(symbol, params = {}) {
|
|
63
91
|
/**
|
|
64
92
|
* @method
|
|
@@ -71,6 +99,24 @@ export default class upbit extends upbitRest {
|
|
|
71
99
|
*/
|
|
72
100
|
return await this.watchPublic(symbol, 'ticker');
|
|
73
101
|
}
|
|
102
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
103
|
+
/**
|
|
104
|
+
* @method
|
|
105
|
+
* @name upbit#watchTicker
|
|
106
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
107
|
+
* @see https://global-docs.upbit.com/reference/websocket-ticker
|
|
108
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
109
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
110
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
111
|
+
*/
|
|
112
|
+
const newTickers = await this.watchPublicMultiple(symbols, 'ticker');
|
|
113
|
+
if (this.newUpdates) {
|
|
114
|
+
const tickers = {};
|
|
115
|
+
tickers[newTickers['symbol']] = newTickers;
|
|
116
|
+
return tickers;
|
|
117
|
+
}
|
|
118
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
119
|
+
}
|
|
74
120
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
75
121
|
/**
|
|
76
122
|
* @method
|
package/js/src/pro/vertex.js
CHANGED
|
@@ -48,6 +48,9 @@ export default class vertex extends vertexRest {
|
|
|
48
48
|
'fetchPositionsSnapshot': true,
|
|
49
49
|
'awaitPositionsSnapshot': true, // whether to wait for the positions snapshot before providing updates
|
|
50
50
|
},
|
|
51
|
+
'ws': {
|
|
52
|
+
'inflate': true,
|
|
53
|
+
},
|
|
51
54
|
},
|
|
52
55
|
'streaming': {
|
|
53
56
|
// 'ping': this.ping,
|
|
@@ -76,6 +79,14 @@ export default class vertex extends vertexRest {
|
|
|
76
79
|
'id': requestId,
|
|
77
80
|
};
|
|
78
81
|
const request = this.extend(subscribe, message);
|
|
82
|
+
const wsOptions = {
|
|
83
|
+
'headers': {
|
|
84
|
+
'Sec-WebSocket-Extensions': 'permessage-deflate',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
this.options['ws'] = {
|
|
88
|
+
'options': wsOptions,
|
|
89
|
+
};
|
|
79
90
|
return await this.watch(url, messageHash, request, messageHash, subscribe);
|
|
80
91
|
}
|
|
81
92
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
package/js/src/vertex.js
CHANGED
|
@@ -2951,6 +2951,17 @@ export default class vertex extends Exchange {
|
|
|
2951
2951
|
url += '?' + this.urlencode(params);
|
|
2952
2952
|
}
|
|
2953
2953
|
}
|
|
2954
|
+
if (path !== 'execute') {
|
|
2955
|
+
// required encoding for public methods
|
|
2956
|
+
if (headers !== undefined) {
|
|
2957
|
+
headers['Accept-Encoding'] = 'gzip';
|
|
2958
|
+
}
|
|
2959
|
+
else {
|
|
2960
|
+
headers = {
|
|
2961
|
+
'Accept-Encoding': 'gzip',
|
|
2962
|
+
};
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2954
2965
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
2955
2966
|
}
|
|
2956
2967
|
}
|
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
|
package/js/src/xt.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ 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
|
+
fetchFundingInterval(symbol: string, params?: {}): Promise<FundingRate>;
|
|
76
77
|
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
77
78
|
parseFundingRate(contract: any, market?: any): FundingRate;
|
|
78
79
|
fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
package/js/src/xt.js
CHANGED
|
@@ -66,6 +66,8 @@ export default class xt extends Exchange {
|
|
|
66
66
|
'fetchDepositWithdrawFee': false,
|
|
67
67
|
'fetchDepositWithdrawFees': false,
|
|
68
68
|
'fetchFundingHistory': true,
|
|
69
|
+
'fetchFundingInterval': true,
|
|
70
|
+
'fetchFundingIntervals': false,
|
|
69
71
|
'fetchFundingRate': true,
|
|
70
72
|
'fetchFundingRateHistory': true,
|
|
71
73
|
'fetchFundingRates': false,
|
|
@@ -4295,6 +4297,18 @@ export default class xt extends Exchange {
|
|
|
4295
4297
|
const sorted = this.sortBy(rates, 'timestamp');
|
|
4296
4298
|
return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
|
|
4297
4299
|
}
|
|
4300
|
+
async fetchFundingInterval(symbol, params = {}) {
|
|
4301
|
+
/**
|
|
4302
|
+
* @method
|
|
4303
|
+
* @name xt#fetchFundingInterval
|
|
4304
|
+
* @description fetch the current funding rate interval
|
|
4305
|
+
* @see https://doc.xt.com/#futures_quotesgetFundingRate
|
|
4306
|
+
* @param {string} symbol unified market symbol
|
|
4307
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4308
|
+
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
4309
|
+
*/
|
|
4310
|
+
return await this.fetchFundingRate(symbol, params);
|
|
4311
|
+
}
|
|
4298
4312
|
async fetchFundingRate(symbol, params = {}) {
|
|
4299
4313
|
/**
|
|
4300
4314
|
* @method
|
package/package.json
CHANGED