ccxt 4.2.58 → 4.2.60
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/CHANGELOG.md +83 -0
- package/README.md +3 -3
- package/build.sh +1 -1
- package/cleanup.sh +3 -0
- package/dist/ccxt.browser.js +716 -382
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +10 -12
- package/dist/cjs/src/base/Exchange.js +2 -0
- package/dist/cjs/src/binance.js +2 -2
- package/dist/cjs/src/bingx.js +41 -3
- package/dist/cjs/src/bitfinex2.js +21 -4
- package/dist/cjs/src/bitget.js +10 -3
- package/dist/cjs/src/bitmart.js +41 -23
- package/dist/cjs/src/bitmex.js +1 -1
- package/dist/cjs/src/blofin.js +60 -2
- package/dist/cjs/src/coinbase.js +24 -14
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/kraken.js +42 -39
- package/dist/cjs/src/kucoinfutures.js +1 -0
- package/dist/cjs/src/lbank.js +1 -1
- package/dist/cjs/src/mexc.js +1 -1
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/phemex.js +1 -1
- package/dist/cjs/src/pro/binance.js +17 -4
- package/dist/cjs/src/pro/bitfinex2.js +1 -1
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +51 -89
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/coinex.js +1 -1
- package/dist/cjs/src/pro/cryptocom.js +1 -1
- package/dist/cjs/src/pro/deribit.js +201 -84
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/independentreserve.js +1 -1
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/kucoinfutures.js +1 -1
- package/dist/cjs/src/pro/mexc.js +5 -3
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/pro/woo.js +1 -1
- package/dist/cjs/src/wazirx.js +6 -1
- package/dist/cjs/src/woo.js +159 -79
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/blofin.d.ts +1 -0
- package/js/src/abstract/wazirx.d.ts +5 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/ascendex.js +10 -12
- package/js/src/base/Exchange.js +2 -0
- package/js/src/binance.js +2 -2
- package/js/src/bingx.d.ts +3 -1
- package/js/src/bingx.js +41 -3
- package/js/src/bitfinex2.js +21 -4
- package/js/src/bitget.js +10 -3
- package/js/src/bitmart.d.ts +9 -2
- package/js/src/bitmart.js +41 -23
- package/js/src/bitmex.js +1 -1
- package/js/src/blofin.d.ts +2 -1
- package/js/src/blofin.js +60 -2
- package/js/src/coinbase.js +24 -14
- package/js/src/hitbtc.js +1 -1
- package/js/src/htx.js +4 -1
- package/js/src/kraken.js +42 -39
- package/js/src/kucoinfutures.js +1 -0
- package/js/src/lbank.js +1 -1
- package/js/src/mexc.js +1 -1
- package/js/src/okx.js +1 -1
- package/js/src/phemex.js +1 -1
- package/js/src/pro/binance.js +17 -4
- package/js/src/pro/bitfinex2.js +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bitmart.d.ts +2 -2
- package/js/src/pro/bitmart.js +51 -89
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/coinex.js +1 -1
- package/js/src/pro/cryptocom.js +1 -1
- package/js/src/pro/deribit.d.ts +5 -0
- package/js/src/pro/deribit.js +202 -85
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/independentreserve.js +1 -1
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/kucoinfutures.js +1 -1
- package/js/src/pro/mexc.js +6 -4
- package/js/src/pro/okx.js +1 -1
- package/js/src/pro/woo.js +1 -1
- package/js/src/wazirx.js +6 -1
- package/js/src/woo.d.ts +8 -0
- package/js/src/woo.js +159 -79
- package/package.json +1 -1
- package/skip-tests.json +44 -18
|
@@ -16,10 +16,13 @@ class deribit extends deribit$1 {
|
|
|
16
16
|
'watchTicker': true,
|
|
17
17
|
'watchTickers': false,
|
|
18
18
|
'watchTrades': true,
|
|
19
|
+
'watchTradesForSymbols': true,
|
|
19
20
|
'watchMyTrades': true,
|
|
20
21
|
'watchOrders': true,
|
|
21
22
|
'watchOrderBook': true,
|
|
23
|
+
'watchOrderBookForSymbols': true,
|
|
22
24
|
'watchOHLCV': true,
|
|
25
|
+
'watchOHLCVForSymbols': true,
|
|
23
26
|
},
|
|
24
27
|
'urls': {
|
|
25
28
|
'test': {
|
|
@@ -30,18 +33,31 @@ class deribit extends deribit$1 {
|
|
|
30
33
|
},
|
|
31
34
|
},
|
|
32
35
|
'options': {
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
'ws': {
|
|
37
|
+
'timeframes': {
|
|
38
|
+
'1m': '1',
|
|
39
|
+
'3m': '3',
|
|
40
|
+
'5m': '5',
|
|
41
|
+
'15m': '15',
|
|
42
|
+
'30m': '30',
|
|
43
|
+
'1h': '60',
|
|
44
|
+
'2h': '120',
|
|
45
|
+
'4h': '180',
|
|
46
|
+
'6h': '360',
|
|
47
|
+
'12h': '720',
|
|
48
|
+
'1d': '1D',
|
|
49
|
+
},
|
|
50
|
+
// watchTrades replacement
|
|
51
|
+
'watchTradesForSymbols': {
|
|
52
|
+
'interval': '100ms', // 100ms, agg2, raw
|
|
53
|
+
},
|
|
54
|
+
// watchOrderBook replacement
|
|
55
|
+
'watchOrderBookForSymbols': {
|
|
56
|
+
'interval': '100ms',
|
|
57
|
+
'useDepthEndpoint': false,
|
|
58
|
+
'depth': '20',
|
|
59
|
+
'group': 'none', // none, 1, 2, 5, 10, 25, 100, 250
|
|
60
|
+
},
|
|
45
61
|
},
|
|
46
62
|
'currencies': ['BTC', 'ETH', 'SOL', 'USDC'],
|
|
47
63
|
},
|
|
@@ -221,27 +237,31 @@ class deribit extends deribit$1 {
|
|
|
221
237
|
* @param {str} [params.interval] specify aggregation and frequency of notifications. Possible values: 100ms, raw
|
|
222
238
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
223
239
|
*/
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
240
|
+
params['callerMethodName'] = 'watchTrades';
|
|
241
|
+
return await this.watchTradesForSymbols([symbol], since, limit, params);
|
|
242
|
+
}
|
|
243
|
+
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
244
|
+
/**
|
|
245
|
+
* @method
|
|
246
|
+
* @name deribit#watchTradesForSymbols
|
|
247
|
+
* @description get the list of most recent trades for a list of symbols
|
|
248
|
+
* @see https://docs.deribit.com/#trades-instrument_name-interval
|
|
249
|
+
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
250
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
251
|
+
* @param {int} [limit] the maximum amount of trades to fetch
|
|
252
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
253
|
+
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
254
|
+
*/
|
|
255
|
+
let interval = undefined;
|
|
256
|
+
[interval, params] = this.handleOptionAndParams(params, 'watchTradesForSymbols', 'interval', '100ms');
|
|
230
257
|
if (interval === 'raw') {
|
|
231
258
|
await this.authenticate();
|
|
232
259
|
}
|
|
233
|
-
const
|
|
234
|
-
'jsonrpc': '2.0',
|
|
235
|
-
'method': 'public/subscribe',
|
|
236
|
-
'params': {
|
|
237
|
-
'channels': [channel],
|
|
238
|
-
},
|
|
239
|
-
'id': this.requestId(),
|
|
240
|
-
};
|
|
241
|
-
const request = this.deepExtend(message, params);
|
|
242
|
-
const trades = await this.watch(url, channel, request, channel, request);
|
|
260
|
+
const trades = await this.watchMultipleWrapper('trades', interval, symbols, params);
|
|
243
261
|
if (this.newUpdates) {
|
|
244
|
-
|
|
262
|
+
const first = this.safeDict(trades, 0);
|
|
263
|
+
const tradeSymbol = this.safeString(first, 'symbol');
|
|
264
|
+
limit = trades.getLimit(tradeSymbol, limit);
|
|
245
265
|
}
|
|
246
266
|
return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
|
|
247
267
|
}
|
|
@@ -267,26 +287,27 @@ class deribit extends deribit$1 {
|
|
|
267
287
|
// }
|
|
268
288
|
// }
|
|
269
289
|
//
|
|
270
|
-
const params = this.
|
|
290
|
+
const params = this.safeDict(message, 'params', {});
|
|
271
291
|
const channel = this.safeString(params, 'channel', '');
|
|
272
292
|
const parts = channel.split('.');
|
|
273
293
|
const marketId = this.safeString(parts, 1);
|
|
294
|
+
const interval = this.safeString(parts, 2);
|
|
274
295
|
const symbol = this.safeSymbol(marketId);
|
|
275
296
|
const market = this.safeMarket(marketId);
|
|
276
|
-
const trades = this.
|
|
277
|
-
|
|
278
|
-
if (stored === undefined) {
|
|
297
|
+
const trades = this.safeList(params, 'data', []);
|
|
298
|
+
if (this.safeValue(this.trades, symbol) === undefined) {
|
|
279
299
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
280
|
-
|
|
281
|
-
this.trades[symbol] = stored;
|
|
300
|
+
this.trades[symbol] = new Cache.ArrayCache(limit);
|
|
282
301
|
}
|
|
302
|
+
const stored = this.trades[symbol];
|
|
283
303
|
for (let i = 0; i < trades.length; i++) {
|
|
284
304
|
const trade = trades[i];
|
|
285
305
|
const parsed = this.parseTrade(trade, market);
|
|
286
306
|
stored.append(parsed);
|
|
287
307
|
}
|
|
288
308
|
this.trades[symbol] = stored;
|
|
289
|
-
|
|
309
|
+
const messageHash = 'trades|' + symbol + '|' + interval;
|
|
310
|
+
client.resolve(this.trades[symbol], messageHash);
|
|
290
311
|
}
|
|
291
312
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
292
313
|
/**
|
|
@@ -375,7 +396,7 @@ class deribit extends deribit$1 {
|
|
|
375
396
|
/**
|
|
376
397
|
* @method
|
|
377
398
|
* @name deribit#watchOrderBook
|
|
378
|
-
* @see https://docs.deribit.com/#
|
|
399
|
+
* @see https://docs.deribit.com/#book-instrument_name-group-depth-interval
|
|
379
400
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
380
401
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
381
402
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -383,25 +404,39 @@ class deribit extends deribit$1 {
|
|
|
383
404
|
* @param {string} [params.interval] Frequency of notifications. Events will be aggregated over this interval. Possible values: 100ms, raw
|
|
384
405
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
385
406
|
*/
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
407
|
+
params['callerMethodName'] = 'watchOrderBook';
|
|
408
|
+
return await this.watchOrderBookForSymbols([symbol], limit, params);
|
|
409
|
+
}
|
|
410
|
+
async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
|
|
411
|
+
/**
|
|
412
|
+
* @method
|
|
413
|
+
* @name deribit#watchOrderBookForSymbols
|
|
414
|
+
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
415
|
+
* @see https://docs.deribit.com/#book-instrument_name-group-depth-interval
|
|
416
|
+
* @param {string[]} symbols unified array of symbols
|
|
417
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
418
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
419
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
420
|
+
*/
|
|
421
|
+
let interval = undefined;
|
|
422
|
+
[interval, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'interval', '100ms');
|
|
391
423
|
if (interval === 'raw') {
|
|
392
424
|
await this.authenticate();
|
|
393
425
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
426
|
+
let descriptor = '';
|
|
427
|
+
let useDepthEndpoint = undefined; // for more info, see comment in .options
|
|
428
|
+
[useDepthEndpoint, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'useDepthEndpoint', false);
|
|
429
|
+
if (useDepthEndpoint) {
|
|
430
|
+
let depth = undefined;
|
|
431
|
+
[depth, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'depth', '20');
|
|
432
|
+
let group = undefined;
|
|
433
|
+
[group, params] = this.handleOptionAndParams(params, 'watchOrderBookForSymbols', 'group', 'none');
|
|
434
|
+
descriptor = group + '.' + depth + '.' + interval;
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
descriptor = interval;
|
|
438
|
+
}
|
|
439
|
+
const orderbook = await this.watchMultipleWrapper('book', descriptor, symbols, params);
|
|
405
440
|
return orderbook.limit();
|
|
406
441
|
}
|
|
407
442
|
handleOrderBook(client, message) {
|
|
@@ -453,6 +488,20 @@ class deribit extends deribit$1 {
|
|
|
453
488
|
const params = this.safeValue(message, 'params', {});
|
|
454
489
|
const data = this.safeValue(params, 'data', {});
|
|
455
490
|
const channel = this.safeString(params, 'channel');
|
|
491
|
+
const parts = channel.split('.');
|
|
492
|
+
let descriptor = '';
|
|
493
|
+
const partsLength = parts.length;
|
|
494
|
+
const isDetailed = partsLength === 5;
|
|
495
|
+
if (isDetailed) {
|
|
496
|
+
const group = this.safeString(parts, 2);
|
|
497
|
+
const depth = this.safeString(parts, 3);
|
|
498
|
+
const interval = this.safeString(parts, 4);
|
|
499
|
+
descriptor = group + '.' + depth + '.' + interval;
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
const interval = this.safeString(parts, 2);
|
|
503
|
+
descriptor = interval;
|
|
504
|
+
}
|
|
456
505
|
const marketId = this.safeString(data, 'instrument_name');
|
|
457
506
|
const symbol = this.safeSymbol(marketId);
|
|
458
507
|
const timestamp = this.safeInteger(data, 'timestamp');
|
|
@@ -469,7 +518,8 @@ class deribit extends deribit$1 {
|
|
|
469
518
|
storedOrderBook['datetime'] = this.iso8601(timestamp);
|
|
470
519
|
storedOrderBook['symbol'] = symbol;
|
|
471
520
|
this.orderbooks[symbol] = storedOrderBook;
|
|
472
|
-
|
|
521
|
+
const messageHash = 'book|' + symbol + '|' + descriptor;
|
|
522
|
+
client.resolve(storedOrderBook, messageHash);
|
|
473
523
|
}
|
|
474
524
|
cleanOrderBook(data) {
|
|
475
525
|
const bids = this.safeValue(data, 'bids', []);
|
|
@@ -609,28 +659,32 @@ class deribit extends deribit$1 {
|
|
|
609
659
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
610
660
|
*/
|
|
611
661
|
await this.loadMarkets();
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
662
|
+
symbol = this.symbol(symbol);
|
|
663
|
+
const ohlcvs = await this.watchOHLCVForSymbols([[symbol, timeframe]], since, limit, params);
|
|
664
|
+
return ohlcvs[symbol][timeframe];
|
|
665
|
+
}
|
|
666
|
+
async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
|
|
667
|
+
/**
|
|
668
|
+
* @method
|
|
669
|
+
* @name deribit#watchOHLCVForSymbols
|
|
670
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
671
|
+
* @see https://docs.deribit.com/#chart-trades-instrument_name-resolution
|
|
672
|
+
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
673
|
+
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
674
|
+
* @param {int} [limit] the maximum amount of candles to fetch
|
|
675
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
676
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
677
|
+
*/
|
|
678
|
+
const symbolsLength = symbolsAndTimeframes.length;
|
|
679
|
+
if (symbolsLength === 0 || !Array.isArray(symbolsAndTimeframes[0])) {
|
|
680
|
+
throw new errors.ArgumentsRequired(this.id + " watchOHLCVForSymbols() requires a an array of symbols and timeframes, like [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]");
|
|
618
681
|
}
|
|
619
|
-
const
|
|
620
|
-
const message = {
|
|
621
|
-
'jsonrpc': '2.0',
|
|
622
|
-
'method': 'public/subscribe',
|
|
623
|
-
'params': {
|
|
624
|
-
'channels': [channel],
|
|
625
|
-
},
|
|
626
|
-
'id': this.requestId(),
|
|
627
|
-
};
|
|
628
|
-
const request = this.deepExtend(message, params);
|
|
629
|
-
const ohlcv = await this.watch(url, channel, request, channel, request);
|
|
682
|
+
const [symbol, timeframe, candles] = await this.watchMultipleWrapper('chart.trades', undefined, symbolsAndTimeframes, params);
|
|
630
683
|
if (this.newUpdates) {
|
|
631
|
-
limit =
|
|
684
|
+
limit = candles.getLimit(symbol, limit);
|
|
632
685
|
}
|
|
633
|
-
|
|
686
|
+
const filtered = this.filterBySinceLimit(candles, since, limit, 0, true);
|
|
687
|
+
return this.createOHLCVObject(symbol, timeframe, filtered);
|
|
634
688
|
}
|
|
635
689
|
handleOHLCV(client, message) {
|
|
636
690
|
//
|
|
@@ -651,13 +705,44 @@ class deribit extends deribit$1 {
|
|
|
651
705
|
// }
|
|
652
706
|
// }
|
|
653
707
|
//
|
|
654
|
-
const params = this.
|
|
708
|
+
const params = this.safeDict(message, 'params', {});
|
|
655
709
|
const channel = this.safeString(params, 'channel', '');
|
|
656
710
|
const parts = channel.split('.');
|
|
657
711
|
const marketId = this.safeString(parts, 2);
|
|
658
|
-
const
|
|
659
|
-
const
|
|
660
|
-
const
|
|
712
|
+
const rawTimeframe = this.safeString(parts, 3);
|
|
713
|
+
const market = this.safeMarket(marketId);
|
|
714
|
+
const symbol = market['symbol'];
|
|
715
|
+
const wsOptions = this.safeDict(this.options, 'ws', {});
|
|
716
|
+
const timeframes = this.safeDict(wsOptions, 'timeframes', {});
|
|
717
|
+
const unifiedTimeframe = this.findTimeframe(rawTimeframe, timeframes);
|
|
718
|
+
this.ohlcvs[symbol] = this.safeDict(this.ohlcvs, symbol, {});
|
|
719
|
+
if (this.safeValue(this.ohlcvs[symbol], unifiedTimeframe) === undefined) {
|
|
720
|
+
const limit = this.safeInteger(this.options, 'OHLCVLimit', 1000);
|
|
721
|
+
this.ohlcvs[symbol][unifiedTimeframe] = new Cache.ArrayCacheByTimestamp(limit);
|
|
722
|
+
}
|
|
723
|
+
const stored = this.ohlcvs[symbol][unifiedTimeframe];
|
|
724
|
+
const ohlcv = this.safeDict(params, 'data', {});
|
|
725
|
+
// data contains a single OHLCV candle
|
|
726
|
+
const parsed = this.parseWsOHLCV(ohlcv, market);
|
|
727
|
+
stored.append(parsed);
|
|
728
|
+
this.ohlcvs[symbol][unifiedTimeframe] = stored;
|
|
729
|
+
const resolveData = [symbol, unifiedTimeframe, stored];
|
|
730
|
+
const messageHash = 'chart.trades|' + symbol + '|' + rawTimeframe;
|
|
731
|
+
client.resolve(resolveData, messageHash);
|
|
732
|
+
}
|
|
733
|
+
parseWsOHLCV(ohlcv, market = undefined) {
|
|
734
|
+
//
|
|
735
|
+
// {
|
|
736
|
+
// "c": "28909.0",
|
|
737
|
+
// "o": "28915.4",
|
|
738
|
+
// "h": "28915.4",
|
|
739
|
+
// "l": "28896.1",
|
|
740
|
+
// "v": "27.6919",
|
|
741
|
+
// "T": 1696687499999,
|
|
742
|
+
// "t": 1696687440000
|
|
743
|
+
// }
|
|
744
|
+
//
|
|
745
|
+
return [
|
|
661
746
|
this.safeInteger(ohlcv, 'tick'),
|
|
662
747
|
this.safeNumber(ohlcv, 'open'),
|
|
663
748
|
this.safeNumber(ohlcv, 'high'),
|
|
@@ -665,14 +750,46 @@ class deribit extends deribit$1 {
|
|
|
665
750
|
this.safeNumber(ohlcv, 'close'),
|
|
666
751
|
this.safeNumber(ohlcv, 'volume'),
|
|
667
752
|
];
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
753
|
+
}
|
|
754
|
+
async watchMultipleWrapper(channelName, channelDescriptor, symbolsArray = undefined, params = {}) {
|
|
755
|
+
await this.loadMarkets();
|
|
756
|
+
const url = this.urls['api']['ws'];
|
|
757
|
+
const rawSubscriptions = [];
|
|
758
|
+
const messageHashes = [];
|
|
759
|
+
const isOHLCV = (channelName === 'chart.trades');
|
|
760
|
+
const symbols = isOHLCV ? this.getListFromObjectValues(symbolsArray, 0) : symbolsArray;
|
|
761
|
+
this.marketSymbols(symbols, undefined, false);
|
|
762
|
+
for (let i = 0; i < symbolsArray.length; i++) {
|
|
763
|
+
const current = symbolsArray[i];
|
|
764
|
+
let market = undefined;
|
|
765
|
+
if (isOHLCV) {
|
|
766
|
+
market = this.market(current[0]);
|
|
767
|
+
const unifiedTf = current[1];
|
|
768
|
+
const rawTf = this.safeString(this.timeframes, unifiedTf, unifiedTf);
|
|
769
|
+
channelDescriptor = rawTf;
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
market = this.market(current);
|
|
773
|
+
}
|
|
774
|
+
const message = channelName + '.' + market['id'] + '.' + channelDescriptor;
|
|
775
|
+
rawSubscriptions.push(message);
|
|
776
|
+
messageHashes.push(channelName + '|' + market['symbol'] + '|' + channelDescriptor);
|
|
672
777
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
778
|
+
const request = {
|
|
779
|
+
'jsonrpc': '2.0',
|
|
780
|
+
'method': 'public/subscribe',
|
|
781
|
+
'params': {
|
|
782
|
+
'channels': rawSubscriptions,
|
|
783
|
+
},
|
|
784
|
+
'id': this.requestId(),
|
|
785
|
+
};
|
|
786
|
+
const extendedRequest = this.deepExtend(request, params);
|
|
787
|
+
const maxMessageByteLimit = 32768 - 1; // 'Message Too Big: limit 32768B'
|
|
788
|
+
const jsonedText = this.json(extendedRequest);
|
|
789
|
+
if (jsonedText.length >= maxMessageByteLimit) {
|
|
790
|
+
throw new errors.ExchangeError(this.id + ' requested subscription length over limit, try to reduce symbols amount');
|
|
791
|
+
}
|
|
792
|
+
return await this.watchMultiple(url, messageHashes, extendedRequest, rawSubscriptions);
|
|
676
793
|
}
|
|
677
794
|
handleMessage(client, message) {
|
|
678
795
|
//
|
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -822,7 +822,7 @@ class gate extends gate$1 {
|
|
|
822
822
|
const client = this.client(url);
|
|
823
823
|
this.setPositionsCache(client, type, symbols);
|
|
824
824
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
825
|
-
const awaitPositionsSnapshot = this.
|
|
825
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
826
826
|
const cache = this.safeValue(this.positions, type);
|
|
827
827
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && cache === undefined) {
|
|
828
828
|
return await client.future(type + ':fetchPositionsSnapshot');
|
|
@@ -196,7 +196,7 @@ class independentreserve extends independentreserve$1 {
|
|
|
196
196
|
orderbook['timestamp'] = timestamp;
|
|
197
197
|
orderbook['datetime'] = this.iso8601(timestamp);
|
|
198
198
|
}
|
|
199
|
-
const checksum = this.
|
|
199
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
200
200
|
if (checksum && receivedSnapshot) {
|
|
201
201
|
const storedAsks = orderbook['asks'];
|
|
202
202
|
const storedBids = orderbook['bids'];
|
|
@@ -697,7 +697,7 @@ class kraken extends kraken$1 {
|
|
|
697
697
|
}
|
|
698
698
|
// don't remove this line or I will poop on your face
|
|
699
699
|
orderbook.limit();
|
|
700
|
-
const checksum = this.
|
|
700
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
701
701
|
if (checksum) {
|
|
702
702
|
const priceString = this.safeString(example, 0);
|
|
703
703
|
const amountString = this.safeString(example, 1);
|
|
@@ -238,7 +238,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
238
238
|
const client = this.client(url);
|
|
239
239
|
this.setPositionCache(client, symbol);
|
|
240
240
|
const fetchPositionSnapshot = this.handleOption('watchPosition', 'fetchPositionSnapshot', true);
|
|
241
|
-
const awaitPositionSnapshot = this.
|
|
241
|
+
const awaitPositionSnapshot = this.safeBool('watchPosition', 'awaitPositionSnapshot', true);
|
|
242
242
|
const currentPosition = this.getCurrentPosition(symbol);
|
|
243
243
|
if (fetchPositionSnapshot && awaitPositionSnapshot && currentPosition === undefined) {
|
|
244
244
|
const snapshot = await client.future('fetchPositionSnapshot:' + symbol);
|
package/dist/cjs/src/pro/mexc.js
CHANGED
|
@@ -500,10 +500,12 @@ class mexc extends mexc$1 {
|
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
handleDelta(orderbook, delta) {
|
|
503
|
-
const
|
|
503
|
+
const existingNonce = this.safeInteger(orderbook, 'nonce');
|
|
504
504
|
const deltaNonce = this.safeInteger2(delta, 'r', 'version');
|
|
505
|
-
if (deltaNonce
|
|
506
|
-
|
|
505
|
+
if (deltaNonce < existingNonce) {
|
|
506
|
+
// even when doing < comparison, this happens: https://app.travis-ci.com/github/ccxt/ccxt/builds/269234741#L1809
|
|
507
|
+
// so, we just skip old updates
|
|
508
|
+
return;
|
|
507
509
|
}
|
|
508
510
|
orderbook['nonce'] = deltaNonce;
|
|
509
511
|
const asks = this.safeValue(delta, 'asks', []);
|
package/dist/cjs/src/pro/okx.js
CHANGED
|
@@ -559,7 +559,7 @@ class okx extends okx$1 {
|
|
|
559
559
|
const storedBids = orderbook['bids'];
|
|
560
560
|
this.handleDeltas(storedAsks, asks);
|
|
561
561
|
this.handleDeltas(storedBids, bids);
|
|
562
|
-
const checksum = this.
|
|
562
|
+
const checksum = this.safeBool(this.options, 'checksum', true);
|
|
563
563
|
if (checksum) {
|
|
564
564
|
const asksLength = storedAsks.length;
|
|
565
565
|
const bidsLength = storedBids.length;
|
package/dist/cjs/src/pro/woo.js
CHANGED
|
@@ -629,7 +629,7 @@ class woo extends woo$1 {
|
|
|
629
629
|
const client = this.client(url);
|
|
630
630
|
this.setPositionsCache(client, symbols);
|
|
631
631
|
const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
|
|
632
|
-
const awaitPositionsSnapshot = this.
|
|
632
|
+
const awaitPositionsSnapshot = this.safeBool('watchPositions', 'awaitPositionsSnapshot', true);
|
|
633
633
|
if (fetchPositionsSnapshot && awaitPositionsSnapshot && this.positions === undefined) {
|
|
634
634
|
const snapshot = await client.future('fetchPositionsSnapshot');
|
|
635
635
|
return this.filterBySymbolsSinceLimit(snapshot, symbols, since, limit, true);
|
package/dist/cjs/src/wazirx.js
CHANGED
|
@@ -110,7 +110,7 @@ class wazirx extends wazirx$1 {
|
|
|
110
110
|
'public': {
|
|
111
111
|
'get': {
|
|
112
112
|
'exchangeInfo': 1,
|
|
113
|
-
'depth':
|
|
113
|
+
'depth': 0.5,
|
|
114
114
|
'ping': 1,
|
|
115
115
|
'systemStatus': 1,
|
|
116
116
|
'tickers/24hr': 1,
|
|
@@ -129,6 +129,11 @@ class wazirx extends wazirx$1 {
|
|
|
129
129
|
'openOrders': 1,
|
|
130
130
|
'order': 0.5,
|
|
131
131
|
'myTrades': 0.5,
|
|
132
|
+
'coins': 12,
|
|
133
|
+
'crypto/withdraws': 12,
|
|
134
|
+
'crypto/deposits/address': 60,
|
|
135
|
+
'sub_account/fund_transfer/history': 1,
|
|
136
|
+
'sub_account/accounts': 1,
|
|
132
137
|
},
|
|
133
138
|
'post': {
|
|
134
139
|
'order': 0.1,
|