ccxt 4.4.68__py2.py3-none-any.whl → 4.4.70__py2.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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/bybit.py +4 -0
- ccxt/abstract/myokx.py +3 -0
- ccxt/abstract/okx.py +3 -0
- ccxt/abstract/paradex.py +23 -0
- ccxt/abstract/tradeogre.py +2 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +5 -1
- ccxt/async_support/binance.py +17 -3
- ccxt/async_support/bitget.py +47 -262
- ccxt/async_support/bitstamp.py +2 -3
- ccxt/async_support/bybit.py +7 -0
- ccxt/async_support/coinbase.py +24 -9
- ccxt/async_support/cryptomus.py +122 -6
- ccxt/async_support/hyperliquid.py +17 -8
- ccxt/async_support/okx.py +4 -0
- ccxt/async_support/paradex.py +173 -5
- ccxt/async_support/phemex.py +2 -2
- ccxt/async_support/tradeogre.py +31 -11
- ccxt/async_support/whitebit.py +210 -2
- ccxt/base/exchange.py +1 -2
- ccxt/binance.py +17 -3
- ccxt/bitget.py +47 -262
- ccxt/bitstamp.py +2 -3
- ccxt/bybit.py +7 -0
- ccxt/coinbase.py +24 -9
- ccxt/cryptomus.py +122 -6
- ccxt/hyperliquid.py +17 -8
- ccxt/okx.py +4 -0
- ccxt/paradex.py +173 -5
- ccxt/phemex.py +2 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +28 -3
- ccxt/pro/bybit.py +81 -37
- ccxt/test/tests_async.py +25 -3
- ccxt/test/tests_sync.py +25 -3
- ccxt/tradeogre.py +31 -11
- ccxt/whitebit.py +210 -2
- {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/METADATA +4 -4
- {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/RECORD +43 -43
- {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/WHEEL +0 -0
- {ccxt-4.4.68.dist-info → ccxt-4.4.70.dist-info}/top_level.txt +0 -0
ccxt/bitget.py
CHANGED
@@ -1690,33 +1690,6 @@ class bitget(Exchange, ImplicitAPI):
|
|
1690
1690
|
def set_sandbox_mode(self, enabled):
|
1691
1691
|
self.options['sandboxMode'] = enabled
|
1692
1692
|
|
1693
|
-
def convert_symbol_for_sandbox(self, symbol):
|
1694
|
-
if symbol.startswith('S'):
|
1695
|
-
# handle using the exchange specified sandbox symbols
|
1696
|
-
return symbol
|
1697
|
-
convertedSymbol = None
|
1698
|
-
if symbol.find('/') > -1:
|
1699
|
-
if symbol.find(':') == -1:
|
1700
|
-
raise NotSupported(self.id + ' sandbox supports swap and future markets only')
|
1701
|
-
splitBase = symbol.split('/')
|
1702
|
-
previousBase = self.safe_string(splitBase, 0)
|
1703
|
-
previousQuoteSettleExpiry = self.safe_string(splitBase, 1)
|
1704
|
-
splitQuote = previousQuoteSettleExpiry.split(':')
|
1705
|
-
previousQuote = self.safe_string(splitQuote, 0)
|
1706
|
-
previousSettleExpiry = self.safe_string(splitQuote, 1)
|
1707
|
-
splitSettle = previousSettleExpiry.split('-')
|
1708
|
-
previousSettle = self.safe_string(splitSettle, 0)
|
1709
|
-
expiry = self.safe_string(splitSettle, 1)
|
1710
|
-
convertedSymbol = 'S' + previousBase + '/S' + previousQuote + ':S' + previousSettle
|
1711
|
-
if expiry is not None:
|
1712
|
-
convertedSymbol = convertedSymbol + '-' + expiry
|
1713
|
-
else:
|
1714
|
-
# handle using a market id instead of a unified symbol
|
1715
|
-
base = symbol[0:3]
|
1716
|
-
remaining = symbol[3:]
|
1717
|
-
convertedSymbol = 'S' + base + 'S' + remaining
|
1718
|
-
return convertedSymbol
|
1719
|
-
|
1720
1693
|
def handle_product_type_and_params(self, market=None, params={}):
|
1721
1694
|
subType = None
|
1722
1695
|
subType, params = self.handle_sub_type_and_params('handleProductTypeAndParams', None, params)
|
@@ -1793,12 +1766,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1793
1766
|
for i in range(0, len(types)):
|
1794
1767
|
type = types[i]
|
1795
1768
|
if (type == 'swap') or (type == 'future'):
|
1796
|
-
subTypes =
|
1797
|
-
if sandboxMode:
|
1798
|
-
# the following are simulated trading markets ['SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES']
|
1799
|
-
subTypes = ['SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES']
|
1800
|
-
else:
|
1801
|
-
subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES']
|
1769
|
+
subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES', 'SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES']
|
1802
1770
|
for j in range(0, len(subTypes)):
|
1803
1771
|
promises.append(self.publicMixGetV2MixMarketContracts(self.extend(params, {
|
1804
1772
|
'productType': subTypes[j],
|
@@ -2167,13 +2135,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2167
2135
|
:returns dict: a `leverage tiers structure <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`
|
2168
2136
|
"""
|
2169
2137
|
self.load_markets()
|
2170
|
-
|
2171
|
-
market = None
|
2172
|
-
if sandboxMode:
|
2173
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2174
|
-
market = self.market(sandboxSymbol)
|
2175
|
-
else:
|
2176
|
-
market = self.market(symbol)
|
2138
|
+
market = self.market(symbol)
|
2177
2139
|
request: dict = {}
|
2178
2140
|
response = None
|
2179
2141
|
marginMode = None
|
@@ -2659,13 +2621,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2659
2621
|
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
2660
2622
|
"""
|
2661
2623
|
self.load_markets()
|
2662
|
-
|
2663
|
-
market = None
|
2664
|
-
if sandboxMode:
|
2665
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2666
|
-
market = self.market(sandboxSymbol)
|
2667
|
-
else:
|
2668
|
-
market = self.market(symbol)
|
2624
|
+
market = self.market(symbol)
|
2669
2625
|
request: dict = {
|
2670
2626
|
'symbol': market['id'],
|
2671
2627
|
}
|
@@ -2825,13 +2781,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2825
2781
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
2826
2782
|
"""
|
2827
2783
|
self.load_markets()
|
2828
|
-
|
2829
|
-
market = None
|
2830
|
-
if sandboxMode:
|
2831
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2832
|
-
market = self.market(sandboxSymbol)
|
2833
|
-
else:
|
2834
|
-
market = self.market(symbol)
|
2784
|
+
market = self.market(symbol)
|
2835
2785
|
request: dict = {
|
2836
2786
|
'symbol': market['id'],
|
2837
2787
|
}
|
@@ -2920,13 +2870,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2920
2870
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
2921
2871
|
"""
|
2922
2872
|
self.load_markets()
|
2923
|
-
|
2924
|
-
market = None
|
2925
|
-
if sandboxMode:
|
2926
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2927
|
-
market = self.market(sandboxSymbol)
|
2928
|
-
else:
|
2929
|
-
market = self.market(symbol)
|
2873
|
+
market = self.market(symbol)
|
2930
2874
|
request: dict = {
|
2931
2875
|
'symbol': market['id'],
|
2932
2876
|
}
|
@@ -2958,12 +2902,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2958
2902
|
market = None
|
2959
2903
|
if symbols is not None:
|
2960
2904
|
symbol = self.safe_value(symbols, 0)
|
2961
|
-
|
2962
|
-
if sandboxMode:
|
2963
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2964
|
-
market = self.market(sandboxSymbol)
|
2965
|
-
else:
|
2966
|
-
market = self.market(symbol)
|
2905
|
+
market = self.market(symbol)
|
2967
2906
|
response = None
|
2968
2907
|
request: dict = {}
|
2969
2908
|
type = None
|
@@ -3179,13 +3118,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3179
3118
|
paginate, params = self.handle_option_and_params(params, 'fetchTrades', 'paginate')
|
3180
3119
|
if paginate:
|
3181
3120
|
return self.fetch_paginated_call_cursor('fetchTrades', symbol, since, limit, params, 'idLessThan', 'idLessThan')
|
3182
|
-
|
3183
|
-
market = None
|
3184
|
-
if sandboxMode:
|
3185
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
3186
|
-
market = self.market(sandboxSymbol)
|
3187
|
-
else:
|
3188
|
-
market = self.market(symbol)
|
3121
|
+
market = self.market(symbol)
|
3189
3122
|
request: dict = {
|
3190
3123
|
'symbol': market['id'],
|
3191
3124
|
}
|
@@ -3480,14 +3413,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
3480
3413
|
paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
|
3481
3414
|
if paginate:
|
3482
3415
|
return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimitForRecentEndpoint)
|
3483
|
-
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
3484
3416
|
useHistoryEndpoint = self.safe_bool(params, 'useHistoryEndpoint', False)
|
3485
|
-
market =
|
3486
|
-
if sandboxMode:
|
3487
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
3488
|
-
market = self.market(sandboxSymbol)
|
3489
|
-
else:
|
3490
|
-
market = self.market(symbol)
|
3417
|
+
market = self.market(symbol)
|
3491
3418
|
marketType = 'spot' if market['spot'] else 'swap'
|
3492
3419
|
timeframes = self.options['timeframes'][marketType]
|
3493
3420
|
msInDay = 86400000
|
@@ -4291,13 +4218,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4291
4218
|
return self.parse_order(data, market)
|
4292
4219
|
|
4293
4220
|
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
4294
|
-
|
4295
|
-
market = None
|
4296
|
-
if sandboxMode:
|
4297
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4298
|
-
market = self.market(sandboxSymbol)
|
4299
|
-
else:
|
4300
|
-
market = self.market(symbol)
|
4221
|
+
market = self.market(symbol)
|
4301
4222
|
marketType = None
|
4302
4223
|
marginMode = None
|
4303
4224
|
marketType, params = self.handle_market_type_and_params('createOrder', market, params)
|
@@ -4509,13 +4430,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4509
4430
|
raise BadRequest(self.id + ' createOrders() requires all orders to have the same margin mode(isolated or cross)')
|
4510
4431
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
|
4511
4432
|
ordersRequests.append(orderRequest)
|
4512
|
-
|
4513
|
-
market = None
|
4514
|
-
if sandboxMode:
|
4515
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4516
|
-
market = self.market(sandboxSymbol)
|
4517
|
-
else:
|
4518
|
-
market = self.market(symbol)
|
4433
|
+
market = self.market(symbol)
|
4519
4434
|
request: dict = {
|
4520
4435
|
'symbol': market['id'],
|
4521
4436
|
'orderList': ordersRequests,
|
@@ -4599,13 +4514,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4599
4514
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4600
4515
|
"""
|
4601
4516
|
self.load_markets()
|
4602
|
-
|
4603
|
-
market = None
|
4604
|
-
if sandboxMode:
|
4605
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4606
|
-
market = self.market(sandboxSymbol)
|
4607
|
-
else:
|
4608
|
-
market = self.market(symbol)
|
4517
|
+
market = self.market(symbol)
|
4609
4518
|
request: dict = {
|
4610
4519
|
'orderId': id,
|
4611
4520
|
}
|
@@ -4742,13 +4651,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4742
4651
|
if symbol is None:
|
4743
4652
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
4744
4653
|
self.load_markets()
|
4745
|
-
|
4746
|
-
market = None
|
4747
|
-
if sandboxMode:
|
4748
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4749
|
-
market = self.market(sandboxSymbol)
|
4750
|
-
else:
|
4751
|
-
market = self.market(symbol)
|
4654
|
+
market = self.market(symbol)
|
4752
4655
|
marginMode = None
|
4753
4656
|
response = None
|
4754
4657
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
|
@@ -4862,13 +4765,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4862
4765
|
if symbol is None:
|
4863
4766
|
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
|
4864
4767
|
self.load_markets()
|
4865
|
-
|
4866
|
-
market = None
|
4867
|
-
if sandboxMode:
|
4868
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4869
|
-
market = self.market(sandboxSymbol)
|
4870
|
-
else:
|
4871
|
-
market = self.market(symbol)
|
4768
|
+
market = self.market(symbol)
|
4872
4769
|
marginMode = None
|
4873
4770
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrders', params)
|
4874
4771
|
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
@@ -4943,13 +4840,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4943
4840
|
if symbol is None:
|
4944
4841
|
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
4945
4842
|
self.load_markets()
|
4946
|
-
|
4947
|
-
market = None
|
4948
|
-
if sandboxMode:
|
4949
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4950
|
-
market = self.market(sandboxSymbol)
|
4951
|
-
else:
|
4952
|
-
market = self.market(symbol)
|
4843
|
+
market = self.market(symbol)
|
4953
4844
|
marginMode = None
|
4954
4845
|
marginMode, params = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
4955
4846
|
request: dict = {
|
@@ -5052,13 +4943,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
5052
4943
|
if symbol is None:
|
5053
4944
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
|
5054
4945
|
self.load_markets()
|
5055
|
-
|
5056
|
-
market = None
|
5057
|
-
if sandboxMode:
|
5058
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
5059
|
-
market = self.market(sandboxSymbol)
|
5060
|
-
else:
|
5061
|
-
market = self.market(symbol)
|
4946
|
+
market = self.market(symbol)
|
5062
4947
|
request: dict = {
|
5063
4948
|
'orderId': id,
|
5064
4949
|
}
|
@@ -5176,18 +5061,13 @@ class bitget(Exchange, ImplicitAPI):
|
|
5176
5061
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5177
5062
|
"""
|
5178
5063
|
self.load_markets()
|
5179
|
-
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
5180
5064
|
market = None
|
5181
5065
|
type = None
|
5182
5066
|
request: dict = {}
|
5183
5067
|
marginMode = None
|
5184
5068
|
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
5185
5069
|
if symbol is not None:
|
5186
|
-
|
5187
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
5188
|
-
market = self.market(sandboxSymbol)
|
5189
|
-
else:
|
5190
|
-
market = self.market(symbol)
|
5070
|
+
market = self.market(symbol)
|
5191
5071
|
request['symbol'] = market['id']
|
5192
5072
|
defaultType = self.safe_string_2(self.options, 'fetchOpenOrders', 'defaultType', 'spot')
|
5193
5073
|
marketType = market['type'] if ('type' in market) else defaultType
|
@@ -5514,12 +5394,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
5514
5394
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5515
5395
|
"""
|
5516
5396
|
self.load_markets()
|
5517
|
-
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
5518
5397
|
market = None
|
5519
|
-
if sandboxMode:
|
5520
|
-
if symbol is not None:
|
5521
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
5522
|
-
symbol = sandboxSymbol
|
5523
5398
|
request: dict = {}
|
5524
5399
|
if symbol is not None:
|
5525
5400
|
market = self.market(symbol)
|
@@ -5801,12 +5676,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
5801
5676
|
params = self.omit(params, 'symbol')
|
5802
5677
|
market = None
|
5803
5678
|
if symbol is not None:
|
5804
|
-
|
5805
|
-
if sandboxMode:
|
5806
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
5807
|
-
market = self.market(sandboxSymbol)
|
5808
|
-
else:
|
5809
|
-
market = self.market(symbol)
|
5679
|
+
market = self.market(symbol)
|
5810
5680
|
marketType = None
|
5811
5681
|
marketType, params = self.handle_market_type_and_params('fetchLedger', market, params)
|
5812
5682
|
paginate = False
|
@@ -6011,13 +5881,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6011
5881
|
if symbol is None:
|
6012
5882
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
|
6013
5883
|
self.load_markets()
|
6014
|
-
|
6015
|
-
market = None
|
6016
|
-
if sandboxMode:
|
6017
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6018
|
-
market = self.market(sandboxSymbol)
|
6019
|
-
else:
|
6020
|
-
market = self.market(symbol)
|
5884
|
+
market = self.market(symbol)
|
6021
5885
|
marginMode = None
|
6022
5886
|
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
6023
5887
|
paginate = False
|
@@ -6173,13 +6037,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6173
6037
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
6174
6038
|
"""
|
6175
6039
|
self.load_markets()
|
6176
|
-
|
6177
|
-
market = None
|
6178
|
-
if sandboxMode:
|
6179
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6180
|
-
market = self.market(sandboxSymbol)
|
6181
|
-
else:
|
6182
|
-
market = self.market(symbol)
|
6040
|
+
market = self.market(symbol)
|
6183
6041
|
productType = None
|
6184
6042
|
productType, params = self.handle_product_type_and_params(market, params)
|
6185
6043
|
request: dict = {
|
@@ -6252,12 +6110,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6252
6110
|
market = None
|
6253
6111
|
if symbols is not None:
|
6254
6112
|
first = self.safe_string(symbols, 0)
|
6255
|
-
|
6256
|
-
if sandboxMode:
|
6257
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(first)
|
6258
|
-
market = self.market(sandboxSymbol)
|
6259
|
-
else:
|
6260
|
-
market = self.market(first)
|
6113
|
+
market = self.market(first)
|
6261
6114
|
productType = None
|
6262
6115
|
productType, params = self.handle_product_type_and_params(market, params)
|
6263
6116
|
request: dict = {
|
@@ -6544,13 +6397,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6544
6397
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingRateHistory', 'paginate')
|
6545
6398
|
if paginate:
|
6546
6399
|
return self.fetch_paginated_call_incremental('fetchFundingRateHistory', symbol, since, limit, params, 'pageNo', 100)
|
6547
|
-
|
6548
|
-
market = None
|
6549
|
-
if sandboxMode:
|
6550
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6551
|
-
market = self.market(sandboxSymbol)
|
6552
|
-
else:
|
6553
|
-
market = self.market(symbol)
|
6400
|
+
market = self.market(symbol)
|
6554
6401
|
productType = None
|
6555
6402
|
productType, params = self.handle_product_type_and_params(market, params)
|
6556
6403
|
request: dict = {
|
@@ -6604,13 +6451,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6604
6451
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
6605
6452
|
"""
|
6606
6453
|
self.load_markets()
|
6607
|
-
|
6608
|
-
market = None
|
6609
|
-
if sandboxMode:
|
6610
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6611
|
-
market = self.market(sandboxSymbol)
|
6612
|
-
else:
|
6613
|
-
market = self.market(symbol)
|
6454
|
+
market = self.market(symbol)
|
6614
6455
|
if not market['swap']:
|
6615
6456
|
raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
|
6616
6457
|
productType = None
|
@@ -6652,12 +6493,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6652
6493
|
market = None
|
6653
6494
|
if symbols is not None:
|
6654
6495
|
symbol = self.safe_value(symbols, 0)
|
6655
|
-
|
6656
|
-
if sandboxMode:
|
6657
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6658
|
-
market = self.market(sandboxSymbol)
|
6659
|
-
else:
|
6660
|
-
market = self.market(symbol)
|
6496
|
+
market = self.market(symbol)
|
6661
6497
|
request: dict = {}
|
6662
6498
|
productType = None
|
6663
6499
|
productType, params = self.handle_product_type_and_params(market, params)
|
@@ -6793,13 +6629,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6793
6629
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
|
6794
6630
|
if paginate:
|
6795
6631
|
return self.fetch_paginated_call_cursor('fetchFundingHistory', symbol, since, limit, params, 'endId', 'idLessThan')
|
6796
|
-
|
6797
|
-
market = None
|
6798
|
-
if sandboxMode:
|
6799
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6800
|
-
market = self.market(sandboxSymbol)
|
6801
|
-
else:
|
6802
|
-
market = self.market(symbol)
|
6632
|
+
market = self.market(symbol)
|
6803
6633
|
if not market['swap']:
|
6804
6634
|
raise BadSymbol(self.id + ' fetchFundingHistory() supports swap contracts only')
|
6805
6635
|
productType = None
|
@@ -6877,18 +6707,15 @@ class bitget(Exchange, ImplicitAPI):
|
|
6877
6707
|
continue
|
6878
6708
|
result.append(self.parse_funding_history(contract, market))
|
6879
6709
|
sorted = self.sort_by(result, 'timestamp')
|
6880
|
-
|
6710
|
+
symbol = None
|
6711
|
+
if market is not None:
|
6712
|
+
symbol = market['symbol']
|
6713
|
+
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
6881
6714
|
|
6882
6715
|
def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
|
6883
6716
|
self.load_markets()
|
6884
6717
|
holdSide = self.safe_string(params, 'holdSide')
|
6885
|
-
|
6886
|
-
market = None
|
6887
|
-
if sandboxMode:
|
6888
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6889
|
-
market = self.market(sandboxSymbol)
|
6890
|
-
else:
|
6891
|
-
market = self.market(symbol)
|
6718
|
+
market = self.market(symbol)
|
6892
6719
|
productType = None
|
6893
6720
|
productType, params = self.handle_product_type_and_params(market, params)
|
6894
6721
|
request: dict = {
|
@@ -6984,13 +6811,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6984
6811
|
:returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
|
6985
6812
|
"""
|
6986
6813
|
self.load_markets()
|
6987
|
-
|
6988
|
-
market = None
|
6989
|
-
if sandboxMode:
|
6990
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6991
|
-
market = self.market(sandboxSymbol)
|
6992
|
-
else:
|
6993
|
-
market = self.market(symbol)
|
6814
|
+
market = self.market(symbol)
|
6994
6815
|
productType = None
|
6995
6816
|
productType, params = self.handle_product_type_and_params(market, params)
|
6996
6817
|
request: dict = {
|
@@ -7031,12 +6852,15 @@ class bitget(Exchange, ImplicitAPI):
|
|
7031
6852
|
return self.parse_leverage(data, market)
|
7032
6853
|
|
7033
6854
|
def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
|
6855
|
+
isCrossMarginMode = self.safe_string(leverage, 'marginMode') == 'crossed'
|
6856
|
+
longLevKey = 'crossedMarginLeverage' if isCrossMarginMode else 'isolatedLongLever'
|
6857
|
+
shortLevKey = 'crossedMarginLeverage' if isCrossMarginMode else 'isolatedShortLever'
|
7034
6858
|
return {
|
7035
6859
|
'info': leverage,
|
7036
6860
|
'symbol': market['symbol'],
|
7037
|
-
'marginMode': 'isolated',
|
7038
|
-
'longLeverage': self.safe_integer(leverage,
|
7039
|
-
'shortLeverage': self.safe_integer(leverage,
|
6861
|
+
'marginMode': 'cross' if isCrossMarginMode else 'isolated',
|
6862
|
+
'longLeverage': self.safe_integer(leverage, longLevKey),
|
6863
|
+
'shortLeverage': self.safe_integer(leverage, shortLevKey),
|
7040
6864
|
}
|
7041
6865
|
|
7042
6866
|
def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
@@ -7054,13 +6878,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7054
6878
|
if symbol is None:
|
7055
6879
|
raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
|
7056
6880
|
self.load_markets()
|
7057
|
-
|
7058
|
-
market = None
|
7059
|
-
if sandboxMode:
|
7060
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
7061
|
-
market = self.market(sandboxSymbol)
|
7062
|
-
else:
|
7063
|
-
market = self.market(symbol)
|
6881
|
+
market = self.market(symbol)
|
7064
6882
|
productType = None
|
7065
6883
|
productType, params = self.handle_product_type_and_params(market, params)
|
7066
6884
|
request: dict = {
|
@@ -7107,13 +6925,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7107
6925
|
if (marginMode != 'isolated') and (marginMode != 'crossed'):
|
7108
6926
|
raise ArgumentsRequired(self.id + ' setMarginMode() marginMode must be either isolated or crossed(cross)')
|
7109
6927
|
self.load_markets()
|
7110
|
-
|
7111
|
-
market = None
|
7112
|
-
if sandboxMode:
|
7113
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
7114
|
-
market = self.market(sandboxSymbol)
|
7115
|
-
else:
|
7116
|
-
market = self.market(symbol)
|
6928
|
+
market = self.market(symbol)
|
7117
6929
|
productType = None
|
7118
6930
|
productType, params = self.handle_product_type_and_params(market, params)
|
7119
6931
|
request: dict = {
|
@@ -7155,12 +6967,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7155
6967
|
posMode = 'hedge_mode' if hedged else 'one_way_mode'
|
7156
6968
|
market = None
|
7157
6969
|
if symbol is not None:
|
7158
|
-
|
7159
|
-
if sandboxMode:
|
7160
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
7161
|
-
market = self.market(sandboxSymbol)
|
7162
|
-
else:
|
7163
|
-
market = self.market(symbol)
|
6970
|
+
market = self.market(symbol)
|
7164
6971
|
productType = None
|
7165
6972
|
productType, params = self.handle_product_type_and_params(market, params)
|
7166
6973
|
request: dict = {
|
@@ -7191,13 +6998,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7191
6998
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
7192
6999
|
"""
|
7193
7000
|
self.load_markets()
|
7194
|
-
|
7195
|
-
market = None
|
7196
|
-
if sandboxMode:
|
7197
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
7198
|
-
market = self.market(sandboxSymbol)
|
7199
|
-
else:
|
7200
|
-
market = self.market(symbol)
|
7001
|
+
market = self.market(symbol)
|
7201
7002
|
if not market['contract']:
|
7202
7003
|
raise BadRequest(self.id + ' fetchOpenInterest() supports contract markets only')
|
7203
7004
|
productType = None
|
@@ -8197,13 +7998,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
8197
7998
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
8198
7999
|
"""
|
8199
8000
|
self.load_markets()
|
8200
|
-
|
8201
|
-
market = None
|
8202
|
-
if sandboxMode:
|
8203
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
8204
|
-
market = self.market(sandboxSymbol)
|
8205
|
-
else:
|
8206
|
-
market = self.market(symbol)
|
8001
|
+
market = self.market(symbol)
|
8207
8002
|
productType = None
|
8208
8003
|
productType, params = self.handle_product_type_and_params(market, params)
|
8209
8004
|
request: dict = {
|
@@ -8283,13 +8078,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
8283
8078
|
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
8284
8079
|
"""
|
8285
8080
|
self.load_markets()
|
8286
|
-
|
8287
|
-
market = None
|
8288
|
-
if sandboxMode:
|
8289
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
8290
|
-
market = self.market(sandboxSymbol)
|
8291
|
-
else:
|
8292
|
-
market = self.market(symbol)
|
8081
|
+
market = self.market(symbol)
|
8293
8082
|
productType = None
|
8294
8083
|
productType, params = self.handle_product_type_and_params(market, params)
|
8295
8084
|
request: dict = {
|
@@ -8678,13 +8467,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
8678
8467
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
8679
8468
|
"""
|
8680
8469
|
self.load_markets()
|
8681
|
-
|
8682
|
-
market = None
|
8683
|
-
if sandboxMode:
|
8684
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
8685
|
-
market = self.market(sandboxSymbol)
|
8686
|
-
else:
|
8687
|
-
market = self.market(symbol)
|
8470
|
+
market = self.market(symbol)
|
8688
8471
|
productType = None
|
8689
8472
|
productType, params = self.handle_product_type_and_params(market, params)
|
8690
8473
|
request: dict = {
|
@@ -8864,10 +8647,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
8864
8647
|
}
|
8865
8648
|
if method == 'POST':
|
8866
8649
|
headers['Content-Type'] = 'application/json'
|
8867
|
-
sandboxMode = self.
|
8650
|
+
sandboxMode = self.safe_bool_2(self.options, 'sandboxMode', 'sandbox', False)
|
8868
8651
|
if sandboxMode and (path != 'v2/public/time'):
|
8869
8652
|
# https://github.com/ccxt/ccxt/issues/25252#issuecomment-2662742336
|
8870
8653
|
if headers is None:
|
8871
8654
|
headers = {}
|
8872
|
-
|
8655
|
+
productType = self.safe_string(params, 'productType')
|
8656
|
+
if (productType != 'SCOIN-FUTURES') and (productType != 'SUSDT-FUTURES') and (productType != 'SUSDC-FUTURES'):
|
8657
|
+
headers['PAPTRADING'] = '1'
|
8873
8658
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
ccxt/bitstamp.py
CHANGED
@@ -1282,10 +1282,9 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
1282
1282
|
|
1283
1283
|
def parse_trading_fees(self, fees):
|
1284
1284
|
result: dict = {'info': fees}
|
1285
|
-
|
1286
|
-
for i in range(0, len(symbols)):
|
1287
|
-
symbol = symbols[i]
|
1285
|
+
for i in range(0, len(fees)):
|
1288
1286
|
fee = self.parse_trading_fee(fees[i])
|
1287
|
+
symbol = fee['symbol']
|
1289
1288
|
result[symbol] = fee
|
1290
1289
|
return result
|
1291
1290
|
|
ccxt/bybit.py
CHANGED
@@ -266,6 +266,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
266
266
|
# institutional lending
|
267
267
|
'v5/ins-loan/product-infos': 5,
|
268
268
|
'v5/ins-loan/ensure-tokens-convert': 5,
|
269
|
+
# earn
|
270
|
+
'v5/earn/product': 5,
|
269
271
|
},
|
270
272
|
},
|
271
273
|
'private': {
|
@@ -424,6 +426,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
424
426
|
'v5/broker/earnings-info': 5,
|
425
427
|
'v5/broker/account-info': 5,
|
426
428
|
'v5/broker/asset/query-sub-member-deposit-record': 10,
|
429
|
+
# earn
|
430
|
+
'v5/earn/order': 5,
|
431
|
+
'v5/earn/position': 5,
|
427
432
|
},
|
428
433
|
'post': {
|
429
434
|
# spot
|
@@ -559,6 +564,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
559
564
|
'v5/broker/award/info': 5,
|
560
565
|
'v5/broker/award/distribute-award': 5,
|
561
566
|
'v5/broker/award/distribution-record': 5,
|
567
|
+
# earn
|
568
|
+
'v5/earn/place-order': 5,
|
562
569
|
},
|
563
570
|
},
|
564
571
|
},
|