ccxt 4.5.1 → 4.5.3
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 +110 -112
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -9
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/base/Exchange.js +11 -0
- package/dist/cjs/src/binance.js +25 -25
- package/dist/cjs/src/bitget.js +2 -2
- package/dist/cjs/src/coincatch.js +2 -2
- package/dist/cjs/src/gate.js +27 -12
- package/dist/cjs/src/gemini.js +3 -3
- package/dist/cjs/src/htx.js +4 -4
- package/dist/cjs/src/indodax.js +11 -12
- package/dist/cjs/src/kucoinfutures.js +8 -8
- package/dist/cjs/src/mexc.js +30 -1
- package/dist/cjs/src/okx.js +19 -5
- package/dist/cjs/src/poloniex.js +1 -1
- package/dist/cjs/src/pro/binance.js +3 -3
- package/dist/cjs/src/pro/bitfinex.js +140 -0
- package/dist/cjs/src/pro/bitget.js +222 -42
- package/dist/cjs/src/pro/bitmart.js +1 -1
- package/dist/cjs/src/pro/bybit.js +3 -3
- package/dist/cjs/src/pro/gemini.js +7 -2
- package/dist/cjs/src/pro/hyperliquid.js +5 -0
- package/dist/cjs/src/pro/kraken.js +4 -6
- package/dist/cjs/src/pro/kucoin.js +64 -0
- package/dist/cjs/src/pro/mexc.js +7 -3
- package/dist/cjs/src/zonda.js +12 -0
- package/js/ccxt.d.ts +2 -11
- package/js/ccxt.js +2 -8
- package/js/src/ascendex.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +11 -0
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +25 -25
- package/js/src/bitget.js +2 -2
- package/js/src/coincatch.js +2 -2
- package/js/src/gate.js +27 -12
- package/js/src/gemini.js +3 -3
- package/js/src/htx.js +4 -4
- package/js/src/indodax.js +11 -12
- package/js/src/kucoinfutures.js +8 -8
- package/js/src/mexc.d.ts +3 -0
- package/js/src/mexc.js +30 -1
- package/js/src/okx.d.ts +4 -2
- package/js/src/okx.js +19 -5
- package/js/src/poloniex.js +1 -1
- package/js/src/pro/binance.js +3 -3
- package/js/src/pro/bitfinex.d.ts +30 -0
- package/js/src/pro/bitfinex.js +140 -0
- package/js/src/pro/bitget.d.ts +10 -0
- package/js/src/pro/bitget.js +228 -42
- package/js/src/pro/bitmart.js +1 -1
- package/js/src/pro/bybit.d.ts +2 -2
- package/js/src/pro/bybit.js +3 -3
- package/js/src/pro/gemini.d.ts +1 -1
- package/js/src/pro/gemini.js +7 -2
- package/js/src/pro/hyperliquid.js +5 -0
- package/js/src/pro/kraken.js +4 -6
- package/js/src/pro/kucoin.d.ts +22 -0
- package/js/src/pro/kucoin.js +64 -0
- package/js/src/pro/mexc.js +7 -3
- package/js/src/zonda.js +12 -0
- package/package.json +2 -1
- package/js/src/abstract/ellipx.d.ts +0 -28
- package/js/src/abstract/ellipx.js +0 -11
- package/js/src/abstract/vertex.d.ts +0 -22
- package/js/src/abstract/vertex.js +0 -11
- package/js/src/ellipx.d.ts +0 -237
- package/js/src/ellipx.js +0 -2071
- package/js/src/pro/vertex.d.ts +0 -104
- package/js/src/pro/vertex.js +0 -999
- package/js/src/vertex.d.ts +0 -346
- package/js/src/vertex.js +0 -3146
|
@@ -63,6 +63,7 @@ class bitget extends bitget$1["default"] {
|
|
|
63
63
|
// WS timeframes differ from REST timeframes
|
|
64
64
|
'timeframes': {
|
|
65
65
|
'1m': '1m',
|
|
66
|
+
'3m': '3m',
|
|
66
67
|
'5m': '5m',
|
|
67
68
|
'15m': '15m',
|
|
68
69
|
'30m': '30m',
|
|
@@ -485,11 +486,13 @@ class bitget extends bitget$1["default"] {
|
|
|
485
486
|
* @description watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
|
486
487
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
|
487
488
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
|
489
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel
|
|
488
490
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
489
491
|
* @param {string} timeframe the length of time each candle represents
|
|
490
492
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
491
493
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
492
494
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
495
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
493
496
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
494
497
|
*/
|
|
495
498
|
async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
@@ -498,14 +501,26 @@ class bitget extends bitget$1["default"] {
|
|
|
498
501
|
symbol = market['symbol'];
|
|
499
502
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
500
503
|
const interval = this.safeString(timeframes, timeframe);
|
|
501
|
-
|
|
504
|
+
let messageHash = undefined;
|
|
502
505
|
let instType = undefined;
|
|
503
|
-
|
|
506
|
+
let uta = undefined;
|
|
507
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchOHLCV', 'uta', false);
|
|
508
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
504
509
|
const args = {
|
|
505
510
|
'instType': instType,
|
|
506
|
-
'channel': 'candle' + interval,
|
|
507
|
-
'instId': market['id'],
|
|
508
511
|
};
|
|
512
|
+
if (uta) {
|
|
513
|
+
args['topic'] = 'kline';
|
|
514
|
+
args['symbol'] = market['id'];
|
|
515
|
+
args['interval'] = interval;
|
|
516
|
+
params['uta'] = true;
|
|
517
|
+
messageHash = 'kline:' + symbol;
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
args['channel'] = 'candle' + interval;
|
|
521
|
+
args['instId'] = market['id'];
|
|
522
|
+
messageHash = 'candles:' + timeframe + ':' + symbol;
|
|
523
|
+
}
|
|
509
524
|
const ohlcv = await this.watchPublic(messageHash, args, params);
|
|
510
525
|
if (this.newUpdates) {
|
|
511
526
|
limit = ohlcv.getLimit(symbol, limit);
|
|
@@ -518,17 +533,40 @@ class bitget extends bitget$1["default"] {
|
|
|
518
533
|
* @description unsubscribe from the ohlcv channel
|
|
519
534
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
|
520
535
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
|
536
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel
|
|
521
537
|
* @param {string} symbol unified symbol of the market to unwatch the ohlcv for
|
|
522
538
|
* @param {string} [timeframe] the period for the ratio, default is 1 minute
|
|
523
539
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
540
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
524
541
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
525
542
|
*/
|
|
526
543
|
async unWatchOHLCV(symbol, timeframe = '1m', params = {}) {
|
|
527
544
|
await this.loadMarkets();
|
|
528
545
|
const timeframes = this.safeDict(this.options, 'timeframes');
|
|
529
546
|
const interval = this.safeString(timeframes, timeframe);
|
|
530
|
-
|
|
531
|
-
|
|
547
|
+
let channel = undefined;
|
|
548
|
+
let market = undefined;
|
|
549
|
+
if (symbol !== undefined) {
|
|
550
|
+
market = this.market(symbol);
|
|
551
|
+
}
|
|
552
|
+
let instType = undefined;
|
|
553
|
+
let messageHash = undefined;
|
|
554
|
+
let uta = undefined;
|
|
555
|
+
[uta, params] = this.handleOptionAndParams(params, 'unWatchOHLCV', 'uta', false);
|
|
556
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
557
|
+
if (uta) {
|
|
558
|
+
channel = 'kline';
|
|
559
|
+
market['id'];
|
|
560
|
+
params['uta'] = true;
|
|
561
|
+
params['interval'] = interval;
|
|
562
|
+
messageHash = channel + symbol;
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
channel = 'candle' + interval;
|
|
566
|
+
market['id'];
|
|
567
|
+
messageHash = 'candles:' + interval;
|
|
568
|
+
}
|
|
569
|
+
return await this.unWatchChannel(symbol, channel, messageHash, params);
|
|
532
570
|
}
|
|
533
571
|
handleOHLCV(client, message) {
|
|
534
572
|
//
|
|
@@ -564,15 +602,47 @@ class bitget extends bitget$1["default"] {
|
|
|
564
602
|
// "ts": 1701901610417
|
|
565
603
|
// }
|
|
566
604
|
//
|
|
605
|
+
// uta
|
|
606
|
+
//
|
|
607
|
+
// {
|
|
608
|
+
// "action": "snapshot",
|
|
609
|
+
// "arg": {
|
|
610
|
+
// "instType": "usdt-futures",
|
|
611
|
+
// "topic": "kline",
|
|
612
|
+
// "symbol": "BTCUSDT",
|
|
613
|
+
// "interval": "1m"
|
|
614
|
+
// },
|
|
615
|
+
// "data": [
|
|
616
|
+
// {
|
|
617
|
+
// "start": "1755564480000",
|
|
618
|
+
// "open": "116286",
|
|
619
|
+
// "close": "116256.2",
|
|
620
|
+
// "high": "116310.2",
|
|
621
|
+
// "low": "116232.8",
|
|
622
|
+
// "volume": "39.7062",
|
|
623
|
+
// "turnover": "4616746.46654"
|
|
624
|
+
// },
|
|
625
|
+
// ],
|
|
626
|
+
// "ts": 1755594421877
|
|
627
|
+
// }
|
|
628
|
+
//
|
|
567
629
|
const arg = this.safeValue(message, 'arg', {});
|
|
568
|
-
const instType = this.
|
|
569
|
-
const marketType = (instType === '
|
|
570
|
-
const marketId = this.
|
|
630
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
631
|
+
const marketType = (instType === 'spot') ? 'spot' : 'contract';
|
|
632
|
+
const marketId = this.safeString2(arg, 'instId', 'symbol');
|
|
571
633
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
572
634
|
const symbol = market['symbol'];
|
|
573
635
|
this.ohlcvs[symbol] = this.safeValue(this.ohlcvs, symbol, {});
|
|
574
|
-
const channel = this.
|
|
575
|
-
|
|
636
|
+
const channel = this.safeString2(arg, 'channel', 'topic');
|
|
637
|
+
let interval = this.safeString(arg, 'interval');
|
|
638
|
+
let isUta = undefined;
|
|
639
|
+
if (interval === undefined) {
|
|
640
|
+
isUta = false;
|
|
641
|
+
interval = channel.replace('candle', '');
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
isUta = true;
|
|
645
|
+
}
|
|
576
646
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
577
647
|
const timeframe = this.findTimeframe(interval, timeframes);
|
|
578
648
|
let stored = this.safeValue(this.ohlcvs[symbol], timeframe);
|
|
@@ -586,7 +656,13 @@ class bitget extends bitget$1["default"] {
|
|
|
586
656
|
const parsed = this.parseWsOHLCV(data[i], market);
|
|
587
657
|
stored.append(parsed);
|
|
588
658
|
}
|
|
589
|
-
|
|
659
|
+
let messageHash = undefined;
|
|
660
|
+
if (isUta) {
|
|
661
|
+
messageHash = 'kline:' + symbol;
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
messageHash = 'candles:' + timeframe + ':' + symbol;
|
|
665
|
+
}
|
|
590
666
|
client.resolve(stored, messageHash);
|
|
591
667
|
}
|
|
592
668
|
parseWsOHLCV(ohlcv, market = undefined) {
|
|
@@ -602,14 +678,26 @@ class bitget extends bitget$1["default"] {
|
|
|
602
678
|
// "437404.105512" // USDT volume
|
|
603
679
|
// ]
|
|
604
680
|
//
|
|
681
|
+
// uta
|
|
682
|
+
//
|
|
683
|
+
// {
|
|
684
|
+
// "start": "1755564480000",
|
|
685
|
+
// "open": "116286",
|
|
686
|
+
// "close": "116256.2",
|
|
687
|
+
// "high": "116310.2",
|
|
688
|
+
// "low": "116232.8",
|
|
689
|
+
// "volume": "39.7062",
|
|
690
|
+
// "turnover": "4616746.46654"
|
|
691
|
+
// }
|
|
692
|
+
//
|
|
605
693
|
const volumeIndex = (market['inverse']) ? 6 : 5;
|
|
606
694
|
return [
|
|
607
|
-
this.
|
|
608
|
-
this.
|
|
609
|
-
this.
|
|
610
|
-
this.
|
|
611
|
-
this.
|
|
612
|
-
this.
|
|
695
|
+
this.safeInteger2(ohlcv, 'start', 0),
|
|
696
|
+
this.safeNumber2(ohlcv, 'open', 1),
|
|
697
|
+
this.safeNumber2(ohlcv, 'high', 2),
|
|
698
|
+
this.safeNumber2(ohlcv, 'low', 3),
|
|
699
|
+
this.safeNumber2(ohlcv, 'close', 4),
|
|
700
|
+
this.safeNumber2(ohlcv, 'volume', volumeIndex),
|
|
613
701
|
];
|
|
614
702
|
}
|
|
615
703
|
/**
|
|
@@ -652,12 +740,23 @@ class bitget extends bitget$1["default"] {
|
|
|
652
740
|
const market = this.market(symbol);
|
|
653
741
|
const messageHash = 'unsubscribe:' + messageHashTopic + ':' + market['symbol'];
|
|
654
742
|
let instType = undefined;
|
|
655
|
-
|
|
743
|
+
let uta = undefined;
|
|
744
|
+
[uta, params] = this.handleOptionAndParams(params, 'unWatchChannel', 'uta', false);
|
|
745
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
656
746
|
const args = {
|
|
657
747
|
'instType': instType,
|
|
658
|
-
'channel': channel,
|
|
659
|
-
'instId': market['id'],
|
|
660
748
|
};
|
|
749
|
+
if (uta) {
|
|
750
|
+
args['topic'] = channel;
|
|
751
|
+
args['symbol'] = market['id'];
|
|
752
|
+
args['interval'] = this.safeString(params, 'interval', '1m');
|
|
753
|
+
params['uta'] = true;
|
|
754
|
+
params = this.omit(params, 'interval');
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
args['channel'] = channel;
|
|
758
|
+
args['instId'] = market['id'];
|
|
759
|
+
}
|
|
661
760
|
return await this.unWatchPublic(messageHash, args, params);
|
|
662
761
|
}
|
|
663
762
|
/**
|
|
@@ -823,10 +922,12 @@ class bitget extends bitget$1["default"] {
|
|
|
823
922
|
* @description get the list of most recent trades for a particular symbol
|
|
824
923
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel
|
|
825
924
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel
|
|
925
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel
|
|
826
926
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
827
927
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
828
928
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
829
929
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
930
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
830
931
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
831
932
|
*/
|
|
832
933
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
@@ -838,10 +939,12 @@ class bitget extends bitget$1["default"] {
|
|
|
838
939
|
* @description get the list of most recent trades for a particular symbol
|
|
839
940
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel
|
|
840
941
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel
|
|
942
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel
|
|
841
943
|
* @param {string[]} symbols unified symbol of the market to fetch trades for
|
|
842
944
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
843
945
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
844
946
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
947
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
845
948
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
846
949
|
*/
|
|
847
950
|
async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
|
|
@@ -851,21 +954,28 @@ class bitget extends bitget$1["default"] {
|
|
|
851
954
|
}
|
|
852
955
|
await this.loadMarkets();
|
|
853
956
|
symbols = this.marketSymbols(symbols);
|
|
957
|
+
let uta = undefined;
|
|
958
|
+
[uta, params] = this.handleOptionAndParams(params, 'watchTradesForSymbols', 'uta', false);
|
|
854
959
|
const topics = [];
|
|
855
960
|
const messageHashes = [];
|
|
856
961
|
for (let i = 0; i < symbols.length; i++) {
|
|
857
962
|
const symbol = symbols[i];
|
|
858
963
|
const market = this.market(symbol);
|
|
859
964
|
let instType = undefined;
|
|
860
|
-
[instType, params] = this.getInstType(market,
|
|
965
|
+
[instType, params] = this.getInstType(market, uta, params);
|
|
861
966
|
const args = {
|
|
862
967
|
'instType': instType,
|
|
863
|
-
'channel': 'trade',
|
|
864
|
-
'instId': market['id'],
|
|
865
968
|
};
|
|
969
|
+
const topicOrChannel = uta ? 'topic' : 'channel';
|
|
970
|
+
const symbolOrInstId = uta ? 'symbol' : 'instId';
|
|
971
|
+
args[topicOrChannel] = uta ? 'publicTrade' : 'trade';
|
|
972
|
+
args[symbolOrInstId] = market['id'];
|
|
866
973
|
topics.push(args);
|
|
867
974
|
messageHashes.push('trade:' + symbol);
|
|
868
975
|
}
|
|
976
|
+
if (uta) {
|
|
977
|
+
params['uta'] = true;
|
|
978
|
+
}
|
|
869
979
|
const trades = await this.watchPublicMultiple(messageHashes, topics, params);
|
|
870
980
|
if (this.newUpdates) {
|
|
871
981
|
const first = this.safeValue(trades, 0);
|
|
@@ -886,13 +996,17 @@ class bitget extends bitget$1["default"] {
|
|
|
886
996
|
* @description unsubscribe from the trades channel
|
|
887
997
|
* @see https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel
|
|
888
998
|
* @see https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel
|
|
999
|
+
* @see https://www.bitget.com/api-doc/uta/websocket/public/New-Trades-Channel
|
|
889
1000
|
* @param {string} symbol unified symbol of the market to unwatch the trades for
|
|
890
1001
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1002
|
+
* @param {boolean} [params.uta] set to true for the unified trading account (uta), defaults to false
|
|
891
1003
|
* @returns {any} status of the unwatch request
|
|
892
1004
|
*/
|
|
893
1005
|
async unWatchTrades(symbol, params = {}) {
|
|
894
|
-
|
|
895
|
-
|
|
1006
|
+
let uta = undefined;
|
|
1007
|
+
[uta, params] = this.handleOptionAndParams(params, 'unWatchTrades', 'uta', false);
|
|
1008
|
+
const channelTopic = uta ? 'publicTrade' : 'trade';
|
|
1009
|
+
return await this.unWatchChannel(symbol, channelTopic, 'trade', params);
|
|
896
1010
|
}
|
|
897
1011
|
handleTrades(client, message) {
|
|
898
1012
|
//
|
|
@@ -911,10 +1025,28 @@ class bitget extends bitget$1["default"] {
|
|
|
911
1025
|
// "ts": 1701910980730
|
|
912
1026
|
// }
|
|
913
1027
|
//
|
|
1028
|
+
// uta
|
|
1029
|
+
//
|
|
1030
|
+
// {
|
|
1031
|
+
// "action": "snapshot",
|
|
1032
|
+
// "arg": { "instType": "spot", "topic": "publicTrade", "symbol": "BTCUSDT" },
|
|
1033
|
+
// "data": [
|
|
1034
|
+
// {
|
|
1035
|
+
// "T": "1756287827920",
|
|
1036
|
+
// "P": "110878.5",
|
|
1037
|
+
// "v": "0.07",
|
|
1038
|
+
// "S": "buy",
|
|
1039
|
+
// "L": "1344534089797185550"
|
|
1040
|
+
// "i": "1344534089797185549"
|
|
1041
|
+
// },
|
|
1042
|
+
// ],
|
|
1043
|
+
// "ts": 1701910980730
|
|
1044
|
+
// }
|
|
1045
|
+
//
|
|
914
1046
|
const arg = this.safeValue(message, 'arg', {});
|
|
915
|
-
const instType = this.
|
|
916
|
-
const marketType = (instType === '
|
|
917
|
-
const marketId = this.
|
|
1047
|
+
const instType = this.safeStringLower(arg, 'instType');
|
|
1048
|
+
const marketType = (instType === 'spot') ? 'spot' : 'contract';
|
|
1049
|
+
const marketId = this.safeString2(arg, 'instId', 'symbol');
|
|
918
1050
|
const market = this.safeMarket(marketId, undefined, undefined, marketType);
|
|
919
1051
|
const symbol = market['symbol'];
|
|
920
1052
|
let stored = this.safeValue(this.trades, symbol);
|
|
@@ -993,13 +1125,24 @@ class bitget extends bitget$1["default"] {
|
|
|
993
1125
|
// "uTime": "1714471204194"
|
|
994
1126
|
// }
|
|
995
1127
|
//
|
|
1128
|
+
// uta
|
|
1129
|
+
//
|
|
1130
|
+
// {
|
|
1131
|
+
// "i": "1344534089797185549", // Fill execution ID
|
|
1132
|
+
// "L": "1344534089797185550", // Execution correlation ID
|
|
1133
|
+
// "p": "110878.5", // Fill price
|
|
1134
|
+
// "v": "0.07", // Fill size
|
|
1135
|
+
// "S": "buy", // Fill side
|
|
1136
|
+
// "T": "1756287827920" // Fill timestamp
|
|
1137
|
+
// }
|
|
1138
|
+
//
|
|
996
1139
|
const instId = this.safeString2(trade, 'symbol', 'instId');
|
|
997
1140
|
const posMode = this.safeString(trade, 'posMode');
|
|
998
1141
|
const defaultType = (posMode !== undefined) ? 'contract' : 'spot';
|
|
999
1142
|
if (market === undefined) {
|
|
1000
1143
|
market = this.safeMarket(instId, undefined, undefined, defaultType);
|
|
1001
1144
|
}
|
|
1002
|
-
const timestamp = this.safeIntegerN(trade, ['uTime', 'cTime', 'ts']);
|
|
1145
|
+
const timestamp = this.safeIntegerN(trade, ['uTime', 'cTime', 'ts', 'T']);
|
|
1003
1146
|
const feeDetail = this.safeList(trade, 'feeDetail', []);
|
|
1004
1147
|
const first = this.safeDict(feeDetail, 0);
|
|
1005
1148
|
let fee = undefined;
|
|
@@ -1013,16 +1156,16 @@ class bitget extends bitget$1["default"] {
|
|
|
1013
1156
|
}
|
|
1014
1157
|
return this.safeTrade({
|
|
1015
1158
|
'info': trade,
|
|
1016
|
-
'id': this.
|
|
1017
|
-
'order': this.
|
|
1159
|
+
'id': this.safeString2(trade, 'tradeId', 'i'),
|
|
1160
|
+
'order': this.safeString2(trade, 'orderId', 'L'),
|
|
1018
1161
|
'timestamp': timestamp,
|
|
1019
1162
|
'datetime': this.iso8601(timestamp),
|
|
1020
1163
|
'symbol': market['symbol'],
|
|
1021
1164
|
'type': this.safeString(trade, 'orderType'),
|
|
1022
|
-
'side': this.
|
|
1165
|
+
'side': this.safeString2(trade, 'side', 'S'),
|
|
1023
1166
|
'takerOrMaker': this.safeString(trade, 'tradeScope'),
|
|
1024
|
-
'price': this.
|
|
1025
|
-
'amount': this.
|
|
1167
|
+
'price': this.safeStringN(trade, ['priceAvg', 'price', 'P']),
|
|
1168
|
+
'amount': this.safeStringN(trade, ['size', 'baseVolume', 'v']),
|
|
1026
1169
|
'cost': this.safeString2(trade, 'amount', 'quoteVolume'),
|
|
1027
1170
|
'fee': fee,
|
|
1028
1171
|
}, market);
|
|
@@ -2114,6 +2257,18 @@ class bitget extends bitget$1["default"] {
|
|
|
2114
2257
|
// "ts": 1753230479687
|
|
2115
2258
|
// }
|
|
2116
2259
|
//
|
|
2260
|
+
// unsubscribe
|
|
2261
|
+
//
|
|
2262
|
+
// {
|
|
2263
|
+
// "event": "unsubscribe",
|
|
2264
|
+
// "arg": {
|
|
2265
|
+
// "instType": "spot",
|
|
2266
|
+
// "topic": "kline",
|
|
2267
|
+
// "symbol": "BTCUSDT",
|
|
2268
|
+
// "interval": "1m"
|
|
2269
|
+
// }
|
|
2270
|
+
// }
|
|
2271
|
+
//
|
|
2117
2272
|
if (this.handleErrorMessage(client, message)) {
|
|
2118
2273
|
return;
|
|
2119
2274
|
}
|
|
@@ -2142,6 +2297,7 @@ class bitget extends bitget$1["default"] {
|
|
|
2142
2297
|
const methods = {
|
|
2143
2298
|
'ticker': this.handleTicker,
|
|
2144
2299
|
'trade': this.handleTrades,
|
|
2300
|
+
'publicTrade': this.handleTrades,
|
|
2145
2301
|
'fill': this.handleMyTrades,
|
|
2146
2302
|
'orders': this.handleOrder,
|
|
2147
2303
|
'ordersAlgo': this.handleOrder,
|
|
@@ -2152,6 +2308,7 @@ class bitget extends bitget$1["default"] {
|
|
|
2152
2308
|
'positions': this.handlePositions,
|
|
2153
2309
|
'account-isolated': this.handleBalance,
|
|
2154
2310
|
'account-crossed': this.handleBalance,
|
|
2311
|
+
'kline': this.handleOHLCV,
|
|
2155
2312
|
};
|
|
2156
2313
|
const arg = this.safeValue(message, 'arg', {});
|
|
2157
2314
|
const topic = this.safeValue2(arg, 'channel', 'topic', '');
|
|
@@ -2214,7 +2371,7 @@ class bitget extends bitget$1["default"] {
|
|
|
2214
2371
|
const arg = this.safeDict(message, 'arg', {});
|
|
2215
2372
|
const instType = this.safeStringLower(arg, 'instType');
|
|
2216
2373
|
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
2217
|
-
const instId = this.
|
|
2374
|
+
const instId = this.safeString2(arg, 'instId', 'symbol');
|
|
2218
2375
|
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
2219
2376
|
const symbol = market['symbol'];
|
|
2220
2377
|
const messageHash = 'unsubscribe:trade:' + market['symbol'];
|
|
@@ -2261,18 +2418,38 @@ class bitget extends bitget$1["default"] {
|
|
|
2261
2418
|
//
|
|
2262
2419
|
// {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"candle1m","instId":"BTCUSDT"}}
|
|
2263
2420
|
//
|
|
2421
|
+
// UTA
|
|
2422
|
+
//
|
|
2423
|
+
// {"event":"unsubscribe","arg":{"instType":"spot","topic":"kline","symbol":"BTCUSDT","interval":"1m"}}
|
|
2424
|
+
//
|
|
2264
2425
|
const arg = this.safeDict(message, 'arg', {});
|
|
2265
2426
|
const instType = this.safeStringLower(arg, 'instType');
|
|
2266
2427
|
const type = (instType === 'spot') ? 'spot' : 'contract';
|
|
2267
|
-
const instId = this.
|
|
2268
|
-
const channel = this.
|
|
2269
|
-
|
|
2428
|
+
const instId = this.safeString2(arg, 'instId', 'symbol');
|
|
2429
|
+
const channel = this.safeString2(arg, 'channel', 'topic');
|
|
2430
|
+
let interval = this.safeString(arg, 'interval');
|
|
2431
|
+
let isUta = undefined;
|
|
2432
|
+
if (interval === undefined) {
|
|
2433
|
+
isUta = false;
|
|
2434
|
+
interval = channel.replace('candle', '');
|
|
2435
|
+
}
|
|
2436
|
+
else {
|
|
2437
|
+
isUta = true;
|
|
2438
|
+
}
|
|
2270
2439
|
const timeframes = this.safeValue(this.options, 'timeframes');
|
|
2271
2440
|
const timeframe = this.findTimeframe(interval, timeframes);
|
|
2272
2441
|
const market = this.safeMarket(instId, undefined, undefined, type);
|
|
2273
2442
|
const symbol = market['symbol'];
|
|
2274
|
-
|
|
2275
|
-
|
|
2443
|
+
let messageHash = undefined;
|
|
2444
|
+
let subMessageHash = undefined;
|
|
2445
|
+
if (isUta) {
|
|
2446
|
+
messageHash = 'unsubscribe:kline:' + symbol;
|
|
2447
|
+
subMessageHash = 'kline:' + symbol;
|
|
2448
|
+
}
|
|
2449
|
+
else {
|
|
2450
|
+
messageHash = 'unsubscribe:candles:' + timeframe + ':' + symbol;
|
|
2451
|
+
subMessageHash = 'candles:' + timeframe + ':' + symbol;
|
|
2452
|
+
}
|
|
2276
2453
|
if (symbol in this.ohlcvs) {
|
|
2277
2454
|
if (timeframe in this.ohlcvs[symbol]) {
|
|
2278
2455
|
delete this.ohlcvs[symbol][timeframe];
|
|
@@ -2311,7 +2488,7 @@ class bitget extends bitget$1["default"] {
|
|
|
2311
2488
|
// for now only unWatchOrderBook is supporteod
|
|
2312
2489
|
this.handleOrderBookUnSubscription(client, message);
|
|
2313
2490
|
}
|
|
2314
|
-
else if (channel === 'trade') {
|
|
2491
|
+
else if ((channel === 'trade') || (channel === 'publicTrade')) {
|
|
2315
2492
|
this.handleTradesUnSubscription(client, message);
|
|
2316
2493
|
}
|
|
2317
2494
|
else if (channel === 'ticker') {
|
|
@@ -2320,6 +2497,9 @@ class bitget extends bitget$1["default"] {
|
|
|
2320
2497
|
else if (channel.startsWith('candle')) {
|
|
2321
2498
|
this.handleOHLCVUnSubscription(client, message);
|
|
2322
2499
|
}
|
|
2500
|
+
else if (channel.startsWith('kline')) {
|
|
2501
|
+
this.handleOHLCVUnSubscription(client, message);
|
|
2502
|
+
}
|
|
2323
2503
|
}
|
|
2324
2504
|
return message;
|
|
2325
2505
|
}
|
|
@@ -445,13 +445,13 @@ class bybit extends bybit$1["default"] {
|
|
|
445
445
|
* @description unWatches a price ticker
|
|
446
446
|
* @see https://bybit-exchange.github.io/docs/v5/websocket/public/ticker
|
|
447
447
|
* @see https://bybit-exchange.github.io/docs/v5/websocket/public/etp-ticker
|
|
448
|
-
* @param {string[]}
|
|
448
|
+
* @param {string[]} symbol unified symbol of the market to fetch the ticker for
|
|
449
449
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
450
450
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
451
451
|
*/
|
|
452
|
-
async unWatchTicker(
|
|
452
|
+
async unWatchTicker(symbol, params = {}) {
|
|
453
453
|
await this.loadMarkets();
|
|
454
|
-
return await this.unWatchTickers([
|
|
454
|
+
return await this.unWatchTickers([symbol], params);
|
|
455
455
|
}
|
|
456
456
|
handleTicker(client, message) {
|
|
457
457
|
//
|
|
@@ -490,11 +490,16 @@ class gemini extends gemini$1["default"] {
|
|
|
490
490
|
currentBidAsk['timestamp'] = timestamp;
|
|
491
491
|
currentBidAsk['datetime'] = this.iso8601(timestamp);
|
|
492
492
|
currentBidAsk['info'] = rawBidAskChanges;
|
|
493
|
+
const bidsAsksDict = {};
|
|
494
|
+
bidsAsksDict[symbol] = currentBidAsk;
|
|
493
495
|
this.bidsasks[symbol] = currentBidAsk;
|
|
494
|
-
client.resolve(
|
|
496
|
+
client.resolve(bidsAsksDict, messageHash);
|
|
495
497
|
}
|
|
496
|
-
async helperForWatchMultipleConstruct(itemHashName, symbols, params = {}) {
|
|
498
|
+
async helperForWatchMultipleConstruct(itemHashName, symbols = undefined, params = {}) {
|
|
497
499
|
await this.loadMarkets();
|
|
500
|
+
if (symbols === undefined) {
|
|
501
|
+
throw new errors.NotSupported(this.id + ' watchMultiple requires at least one symbol');
|
|
502
|
+
}
|
|
498
503
|
symbols = this.marketSymbols(symbols, undefined, false, true, true);
|
|
499
504
|
const firstMarket = this.market(symbols[0]);
|
|
500
505
|
if (!firstMarket['spot'] && !firstMarket['linear']) {
|
|
@@ -98,6 +98,11 @@ class hyperliquid extends hyperliquid$1["default"] {
|
|
|
98
98
|
await this.loadMarkets();
|
|
99
99
|
const [order, globalParams] = this.parseCreateEditOrderArgs(undefined, symbol, type, side, amount, price, params);
|
|
100
100
|
const orders = await this.createOrdersWs([order], globalParams);
|
|
101
|
+
const ordersLength = orders.length;
|
|
102
|
+
if (ordersLength === 0) {
|
|
103
|
+
// not sure why but it is happening sometimes
|
|
104
|
+
return this.safeOrder({});
|
|
105
|
+
}
|
|
101
106
|
const parsedOrder = orders[0];
|
|
102
107
|
return parsedOrder;
|
|
103
108
|
}
|
|
@@ -1709,7 +1709,7 @@ class kraken extends kraken$1["default"] {
|
|
|
1709
1709
|
//
|
|
1710
1710
|
const errorMessage = this.safeString2(message, 'errorMessage', 'error');
|
|
1711
1711
|
if (errorMessage !== undefined) {
|
|
1712
|
-
|
|
1712
|
+
const requestId = this.safeString2(message, 'reqid', 'req_id');
|
|
1713
1713
|
const broad = this.exceptions['ws']['broad'];
|
|
1714
1714
|
const broadKey = this.findBroadlyMatchedKey(broad, errorMessage);
|
|
1715
1715
|
let exception = undefined;
|
|
@@ -1719,11 +1719,9 @@ class kraken extends kraken$1["default"] {
|
|
|
1719
1719
|
else {
|
|
1720
1720
|
exception = new broad[broadKey](errorMessage);
|
|
1721
1721
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
client.reject(exception);
|
|
1726
|
-
// }
|
|
1722
|
+
if (requestId !== undefined) {
|
|
1723
|
+
client.reject(exception, requestId);
|
|
1724
|
+
}
|
|
1727
1725
|
return false;
|
|
1728
1726
|
}
|
|
1729
1727
|
return true;
|