ccxt 4.3.95 → 4.3.96
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 +4 -4
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -7
- package/dist/cjs/src/base/Exchange.js +0 -4
- package/dist/cjs/src/bingx.js +2 -1
- package/dist/cjs/src/blofin.js +0 -1
- package/dist/cjs/src/bybit.js +8 -2
- package/dist/cjs/src/hyperliquid.js +262 -32
- package/dist/cjs/src/kucoin.js +12 -12
- package/dist/cjs/src/mexc.js +6 -0
- package/dist/cjs/src/okx.js +0 -1
- package/dist/cjs/src/p2b.js +0 -1
- package/dist/cjs/src/pro/binance.js +100 -2
- package/dist/cjs/src/pro/bybit.js +65 -4
- package/dist/cjs/src/pro/cryptocom.js +224 -0
- package/dist/cjs/src/pro/okx.js +264 -35
- package/dist/cjs/src/tradeogre.js +0 -1
- package/js/ccxt.d.ts +2 -8
- package/js/ccxt.js +2 -6
- package/js/src/base/Exchange.d.ts +0 -2
- package/js/src/base/Exchange.js +0 -4
- package/js/src/bingx.js +2 -1
- package/js/src/blofin.js +0 -1
- package/js/src/bybit.js +8 -2
- package/js/src/hyperliquid.d.ts +22 -0
- package/js/src/hyperliquid.js +262 -32
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +12 -12
- package/js/src/mexc.js +6 -0
- package/js/src/okx.js +0 -1
- package/js/src/p2b.js +0 -1
- package/js/src/pro/binance.d.ts +2 -0
- package/js/src/pro/binance.js +100 -2
- package/js/src/pro/bybit.d.ts +3 -1
- package/js/src/pro/bybit.js +65 -4
- package/js/src/pro/cryptocom.d.ts +10 -1
- package/js/src/pro/cryptocom.js +225 -1
- package/js/src/pro/okx.d.ts +10 -1
- package/js/src/pro/okx.js +264 -35
- package/js/src/tradeogre.js +0 -1
- package/package.json +1 -1
- package/js/src/abstract/bitbay.d.ts +0 -56
- package/js/src/abstract/bitbay.js +0 -11
- package/js/src/abstract/hitbtc3.d.ts +0 -118
- package/js/src/abstract/hitbtc3.js +0 -11
package/js/src/pro/okx.js
CHANGED
|
@@ -17,6 +17,7 @@ export default class okx extends okxRest {
|
|
|
17
17
|
'ws': true,
|
|
18
18
|
'watchTicker': true,
|
|
19
19
|
'watchTickers': true,
|
|
20
|
+
'watchBidsAsks': true,
|
|
20
21
|
'watchOrderBook': true,
|
|
21
22
|
'watchTrades': true,
|
|
22
23
|
'watchTradesForSymbols': true,
|
|
@@ -128,9 +129,8 @@ export default class okx extends okxRest {
|
|
|
128
129
|
}
|
|
129
130
|
symbols = this.marketSymbols(symbols);
|
|
130
131
|
const url = this.getUrl(channel, access);
|
|
131
|
-
|
|
132
|
+
const messageHashes = [];
|
|
132
133
|
const args = [];
|
|
133
|
-
messageHash += '::' + symbols.join(',');
|
|
134
134
|
for (let i = 0; i < symbols.length; i++) {
|
|
135
135
|
const marketId = this.marketId(symbols[i]);
|
|
136
136
|
const arg = {
|
|
@@ -138,12 +138,13 @@ export default class okx extends okxRest {
|
|
|
138
138
|
'instId': marketId,
|
|
139
139
|
};
|
|
140
140
|
args.push(this.extend(arg, params));
|
|
141
|
+
messageHashes.push(channel + '::' + symbols[i]);
|
|
141
142
|
}
|
|
142
143
|
const request = {
|
|
143
144
|
'op': 'subscribe',
|
|
144
145
|
'args': args,
|
|
145
146
|
};
|
|
146
|
-
return await this.
|
|
147
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
147
148
|
}
|
|
148
149
|
async subscribe(access, messageHash, channel, symbol, params = {}) {
|
|
149
150
|
await this.loadMarkets();
|
|
@@ -397,6 +398,19 @@ export default class okx extends okxRest {
|
|
|
397
398
|
const ticker = await this.watchTickers([symbol], params);
|
|
398
399
|
return this.safeValue(ticker, symbol);
|
|
399
400
|
}
|
|
401
|
+
async unWatchTicker(symbol, params = {}) {
|
|
402
|
+
/**
|
|
403
|
+
* @method
|
|
404
|
+
* @name okx#unWatchTicker
|
|
405
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel
|
|
406
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
407
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
408
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
409
|
+
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
410
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
411
|
+
*/
|
|
412
|
+
return await this.unWatchTickers([symbol], params);
|
|
413
|
+
}
|
|
400
414
|
async watchTickers(symbols = undefined, params = {}) {
|
|
401
415
|
/**
|
|
402
416
|
* @method
|
|
@@ -418,6 +432,40 @@ export default class okx extends okxRest {
|
|
|
418
432
|
}
|
|
419
433
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
420
434
|
}
|
|
435
|
+
async unWatchTickers(symbols = undefined, params = {}) {
|
|
436
|
+
/**
|
|
437
|
+
* @method
|
|
438
|
+
* @name okx#unWatchTickers
|
|
439
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel
|
|
440
|
+
* @description unWatches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
441
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
442
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
443
|
+
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
444
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
445
|
+
*/
|
|
446
|
+
await this.loadMarkets();
|
|
447
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
448
|
+
let channel = undefined;
|
|
449
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchTickers', 'channel', 'tickers');
|
|
450
|
+
const topics = [];
|
|
451
|
+
const messageHashes = [];
|
|
452
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
453
|
+
const symbol = symbols[i];
|
|
454
|
+
messageHashes.push('unsubscribe:ticker:' + symbol);
|
|
455
|
+
const marketId = this.marketId(symbol);
|
|
456
|
+
const topic = {
|
|
457
|
+
'channel': channel,
|
|
458
|
+
'instId': marketId,
|
|
459
|
+
};
|
|
460
|
+
topics.push(topic);
|
|
461
|
+
}
|
|
462
|
+
const request = {
|
|
463
|
+
'op': 'unsubscribe',
|
|
464
|
+
'args': topics,
|
|
465
|
+
};
|
|
466
|
+
const url = this.getUrl(channel, 'public');
|
|
467
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
468
|
+
}
|
|
421
469
|
handleTicker(client, message) {
|
|
422
470
|
//
|
|
423
471
|
// {
|
|
@@ -444,30 +492,109 @@ export default class okx extends okxRest {
|
|
|
444
492
|
// ]
|
|
445
493
|
// }
|
|
446
494
|
//
|
|
495
|
+
this.handleBidAsk(client, message);
|
|
447
496
|
const arg = this.safeValue(message, 'arg', {});
|
|
497
|
+
const marketId = this.safeString(arg, 'instId');
|
|
498
|
+
const market = this.safeMarket(marketId, undefined, '-');
|
|
499
|
+
const symbol = market['symbol'];
|
|
448
500
|
const channel = this.safeString(arg, 'channel');
|
|
449
501
|
const data = this.safeValue(message, 'data', []);
|
|
450
|
-
const newTickers =
|
|
502
|
+
const newTickers = {};
|
|
451
503
|
for (let i = 0; i < data.length; i++) {
|
|
452
504
|
const ticker = this.parseTicker(data[i]);
|
|
453
|
-
const symbol = ticker['symbol'];
|
|
454
505
|
this.tickers[symbol] = ticker;
|
|
455
|
-
newTickers
|
|
456
|
-
}
|
|
457
|
-
const messageHashes = this.findMessageHashes(client, channel + '::');
|
|
458
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
459
|
-
const messageHash = messageHashes[i];
|
|
460
|
-
const parts = messageHash.split('::');
|
|
461
|
-
const symbolsString = parts[1];
|
|
462
|
-
const symbols = symbolsString.split(',');
|
|
463
|
-
const tickers = this.filterByArray(newTickers, 'symbol', symbols);
|
|
464
|
-
const tickersSymbols = Object.keys(tickers);
|
|
465
|
-
const numTickers = tickersSymbols.length;
|
|
466
|
-
if (numTickers > 0) {
|
|
467
|
-
client.resolve(tickers, messageHash);
|
|
468
|
-
}
|
|
506
|
+
newTickers[symbol] = ticker;
|
|
469
507
|
}
|
|
470
|
-
|
|
508
|
+
const messageHash = channel + '::' + symbol;
|
|
509
|
+
client.resolve(newTickers, messageHash);
|
|
510
|
+
}
|
|
511
|
+
async watchBidsAsks(symbols = undefined, params = {}) {
|
|
512
|
+
/**
|
|
513
|
+
* @method
|
|
514
|
+
* @name okx#watchBidsAsks
|
|
515
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel
|
|
516
|
+
* @description watches best bid & ask for symbols
|
|
517
|
+
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
518
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
519
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
520
|
+
*/
|
|
521
|
+
await this.loadMarkets();
|
|
522
|
+
symbols = this.marketSymbols(symbols, undefined, false);
|
|
523
|
+
let channel = undefined;
|
|
524
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchBidsAsks', 'channel', 'tickers');
|
|
525
|
+
const url = this.getUrl(channel, 'public');
|
|
526
|
+
const messageHashes = [];
|
|
527
|
+
const args = [];
|
|
528
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
529
|
+
const marketId = this.marketId(symbols[i]);
|
|
530
|
+
const arg = {
|
|
531
|
+
'channel': channel,
|
|
532
|
+
'instId': marketId,
|
|
533
|
+
};
|
|
534
|
+
args.push(this.extend(arg, params));
|
|
535
|
+
messageHashes.push('bidask::' + symbols[i]);
|
|
536
|
+
}
|
|
537
|
+
const request = {
|
|
538
|
+
'op': 'subscribe',
|
|
539
|
+
'args': args,
|
|
540
|
+
};
|
|
541
|
+
const newTickers = await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
542
|
+
if (this.newUpdates) {
|
|
543
|
+
const tickers = {};
|
|
544
|
+
tickers[newTickers['symbol']] = newTickers;
|
|
545
|
+
return tickers;
|
|
546
|
+
}
|
|
547
|
+
return this.filterByArray(this.bidsasks, 'symbol', symbols);
|
|
548
|
+
}
|
|
549
|
+
handleBidAsk(client, message) {
|
|
550
|
+
//
|
|
551
|
+
// {
|
|
552
|
+
// "arg": { channel: "tickers", instId: "BTC-USDT" },
|
|
553
|
+
// "data": [
|
|
554
|
+
// {
|
|
555
|
+
// "instType": "SPOT",
|
|
556
|
+
// "instId": "BTC-USDT",
|
|
557
|
+
// "last": "31500.1",
|
|
558
|
+
// "lastSz": "0.00001754",
|
|
559
|
+
// "askPx": "31500.1",
|
|
560
|
+
// "askSz": "0.00998144",
|
|
561
|
+
// "bidPx": "31500",
|
|
562
|
+
// "bidSz": "3.05652439",
|
|
563
|
+
// "open24h": "31697",
|
|
564
|
+
// "high24h": "32248",
|
|
565
|
+
// "low24h": "31165.6",
|
|
566
|
+
// "sodUtc0": "31385.5",
|
|
567
|
+
// "sodUtc8": "32134.9",
|
|
568
|
+
// "volCcy24h": "503403597.38138519",
|
|
569
|
+
// "vol24h": "15937.10781721",
|
|
570
|
+
// "ts": "1626526618762"
|
|
571
|
+
// }
|
|
572
|
+
// ]
|
|
573
|
+
// }
|
|
574
|
+
//
|
|
575
|
+
const data = this.safeList(message, 'data', []);
|
|
576
|
+
const ticker = this.safeDict(data, 0, {});
|
|
577
|
+
const parsedTicker = this.parseWsBidAsk(ticker);
|
|
578
|
+
const symbol = parsedTicker['symbol'];
|
|
579
|
+
this.bidsasks[symbol] = parsedTicker;
|
|
580
|
+
const messageHash = 'bidask::' + symbol;
|
|
581
|
+
client.resolve(parsedTicker, messageHash);
|
|
582
|
+
}
|
|
583
|
+
parseWsBidAsk(ticker, market = undefined) {
|
|
584
|
+
const marketId = this.safeString(ticker, 'instId');
|
|
585
|
+
market = this.safeMarket(marketId, market);
|
|
586
|
+
const symbol = this.safeString(market, 'symbol');
|
|
587
|
+
const timestamp = this.safeInteger(ticker, 'ts');
|
|
588
|
+
return this.safeTicker({
|
|
589
|
+
'symbol': symbol,
|
|
590
|
+
'timestamp': timestamp,
|
|
591
|
+
'datetime': this.iso8601(timestamp),
|
|
592
|
+
'ask': this.safeString(ticker, 'askPx'),
|
|
593
|
+
'askVolume': this.safeString(ticker, 'askSz'),
|
|
594
|
+
'bid': this.safeString(ticker, 'bidPx'),
|
|
595
|
+
'bidVolume': this.safeString(ticker, 'bidSz'),
|
|
596
|
+
'info': ticker,
|
|
597
|
+
}, market);
|
|
471
598
|
}
|
|
472
599
|
async watchLiquidationsForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
473
600
|
/**
|
|
@@ -582,12 +709,28 @@ export default class okx extends okxRest {
|
|
|
582
709
|
params = this.omit(params, ['stop', 'trigger']);
|
|
583
710
|
await this.authenticate({ 'access': isStop ? 'business' : 'private' });
|
|
584
711
|
symbols = this.marketSymbols(symbols, undefined, true, true);
|
|
585
|
-
|
|
712
|
+
const messageHash = 'myLiquidations';
|
|
713
|
+
const messageHashes = [];
|
|
586
714
|
if (symbols !== undefined) {
|
|
587
|
-
|
|
715
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
716
|
+
const symbol = symbols[i];
|
|
717
|
+
messageHashes.push(messageHash + '::' + symbol);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
messageHashes.push(messageHash);
|
|
588
722
|
}
|
|
589
723
|
const channel = 'balance_and_position';
|
|
590
|
-
const
|
|
724
|
+
const request = {
|
|
725
|
+
'op': 'subscribe',
|
|
726
|
+
'args': [
|
|
727
|
+
{
|
|
728
|
+
'channel': channel,
|
|
729
|
+
},
|
|
730
|
+
],
|
|
731
|
+
};
|
|
732
|
+
const url = this.getUrl(channel, 'private');
|
|
733
|
+
const newLiquidations = await this.watchMultiple(url, messageHashes, this.deepExtend(request, params), messageHashes);
|
|
591
734
|
if (this.newUpdates) {
|
|
592
735
|
return newLiquidations;
|
|
593
736
|
}
|
|
@@ -754,6 +897,19 @@ export default class okx extends okxRest {
|
|
|
754
897
|
}
|
|
755
898
|
return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
|
|
756
899
|
}
|
|
900
|
+
async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
|
|
901
|
+
/**
|
|
902
|
+
* @method
|
|
903
|
+
* @name okx#unWatchOHLCV
|
|
904
|
+
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
905
|
+
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
906
|
+
* @param {string} timeframe the length of time each candle represents
|
|
907
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
908
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
909
|
+
*/
|
|
910
|
+
await this.loadMarkets();
|
|
911
|
+
return await this.unWatchOHLCVForSymbols([[symbol, timeframe]], params);
|
|
912
|
+
}
|
|
757
913
|
async watchOHLCVForSymbols(symbolsAndTimeframes, since = undefined, limit = undefined, params = {}) {
|
|
758
914
|
/**
|
|
759
915
|
* @method
|
|
@@ -798,6 +954,43 @@ export default class okx extends okxRest {
|
|
|
798
954
|
const filtered = this.filterBySinceLimit(candles, since, limit, 0, true);
|
|
799
955
|
return this.createOHLCVObject(symbol, timeframe, filtered);
|
|
800
956
|
}
|
|
957
|
+
async unWatchOHLCVForSymbols(symbolsAndTimeframes, params = {}) {
|
|
958
|
+
/**
|
|
959
|
+
* @method
|
|
960
|
+
* @name okx#unWatchOHLCVForSymbols
|
|
961
|
+
* @description unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
962
|
+
* @param {string[][]} symbolsAndTimeframes array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
|
963
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
964
|
+
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
965
|
+
*/
|
|
966
|
+
const symbolsLength = symbolsAndTimeframes.length;
|
|
967
|
+
if (symbolsLength === 0 || !Array.isArray(symbolsAndTimeframes[0])) {
|
|
968
|
+
throw new ArgumentsRequired(this.id + " watchOHLCVForSymbols() requires a an array of symbols and timeframes, like [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]");
|
|
969
|
+
}
|
|
970
|
+
await this.loadMarkets();
|
|
971
|
+
const topics = [];
|
|
972
|
+
const messageHashes = [];
|
|
973
|
+
for (let i = 0; i < symbolsAndTimeframes.length; i++) {
|
|
974
|
+
const symbolAndTimeframe = symbolsAndTimeframes[i];
|
|
975
|
+
const sym = symbolAndTimeframe[0];
|
|
976
|
+
const tf = symbolAndTimeframe[1];
|
|
977
|
+
const marketId = this.marketId(sym);
|
|
978
|
+
const interval = this.safeString(this.timeframes, tf, tf);
|
|
979
|
+
const channel = 'candle' + interval;
|
|
980
|
+
const topic = {
|
|
981
|
+
'channel': channel,
|
|
982
|
+
'instId': marketId,
|
|
983
|
+
};
|
|
984
|
+
topics.push(topic);
|
|
985
|
+
messageHashes.push('unsubscribe:multi:' + channel + ':' + sym);
|
|
986
|
+
}
|
|
987
|
+
const request = {
|
|
988
|
+
'op': 'unsubscribe',
|
|
989
|
+
'args': topics,
|
|
990
|
+
};
|
|
991
|
+
const url = this.getUrl('candle', 'public');
|
|
992
|
+
return await this.watchMultiple(url, messageHashes, request, messageHashes);
|
|
993
|
+
}
|
|
801
994
|
handleOHLCV(client, message) {
|
|
802
995
|
//
|
|
803
996
|
// {
|
|
@@ -1507,6 +1700,9 @@ export default class okx extends okxRest {
|
|
|
1507
1700
|
// }
|
|
1508
1701
|
//
|
|
1509
1702
|
const arg = this.safeValue(message, 'arg', {});
|
|
1703
|
+
const marketId = this.safeString(arg, 'instId');
|
|
1704
|
+
const market = this.safeMarket(marketId, undefined, '-');
|
|
1705
|
+
const symbol = market['symbol'];
|
|
1510
1706
|
const channel = this.safeString(arg, 'channel', '');
|
|
1511
1707
|
const data = this.safeValue(message, 'data', []);
|
|
1512
1708
|
if (this.positions === undefined) {
|
|
@@ -1527,18 +1723,11 @@ export default class okx extends okxRest {
|
|
|
1527
1723
|
newPositions.push(position);
|
|
1528
1724
|
cache.append(position);
|
|
1529
1725
|
}
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
const parts = messageHash.split('::');
|
|
1534
|
-
const symbolsString = parts[1];
|
|
1535
|
-
const symbols = symbolsString.split(',');
|
|
1536
|
-
const positions = this.filterByArray(newPositions, 'symbol', symbols, false);
|
|
1537
|
-
if (!this.isEmpty(positions)) {
|
|
1538
|
-
client.resolve(positions, messageHash);
|
|
1539
|
-
}
|
|
1726
|
+
let messageHash = channel;
|
|
1727
|
+
if (symbol !== undefined) {
|
|
1728
|
+
messageHash = channel + '::' + symbol;
|
|
1540
1729
|
}
|
|
1541
|
-
client.resolve(newPositions,
|
|
1730
|
+
client.resolve(newPositions, messageHash);
|
|
1542
1731
|
}
|
|
1543
1732
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1544
1733
|
/**
|
|
@@ -2172,6 +2361,40 @@ export default class okx extends okxRest {
|
|
|
2172
2361
|
client.reject(error, subMessageHash);
|
|
2173
2362
|
client.resolve(true, messageHash);
|
|
2174
2363
|
}
|
|
2364
|
+
handleUnsubscriptionOHLCV(client, symbol, channel) {
|
|
2365
|
+
const tf = channel.replace('candle', '');
|
|
2366
|
+
const timeframe = this.findTimeframe(tf);
|
|
2367
|
+
const subMessageHash = 'multi:' + channel + ':' + symbol;
|
|
2368
|
+
const messageHash = 'unsubscribe:' + subMessageHash;
|
|
2369
|
+
if (subMessageHash in client.subscriptions) {
|
|
2370
|
+
delete client.subscriptions[subMessageHash];
|
|
2371
|
+
}
|
|
2372
|
+
if (messageHash in client.subscriptions) {
|
|
2373
|
+
delete client.subscriptions[messageHash];
|
|
2374
|
+
}
|
|
2375
|
+
if (timeframe in this.ohlcvs[symbol]) {
|
|
2376
|
+
delete this.ohlcvs[symbol][timeframe];
|
|
2377
|
+
}
|
|
2378
|
+
const error = new UnsubscribeError(this.id + ' ' + subMessageHash);
|
|
2379
|
+
client.reject(error, subMessageHash);
|
|
2380
|
+
client.resolve(true, messageHash);
|
|
2381
|
+
}
|
|
2382
|
+
handleUnsubscriptionTicker(client, symbol, channel) {
|
|
2383
|
+
const subMessageHash = channel + '::' + symbol;
|
|
2384
|
+
const messageHash = 'unsubscribe:ticker:' + symbol;
|
|
2385
|
+
if (subMessageHash in client.subscriptions) {
|
|
2386
|
+
delete client.subscriptions[subMessageHash];
|
|
2387
|
+
}
|
|
2388
|
+
if (messageHash in client.subscriptions) {
|
|
2389
|
+
delete client.subscriptions[messageHash];
|
|
2390
|
+
}
|
|
2391
|
+
if (symbol in this.tickers) {
|
|
2392
|
+
delete this.tickers[symbol];
|
|
2393
|
+
}
|
|
2394
|
+
const error = new UnsubscribeError(this.id + ' ' + subMessageHash);
|
|
2395
|
+
client.reject(error, subMessageHash);
|
|
2396
|
+
client.resolve(true, messageHash);
|
|
2397
|
+
}
|
|
2175
2398
|
handleUnsubscription(client, message) {
|
|
2176
2399
|
//
|
|
2177
2400
|
// {
|
|
@@ -2184,7 +2407,7 @@ export default class okx extends okxRest {
|
|
|
2184
2407
|
// }
|
|
2185
2408
|
// arg might be an array or list
|
|
2186
2409
|
const arg = this.safeDict(message, 'arg', {});
|
|
2187
|
-
const channel = this.safeString(arg, 'channel');
|
|
2410
|
+
const channel = this.safeString(arg, 'channel', '');
|
|
2188
2411
|
const marketId = this.safeString(arg, 'instId');
|
|
2189
2412
|
const symbol = this.safeSymbol(marketId);
|
|
2190
2413
|
if (channel === 'trades') {
|
|
@@ -2193,5 +2416,11 @@ export default class okx extends okxRest {
|
|
|
2193
2416
|
else if (channel.startsWith('bbo') || channel.startsWith('book')) {
|
|
2194
2417
|
this.handleUnsubscriptionOrderBook(client, symbol, channel);
|
|
2195
2418
|
}
|
|
2419
|
+
else if (channel.indexOf('tickers') > -1) {
|
|
2420
|
+
this.handleUnsubscriptionTicker(client, symbol, channel);
|
|
2421
|
+
}
|
|
2422
|
+
else if (channel.startsWith('candle')) {
|
|
2423
|
+
this.handleUnsubscriptionOHLCV(client, symbol, channel);
|
|
2424
|
+
}
|
|
2196
2425
|
}
|
|
2197
2426
|
}
|
package/js/src/tradeogre.js
CHANGED
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { implicitReturnType } from '../base/types.js';
|
|
2
|
-
import _zonda from '../zonda.js';
|
|
3
|
-
interface zonda {
|
|
4
|
-
publicGetIdAll(params?: {}): Promise<implicitReturnType>;
|
|
5
|
-
publicGetIdMarket(params?: {}): Promise<implicitReturnType>;
|
|
6
|
-
publicGetIdOrderbook(params?: {}): Promise<implicitReturnType>;
|
|
7
|
-
publicGetIdTicker(params?: {}): Promise<implicitReturnType>;
|
|
8
|
-
publicGetIdTrades(params?: {}): Promise<implicitReturnType>;
|
|
9
|
-
privatePostInfo(params?: {}): Promise<implicitReturnType>;
|
|
10
|
-
privatePostTrade(params?: {}): Promise<implicitReturnType>;
|
|
11
|
-
privatePostCancel(params?: {}): Promise<implicitReturnType>;
|
|
12
|
-
privatePostOrderbook(params?: {}): Promise<implicitReturnType>;
|
|
13
|
-
privatePostOrders(params?: {}): Promise<implicitReturnType>;
|
|
14
|
-
privatePostTransfer(params?: {}): Promise<implicitReturnType>;
|
|
15
|
-
privatePostWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
16
|
-
privatePostHistory(params?: {}): Promise<implicitReturnType>;
|
|
17
|
-
privatePostTransactions(params?: {}): Promise<implicitReturnType>;
|
|
18
|
-
v1_01PublicGetTradingTicker(params?: {}): Promise<implicitReturnType>;
|
|
19
|
-
v1_01PublicGetTradingTickerSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
|
-
v1_01PublicGetTradingStats(params?: {}): Promise<implicitReturnType>;
|
|
21
|
-
v1_01PublicGetTradingStatsSymbol(params?: {}): Promise<implicitReturnType>;
|
|
22
|
-
v1_01PublicGetTradingOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
|
|
23
|
-
v1_01PublicGetTradingTransactionsSymbol(params?: {}): Promise<implicitReturnType>;
|
|
24
|
-
v1_01PublicGetTradingCandleHistorySymbolResolution(params?: {}): Promise<implicitReturnType>;
|
|
25
|
-
v1_01PrivateGetApiPaymentsDepositsCryptoAddresses(params?: {}): Promise<implicitReturnType>;
|
|
26
|
-
v1_01PrivateGetPaymentsWithdrawalDetailId(params?: {}): Promise<implicitReturnType>;
|
|
27
|
-
v1_01PrivateGetPaymentsDepositDetailId(params?: {}): Promise<implicitReturnType>;
|
|
28
|
-
v1_01PrivateGetTradingOffer(params?: {}): Promise<implicitReturnType>;
|
|
29
|
-
v1_01PrivateGetTradingStopOffer(params?: {}): Promise<implicitReturnType>;
|
|
30
|
-
v1_01PrivateGetTradingConfigSymbol(params?: {}): Promise<implicitReturnType>;
|
|
31
|
-
v1_01PrivateGetTradingHistoryTransactions(params?: {}): Promise<implicitReturnType>;
|
|
32
|
-
v1_01PrivateGetBalancesBITBAYHistory(params?: {}): Promise<implicitReturnType>;
|
|
33
|
-
v1_01PrivateGetBalancesBITBAYBalance(params?: {}): Promise<implicitReturnType>;
|
|
34
|
-
v1_01PrivateGetFiatCantorRateBaseIdQuoteId(params?: {}): Promise<implicitReturnType>;
|
|
35
|
-
v1_01PrivateGetFiatCantorHistory(params?: {}): Promise<implicitReturnType>;
|
|
36
|
-
v1_01PrivateGetClientPaymentsV2CustomerCryptoCurrencyChannelsDeposit(params?: {}): Promise<implicitReturnType>;
|
|
37
|
-
v1_01PrivateGetClientPaymentsV2CustomerCryptoCurrencyChannelsWithdrawal(params?: {}): Promise<implicitReturnType>;
|
|
38
|
-
v1_01PrivateGetClientPaymentsV2CustomerCryptoDepositFee(params?: {}): Promise<implicitReturnType>;
|
|
39
|
-
v1_01PrivateGetClientPaymentsV2CustomerCryptoWithdrawalFee(params?: {}): Promise<implicitReturnType>;
|
|
40
|
-
v1_01PrivatePostTradingOfferSymbol(params?: {}): Promise<implicitReturnType>;
|
|
41
|
-
v1_01PrivatePostTradingStopOfferSymbol(params?: {}): Promise<implicitReturnType>;
|
|
42
|
-
v1_01PrivatePostTradingConfigSymbol(params?: {}): Promise<implicitReturnType>;
|
|
43
|
-
v1_01PrivatePostBalancesBITBAYBalance(params?: {}): Promise<implicitReturnType>;
|
|
44
|
-
v1_01PrivatePostBalancesBITBAYBalanceTransferSourceDestination(params?: {}): Promise<implicitReturnType>;
|
|
45
|
-
v1_01PrivatePostFiatCantorExchange(params?: {}): Promise<implicitReturnType>;
|
|
46
|
-
v1_01PrivatePostApiPaymentsWithdrawalsCrypto(params?: {}): Promise<implicitReturnType>;
|
|
47
|
-
v1_01PrivatePostApiPaymentsWithdrawalsFiat(params?: {}): Promise<implicitReturnType>;
|
|
48
|
-
v1_01PrivatePostClientPaymentsV2CustomerCryptoDeposit(params?: {}): Promise<implicitReturnType>;
|
|
49
|
-
v1_01PrivatePostClientPaymentsV2CustomerCryptoWithdrawal(params?: {}): Promise<implicitReturnType>;
|
|
50
|
-
v1_01PrivateDeleteTradingOfferSymbolIdSidePrice(params?: {}): Promise<implicitReturnType>;
|
|
51
|
-
v1_01PrivateDeleteTradingStopOfferSymbolIdSidePrice(params?: {}): Promise<implicitReturnType>;
|
|
52
|
-
v1_01PrivatePutBalancesBITBAYBalanceId(params?: {}): Promise<implicitReturnType>;
|
|
53
|
-
}
|
|
54
|
-
declare abstract class zonda extends _zonda {
|
|
55
|
-
}
|
|
56
|
-
export default zonda;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// ----------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
-
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
-
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
-
|
|
7
|
-
// -------------------------------------------------------------------------------
|
|
8
|
-
import _zonda from '../zonda.js';
|
|
9
|
-
class zonda extends _zonda {
|
|
10
|
-
}
|
|
11
|
-
export default zonda;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { implicitReturnType } from '../base/types.js';
|
|
2
|
-
import _hitbtc from '../hitbtc.js';
|
|
3
|
-
interface hitbtc {
|
|
4
|
-
publicGetPublicCurrency(params?: {}): Promise<implicitReturnType>;
|
|
5
|
-
publicGetPublicCurrencyCurrency(params?: {}): Promise<implicitReturnType>;
|
|
6
|
-
publicGetPublicSymbol(params?: {}): Promise<implicitReturnType>;
|
|
7
|
-
publicGetPublicSymbolSymbol(params?: {}): Promise<implicitReturnType>;
|
|
8
|
-
publicGetPublicTicker(params?: {}): Promise<implicitReturnType>;
|
|
9
|
-
publicGetPublicTickerSymbol(params?: {}): Promise<implicitReturnType>;
|
|
10
|
-
publicGetPublicPriceRate(params?: {}): Promise<implicitReturnType>;
|
|
11
|
-
publicGetPublicPriceHistory(params?: {}): Promise<implicitReturnType>;
|
|
12
|
-
publicGetPublicPriceTicker(params?: {}): Promise<implicitReturnType>;
|
|
13
|
-
publicGetPublicPriceTickerSymbol(params?: {}): Promise<implicitReturnType>;
|
|
14
|
-
publicGetPublicTrades(params?: {}): Promise<implicitReturnType>;
|
|
15
|
-
publicGetPublicTradesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
16
|
-
publicGetPublicOrderbook(params?: {}): Promise<implicitReturnType>;
|
|
17
|
-
publicGetPublicOrderbookSymbol(params?: {}): Promise<implicitReturnType>;
|
|
18
|
-
publicGetPublicCandles(params?: {}): Promise<implicitReturnType>;
|
|
19
|
-
publicGetPublicCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
20
|
-
publicGetPublicConvertedCandles(params?: {}): Promise<implicitReturnType>;
|
|
21
|
-
publicGetPublicConvertedCandlesSymbol(params?: {}): Promise<implicitReturnType>;
|
|
22
|
-
publicGetPublicFuturesInfo(params?: {}): Promise<implicitReturnType>;
|
|
23
|
-
publicGetPublicFuturesInfoSymbol(params?: {}): Promise<implicitReturnType>;
|
|
24
|
-
publicGetPublicFuturesHistoryFunding(params?: {}): Promise<implicitReturnType>;
|
|
25
|
-
publicGetPublicFuturesHistoryFundingSymbol(params?: {}): Promise<implicitReturnType>;
|
|
26
|
-
publicGetPublicFuturesCandlesIndexPrice(params?: {}): Promise<implicitReturnType>;
|
|
27
|
-
publicGetPublicFuturesCandlesIndexPriceSymbol(params?: {}): Promise<implicitReturnType>;
|
|
28
|
-
publicGetPublicFuturesCandlesMarkPrice(params?: {}): Promise<implicitReturnType>;
|
|
29
|
-
publicGetPublicFuturesCandlesMarkPriceSymbol(params?: {}): Promise<implicitReturnType>;
|
|
30
|
-
publicGetPublicFuturesCandlesPremiumIndex(params?: {}): Promise<implicitReturnType>;
|
|
31
|
-
publicGetPublicFuturesCandlesPremiumIndexSymbol(params?: {}): Promise<implicitReturnType>;
|
|
32
|
-
publicGetPublicFuturesCandlesOpenInterest(params?: {}): Promise<implicitReturnType>;
|
|
33
|
-
publicGetPublicFuturesCandlesOpenInterestSymbol(params?: {}): Promise<implicitReturnType>;
|
|
34
|
-
privateGetSpotBalance(params?: {}): Promise<implicitReturnType>;
|
|
35
|
-
privateGetSpotBalanceCurrency(params?: {}): Promise<implicitReturnType>;
|
|
36
|
-
privateGetSpotOrder(params?: {}): Promise<implicitReturnType>;
|
|
37
|
-
privateGetSpotOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
38
|
-
privateGetSpotFee(params?: {}): Promise<implicitReturnType>;
|
|
39
|
-
privateGetSpotFeeSymbol(params?: {}): Promise<implicitReturnType>;
|
|
40
|
-
privateGetSpotHistoryOrder(params?: {}): Promise<implicitReturnType>;
|
|
41
|
-
privateGetSpotHistoryTrade(params?: {}): Promise<implicitReturnType>;
|
|
42
|
-
privateGetMarginAccount(params?: {}): Promise<implicitReturnType>;
|
|
43
|
-
privateGetMarginAccountIsolatedSymbol(params?: {}): Promise<implicitReturnType>;
|
|
44
|
-
privateGetMarginAccountCrossCurrency(params?: {}): Promise<implicitReturnType>;
|
|
45
|
-
privateGetMarginOrder(params?: {}): Promise<implicitReturnType>;
|
|
46
|
-
privateGetMarginOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
47
|
-
privateGetMarginConfig(params?: {}): Promise<implicitReturnType>;
|
|
48
|
-
privateGetMarginHistoryOrder(params?: {}): Promise<implicitReturnType>;
|
|
49
|
-
privateGetMarginHistoryTrade(params?: {}): Promise<implicitReturnType>;
|
|
50
|
-
privateGetMarginHistoryPositions(params?: {}): Promise<implicitReturnType>;
|
|
51
|
-
privateGetMarginHistoryClearing(params?: {}): Promise<implicitReturnType>;
|
|
52
|
-
privateGetFuturesBalance(params?: {}): Promise<implicitReturnType>;
|
|
53
|
-
privateGetFuturesBalanceCurrency(params?: {}): Promise<implicitReturnType>;
|
|
54
|
-
privateGetFuturesAccount(params?: {}): Promise<implicitReturnType>;
|
|
55
|
-
privateGetFuturesAccountIsolatedSymbol(params?: {}): Promise<implicitReturnType>;
|
|
56
|
-
privateGetFuturesOrder(params?: {}): Promise<implicitReturnType>;
|
|
57
|
-
privateGetFuturesOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
58
|
-
privateGetFuturesConfig(params?: {}): Promise<implicitReturnType>;
|
|
59
|
-
privateGetFuturesFee(params?: {}): Promise<implicitReturnType>;
|
|
60
|
-
privateGetFuturesFeeSymbol(params?: {}): Promise<implicitReturnType>;
|
|
61
|
-
privateGetFuturesHistoryOrder(params?: {}): Promise<implicitReturnType>;
|
|
62
|
-
privateGetFuturesHistoryTrade(params?: {}): Promise<implicitReturnType>;
|
|
63
|
-
privateGetFuturesHistoryPositions(params?: {}): Promise<implicitReturnType>;
|
|
64
|
-
privateGetFuturesHistoryClearing(params?: {}): Promise<implicitReturnType>;
|
|
65
|
-
privateGetWalletBalance(params?: {}): Promise<implicitReturnType>;
|
|
66
|
-
privateGetWalletBalanceCurrency(params?: {}): Promise<implicitReturnType>;
|
|
67
|
-
privateGetWalletCryptoAddress(params?: {}): Promise<implicitReturnType>;
|
|
68
|
-
privateGetWalletCryptoAddressRecentDeposit(params?: {}): Promise<implicitReturnType>;
|
|
69
|
-
privateGetWalletCryptoAddressRecentWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
70
|
-
privateGetWalletCryptoAddressCheckMine(params?: {}): Promise<implicitReturnType>;
|
|
71
|
-
privateGetWalletTransactions(params?: {}): Promise<implicitReturnType>;
|
|
72
|
-
privateGetWalletTransactionsTxId(params?: {}): Promise<implicitReturnType>;
|
|
73
|
-
privateGetWalletCryptoFeeEstimate(params?: {}): Promise<implicitReturnType>;
|
|
74
|
-
privateGetWalletAirdrops(params?: {}): Promise<implicitReturnType>;
|
|
75
|
-
privateGetWalletAmountLocks(params?: {}): Promise<implicitReturnType>;
|
|
76
|
-
privateGetSubAccount(params?: {}): Promise<implicitReturnType>;
|
|
77
|
-
privateGetSubAccountAcl(params?: {}): Promise<implicitReturnType>;
|
|
78
|
-
privateGetSubAccountBalanceSubAccID(params?: {}): Promise<implicitReturnType>;
|
|
79
|
-
privateGetSubAccountCryptoAddressSubAccIDCurrency(params?: {}): Promise<implicitReturnType>;
|
|
80
|
-
privatePostSpotOrder(params?: {}): Promise<implicitReturnType>;
|
|
81
|
-
privatePostSpotOrderList(params?: {}): Promise<implicitReturnType>;
|
|
82
|
-
privatePostMarginOrder(params?: {}): Promise<implicitReturnType>;
|
|
83
|
-
privatePostMarginOrderList(params?: {}): Promise<implicitReturnType>;
|
|
84
|
-
privatePostFuturesOrder(params?: {}): Promise<implicitReturnType>;
|
|
85
|
-
privatePostFuturesOrderList(params?: {}): Promise<implicitReturnType>;
|
|
86
|
-
privatePostWalletCryptoAddress(params?: {}): Promise<implicitReturnType>;
|
|
87
|
-
privatePostWalletCryptoWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
88
|
-
privatePostWalletConvert(params?: {}): Promise<implicitReturnType>;
|
|
89
|
-
privatePostWalletTransfer(params?: {}): Promise<implicitReturnType>;
|
|
90
|
-
privatePostWalletInternalWithdraw(params?: {}): Promise<implicitReturnType>;
|
|
91
|
-
privatePostWalletCryptoCheckOffchainAvailable(params?: {}): Promise<implicitReturnType>;
|
|
92
|
-
privatePostWalletCryptoFeesEstimate(params?: {}): Promise<implicitReturnType>;
|
|
93
|
-
privatePostWalletAirdropsIdClaim(params?: {}): Promise<implicitReturnType>;
|
|
94
|
-
privatePostSubAccountFreeze(params?: {}): Promise<implicitReturnType>;
|
|
95
|
-
privatePostSubAccountActivate(params?: {}): Promise<implicitReturnType>;
|
|
96
|
-
privatePostSubAccountTransfer(params?: {}): Promise<implicitReturnType>;
|
|
97
|
-
privatePostSubAccountAcl(params?: {}): Promise<implicitReturnType>;
|
|
98
|
-
privatePatchSpotOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
99
|
-
privatePatchMarginOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
100
|
-
privatePatchFuturesOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
101
|
-
privateDeleteSpotOrder(params?: {}): Promise<implicitReturnType>;
|
|
102
|
-
privateDeleteSpotOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
103
|
-
privateDeleteMarginPosition(params?: {}): Promise<implicitReturnType>;
|
|
104
|
-
privateDeleteMarginPositionIsolatedSymbol(params?: {}): Promise<implicitReturnType>;
|
|
105
|
-
privateDeleteMarginOrder(params?: {}): Promise<implicitReturnType>;
|
|
106
|
-
privateDeleteMarginOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
107
|
-
privateDeleteFuturesPosition(params?: {}): Promise<implicitReturnType>;
|
|
108
|
-
privateDeleteFuturesPositionMarginModeSymbol(params?: {}): Promise<implicitReturnType>;
|
|
109
|
-
privateDeleteFuturesOrder(params?: {}): Promise<implicitReturnType>;
|
|
110
|
-
privateDeleteFuturesOrderClientOrderId(params?: {}): Promise<implicitReturnType>;
|
|
111
|
-
privateDeleteWalletCryptoWithdrawId(params?: {}): Promise<implicitReturnType>;
|
|
112
|
-
privatePutMarginAccountIsolatedSymbol(params?: {}): Promise<implicitReturnType>;
|
|
113
|
-
privatePutFuturesAccountIsolatedSymbol(params?: {}): Promise<implicitReturnType>;
|
|
114
|
-
privatePutWalletCryptoWithdrawId(params?: {}): Promise<implicitReturnType>;
|
|
115
|
-
}
|
|
116
|
-
declare abstract class hitbtc extends _hitbtc {
|
|
117
|
-
}
|
|
118
|
-
export default hitbtc;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// ----------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
-
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
-
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
-
|
|
7
|
-
// -------------------------------------------------------------------------------
|
|
8
|
-
import _hitbtc from '../hitbtc.js';
|
|
9
|
-
class hitbtc extends _hitbtc {
|
|
10
|
-
}
|
|
11
|
-
export default hitbtc;
|