ccxt 4.3.89 → 4.3.91
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/alpaca.js +2 -2
- package/dist/cjs/src/ascendex.js +95 -97
- package/dist/cjs/src/binance.js +1 -1
- package/dist/cjs/src/bingx.js +31 -17
- package/dist/cjs/src/bitfinex2.js +21 -22
- package/dist/cjs/src/bitget.js +2 -2
- package/dist/cjs/src/bitmart.js +6 -9
- package/dist/cjs/src/coinbaseinternational.js +2 -1
- package/dist/cjs/src/coinex.js +1 -17
- package/dist/cjs/src/hitbtc.js +2 -0
- package/dist/cjs/src/htx.js +49 -49
- package/dist/cjs/src/huobijp.js +0 -9
- package/dist/cjs/src/kucoin.js +59 -21
- package/dist/cjs/src/kucoinfutures.js +26 -2
- package/dist/cjs/src/latoken.js +1 -0
- package/dist/cjs/src/okx.js +1 -8
- package/dist/cjs/src/pro/binance.js +323 -0
- package/dist/cjs/src/pro/bingx.js +263 -91
- package/dist/cjs/src/pro/bithumb.js +5 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/coinex.js +994 -679
- package/dist/cjs/src/pro/lbank.js +2 -3
- package/dist/cjs/src/pro/okx.js +159 -3
- package/dist/cjs/src/whitebit.js +5 -3
- package/dist/cjs/src/woo.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kucoin.d.ts +1 -0
- package/js/src/abstract/kucoinfutures.d.ts +1 -0
- package/js/src/alpaca.js +2 -2
- package/js/src/ascendex.js +95 -97
- package/js/src/binance.js +1 -1
- package/js/src/bingx.js +31 -17
- package/js/src/bitfinex2.d.ts +0 -1
- package/js/src/bitfinex2.js +21 -22
- package/js/src/bitget.js +2 -2
- package/js/src/bitmart.d.ts +0 -1
- package/js/src/bitmart.js +6 -9
- package/js/src/coinbaseinternational.js +2 -1
- package/js/src/coinex.d.ts +0 -2
- package/js/src/coinex.js +1 -17
- package/js/src/hitbtc.js +2 -0
- package/js/src/htx.js +49 -49
- package/js/src/huobijp.d.ts +0 -1
- package/js/src/huobijp.js +0 -9
- package/js/src/kucoin.d.ts +3 -1
- package/js/src/kucoin.js +59 -21
- package/js/src/kucoinfutures.d.ts +1 -0
- package/js/src/kucoinfutures.js +26 -2
- package/js/src/latoken.js +1 -0
- package/js/src/okx.d.ts +0 -1
- package/js/src/okx.js +1 -8
- package/js/src/pro/binance.d.ts +9 -1
- package/js/src/pro/binance.js +327 -1
- package/js/src/pro/bingx.d.ts +2 -2
- package/js/src/pro/bingx.js +263 -91
- package/js/src/pro/bithumb.js +5 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/coinex.d.ts +12 -6
- package/js/src/pro/coinex.js +996 -681
- package/js/src/pro/lbank.js +2 -3
- package/js/src/pro/okx.d.ts +7 -0
- package/js/src/pro/okx.js +162 -4
- package/js/src/whitebit.js +5 -3
- package/js/src/woo.js +1 -1
- package/package.json +1 -1
package/js/src/pro/lbank.js
CHANGED
|
@@ -501,7 +501,7 @@ export default class lbank extends lbankRest {
|
|
|
501
501
|
/**
|
|
502
502
|
* @method
|
|
503
503
|
* @name lbank#watchOrders
|
|
504
|
-
* @see https://
|
|
504
|
+
* @see https://www.lbank.com/en-US/docs/index.html#update-subscribed-orders
|
|
505
505
|
* @description get the list of trades associated with the user
|
|
506
506
|
* @param {string} [symbol] unified symbol of the market to fetch trades for
|
|
507
507
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -665,7 +665,7 @@ export default class lbank extends lbankRest {
|
|
|
665
665
|
async fetchOrderBookWs(symbol, limit = undefined, params = {}) {
|
|
666
666
|
/**
|
|
667
667
|
* @method
|
|
668
|
-
* @name lbank#
|
|
668
|
+
* @name lbank#fetchOrderBookWs
|
|
669
669
|
* @see https://www.lbank.com/en-US/docs/index.html#request-amp-subscription-instruction
|
|
670
670
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
671
671
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
@@ -695,7 +695,6 @@ export default class lbank extends lbankRest {
|
|
|
695
695
|
* @method
|
|
696
696
|
* @name lbank#watchOrderBook
|
|
697
697
|
* @see https://www.lbank.com/en-US/docs/index.html#market-depth
|
|
698
|
-
* @see https://www.lbank.com/en-US/docs/index.html#market-increment-depth
|
|
699
698
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
700
699
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
701
700
|
* @param {int|undefined} limit the maximum amount of order book entries to return
|
package/js/src/pro/okx.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export default class okx extends okxRest {
|
|
|
8
8
|
subscribe(access: any, messageHash: any, channel: any, symbol: any, params?: {}): Promise<any>;
|
|
9
9
|
watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
10
10
|
watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
11
|
+
unWatchTradesForSymbols(symbols: string[], params?: {}): Promise<any>;
|
|
12
|
+
unWatchTrades(symbol: string, params?: {}): Promise<any>;
|
|
11
13
|
handleTrades(client: Client, message: any): void;
|
|
12
14
|
watchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
13
15
|
watchFundingRates(symbols: string[], params?: {}): Promise<FundingRates>;
|
|
@@ -26,6 +28,8 @@ export default class okx extends okxRest {
|
|
|
26
28
|
handleOHLCV(client: Client, message: any): void;
|
|
27
29
|
watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
28
30
|
watchOrderBookForSymbols(symbols: string[], limit?: Int, params?: {}): Promise<OrderBook>;
|
|
31
|
+
unWatchOrderBookForSymbols(symbols: string[], params?: {}): Promise<any>;
|
|
32
|
+
unWatchOrderBook(symbol: string, params?: {}): Promise<any>;
|
|
29
33
|
handleDelta(bookside: any, delta: any): void;
|
|
30
34
|
handleDeltas(bookside: any, deltas: any): void;
|
|
31
35
|
handleOrderBookMessage(client: Client, message: any, orderbook: any, messageHash: any, market?: any): any;
|
|
@@ -54,4 +58,7 @@ export default class okx extends okxRest {
|
|
|
54
58
|
handlePong(client: Client, message: any): any;
|
|
55
59
|
handleErrorMessage(client: Client, message: any): any;
|
|
56
60
|
handleMessage(client: Client, message: any): void;
|
|
61
|
+
handleUnSubscriptionTrades(client: Client, symbol: string): void;
|
|
62
|
+
handleUnsubscriptionOrderBook(client: Client, symbol: string, channel: string): void;
|
|
63
|
+
handleUnsubscription(client: Client, message: any): void;
|
|
57
64
|
}
|
package/js/src/pro/okx.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
import okxRest from '../okx.js';
|
|
9
|
-
import { ArgumentsRequired, BadRequest, ExchangeError, ChecksumError, AuthenticationError, InvalidNonce } from '../base/errors.js';
|
|
9
|
+
import { ArgumentsRequired, BadRequest, ExchangeError, ChecksumError, AuthenticationError, InvalidNonce, UnsubscribeError } from '../base/errors.js';
|
|
10
10
|
import { ArrayCache, ArrayCacheByTimestamp, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide } from '../base/ws/Cache.js';
|
|
11
11
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
@@ -220,6 +220,48 @@ export default class okx extends okxRest {
|
|
|
220
220
|
}
|
|
221
221
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
222
222
|
}
|
|
223
|
+
async unWatchTradesForSymbols(symbols, params = {}) {
|
|
224
|
+
/**
|
|
225
|
+
* @method
|
|
226
|
+
* @name okx#unWatchTradesForSymbols
|
|
227
|
+
* @description unWatches from the stream channel
|
|
228
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
229
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
230
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
231
|
+
*/
|
|
232
|
+
await this.loadMarkets();
|
|
233
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
234
|
+
const channel = 'trades';
|
|
235
|
+
const topics = [];
|
|
236
|
+
const messageHashes = [];
|
|
237
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
238
|
+
const symbol = symbols[i];
|
|
239
|
+
messageHashes.push('unsubscribe:trades:' + symbol);
|
|
240
|
+
const marketId = this.marketId(symbol);
|
|
241
|
+
const topic = {
|
|
242
|
+
'channel': channel,
|
|
243
|
+
'instId': marketId,
|
|
244
|
+
};
|
|
245
|
+
topics.push(topic);
|
|
246
|
+
}
|
|
247
|
+
const request = {
|
|
248
|
+
'op': 'unsubscribe',
|
|
249
|
+
'args': topics,
|
|
250
|
+
};
|
|
251
|
+
const url = this.getUrl(channel, 'public');
|
|
252
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
253
|
+
}
|
|
254
|
+
async unWatchTrades(symbol, params = {}) {
|
|
255
|
+
/**
|
|
256
|
+
* @method
|
|
257
|
+
* @name okx#unWatchTradesForSymbols
|
|
258
|
+
* @description unWatches from the stream channel
|
|
259
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
260
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
261
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
262
|
+
*/
|
|
263
|
+
return await this.unWatchTradesForSymbols([symbol], params);
|
|
264
|
+
}
|
|
223
265
|
handleTrades(client, message) {
|
|
224
266
|
//
|
|
225
267
|
// {
|
|
@@ -366,9 +408,8 @@ export default class okx extends okxRest {
|
|
|
366
408
|
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
367
409
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
368
410
|
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
411
|
+
await this.loadMarkets();
|
|
412
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
372
413
|
let channel = undefined;
|
|
373
414
|
[channel, params] = this.handleOptionAndParams(params, 'watchTickers', 'channel', 'tickers');
|
|
374
415
|
const newTickers = await this.subscribeMultiple('public', channel, symbols, params);
|
|
@@ -895,6 +936,72 @@ export default class okx extends okxRest {
|
|
|
895
936
|
const orderbook = await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
896
937
|
return orderbook.limit();
|
|
897
938
|
}
|
|
939
|
+
async unWatchOrderBookForSymbols(symbols, params = {}) {
|
|
940
|
+
/**
|
|
941
|
+
* @method
|
|
942
|
+
* @name okx#unWatchOrderBookForSymbols
|
|
943
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel
|
|
944
|
+
* @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
945
|
+
* @param {string[]} symbols unified array of symbols
|
|
946
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
947
|
+
* @param {int} [params.limit] the maximum amount of order book entries to return
|
|
948
|
+
* @param {string} [params.depth] okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt
|
|
949
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
950
|
+
*/
|
|
951
|
+
await this.loadMarkets();
|
|
952
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
953
|
+
let depth = undefined;
|
|
954
|
+
[depth, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'depth', 'books');
|
|
955
|
+
const limit = this.safeInteger(params, 'limit');
|
|
956
|
+
if (limit !== undefined) {
|
|
957
|
+
if (limit === 1) {
|
|
958
|
+
depth = 'bbo-tbt';
|
|
959
|
+
}
|
|
960
|
+
else if (limit > 1 && limit <= 5) {
|
|
961
|
+
depth = 'books5';
|
|
962
|
+
}
|
|
963
|
+
else if (limit === 50) {
|
|
964
|
+
depth = 'books50-l2-tbt'; // Make sure you have VIP4 and above
|
|
965
|
+
}
|
|
966
|
+
else if (limit === 400) {
|
|
967
|
+
depth = 'books';
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
const topics = [];
|
|
971
|
+
const subMessageHashes = [];
|
|
972
|
+
const messageHashes = [];
|
|
973
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
974
|
+
const symbol = symbols[i];
|
|
975
|
+
subMessageHashes.push(depth + ':' + symbol);
|
|
976
|
+
messageHashes.push('unsubscribe:orderbook:' + symbol);
|
|
977
|
+
const marketId = this.marketId(symbol);
|
|
978
|
+
const topic = {
|
|
979
|
+
'channel': depth,
|
|
980
|
+
'instId': marketId,
|
|
981
|
+
};
|
|
982
|
+
topics.push(topic);
|
|
983
|
+
}
|
|
984
|
+
const request = {
|
|
985
|
+
'op': 'unsubscribe',
|
|
986
|
+
'args': topics,
|
|
987
|
+
};
|
|
988
|
+
const url = this.getUrl(depth, 'public');
|
|
989
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
990
|
+
}
|
|
991
|
+
async unWatchOrderBook(symbol, params = {}) {
|
|
992
|
+
/**
|
|
993
|
+
* @method
|
|
994
|
+
* @name okx#unWatchOrderBook
|
|
995
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-order-book-channel
|
|
996
|
+
* @description unWatches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
997
|
+
* @param {string} symbol unified array of symbols
|
|
998
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
999
|
+
* @param {int} [params.limit] the maximum amount of order book entries to return
|
|
1000
|
+
* @param {string} [params.depth] okx order book depth, can be books, books5, books-l2-tbt, books50-l2-tbt, bbo-tbt
|
|
1001
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
1002
|
+
*/
|
|
1003
|
+
return await this.unWatchOrderBookForSymbols([symbol], params);
|
|
1004
|
+
}
|
|
898
1005
|
handleDelta(bookside, delta) {
|
|
899
1006
|
//
|
|
900
1007
|
// [
|
|
@@ -1990,6 +2097,7 @@ export default class okx extends okxRest {
|
|
|
1990
2097
|
// 'book': 'handleOrderBook',
|
|
1991
2098
|
'login': this.handleAuthenticate,
|
|
1992
2099
|
'subscribe': this.handleSubscriptionStatus,
|
|
2100
|
+
'unsubscribe': this.handleUnsubscription,
|
|
1993
2101
|
'order': this.handlePlaceOrders,
|
|
1994
2102
|
'batch-orders': this.handlePlaceOrders,
|
|
1995
2103
|
'amend-order': this.handlePlaceOrders,
|
|
@@ -2036,4 +2144,54 @@ export default class okx extends okxRest {
|
|
|
2036
2144
|
}
|
|
2037
2145
|
}
|
|
2038
2146
|
}
|
|
2147
|
+
handleUnSubscriptionTrades(client, symbol) {
|
|
2148
|
+
const subMessageHash = 'trades:' + symbol;
|
|
2149
|
+
const messageHash = 'unsubscribe:trades:' + symbol;
|
|
2150
|
+
if (subMessageHash in client.subscriptions) {
|
|
2151
|
+
delete client.subscriptions[subMessageHash];
|
|
2152
|
+
}
|
|
2153
|
+
if (messageHash in client.subscriptions) {
|
|
2154
|
+
delete client.subscriptions[messageHash];
|
|
2155
|
+
}
|
|
2156
|
+
delete this.trades[symbol];
|
|
2157
|
+
const error = new UnsubscribeError(this.id + ' ' + subMessageHash);
|
|
2158
|
+
client.reject(error, subMessageHash);
|
|
2159
|
+
client.resolve(true, messageHash);
|
|
2160
|
+
}
|
|
2161
|
+
handleUnsubscriptionOrderBook(client, symbol, channel) {
|
|
2162
|
+
const subMessageHash = channel + ':' + symbol;
|
|
2163
|
+
const messageHash = 'unsubscribe:orderbook:' + symbol;
|
|
2164
|
+
if (subMessageHash in client.subscriptions) {
|
|
2165
|
+
delete client.subscriptions[subMessageHash];
|
|
2166
|
+
}
|
|
2167
|
+
if (messageHash in client.subscriptions) {
|
|
2168
|
+
delete client.subscriptions[messageHash];
|
|
2169
|
+
}
|
|
2170
|
+
delete this.orderbooks[symbol];
|
|
2171
|
+
const error = new UnsubscribeError(this.id + ' ' + subMessageHash);
|
|
2172
|
+
client.reject(error, subMessageHash);
|
|
2173
|
+
client.resolve(true, messageHash);
|
|
2174
|
+
}
|
|
2175
|
+
handleUnsubscription(client, message) {
|
|
2176
|
+
//
|
|
2177
|
+
// {
|
|
2178
|
+
// "event": "unsubscribe",
|
|
2179
|
+
// "arg": {
|
|
2180
|
+
// "channel": "tickers",
|
|
2181
|
+
// "instId": "LTC-USD-200327"
|
|
2182
|
+
// },
|
|
2183
|
+
// "connId": "a4d3ae55"
|
|
2184
|
+
// }
|
|
2185
|
+
// arg might be an array or list
|
|
2186
|
+
const arg = this.safeDict(message, 'arg', {});
|
|
2187
|
+
const channel = this.safeString(arg, 'channel');
|
|
2188
|
+
const marketId = this.safeString(arg, 'instId');
|
|
2189
|
+
const symbol = this.safeSymbol(marketId);
|
|
2190
|
+
if (channel === 'trades') {
|
|
2191
|
+
this.handleUnSubscriptionTrades(client, symbol);
|
|
2192
|
+
}
|
|
2193
|
+
else if (channel.startsWith('bbo') || channel.startsWith('book')) {
|
|
2194
|
+
this.handleUnsubscriptionOrderBook(client, symbol, channel);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2039
2197
|
}
|
package/js/src/whitebit.js
CHANGED
|
@@ -2636,9 +2636,11 @@ export default class whitebit extends Exchange {
|
|
|
2636
2636
|
errorInfo = status;
|
|
2637
2637
|
}
|
|
2638
2638
|
else {
|
|
2639
|
-
const errorObject = this.
|
|
2640
|
-
|
|
2641
|
-
|
|
2639
|
+
const errorObject = this.safeDict(response, 'errors', {});
|
|
2640
|
+
const errorKeys = Object.keys(errorObject);
|
|
2641
|
+
const errorsLength = errorKeys.length;
|
|
2642
|
+
if (errorsLength > 0) {
|
|
2643
|
+
const errorKey = errorKeys[0];
|
|
2642
2644
|
const errorMessageArray = this.safeValue(errorObject, errorKey, []);
|
|
2643
2645
|
const errorMessageLength = errorMessageArray.length;
|
|
2644
2646
|
errorInfo = (errorMessageLength > 0) ? errorMessageArray[0] : body;
|
package/js/src/woo.js
CHANGED
|
@@ -485,7 +485,7 @@ export default class woo extends Exchange {
|
|
|
485
485
|
'swap': swap,
|
|
486
486
|
'future': false,
|
|
487
487
|
'option': false,
|
|
488
|
-
'active':
|
|
488
|
+
'active': this.safeString(market, 'is_trading') === '1',
|
|
489
489
|
'contract': contract,
|
|
490
490
|
'linear': linear,
|
|
491
491
|
'inverse': undefined,
|
package/package.json
CHANGED