bitget 0.0.83__py3-none-any.whl → 0.0.84__py3-none-any.whl
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.
- bitget/ccxt/__init__.py +1 -1
- bitget/ccxt/async_support/__init__.py +1 -1
- bitget/ccxt/async_support/base/exchange.py +1 -1
- bitget/ccxt/async_support/bitget.py +1 -1
- bitget/ccxt/base/exchange.py +1 -1
- bitget/ccxt/bitget.py +1 -1
- bitget/ccxt/pro/__init__.py +1 -1
- bitget/ccxt/pro/bitget.py +151 -26
- {bitget-0.0.83.dist-info → bitget-0.0.84.dist-info}/METADATA +1 -1
- {bitget-0.0.83.dist-info → bitget-0.0.84.dist-info}/RECORD +11 -11
- {bitget-0.0.83.dist-info → bitget-0.0.84.dist-info}/WHEEL +0 -0
bitget/ccxt/__init__.py
CHANGED
@@ -1917,7 +1917,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1917
1917
|
res = self.safe_dict(results, i)
|
1918
1918
|
data = self.safe_list(res, 'data', [])
|
1919
1919
|
firstData = self.safe_dict(data, 0, {})
|
1920
|
-
isBorrowable = self.
|
1920
|
+
isBorrowable = self.safe_bool(firstData, 'isBorrowable')
|
1921
1921
|
if fetchMargins and isBorrowable is not None:
|
1922
1922
|
keysList = list(self.index_by(data, 'symbol').keys())
|
1923
1923
|
self.options['crossMarginPairsData'] = keysList
|
bitget/ccxt/base/exchange.py
CHANGED
bitget/ccxt/bitget.py
CHANGED
@@ -1916,7 +1916,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1916
1916
|
res = self.safe_dict(results, i)
|
1917
1917
|
data = self.safe_list(res, 'data', [])
|
1918
1918
|
firstData = self.safe_dict(data, 0, {})
|
1919
|
-
isBorrowable = self.
|
1919
|
+
isBorrowable = self.safe_bool(firstData, 'isBorrowable')
|
1920
1920
|
if fetchMargins and isBorrowable is not None:
|
1921
1921
|
keysList = list(self.index_by(data, 'symbol').keys())
|
1922
1922
|
self.options['crossMarginPairsData'] = keysList
|
bitget/ccxt/pro/__init__.py
CHANGED
bitget/ccxt/pro/bitget.py
CHANGED
@@ -71,6 +71,7 @@ class bitget(bitgetAsync):
|
|
71
71
|
# WS timeframes differ from REST timeframes
|
72
72
|
'timeframes': {
|
73
73
|
'1m': '1m',
|
74
|
+
'3m': '3m',
|
74
75
|
'5m': '5m',
|
75
76
|
'15m': '15m',
|
76
77
|
'30m': '30m',
|
@@ -484,12 +485,14 @@ class bitget(bitgetAsync):
|
|
484
485
|
|
485
486
|
https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
486
487
|
https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
488
|
+
https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel
|
487
489
|
|
488
490
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
489
491
|
:param str 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 dict [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, open, high, low, close, volume
|
494
497
|
"""
|
495
498
|
await self.load_markets()
|
@@ -497,14 +500,24 @@ class bitget(bitgetAsync):
|
|
497
500
|
symbol = market['symbol']
|
498
501
|
timeframes = self.safe_value(self.options, 'timeframes')
|
499
502
|
interval = self.safe_string(timeframes, timeframe)
|
500
|
-
messageHash =
|
503
|
+
messageHash = None
|
501
504
|
instType = None
|
502
|
-
|
505
|
+
uta = None
|
506
|
+
uta, params = self.handle_option_and_params(params, 'watchOHLCV', 'uta', False)
|
507
|
+
instType, params = self.get_inst_type(market, uta, params)
|
503
508
|
args: dict = {
|
504
509
|
'instType': instType,
|
505
|
-
'channel': 'candle' + interval,
|
506
|
-
'instId': market['id'],
|
507
510
|
}
|
511
|
+
if uta:
|
512
|
+
args['topic'] = 'kline'
|
513
|
+
args['symbol'] = market['id']
|
514
|
+
args['interval'] = interval
|
515
|
+
params['uta'] = True
|
516
|
+
messageHash = 'kline:' + symbol
|
517
|
+
else:
|
518
|
+
args['channel'] = 'candle' + interval
|
519
|
+
args['instId'] = market['id']
|
520
|
+
messageHash = 'candles:' + timeframe + ':' + symbol
|
508
521
|
ohlcv = await self.watch_public(messageHash, args, params)
|
509
522
|
if self.newUpdates:
|
510
523
|
limit = ohlcv.getLimit(symbol, limit)
|
@@ -516,17 +529,43 @@ class bitget(bitgetAsync):
|
|
516
529
|
|
517
530
|
https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
518
531
|
https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
532
|
+
https://www.bitget.com/api-doc/uta/websocket/public/Candlesticks-Channel
|
519
533
|
|
520
534
|
:param str symbol: unified symbol of the market to unwatch the ohlcv for
|
521
535
|
:param str [timeframe]: the period for the ratio, default is 1 minute
|
522
536
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
537
|
+
:param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False
|
523
538
|
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
524
539
|
"""
|
525
540
|
await self.load_markets()
|
526
541
|
timeframes = self.safe_dict(self.options, 'timeframes')
|
527
542
|
interval = self.safe_string(timeframes, timeframe)
|
528
|
-
channel =
|
529
|
-
|
543
|
+
channel = None
|
544
|
+
market = None
|
545
|
+
if symbol is not None:
|
546
|
+
market = self.market(symbol)
|
547
|
+
instType = None
|
548
|
+
messageHash = None
|
549
|
+
uta = None
|
550
|
+
uta, params = self.handle_option_and_params(params, 'unWatchOHLCV', 'uta', False)
|
551
|
+
instType, params = self.get_inst_type(market, uta, params)
|
552
|
+
args: dict = {
|
553
|
+
'instType': instType,
|
554
|
+
}
|
555
|
+
if uta:
|
556
|
+
channel = 'kline'
|
557
|
+
args['topic'] = channel
|
558
|
+
args['symbol'] = market['id']
|
559
|
+
args['interval'] = interval
|
560
|
+
params['uta'] = True
|
561
|
+
params['interval'] = interval
|
562
|
+
messageHash = channel + symbol
|
563
|
+
else:
|
564
|
+
channel = 'candle' + interval
|
565
|
+
args['channel'] = channel
|
566
|
+
args['instId'] = market['id']
|
567
|
+
messageHash = 'candles:' + interval
|
568
|
+
return await self.un_watch_channel(symbol, channel, messageHash, params)
|
530
569
|
|
531
570
|
def handle_ohlcv(self, client: Client, message):
|
532
571
|
#
|
@@ -562,15 +601,45 @@ class bitget(bitgetAsync):
|
|
562
601
|
# "ts": 1701901610417
|
563
602
|
# }
|
564
603
|
#
|
604
|
+
# uta
|
605
|
+
#
|
606
|
+
# {
|
607
|
+
# "action": "snapshot",
|
608
|
+
# "arg": {
|
609
|
+
# "instType": "usdt-futures",
|
610
|
+
# "topic": "kline",
|
611
|
+
# "symbol": "BTCUSDT",
|
612
|
+
# "interval": "1m"
|
613
|
+
# },
|
614
|
+
# "data": [
|
615
|
+
# {
|
616
|
+
# "start": "1755564480000",
|
617
|
+
# "open": "116286",
|
618
|
+
# "close": "116256.2",
|
619
|
+
# "high": "116310.2",
|
620
|
+
# "low": "116232.8",
|
621
|
+
# "volume": "39.7062",
|
622
|
+
# "turnover": "4616746.46654"
|
623
|
+
# },
|
624
|
+
# ],
|
625
|
+
# "ts": 1755594421877
|
626
|
+
# }
|
627
|
+
#
|
565
628
|
arg = self.safe_value(message, 'arg', {})
|
566
|
-
instType = self.
|
567
|
-
marketType = 'spot' if (instType == '
|
568
|
-
marketId = self.
|
629
|
+
instType = self.safe_string_lower(arg, 'instType')
|
630
|
+
marketType = 'spot' if (instType == 'spot') else 'contract'
|
631
|
+
marketId = self.safe_string_2(arg, 'instId', 'symbol')
|
569
632
|
market = self.safe_market(marketId, None, None, marketType)
|
570
633
|
symbol = market['symbol']
|
571
634
|
self.ohlcvs[symbol] = self.safe_value(self.ohlcvs, symbol, {})
|
572
|
-
channel = self.
|
573
|
-
interval =
|
635
|
+
channel = self.safe_string_2(arg, 'channel', 'topic')
|
636
|
+
interval = self.safe_string(arg, 'interval')
|
637
|
+
isUta = None
|
638
|
+
if interval is None:
|
639
|
+
isUta = False
|
640
|
+
interval = channel.replace('candle', '')
|
641
|
+
else:
|
642
|
+
isUta = True
|
574
643
|
timeframes = self.safe_value(self.options, 'timeframes')
|
575
644
|
timeframe = self.find_timeframe(interval, timeframes)
|
576
645
|
stored = self.safe_value(self.ohlcvs[symbol], timeframe)
|
@@ -582,7 +651,11 @@ class bitget(bitgetAsync):
|
|
582
651
|
for i in range(0, len(data)):
|
583
652
|
parsed = self.parse_ws_ohlcv(data[i], market)
|
584
653
|
stored.append(parsed)
|
585
|
-
messageHash =
|
654
|
+
messageHash = None
|
655
|
+
if isUta:
|
656
|
+
messageHash = 'kline:' + symbol
|
657
|
+
else:
|
658
|
+
messageHash = 'candles:' + timeframe + ':' + symbol
|
586
659
|
client.resolve(stored, messageHash)
|
587
660
|
|
588
661
|
def parse_ws_ohlcv(self, ohlcv, market=None) -> list:
|
@@ -598,14 +671,26 @@ class bitget(bitgetAsync):
|
|
598
671
|
# "437404.105512" # USDT volume
|
599
672
|
# ]
|
600
673
|
#
|
674
|
+
# uta
|
675
|
+
#
|
676
|
+
# {
|
677
|
+
# "start": "1755564480000",
|
678
|
+
# "open": "116286",
|
679
|
+
# "close": "116256.2",
|
680
|
+
# "high": "116310.2",
|
681
|
+
# "low": "116232.8",
|
682
|
+
# "volume": "39.7062",
|
683
|
+
# "turnover": "4616746.46654"
|
684
|
+
# }
|
685
|
+
#
|
601
686
|
volumeIndex = 6 if (market['inverse']) else 5
|
602
687
|
return [
|
603
|
-
self.
|
604
|
-
self.
|
605
|
-
self.
|
606
|
-
self.
|
607
|
-
self.
|
608
|
-
self.
|
688
|
+
self.safe_integer_2(ohlcv, 'start', 0),
|
689
|
+
self.safe_number_2(ohlcv, 'open', 1),
|
690
|
+
self.safe_number_2(ohlcv, 'high', 2),
|
691
|
+
self.safe_number_2(ohlcv, 'low', 3),
|
692
|
+
self.safe_number_2(ohlcv, 'close', 4),
|
693
|
+
self.safe_number_2(ohlcv, 'volume', volumeIndex),
|
609
694
|
]
|
610
695
|
|
611
696
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
@@ -647,12 +732,21 @@ class bitget(bitgetAsync):
|
|
647
732
|
market = self.market(symbol)
|
648
733
|
messageHash = 'unsubscribe:' + messageHashTopic + ':' + market['symbol']
|
649
734
|
instType = None
|
650
|
-
|
735
|
+
uta = None
|
736
|
+
uta, params = self.handle_option_and_params(params, 'unWatchChannel', 'uta', False)
|
737
|
+
instType, params = self.get_inst_type(market, uta, params)
|
651
738
|
args: dict = {
|
652
739
|
'instType': instType,
|
653
|
-
'channel': channel,
|
654
|
-
'instId': market['id'],
|
655
740
|
}
|
741
|
+
if uta:
|
742
|
+
args['topic'] = channel
|
743
|
+
args['symbol'] = market['id']
|
744
|
+
args['interval'] = self.safe_string(params, 'interval', '1m')
|
745
|
+
params['uta'] = True
|
746
|
+
params = self.omit(params, 'interval')
|
747
|
+
else:
|
748
|
+
args['channel'] = channel
|
749
|
+
args['instId'] = market['id']
|
656
750
|
return await self.un_watch_public(messageHash, args, params)
|
657
751
|
|
658
752
|
async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}) -> OrderBook:
|
@@ -2002,6 +2096,18 @@ class bitget(bitgetAsync):
|
|
2002
2096
|
# "ts": 1753230479687
|
2003
2097
|
# }
|
2004
2098
|
#
|
2099
|
+
# unsubscribe
|
2100
|
+
#
|
2101
|
+
# {
|
2102
|
+
# "event": "unsubscribe",
|
2103
|
+
# "arg": {
|
2104
|
+
# "instType": "spot",
|
2105
|
+
# "topic": "kline",
|
2106
|
+
# "symbol": "BTCUSDT",
|
2107
|
+
# "interval": "1m"
|
2108
|
+
# }
|
2109
|
+
# }
|
2110
|
+
#
|
2005
2111
|
if self.handle_error_message(client, message):
|
2006
2112
|
return
|
2007
2113
|
content = self.safe_string(message, 'message')
|
@@ -2034,6 +2140,7 @@ class bitget(bitgetAsync):
|
|
2034
2140
|
'positions': self.handle_positions,
|
2035
2141
|
'account-isolated': self.handle_balance,
|
2036
2142
|
'account-crossed': self.handle_balance,
|
2143
|
+
'kline': self.handle_ohlcv,
|
2037
2144
|
}
|
2038
2145
|
arg = self.safe_value(message, 'arg', {})
|
2039
2146
|
topic = self.safe_value_2(arg, 'channel', 'topic', '')
|
@@ -2131,18 +2238,34 @@ class bitget(bitgetAsync):
|
|
2131
2238
|
#
|
2132
2239
|
# {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"candle1m","instId":"BTCUSDT"}}
|
2133
2240
|
#
|
2241
|
+
# UTA
|
2242
|
+
#
|
2243
|
+
# {"event":"unsubscribe","arg":{"instType":"spot","topic":"kline","symbol":"BTCUSDT","interval":"1m"}}
|
2244
|
+
#
|
2134
2245
|
arg = self.safe_dict(message, 'arg', {})
|
2135
2246
|
instType = self.safe_string_lower(arg, 'instType')
|
2136
2247
|
type = 'spot' if (instType == 'spot') else 'contract'
|
2137
|
-
instId = self.
|
2138
|
-
channel = self.
|
2139
|
-
interval =
|
2248
|
+
instId = self.safe_string_2(arg, 'instId', 'symbol')
|
2249
|
+
channel = self.safe_string_2(arg, 'channel', 'topic')
|
2250
|
+
interval = self.safe_string(arg, 'interval')
|
2251
|
+
isUta = None
|
2252
|
+
if interval is None:
|
2253
|
+
isUta = False
|
2254
|
+
interval = channel.replace('candle', '')
|
2255
|
+
else:
|
2256
|
+
isUta = True
|
2140
2257
|
timeframes = self.safe_value(self.options, 'timeframes')
|
2141
2258
|
timeframe = self.find_timeframe(interval, timeframes)
|
2142
2259
|
market = self.safe_market(instId, None, None, type)
|
2143
2260
|
symbol = market['symbol']
|
2144
|
-
messageHash =
|
2145
|
-
subMessageHash =
|
2261
|
+
messageHash = None
|
2262
|
+
subMessageHash = None
|
2263
|
+
if isUta:
|
2264
|
+
messageHash = 'unsubscribe:kline:' + symbol
|
2265
|
+
subMessageHash = 'kline:' + symbol
|
2266
|
+
else:
|
2267
|
+
messageHash = 'unsubscribe:candles:' + timeframe + ':' + symbol
|
2268
|
+
subMessageHash = 'candles:' + timeframe + ':' + symbol
|
2146
2269
|
if symbol in self.ohlcvs:
|
2147
2270
|
if timeframe in self.ohlcvs[symbol]:
|
2148
2271
|
del self.ohlcvs[symbol][timeframe]
|
@@ -2183,4 +2306,6 @@ class bitget(bitgetAsync):
|
|
2183
2306
|
self.handle_ticker_un_subscription(client, message)
|
2184
2307
|
elif channel.startswith('candle'):
|
2185
2308
|
self.handle_ohlcv_un_subscription(client, message)
|
2309
|
+
elif channel.startswith('kline'):
|
2310
|
+
self.handle_ohlcv_un_subscription(client, message)
|
2186
2311
|
return message
|
@@ -1,11 +1,11 @@
|
|
1
1
|
bitget/__init__.py,sha256=D5tG1_AjwXjMim3CPnCuWSheOXtq4vlSwVCS5ZG1bMQ,246
|
2
|
-
bitget/ccxt/__init__.py,sha256=
|
3
|
-
bitget/ccxt/bitget.py,sha256=
|
2
|
+
bitget/ccxt/__init__.py,sha256=bhjUppzTIV1pAkFw4voNhDr2x1V1H1U5FYk6GlRJqj4,6130
|
3
|
+
bitget/ccxt/bitget.py,sha256=v7U-p48XIejR2OEV3xCBV4KkuifaJYqkhKILiWrxQas,518993
|
4
4
|
bitget/ccxt/abstract/bitget.py,sha256=U3sRAK3oQJt2ujn-S0ci05HnOIHEad7CJvpDeTQfrYY,101038
|
5
|
-
bitget/ccxt/async_support/__init__.py,sha256=
|
6
|
-
bitget/ccxt/async_support/bitget.py,sha256=
|
5
|
+
bitget/ccxt/async_support/__init__.py,sha256=OrWNftRHccFCGxS1-vfed7yaul7GAyr3Yz5tvCkqbD0,4863
|
6
|
+
bitget/ccxt/async_support/bitget.py,sha256=nxjRW9dJ5H7HHp-p9yf_ciwpKkXxK0IQY_ERTktNTXE,521000
|
7
7
|
bitget/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
|
8
|
-
bitget/ccxt/async_support/base/exchange.py,sha256=
|
8
|
+
bitget/ccxt/async_support/base/exchange.py,sha256=f8NMSn7dvE2ZuL71iRKyinVbyafvacm5Zj4WcQ4TWck,121268
|
9
9
|
bitget/ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
|
10
10
|
bitget/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
|
11
11
|
bitget/ccxt/async_support/base/ws/cache.py,sha256=xf2VOtfUwloxSlIQ39M1RGZHWQzyS9IGhB5NX6cDcAc,8370
|
@@ -17,11 +17,11 @@ bitget/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9pr
|
|
17
17
|
bitget/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
|
18
18
|
bitget/ccxt/base/decimal_to_precision.py,sha256=3XI30u9YudHbTA438397u5rkdlXa3atxwZEfUus3C4k,6803
|
19
19
|
bitget/ccxt/base/errors.py,sha256=OGhWNvNtRlJOzFx-n1x3ZjTnaPpfWH0Vc0xACS-MeDw,5012
|
20
|
-
bitget/ccxt/base/exchange.py,sha256=
|
20
|
+
bitget/ccxt/base/exchange.py,sha256=wXcblsdBqxUWtSbKu1hDTey2mOUhXe05MT7b91Mztno,334337
|
21
21
|
bitget/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
|
22
22
|
bitget/ccxt/base/types.py,sha256=Gvbogh9i7pPH7Z18xesYeDPribqqwq8uKpOv-YODFBs,11505
|
23
|
-
bitget/ccxt/pro/__init__.py,sha256=
|
24
|
-
bitget/ccxt/pro/bitget.py,sha256=
|
23
|
+
bitget/ccxt/pro/__init__.py,sha256=aclE2S1jDsTNzAhGI_S75WZVCYLRnRO5helH8RmJuqk,4177
|
24
|
+
bitget/ccxt/pro/bitget.py,sha256=p4XPcaqmc581alL-UoX08RMgGQYN6Zz0nRoUaP1qmKM,101076
|
25
25
|
bitget/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
|
26
26
|
bitget/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
|
27
27
|
bitget/ccxt/static_dependencies/ecdsa/__init__.py,sha256=Xaj0G79BLtBt2YZcOOMV8qOlQZ7fIJznNiHhiEEZfQA,594
|
@@ -281,6 +281,6 @@ bitget/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX
|
|
281
281
|
bitget/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
|
282
282
|
bitget/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
283
283
|
bitget/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
|
284
|
-
bitget-0.0.
|
285
|
-
bitget-0.0.
|
286
|
-
bitget-0.0.
|
284
|
+
bitget-0.0.84.dist-info/METADATA,sha256=T2WyP5f7a_Zf3IPcpO44AuB6LgTSIuDF29xa4WH4jZs,44874
|
285
|
+
bitget-0.0.84.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
286
|
+
bitget-0.0.84.dist-info/RECORD,,
|
File without changes
|