ccxt 4.4.8 → 4.4.9
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 +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bigone.js +35 -86
- package/dist/cjs/src/bingx.js +7 -2
- package/dist/cjs/src/bitget.js +3 -0
- package/dist/cjs/src/bybit.js +5 -1
- package/dist/cjs/src/gate.js +35 -1
- package/dist/cjs/src/htx.js +2 -0
- package/dist/cjs/src/kucoin.js +2 -1
- package/dist/cjs/src/kucoinfutures.js +162 -2
- package/dist/cjs/src/pro/binance.js +4 -4
- 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/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/bigone.js +35 -86
- package/js/src/bingx.js +7 -2
- package/js/src/bitget.js +3 -0
- package/js/src/bybit.js +5 -1
- package/js/src/gate.js +35 -1
- package/js/src/htx.js +2 -0
- package/js/src/kucoin.js +2 -1
- package/js/src/kucoinfutures.d.ts +7 -1
- package/js/src/kucoinfutures.js +162 -2
- package/js/src/pro/binance.js +4 -4
- 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/package.json +1 -1
|
@@ -14,6 +14,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
14
14
|
'ws': true,
|
|
15
15
|
'watchTicker': true,
|
|
16
16
|
'watchTickers': true,
|
|
17
|
+
'watchBidsAsks': true,
|
|
17
18
|
'watchTrades': true,
|
|
18
19
|
'watchTradesForSymbols': false,
|
|
19
20
|
'watchOrderBook': true,
|
|
@@ -48,8 +49,11 @@ class hitbtc extends hitbtc$1 {
|
|
|
48
49
|
'watchTickers': {
|
|
49
50
|
'method': 'ticker/{speed}', // 'ticker/{speed}','ticker/price/{speed}', 'ticker/{speed}/batch', or 'ticker/{speed}/price/batch''
|
|
50
51
|
},
|
|
52
|
+
'watchBidsAsks': {
|
|
53
|
+
'method': 'orderbook/top/{speed}', // 'orderbook/top/{speed}', 'orderbook/top/{speed}/batch'
|
|
54
|
+
},
|
|
51
55
|
'watchOrderBook': {
|
|
52
|
-
'method': 'orderbook/full', // 'orderbook/full', 'orderbook/{depth}/{speed}', 'orderbook/{depth}/{speed}/batch'
|
|
56
|
+
'method': 'orderbook/full', // 'orderbook/full', 'orderbook/{depth}/{speed}', 'orderbook/{depth}/{speed}/batch'
|
|
53
57
|
},
|
|
54
58
|
},
|
|
55
59
|
'timeframes': {
|
|
@@ -125,10 +129,17 @@ class hitbtc extends hitbtc$1 {
|
|
|
125
129
|
* @param {object} [params] extra parameters specific to the hitbtc api
|
|
126
130
|
*/
|
|
127
131
|
await this.loadMarkets();
|
|
132
|
+
symbols = this.marketSymbols(symbols);
|
|
133
|
+
const isBatch = name.indexOf('batch') >= 0;
|
|
128
134
|
const url = this.urls['api']['ws']['public'];
|
|
129
|
-
|
|
130
|
-
if (symbols !== undefined) {
|
|
131
|
-
|
|
135
|
+
const messageHashes = [];
|
|
136
|
+
if (symbols !== undefined && !isBatch) {
|
|
137
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
138
|
+
messageHashes.push(messageHashPrefix + '::' + symbols[i]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
messageHashes.push(messageHashPrefix);
|
|
132
143
|
}
|
|
133
144
|
const subscribe = {
|
|
134
145
|
'method': 'subscribe',
|
|
@@ -136,7 +147,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
136
147
|
'ch': name,
|
|
137
148
|
};
|
|
138
149
|
const request = this.extend(subscribe, params);
|
|
139
|
-
return await this.
|
|
150
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
140
151
|
}
|
|
141
152
|
async subscribePrivate(name, symbol = undefined, params = {}) {
|
|
142
153
|
/**
|
|
@@ -193,7 +204,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
193
204
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
194
205
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
195
206
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
196
|
-
* @param {string} [params.method] 'orderbook/full', 'orderbook/{depth}/{speed}', 'orderbook/{depth}/{speed}/batch'
|
|
207
|
+
* @param {string} [params.method] 'orderbook/full', 'orderbook/{depth}/{speed}', 'orderbook/{depth}/{speed}/batch'
|
|
197
208
|
* @param {int} [params.depth] 5 , 10, or 20 (default)
|
|
198
209
|
* @param {int} [params.speed] 100 (default), 500, or 1000
|
|
199
210
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
@@ -209,12 +220,6 @@ class hitbtc extends hitbtc$1 {
|
|
|
209
220
|
else if (name === 'orderbook/{depth}/{speed}/batch') {
|
|
210
221
|
name = 'orderbook/D' + depth + '/' + speed + 'ms/batch';
|
|
211
222
|
}
|
|
212
|
-
else if (name === 'orderbook/top/{speed}') {
|
|
213
|
-
name = 'orderbook/top/' + speed + 'ms';
|
|
214
|
-
}
|
|
215
|
-
else if (name === 'orderbook/top/{speed}/batch') {
|
|
216
|
-
name = 'orderbook/top/' + speed + 'ms/batch';
|
|
217
|
-
}
|
|
218
223
|
const market = this.market(symbol);
|
|
219
224
|
const request = {
|
|
220
225
|
'params': {
|
|
@@ -310,20 +315,8 @@ class hitbtc extends hitbtc$1 {
|
|
|
310
315
|
* @param {string} [params.speed] '1s' (default), or '3s'
|
|
311
316
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
312
317
|
*/
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
const method = this.safeString2(params, 'method', 'defaultMethod', defaultMethod);
|
|
316
|
-
const speed = this.safeString(params, 'speed', '1s');
|
|
317
|
-
const name = this.implodeParams(method, { 'speed': speed });
|
|
318
|
-
params = this.omit(params, ['method', 'speed']);
|
|
319
|
-
const market = this.market(symbol);
|
|
320
|
-
const request = {
|
|
321
|
-
'params': {
|
|
322
|
-
'symbols': [market['id']],
|
|
323
|
-
},
|
|
324
|
-
};
|
|
325
|
-
const result = await this.subscribePublic(name, 'tickers', [symbol], this.deepExtend(request, params));
|
|
326
|
-
return this.safeValue(result, symbol);
|
|
318
|
+
const ticker = await this.watchTickers([symbol], params);
|
|
319
|
+
return this.safeValue(ticker, symbol);
|
|
327
320
|
}
|
|
328
321
|
async watchTickers(symbols = undefined, params = {}) {
|
|
329
322
|
/**
|
|
@@ -332,13 +325,14 @@ class hitbtc extends hitbtc$1 {
|
|
|
332
325
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
333
326
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
334
327
|
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
335
|
-
* @param {string} params.method 'ticker/{speed}'
|
|
328
|
+
* @param {string} params.method 'ticker/{speed}' ,'ticker/price/{speed}', 'ticker/{speed}/batch' (default), or 'ticker/{speed}/price/batch''
|
|
336
329
|
* @param {string} params.speed '1s' (default), or '3s'
|
|
337
330
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/en/latest/manual.html#ticker-structure}
|
|
338
331
|
*/
|
|
339
332
|
await this.loadMarkets();
|
|
333
|
+
symbols = this.marketSymbols(symbols);
|
|
340
334
|
const options = this.safeValue(this.options, 'watchTicker');
|
|
341
|
-
const defaultMethod = this.safeString(options, 'method', 'ticker/{speed}');
|
|
335
|
+
const defaultMethod = this.safeString(options, 'method', 'ticker/{speed}/batch');
|
|
342
336
|
const method = this.safeString2(params, 'method', 'defaultMethod', defaultMethod);
|
|
343
337
|
const speed = this.safeString(params, 'speed', '1s');
|
|
344
338
|
const name = this.implodeParams(method, { 'speed': speed });
|
|
@@ -358,11 +352,15 @@ class hitbtc extends hitbtc$1 {
|
|
|
358
352
|
'symbols': marketIds,
|
|
359
353
|
},
|
|
360
354
|
};
|
|
361
|
-
const
|
|
355
|
+
const newTickers = await this.subscribePublic(name, 'tickers', symbols, this.deepExtend(request, params));
|
|
362
356
|
if (this.newUpdates) {
|
|
363
|
-
|
|
357
|
+
if (!Array.isArray(newTickers)) {
|
|
358
|
+
const tickers = {};
|
|
359
|
+
tickers[newTickers['symbol']] = newTickers;
|
|
360
|
+
return tickers;
|
|
361
|
+
}
|
|
364
362
|
}
|
|
365
|
-
return this.filterByArray(
|
|
363
|
+
return this.filterByArray(newTickers, 'symbol', symbols);
|
|
366
364
|
}
|
|
367
365
|
handleTicker(client, message) {
|
|
368
366
|
//
|
|
@@ -405,30 +403,19 @@ class hitbtc extends hitbtc$1 {
|
|
|
405
403
|
//
|
|
406
404
|
const data = this.safeValue(message, 'data', {});
|
|
407
405
|
const marketIds = Object.keys(data);
|
|
408
|
-
const
|
|
406
|
+
const result = [];
|
|
407
|
+
const topic = 'tickers';
|
|
409
408
|
for (let i = 0; i < marketIds.length; i++) {
|
|
410
409
|
const marketId = marketIds[i];
|
|
411
410
|
const market = this.safeMarket(marketId);
|
|
412
411
|
const symbol = market['symbol'];
|
|
413
412
|
const ticker = this.parseWsTicker(data[marketId], market);
|
|
414
413
|
this.tickers[symbol] = ticker;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
419
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
420
|
-
const messageHash = messageHashes[i];
|
|
421
|
-
const parts = messageHash.split('::');
|
|
422
|
-
const symbolsString = parts[1];
|
|
423
|
-
const symbols = symbolsString.split(',');
|
|
424
|
-
const tickers = this.filterByArray(newTickers, 'symbol', symbols);
|
|
425
|
-
const tickersSymbols = Object.keys(tickers);
|
|
426
|
-
const numTickers = tickersSymbols.length;
|
|
427
|
-
if (numTickers > 0) {
|
|
428
|
-
client.resolve(tickers, messageHash);
|
|
429
|
-
}
|
|
414
|
+
result.push(ticker);
|
|
415
|
+
const messageHash = topic + '::' + symbol;
|
|
416
|
+
client.resolve(ticker, messageHash);
|
|
430
417
|
}
|
|
431
|
-
|
|
418
|
+
client.resolve(result, topic);
|
|
432
419
|
}
|
|
433
420
|
parseWsTicker(ticker, market = undefined) {
|
|
434
421
|
//
|
|
@@ -485,6 +472,86 @@ class hitbtc extends hitbtc$1 {
|
|
|
485
472
|
'info': ticker,
|
|
486
473
|
}, market);
|
|
487
474
|
}
|
|
475
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
476
|
+
/**
|
|
477
|
+
* @method
|
|
478
|
+
* @name hitbtc#watchBidsAsks
|
|
479
|
+
* @description watches best bid & ask for symbols
|
|
480
|
+
* @see https://api.hitbtc.com/#subscribe-to-top-of-book
|
|
481
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
482
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
483
|
+
* @param {string} [params.method] 'orderbook/top/{speed}' or 'orderbook/top/{speed}/batch (default)'
|
|
484
|
+
* @param {string} [params.speed] '100ms' (default) or '500ms' or '1000ms'
|
|
485
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
486
|
+
*/
|
|
487
|
+
await this.loadMarkets();
|
|
488
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
489
|
+
const options = this.safeValue(this.options, 'watchBidsAsks');
|
|
490
|
+
const defaultMethod = this.safeString(options, 'method', 'orderbook/top/{speed}/batch');
|
|
491
|
+
const method = this.safeString2(params, 'method', 'defaultMethod', defaultMethod);
|
|
492
|
+
const speed = this.safeString(params, 'speed', '100ms');
|
|
493
|
+
const name = this.implodeParams(method, { 'speed': speed });
|
|
494
|
+
params = this.omit(params, ['method', 'speed']);
|
|
495
|
+
const marketIds = this.marketIds(symbols);
|
|
496
|
+
const request = {
|
|
497
|
+
'params': {
|
|
498
|
+
'symbols': marketIds,
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
const newTickers = await this.subscribePublic(name, 'bidask', symbols, this.deepExtend(request, params));
|
|
502
|
+
if (this.newUpdates) {
|
|
503
|
+
if (!Array.isArray(newTickers)) {
|
|
504
|
+
const tickers = {};
|
|
505
|
+
tickers[newTickers['symbol']] = newTickers;
|
|
506
|
+
return tickers;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return this.filterByArray(newTickers, 'symbol', symbols);
|
|
510
|
+
}
|
|
511
|
+
handleBidAsk(client, message) {
|
|
512
|
+
//
|
|
513
|
+
// {
|
|
514
|
+
// "ch": "orderbook/top/100ms", // or 'orderbook/top/100ms/batch'
|
|
515
|
+
// "data": {
|
|
516
|
+
// "BTCUSDT": {
|
|
517
|
+
// "t": 1727276919771,
|
|
518
|
+
// "a": "63931.45",
|
|
519
|
+
// "A": "0.02879",
|
|
520
|
+
// "b": "63926.97",
|
|
521
|
+
// "B": "0.00100"
|
|
522
|
+
// }
|
|
523
|
+
// }
|
|
524
|
+
// }
|
|
525
|
+
//
|
|
526
|
+
const data = this.safeDict(message, 'data', {});
|
|
527
|
+
const marketIds = Object.keys(data);
|
|
528
|
+
const result = [];
|
|
529
|
+
const topic = 'bidask';
|
|
530
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
531
|
+
const marketId = marketIds[i];
|
|
532
|
+
const market = this.safeMarket(marketId);
|
|
533
|
+
const symbol = market['symbol'];
|
|
534
|
+
const ticker = this.parseWsBidAsk(data[marketId], market);
|
|
535
|
+
this.bidsasks[symbol] = ticker;
|
|
536
|
+
result.push(ticker);
|
|
537
|
+
const messageHash = topic + '::' + symbol;
|
|
538
|
+
client.resolve(ticker, messageHash);
|
|
539
|
+
}
|
|
540
|
+
client.resolve(result, topic);
|
|
541
|
+
}
|
|
542
|
+
parseWsBidAsk(ticker, market = undefined) {
|
|
543
|
+
const timestamp = this.safeInteger(ticker, 't');
|
|
544
|
+
return this.safeTicker({
|
|
545
|
+
'symbol': market['symbol'],
|
|
546
|
+
'timestamp': timestamp,
|
|
547
|
+
'datetime': this.iso8601(timestamp),
|
|
548
|
+
'ask': this.safeString(ticker, 'a'),
|
|
549
|
+
'askVolume': this.safeString(ticker, 'A'),
|
|
550
|
+
'bid': this.safeString(ticker, 'b'),
|
|
551
|
+
'bidVolume': this.safeString(ticker, 'B'),
|
|
552
|
+
'info': ticker,
|
|
553
|
+
}, market);
|
|
554
|
+
}
|
|
488
555
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
489
556
|
/**
|
|
490
557
|
* @method
|
|
@@ -1220,11 +1287,18 @@ class hitbtc extends hitbtc$1 {
|
|
|
1220
1287
|
if (channel !== undefined) {
|
|
1221
1288
|
const splitChannel = channel.split('/');
|
|
1222
1289
|
channel = this.safeString(splitChannel, 0);
|
|
1290
|
+
if (channel === 'orderbook') {
|
|
1291
|
+
const channel2 = this.safeString(splitChannel, 1);
|
|
1292
|
+
if (channel2 !== undefined && channel2 === 'top') {
|
|
1293
|
+
channel = 'orderbook/top';
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1223
1296
|
const methods = {
|
|
1224
1297
|
'candles': this.handleOHLCV,
|
|
1225
1298
|
'ticker': this.handleTicker,
|
|
1226
1299
|
'trades': this.handleTrades,
|
|
1227
1300
|
'orderbook': this.handleOrderBook,
|
|
1301
|
+
'orderbook/top': this.handleBidAsk,
|
|
1228
1302
|
'spot_order': this.handleOrder,
|
|
1229
1303
|
'spot_orders': this.handleOrder,
|
|
1230
1304
|
'margin_order': this.handleOrder,
|
|
@@ -56,6 +56,7 @@ class hollaex extends hollaex$1 {
|
|
|
56
56
|
* @method
|
|
57
57
|
* @name hollaex#watchOrderBook
|
|
58
58
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
59
|
+
* @see https://apidocs.hollaex.com/#sending-receiving-messages
|
|
59
60
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
60
61
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
61
62
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -114,6 +115,7 @@ class hollaex extends hollaex$1 {
|
|
|
114
115
|
* @method
|
|
115
116
|
* @name hollaex#watchTrades
|
|
116
117
|
* @description get the list of most recent trades for a particular symbol
|
|
118
|
+
* @see https://apidocs.hollaex.com/#sending-receiving-messages
|
|
117
119
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
118
120
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
119
121
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -170,6 +172,7 @@ class hollaex extends hollaex$1 {
|
|
|
170
172
|
* @method
|
|
171
173
|
* @name hollaex#watchMyTrades
|
|
172
174
|
* @description watches information on multiple trades made by the user
|
|
175
|
+
* @see https://apidocs.hollaex.com/#sending-receiving-messages
|
|
173
176
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
174
177
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
175
178
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -250,6 +253,7 @@ class hollaex extends hollaex$1 {
|
|
|
250
253
|
* @method
|
|
251
254
|
* @name hollaex#watchOrders
|
|
252
255
|
* @description watches information on multiple orders made by the user
|
|
256
|
+
* @see https://apidocs.hollaex.com/#sending-receiving-messages
|
|
253
257
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
254
258
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
255
259
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -371,6 +375,7 @@ class hollaex extends hollaex$1 {
|
|
|
371
375
|
* @method
|
|
372
376
|
* @name hollaex#watchBalance
|
|
373
377
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
378
|
+
* @see https://apidocs.hollaex.com/#sending-receiving-messages
|
|
374
379
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
375
380
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
376
381
|
*/
|
package/dist/cjs/src/pro/okx.js
CHANGED
|
@@ -2209,15 +2209,31 @@ class okx extends okx$1 {
|
|
|
2209
2209
|
// { event: 'error', msg: "Illegal request: {"op":"subscribe","args":["spot/ticker:BTC-USDT"]}", code: "60012" }
|
|
2210
2210
|
// { event: 'error", msg: "channel:ticker,instId:BTC-USDT doesn"t exist", code: "60018" }
|
|
2211
2211
|
//
|
|
2212
|
-
|
|
2212
|
+
let errorCode = this.safeString(message, 'code');
|
|
2213
2213
|
try {
|
|
2214
2214
|
if (errorCode && errorCode !== '0') {
|
|
2215
2215
|
const feedback = this.id + ' ' + this.json(message);
|
|
2216
|
-
|
|
2217
|
-
|
|
2216
|
+
if (errorCode !== '1') {
|
|
2217
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
|
|
2218
|
+
}
|
|
2219
|
+
let messageString = this.safeValue(message, 'msg');
|
|
2218
2220
|
if (messageString !== undefined) {
|
|
2219
2221
|
this.throwBroadlyMatchedException(this.exceptions['broad'], messageString, feedback);
|
|
2220
2222
|
}
|
|
2223
|
+
else {
|
|
2224
|
+
const data = this.safeList(message, 'data', []);
|
|
2225
|
+
for (let i = 0; i < data.length; i++) {
|
|
2226
|
+
const d = data[i];
|
|
2227
|
+
errorCode = this.safeString(d, 'sCode');
|
|
2228
|
+
if (errorCode !== undefined) {
|
|
2229
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
|
|
2230
|
+
}
|
|
2231
|
+
messageString = this.safeValue(message, 'sMsg');
|
|
2232
|
+
if (messageString !== undefined) {
|
|
2233
|
+
this.throwBroadlyMatchedException(this.exceptions['broad'], messageString, feedback);
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2221
2237
|
throw new errors.ExchangeError(feedback);
|
|
2222
2238
|
}
|
|
2223
2239
|
}
|
package/dist/cjs/src/pro/p2b.js
CHANGED
|
@@ -27,7 +27,7 @@ class p2b extends p2b$1 {
|
|
|
27
27
|
'watchOrders': false,
|
|
28
28
|
// 'watchStatus': true,
|
|
29
29
|
'watchTicker': true,
|
|
30
|
-
'watchTickers':
|
|
30
|
+
'watchTickers': true,
|
|
31
31
|
'watchTrades': true,
|
|
32
32
|
'watchTradesForSymbols': true,
|
|
33
33
|
},
|
|
@@ -133,6 +133,39 @@ class p2b extends p2b$1 {
|
|
|
133
133
|
const messageHash = name + '::' + market['symbol'];
|
|
134
134
|
return await this.subscribe(name + '.subscribe', messageHash, request, params);
|
|
135
135
|
}
|
|
136
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
137
|
+
/**
|
|
138
|
+
* @method
|
|
139
|
+
* @name p2b#watchTickers
|
|
140
|
+
* @see https://github.com/P2B-team/P2B-WSS-Public/blob/main/wss_documentation.md#last-price
|
|
141
|
+
* @see https://github.com/P2B-team/P2B-WSS-Public/blob/main/wss_documentation.md#market-status
|
|
142
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
143
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
144
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
145
|
+
* @param {object} [params.method] 'state' (default) or 'price'
|
|
146
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
147
|
+
*/
|
|
148
|
+
await this.loadMarkets();
|
|
149
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
150
|
+
const watchTickerOptions = this.safeDict(this.options, 'watchTicker');
|
|
151
|
+
let name = this.safeString(watchTickerOptions, 'name', 'state'); // or price
|
|
152
|
+
[name, params] = this.handleOptionAndParams(params, 'method', 'name', name);
|
|
153
|
+
const messageHashes = [];
|
|
154
|
+
const args = [];
|
|
155
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
156
|
+
const market = this.market(symbols[i]);
|
|
157
|
+
messageHashes.push(name + '::' + market['symbol']);
|
|
158
|
+
args.push(market['id']);
|
|
159
|
+
}
|
|
160
|
+
const url = this.urls['api']['ws'];
|
|
161
|
+
const request = {
|
|
162
|
+
'method': name + '.subscribe',
|
|
163
|
+
'params': args,
|
|
164
|
+
'id': this.milliseconds(),
|
|
165
|
+
};
|
|
166
|
+
await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
|
|
167
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
168
|
+
}
|
|
136
169
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
137
170
|
/**
|
|
138
171
|
* @method
|
|
@@ -348,6 +381,7 @@ class p2b extends p2b$1 {
|
|
|
348
381
|
ticker = this.parseTicker(tickerData, market);
|
|
349
382
|
}
|
|
350
383
|
const symbol = ticker['symbol'];
|
|
384
|
+
this.tickers[symbol] = ticker;
|
|
351
385
|
const messageHash = messageHashStart + '::' + symbol;
|
|
352
386
|
client.resolve(ticker, messageHash);
|
|
353
387
|
return message;
|
|
@@ -18,6 +18,7 @@ class whitebit extends whitebit$1 {
|
|
|
18
18
|
'watchOrderBook': true,
|
|
19
19
|
'watchOrders': true,
|
|
20
20
|
'watchTicker': true,
|
|
21
|
+
'watchTickers': true,
|
|
21
22
|
'watchTrades': true,
|
|
22
23
|
'watchTradesForSymbols': false,
|
|
23
24
|
},
|
|
@@ -256,6 +257,36 @@ class whitebit extends whitebit$1 {
|
|
|
256
257
|
// every time we want to subscribe to another market we have to "re-subscribe" sending it all again
|
|
257
258
|
return await this.watchMultipleSubscription(messageHash, method, symbol, false, params);
|
|
258
259
|
}
|
|
260
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
261
|
+
/**
|
|
262
|
+
* @method
|
|
263
|
+
* @name whitebit#watchTickers
|
|
264
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
265
|
+
* @see https://docs.whitebit.com/public/websocket/#market-statistics
|
|
266
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
267
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
268
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
269
|
+
*/
|
|
270
|
+
await this.loadMarkets();
|
|
271
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
272
|
+
const method = 'market_subscribe';
|
|
273
|
+
const url = this.urls['api']['ws'];
|
|
274
|
+
const id = this.nonce();
|
|
275
|
+
const messageHashes = [];
|
|
276
|
+
const args = [];
|
|
277
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
278
|
+
const market = this.market(symbols[i]);
|
|
279
|
+
messageHashes.push('ticker:' + market['symbol']);
|
|
280
|
+
args.push(market['id']);
|
|
281
|
+
}
|
|
282
|
+
const request = {
|
|
283
|
+
'id': id,
|
|
284
|
+
'method': method,
|
|
285
|
+
'params': args,
|
|
286
|
+
};
|
|
287
|
+
await this.watchMultiple(url, messageHashes, this.extend(request, params), messageHashes);
|
|
288
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
289
|
+
}
|
|
259
290
|
handleTicker(client, message) {
|
|
260
291
|
//
|
|
261
292
|
// {
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.4.
|
|
7
|
+
declare const version = "4.4.8";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.4.
|
|
41
|
+
const version = '4.4.9';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -41,7 +41,7 @@ interface Exchange {
|
|
|
41
41
|
contractPrivatePutPositionsSymbolRiskLimit(params?: {}): Promise<implicitReturnType>;
|
|
42
42
|
contractPrivateDeleteOrdersId(params?: {}): Promise<implicitReturnType>;
|
|
43
43
|
contractPrivateDeleteOrdersBatch(params?: {}): Promise<implicitReturnType>;
|
|
44
|
-
|
|
44
|
+
webExchangeGetV3Assets(params?: {}): Promise<implicitReturnType>;
|
|
45
45
|
}
|
|
46
46
|
declare abstract class Exchange extends _Exchange {
|
|
47
47
|
}
|
|
@@ -193,6 +193,8 @@ interface kucoin {
|
|
|
193
193
|
futuresPrivateGetTradeFees(params?: {}): Promise<implicitReturnType>;
|
|
194
194
|
futuresPrivateGetHistoryPositions(params?: {}): Promise<implicitReturnType>;
|
|
195
195
|
futuresPrivateGetGetMaxOpenSize(params?: {}): Promise<implicitReturnType>;
|
|
196
|
+
futuresPrivateGetGetCrossUserLeverage(params?: {}): Promise<implicitReturnType>;
|
|
197
|
+
futuresPrivateGetPositionGetMarginMode(params?: {}): Promise<implicitReturnType>;
|
|
196
198
|
futuresPrivatePostTransferOut(params?: {}): Promise<implicitReturnType>;
|
|
197
199
|
futuresPrivatePostTransferIn(params?: {}): Promise<implicitReturnType>;
|
|
198
200
|
futuresPrivatePostOrders(params?: {}): Promise<implicitReturnType>;
|
|
@@ -204,8 +206,11 @@ interface kucoin {
|
|
|
204
206
|
futuresPrivatePostPositionRiskLimitLevelChange(params?: {}): Promise<implicitReturnType>;
|
|
205
207
|
futuresPrivatePostBulletPrivate(params?: {}): Promise<implicitReturnType>;
|
|
206
208
|
futuresPrivatePostWithdrawals(params?: {}): Promise<implicitReturnType>;
|
|
209
|
+
futuresPrivatePostStOrders(params?: {}): Promise<implicitReturnType>;
|
|
207
210
|
futuresPrivatePostSubApiKey(params?: {}): Promise<implicitReturnType>;
|
|
208
211
|
futuresPrivatePostSubApiKeyUpdate(params?: {}): Promise<implicitReturnType>;
|
|
212
|
+
futuresPrivatePostChangeCrossUserLeverage(params?: {}): Promise<implicitReturnType>;
|
|
213
|
+
futuresPrivatePostPositionChangeMarginMode(params?: {}): Promise<implicitReturnType>;
|
|
209
214
|
futuresPrivateDeleteOrdersOrderId(params?: {}): Promise<implicitReturnType>;
|
|
210
215
|
futuresPrivateDeleteOrdersClientOrderClientOid(params?: {}): Promise<implicitReturnType>;
|
|
211
216
|
futuresPrivateDeleteOrders(params?: {}): Promise<implicitReturnType>;
|