ccxt 4.4.69__py2.py3-none-any.whl → 4.4.71__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 -3
- ccxt/abstract/bingx.py +1 -0
- ccxt/abstract/bitmart.py +1 -0
- ccxt/abstract/bybit.py +4 -0
- ccxt/abstract/myokx.py +3 -0
- ccxt/abstract/okx.py +3 -0
- ccxt/abstract/poloniex.py +36 -0
- ccxt/abstract/tradeogre.py +1 -1
- ccxt/async_support/__init__.py +1 -3
- ccxt/async_support/base/exchange.py +3 -3
- ccxt/async_support/binance.py +107 -102
- ccxt/async_support/bingx.py +64 -42
- ccxt/async_support/bitget.py +47 -265
- ccxt/async_support/bitmart.py +12 -1
- ccxt/async_support/bitopro.py +1 -0
- ccxt/async_support/bitrue.py +1 -0
- ccxt/async_support/bybit.py +7 -0
- ccxt/async_support/cex.py +1 -0
- ccxt/async_support/coinbase.py +23 -4
- ccxt/async_support/coinbaseexchange.py +1 -0
- ccxt/async_support/deribit.py +1 -0
- ccxt/async_support/hashkey.py +4 -2
- ccxt/async_support/hyperliquid.py +16 -7
- ccxt/async_support/kraken.py +77 -5
- ccxt/async_support/kucoin.py +4 -2
- ccxt/async_support/mexc.py +8 -4
- ccxt/async_support/okx.py +62 -46
- ccxt/async_support/poloniex.py +1263 -85
- ccxt/async_support/tradeogre.py +20 -4
- ccxt/async_support/whitebit.py +4 -2
- ccxt/base/exchange.py +23 -4
- ccxt/base/types.py +28 -0
- ccxt/binance.py +107 -102
- ccxt/bingx.py +64 -42
- ccxt/bitget.py +47 -265
- ccxt/bitmart.py +12 -1
- ccxt/bitopro.py +1 -0
- ccxt/bitrue.py +1 -0
- ccxt/bybit.py +7 -0
- ccxt/cex.py +1 -0
- ccxt/coinbase.py +23 -4
- ccxt/coinbaseexchange.py +1 -0
- ccxt/deribit.py +1 -0
- ccxt/hashkey.py +4 -2
- ccxt/hyperliquid.py +16 -7
- ccxt/kraken.py +77 -5
- ccxt/kucoin.py +4 -2
- ccxt/mexc.py +8 -4
- ccxt/okx.py +62 -46
- ccxt/poloniex.py +1262 -85
- ccxt/pro/__init__.py +1 -3
- ccxt/pro/binance.py +102 -102
- ccxt/pro/bingx.py +62 -51
- ccxt/pro/bitget.py +28 -3
- ccxt/pro/bybit.py +81 -37
- ccxt/test/tests_async.py +4 -3
- ccxt/test/tests_sync.py +4 -3
- ccxt/tradeogre.py +20 -4
- ccxt/whitebit.py +4 -2
- {ccxt-4.4.69.dist-info → ccxt-4.4.71.dist-info}/METADATA +6 -9
- {ccxt-4.4.69.dist-info → ccxt-4.4.71.dist-info}/RECORD +64 -65
- ccxt/abstract/poloniexfutures.py +0 -48
- {ccxt-4.4.69.dist-info → ccxt-4.4.71.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.69.dist-info → ccxt-4.4.71.dist-info}/WHEEL +0 -0
- {ccxt-4.4.69.dist-info → ccxt-4.4.71.dist-info}/top_level.txt +0 -0
ccxt/async_support/bitget.py
CHANGED
@@ -1691,33 +1691,6 @@ class bitget(Exchange, ImplicitAPI):
|
|
1691
1691
|
def set_sandbox_mode(self, enabled):
|
1692
1692
|
self.options['sandboxMode'] = enabled
|
1693
1693
|
|
1694
|
-
def convert_symbol_for_sandbox(self, symbol):
|
1695
|
-
if symbol.startswith('S'):
|
1696
|
-
# handle using the exchange specified sandbox symbols
|
1697
|
-
return symbol
|
1698
|
-
convertedSymbol = None
|
1699
|
-
if symbol.find('/') > -1:
|
1700
|
-
if symbol.find(':') == -1:
|
1701
|
-
raise NotSupported(self.id + ' sandbox supports swap and future markets only')
|
1702
|
-
splitBase = symbol.split('/')
|
1703
|
-
previousBase = self.safe_string(splitBase, 0)
|
1704
|
-
previousQuoteSettleExpiry = self.safe_string(splitBase, 1)
|
1705
|
-
splitQuote = previousQuoteSettleExpiry.split(':')
|
1706
|
-
previousQuote = self.safe_string(splitQuote, 0)
|
1707
|
-
previousSettleExpiry = self.safe_string(splitQuote, 1)
|
1708
|
-
splitSettle = previousSettleExpiry.split('-')
|
1709
|
-
previousSettle = self.safe_string(splitSettle, 0)
|
1710
|
-
expiry = self.safe_string(splitSettle, 1)
|
1711
|
-
convertedSymbol = 'S' + previousBase + '/S' + previousQuote + ':S' + previousSettle
|
1712
|
-
if expiry is not None:
|
1713
|
-
convertedSymbol = convertedSymbol + '-' + expiry
|
1714
|
-
else:
|
1715
|
-
# handle using a market id instead of a unified symbol
|
1716
|
-
base = symbol[0:3]
|
1717
|
-
remaining = symbol[3:]
|
1718
|
-
convertedSymbol = 'S' + base + 'S' + remaining
|
1719
|
-
return convertedSymbol
|
1720
|
-
|
1721
1694
|
def handle_product_type_and_params(self, market=None, params={}):
|
1722
1695
|
subType = None
|
1723
1696
|
subType, params = self.handle_sub_type_and_params('handleProductTypeAndParams', None, params)
|
@@ -1785,21 +1758,13 @@ class bitget(Exchange, ImplicitAPI):
|
|
1785
1758
|
"""
|
1786
1759
|
if self.options['adjustForTimeDifference']:
|
1787
1760
|
await self.load_time_difference()
|
1788
|
-
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
1789
1761
|
types = self.safe_value(self.options, 'fetchMarkets', ['spot', 'swap'])
|
1790
|
-
if sandboxMode:
|
1791
|
-
types = ['swap']
|
1792
1762
|
promises = []
|
1793
1763
|
fetchMargins = False
|
1794
1764
|
for i in range(0, len(types)):
|
1795
1765
|
type = types[i]
|
1796
1766
|
if (type == 'swap') or (type == 'future'):
|
1797
|
-
subTypes =
|
1798
|
-
if sandboxMode:
|
1799
|
-
# the following are simulated trading markets ['SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES']
|
1800
|
-
subTypes = ['SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES']
|
1801
|
-
else:
|
1802
|
-
subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES']
|
1767
|
+
subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES', 'SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES']
|
1803
1768
|
for j in range(0, len(subTypes)):
|
1804
1769
|
promises.append(self.publicMixGetV2MixMarketContracts(self.extend(params, {
|
1805
1770
|
'productType': subTypes[j],
|
@@ -2168,13 +2133,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2168
2133
|
:returns dict: a `leverage tiers structure <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`
|
2169
2134
|
"""
|
2170
2135
|
await self.load_markets()
|
2171
|
-
|
2172
|
-
market = None
|
2173
|
-
if sandboxMode:
|
2174
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2175
|
-
market = self.market(sandboxSymbol)
|
2176
|
-
else:
|
2177
|
-
market = self.market(symbol)
|
2136
|
+
market = self.market(symbol)
|
2178
2137
|
request: dict = {}
|
2179
2138
|
response = None
|
2180
2139
|
marginMode = None
|
@@ -2660,13 +2619,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2660
2619
|
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
2661
2620
|
"""
|
2662
2621
|
await self.load_markets()
|
2663
|
-
|
2664
|
-
market = None
|
2665
|
-
if sandboxMode:
|
2666
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2667
|
-
market = self.market(sandboxSymbol)
|
2668
|
-
else:
|
2669
|
-
market = self.market(symbol)
|
2622
|
+
market = self.market(symbol)
|
2670
2623
|
request: dict = {
|
2671
2624
|
'symbol': market['id'],
|
2672
2625
|
}
|
@@ -2826,13 +2779,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2826
2779
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
2827
2780
|
"""
|
2828
2781
|
await self.load_markets()
|
2829
|
-
|
2830
|
-
market = None
|
2831
|
-
if sandboxMode:
|
2832
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2833
|
-
market = self.market(sandboxSymbol)
|
2834
|
-
else:
|
2835
|
-
market = self.market(symbol)
|
2782
|
+
market = self.market(symbol)
|
2836
2783
|
request: dict = {
|
2837
2784
|
'symbol': market['id'],
|
2838
2785
|
}
|
@@ -2921,13 +2868,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2921
2868
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
2922
2869
|
"""
|
2923
2870
|
await self.load_markets()
|
2924
|
-
|
2925
|
-
market = None
|
2926
|
-
if sandboxMode:
|
2927
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2928
|
-
market = self.market(sandboxSymbol)
|
2929
|
-
else:
|
2930
|
-
market = self.market(symbol)
|
2871
|
+
market = self.market(symbol)
|
2931
2872
|
request: dict = {
|
2932
2873
|
'symbol': market['id'],
|
2933
2874
|
}
|
@@ -2959,12 +2900,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2959
2900
|
market = None
|
2960
2901
|
if symbols is not None:
|
2961
2902
|
symbol = self.safe_value(symbols, 0)
|
2962
|
-
|
2963
|
-
if sandboxMode:
|
2964
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
2965
|
-
market = self.market(sandboxSymbol)
|
2966
|
-
else:
|
2967
|
-
market = self.market(symbol)
|
2903
|
+
market = self.market(symbol)
|
2968
2904
|
response = None
|
2969
2905
|
request: dict = {}
|
2970
2906
|
type = None
|
@@ -3180,13 +3116,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3180
3116
|
paginate, params = self.handle_option_and_params(params, 'fetchTrades', 'paginate')
|
3181
3117
|
if paginate:
|
3182
3118
|
return await self.fetch_paginated_call_cursor('fetchTrades', symbol, since, limit, params, 'idLessThan', 'idLessThan')
|
3183
|
-
|
3184
|
-
market = None
|
3185
|
-
if sandboxMode:
|
3186
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
3187
|
-
market = self.market(sandboxSymbol)
|
3188
|
-
else:
|
3189
|
-
market = self.market(symbol)
|
3119
|
+
market = self.market(symbol)
|
3190
3120
|
request: dict = {
|
3191
3121
|
'symbol': market['id'],
|
3192
3122
|
}
|
@@ -3481,14 +3411,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
3481
3411
|
paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
|
3482
3412
|
if paginate:
|
3483
3413
|
return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, maxLimitForRecentEndpoint)
|
3484
|
-
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
3485
3414
|
useHistoryEndpoint = self.safe_bool(params, 'useHistoryEndpoint', False)
|
3486
|
-
market =
|
3487
|
-
if sandboxMode:
|
3488
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
3489
|
-
market = self.market(sandboxSymbol)
|
3490
|
-
else:
|
3491
|
-
market = self.market(symbol)
|
3415
|
+
market = self.market(symbol)
|
3492
3416
|
marketType = 'spot' if market['spot'] else 'swap'
|
3493
3417
|
timeframes = self.options['timeframes'][marketType]
|
3494
3418
|
msInDay = 86400000
|
@@ -4292,13 +4216,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4292
4216
|
return self.parse_order(data, market)
|
4293
4217
|
|
4294
4218
|
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
4295
|
-
|
4296
|
-
market = None
|
4297
|
-
if sandboxMode:
|
4298
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4299
|
-
market = self.market(sandboxSymbol)
|
4300
|
-
else:
|
4301
|
-
market = self.market(symbol)
|
4219
|
+
market = self.market(symbol)
|
4302
4220
|
marketType = None
|
4303
4221
|
marginMode = None
|
4304
4222
|
marketType, params = self.handle_market_type_and_params('createOrder', market, params)
|
@@ -4510,13 +4428,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4510
4428
|
raise BadRequest(self.id + ' createOrders() requires all orders to have the same margin mode(isolated or cross)')
|
4511
4429
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
|
4512
4430
|
ordersRequests.append(orderRequest)
|
4513
|
-
|
4514
|
-
market = None
|
4515
|
-
if sandboxMode:
|
4516
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4517
|
-
market = self.market(sandboxSymbol)
|
4518
|
-
else:
|
4519
|
-
market = self.market(symbol)
|
4431
|
+
market = self.market(symbol)
|
4520
4432
|
request: dict = {
|
4521
4433
|
'symbol': market['id'],
|
4522
4434
|
'orderList': ordersRequests,
|
@@ -4600,13 +4512,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4600
4512
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4601
4513
|
"""
|
4602
4514
|
await self.load_markets()
|
4603
|
-
|
4604
|
-
market = None
|
4605
|
-
if sandboxMode:
|
4606
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4607
|
-
market = self.market(sandboxSymbol)
|
4608
|
-
else:
|
4609
|
-
market = self.market(symbol)
|
4515
|
+
market = self.market(symbol)
|
4610
4516
|
request: dict = {
|
4611
4517
|
'orderId': id,
|
4612
4518
|
}
|
@@ -4743,13 +4649,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4743
4649
|
if symbol is None:
|
4744
4650
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
4745
4651
|
await self.load_markets()
|
4746
|
-
|
4747
|
-
market = None
|
4748
|
-
if sandboxMode:
|
4749
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4750
|
-
market = self.market(sandboxSymbol)
|
4751
|
-
else:
|
4752
|
-
market = self.market(symbol)
|
4652
|
+
market = self.market(symbol)
|
4753
4653
|
marginMode = None
|
4754
4654
|
response = None
|
4755
4655
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
|
@@ -4863,13 +4763,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4863
4763
|
if symbol is None:
|
4864
4764
|
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
|
4865
4765
|
await self.load_markets()
|
4866
|
-
|
4867
|
-
market = None
|
4868
|
-
if sandboxMode:
|
4869
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4870
|
-
market = self.market(sandboxSymbol)
|
4871
|
-
else:
|
4872
|
-
market = self.market(symbol)
|
4766
|
+
market = self.market(symbol)
|
4873
4767
|
marginMode = None
|
4874
4768
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrders', params)
|
4875
4769
|
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
@@ -4944,13 +4838,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4944
4838
|
if symbol is None:
|
4945
4839
|
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
4946
4840
|
await self.load_markets()
|
4947
|
-
|
4948
|
-
market = None
|
4949
|
-
if sandboxMode:
|
4950
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
4951
|
-
market = self.market(sandboxSymbol)
|
4952
|
-
else:
|
4953
|
-
market = self.market(symbol)
|
4841
|
+
market = self.market(symbol)
|
4954
4842
|
marginMode = None
|
4955
4843
|
marginMode, params = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
4956
4844
|
request: dict = {
|
@@ -5053,13 +4941,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
5053
4941
|
if symbol is None:
|
5054
4942
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
|
5055
4943
|
await self.load_markets()
|
5056
|
-
|
5057
|
-
market = None
|
5058
|
-
if sandboxMode:
|
5059
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
5060
|
-
market = self.market(sandboxSymbol)
|
5061
|
-
else:
|
5062
|
-
market = self.market(symbol)
|
4944
|
+
market = self.market(symbol)
|
5063
4945
|
request: dict = {
|
5064
4946
|
'orderId': id,
|
5065
4947
|
}
|
@@ -5177,18 +5059,13 @@ class bitget(Exchange, ImplicitAPI):
|
|
5177
5059
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5178
5060
|
"""
|
5179
5061
|
await self.load_markets()
|
5180
|
-
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
5181
5062
|
market = None
|
5182
5063
|
type = None
|
5183
5064
|
request: dict = {}
|
5184
5065
|
marginMode = None
|
5185
5066
|
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
5186
5067
|
if symbol is not None:
|
5187
|
-
|
5188
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
5189
|
-
market = self.market(sandboxSymbol)
|
5190
|
-
else:
|
5191
|
-
market = self.market(symbol)
|
5068
|
+
market = self.market(symbol)
|
5192
5069
|
request['symbol'] = market['id']
|
5193
5070
|
defaultType = self.safe_string_2(self.options, 'fetchOpenOrders', 'defaultType', 'spot')
|
5194
5071
|
marketType = market['type'] if ('type' in market) else defaultType
|
@@ -5515,12 +5392,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
5515
5392
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
5516
5393
|
"""
|
5517
5394
|
await self.load_markets()
|
5518
|
-
sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
5519
5395
|
market = None
|
5520
|
-
if sandboxMode:
|
5521
|
-
if symbol is not None:
|
5522
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
5523
|
-
symbol = sandboxSymbol
|
5524
5396
|
request: dict = {}
|
5525
5397
|
if symbol is not None:
|
5526
5398
|
market = self.market(symbol)
|
@@ -5802,12 +5674,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
5802
5674
|
params = self.omit(params, 'symbol')
|
5803
5675
|
market = None
|
5804
5676
|
if symbol is not None:
|
5805
|
-
|
5806
|
-
if sandboxMode:
|
5807
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
5808
|
-
market = self.market(sandboxSymbol)
|
5809
|
-
else:
|
5810
|
-
market = self.market(symbol)
|
5677
|
+
market = self.market(symbol)
|
5811
5678
|
marketType = None
|
5812
5679
|
marketType, params = self.handle_market_type_and_params('fetchLedger', market, params)
|
5813
5680
|
paginate = False
|
@@ -6012,13 +5879,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6012
5879
|
if symbol is None:
|
6013
5880
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol argument')
|
6014
5881
|
await self.load_markets()
|
6015
|
-
|
6016
|
-
market = None
|
6017
|
-
if sandboxMode:
|
6018
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6019
|
-
market = self.market(sandboxSymbol)
|
6020
|
-
else:
|
6021
|
-
market = self.market(symbol)
|
5882
|
+
market = self.market(symbol)
|
6022
5883
|
marginMode = None
|
6023
5884
|
marginMode, params = self.handle_margin_mode_and_params('fetchMyTrades', params)
|
6024
5885
|
paginate = False
|
@@ -6174,13 +6035,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6174
6035
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
6175
6036
|
"""
|
6176
6037
|
await self.load_markets()
|
6177
|
-
|
6178
|
-
market = None
|
6179
|
-
if sandboxMode:
|
6180
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6181
|
-
market = self.market(sandboxSymbol)
|
6182
|
-
else:
|
6183
|
-
market = self.market(symbol)
|
6038
|
+
market = self.market(symbol)
|
6184
6039
|
productType = None
|
6185
6040
|
productType, params = self.handle_product_type_and_params(market, params)
|
6186
6041
|
request: dict = {
|
@@ -6253,12 +6108,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6253
6108
|
market = None
|
6254
6109
|
if symbols is not None:
|
6255
6110
|
first = self.safe_string(symbols, 0)
|
6256
|
-
|
6257
|
-
if sandboxMode:
|
6258
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(first)
|
6259
|
-
market = self.market(sandboxSymbol)
|
6260
|
-
else:
|
6261
|
-
market = self.market(first)
|
6111
|
+
market = self.market(first)
|
6262
6112
|
productType = None
|
6263
6113
|
productType, params = self.handle_product_type_and_params(market, params)
|
6264
6114
|
request: dict = {
|
@@ -6545,13 +6395,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6545
6395
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingRateHistory', 'paginate')
|
6546
6396
|
if paginate:
|
6547
6397
|
return await self.fetch_paginated_call_incremental('fetchFundingRateHistory', symbol, since, limit, params, 'pageNo', 100)
|
6548
|
-
|
6549
|
-
market = None
|
6550
|
-
if sandboxMode:
|
6551
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6552
|
-
market = self.market(sandboxSymbol)
|
6553
|
-
else:
|
6554
|
-
market = self.market(symbol)
|
6398
|
+
market = self.market(symbol)
|
6555
6399
|
productType = None
|
6556
6400
|
productType, params = self.handle_product_type_and_params(market, params)
|
6557
6401
|
request: dict = {
|
@@ -6605,13 +6449,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6605
6449
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
6606
6450
|
"""
|
6607
6451
|
await self.load_markets()
|
6608
|
-
|
6609
|
-
market = None
|
6610
|
-
if sandboxMode:
|
6611
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6612
|
-
market = self.market(sandboxSymbol)
|
6613
|
-
else:
|
6614
|
-
market = self.market(symbol)
|
6452
|
+
market = self.market(symbol)
|
6615
6453
|
if not market['swap']:
|
6616
6454
|
raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
|
6617
6455
|
productType = None
|
@@ -6653,12 +6491,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6653
6491
|
market = None
|
6654
6492
|
if symbols is not None:
|
6655
6493
|
symbol = self.safe_value(symbols, 0)
|
6656
|
-
|
6657
|
-
if sandboxMode:
|
6658
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6659
|
-
market = self.market(sandboxSymbol)
|
6660
|
-
else:
|
6661
|
-
market = self.market(symbol)
|
6494
|
+
market = self.market(symbol)
|
6662
6495
|
request: dict = {}
|
6663
6496
|
productType = None
|
6664
6497
|
productType, params = self.handle_product_type_and_params(market, params)
|
@@ -6794,13 +6627,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6794
6627
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
|
6795
6628
|
if paginate:
|
6796
6629
|
return await self.fetch_paginated_call_cursor('fetchFundingHistory', symbol, since, limit, params, 'endId', 'idLessThan')
|
6797
|
-
|
6798
|
-
market = None
|
6799
|
-
if sandboxMode:
|
6800
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6801
|
-
market = self.market(sandboxSymbol)
|
6802
|
-
else:
|
6803
|
-
market = self.market(symbol)
|
6630
|
+
market = self.market(symbol)
|
6804
6631
|
if not market['swap']:
|
6805
6632
|
raise BadSymbol(self.id + ' fetchFundingHistory() supports swap contracts only')
|
6806
6633
|
productType = None
|
@@ -6878,18 +6705,15 @@ class bitget(Exchange, ImplicitAPI):
|
|
6878
6705
|
continue
|
6879
6706
|
result.append(self.parse_funding_history(contract, market))
|
6880
6707
|
sorted = self.sort_by(result, 'timestamp')
|
6881
|
-
|
6708
|
+
symbol = None
|
6709
|
+
if market is not None:
|
6710
|
+
symbol = market['symbol']
|
6711
|
+
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
6882
6712
|
|
6883
6713
|
async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
|
6884
6714
|
await self.load_markets()
|
6885
6715
|
holdSide = self.safe_string(params, 'holdSide')
|
6886
|
-
|
6887
|
-
market = None
|
6888
|
-
if sandboxMode:
|
6889
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6890
|
-
market = self.market(sandboxSymbol)
|
6891
|
-
else:
|
6892
|
-
market = self.market(symbol)
|
6716
|
+
market = self.market(symbol)
|
6893
6717
|
productType = None
|
6894
6718
|
productType, params = self.handle_product_type_and_params(market, params)
|
6895
6719
|
request: dict = {
|
@@ -6985,13 +6809,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
6985
6809
|
:returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
|
6986
6810
|
"""
|
6987
6811
|
await self.load_markets()
|
6988
|
-
|
6989
|
-
market = None
|
6990
|
-
if sandboxMode:
|
6991
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
6992
|
-
market = self.market(sandboxSymbol)
|
6993
|
-
else:
|
6994
|
-
market = self.market(symbol)
|
6812
|
+
market = self.market(symbol)
|
6995
6813
|
productType = None
|
6996
6814
|
productType, params = self.handle_product_type_and_params(market, params)
|
6997
6815
|
request: dict = {
|
@@ -7032,12 +6850,15 @@ class bitget(Exchange, ImplicitAPI):
|
|
7032
6850
|
return self.parse_leverage(data, market)
|
7033
6851
|
|
7034
6852
|
def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
|
6853
|
+
isCrossMarginMode = self.safe_string(leverage, 'marginMode') == 'crossed'
|
6854
|
+
longLevKey = 'crossedMarginLeverage' if isCrossMarginMode else 'isolatedLongLever'
|
6855
|
+
shortLevKey = 'crossedMarginLeverage' if isCrossMarginMode else 'isolatedShortLever'
|
7035
6856
|
return {
|
7036
6857
|
'info': leverage,
|
7037
6858
|
'symbol': market['symbol'],
|
7038
|
-
'marginMode': 'isolated',
|
7039
|
-
'longLeverage': self.safe_integer(leverage,
|
7040
|
-
'shortLeverage': self.safe_integer(leverage,
|
6859
|
+
'marginMode': 'cross' if isCrossMarginMode else 'isolated',
|
6860
|
+
'longLeverage': self.safe_integer(leverage, longLevKey),
|
6861
|
+
'shortLeverage': self.safe_integer(leverage, shortLevKey),
|
7041
6862
|
}
|
7042
6863
|
|
7043
6864
|
async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
@@ -7055,13 +6876,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7055
6876
|
if symbol is None:
|
7056
6877
|
raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
|
7057
6878
|
await self.load_markets()
|
7058
|
-
|
7059
|
-
market = None
|
7060
|
-
if sandboxMode:
|
7061
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
7062
|
-
market = self.market(sandboxSymbol)
|
7063
|
-
else:
|
7064
|
-
market = self.market(symbol)
|
6879
|
+
market = self.market(symbol)
|
7065
6880
|
productType = None
|
7066
6881
|
productType, params = self.handle_product_type_and_params(market, params)
|
7067
6882
|
request: dict = {
|
@@ -7108,13 +6923,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7108
6923
|
if (marginMode != 'isolated') and (marginMode != 'crossed'):
|
7109
6924
|
raise ArgumentsRequired(self.id + ' setMarginMode() marginMode must be either isolated or crossed(cross)')
|
7110
6925
|
await self.load_markets()
|
7111
|
-
|
7112
|
-
market = None
|
7113
|
-
if sandboxMode:
|
7114
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
7115
|
-
market = self.market(sandboxSymbol)
|
7116
|
-
else:
|
7117
|
-
market = self.market(symbol)
|
6926
|
+
market = self.market(symbol)
|
7118
6927
|
productType = None
|
7119
6928
|
productType, params = self.handle_product_type_and_params(market, params)
|
7120
6929
|
request: dict = {
|
@@ -7156,12 +6965,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7156
6965
|
posMode = 'hedge_mode' if hedged else 'one_way_mode'
|
7157
6966
|
market = None
|
7158
6967
|
if symbol is not None:
|
7159
|
-
|
7160
|
-
if sandboxMode:
|
7161
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
7162
|
-
market = self.market(sandboxSymbol)
|
7163
|
-
else:
|
7164
|
-
market = self.market(symbol)
|
6968
|
+
market = self.market(symbol)
|
7165
6969
|
productType = None
|
7166
6970
|
productType, params = self.handle_product_type_and_params(market, params)
|
7167
6971
|
request: dict = {
|
@@ -7192,13 +6996,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7192
6996
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
7193
6997
|
"""
|
7194
6998
|
await self.load_markets()
|
7195
|
-
|
7196
|
-
market = None
|
7197
|
-
if sandboxMode:
|
7198
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
7199
|
-
market = self.market(sandboxSymbol)
|
7200
|
-
else:
|
7201
|
-
market = self.market(symbol)
|
6999
|
+
market = self.market(symbol)
|
7202
7000
|
if not market['contract']:
|
7203
7001
|
raise BadRequest(self.id + ' fetchOpenInterest() supports contract markets only')
|
7204
7002
|
productType = None
|
@@ -8198,13 +7996,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
8198
7996
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
8199
7997
|
"""
|
8200
7998
|
await self.load_markets()
|
8201
|
-
|
8202
|
-
market = None
|
8203
|
-
if sandboxMode:
|
8204
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
8205
|
-
market = self.market(sandboxSymbol)
|
8206
|
-
else:
|
8207
|
-
market = self.market(symbol)
|
7999
|
+
market = self.market(symbol)
|
8208
8000
|
productType = None
|
8209
8001
|
productType, params = self.handle_product_type_and_params(market, params)
|
8210
8002
|
request: dict = {
|
@@ -8284,13 +8076,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
8284
8076
|
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
8285
8077
|
"""
|
8286
8078
|
await self.load_markets()
|
8287
|
-
|
8288
|
-
market = None
|
8289
|
-
if sandboxMode:
|
8290
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
8291
|
-
market = self.market(sandboxSymbol)
|
8292
|
-
else:
|
8293
|
-
market = self.market(symbol)
|
8079
|
+
market = self.market(symbol)
|
8294
8080
|
productType = None
|
8295
8081
|
productType, params = self.handle_product_type_and_params(market, params)
|
8296
8082
|
request: dict = {
|
@@ -8679,13 +8465,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
8679
8465
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
8680
8466
|
"""
|
8681
8467
|
await self.load_markets()
|
8682
|
-
|
8683
|
-
market = None
|
8684
|
-
if sandboxMode:
|
8685
|
-
sandboxSymbol = self.convert_symbol_for_sandbox(symbol)
|
8686
|
-
market = self.market(sandboxSymbol)
|
8687
|
-
else:
|
8688
|
-
market = self.market(symbol)
|
8468
|
+
market = self.market(symbol)
|
8689
8469
|
productType = None
|
8690
8470
|
productType, params = self.handle_product_type_and_params(market, params)
|
8691
8471
|
request: dict = {
|
@@ -8865,10 +8645,12 @@ class bitget(Exchange, ImplicitAPI):
|
|
8865
8645
|
}
|
8866
8646
|
if method == 'POST':
|
8867
8647
|
headers['Content-Type'] = 'application/json'
|
8868
|
-
sandboxMode = self.
|
8648
|
+
sandboxMode = self.safe_bool_2(self.options, 'sandboxMode', 'sandbox', False)
|
8869
8649
|
if sandboxMode and (path != 'v2/public/time'):
|
8870
8650
|
# https://github.com/ccxt/ccxt/issues/25252#issuecomment-2662742336
|
8871
8651
|
if headers is None:
|
8872
8652
|
headers = {}
|
8873
|
-
|
8653
|
+
productType = self.safe_string(params, 'productType')
|
8654
|
+
if (productType != 'SCOIN-FUTURES') and (productType != 'SUSDT-FUTURES') and (productType != 'SUSDC-FUTURES'):
|
8655
|
+
headers['PAPTRADING'] = '1'
|
8874
8656
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
ccxt/async_support/bitmart.py
CHANGED
@@ -61,6 +61,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
61
61
|
'createOrder': True,
|
62
62
|
'createOrders': True,
|
63
63
|
'createPostOnlyOrder': True,
|
64
|
+
'createReduceOnlyOrder': True,
|
64
65
|
'createStopLimitOrder': False,
|
65
66
|
'createStopMarketOrder': False,
|
66
67
|
'createStopOrder': False,
|
@@ -278,6 +279,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
278
279
|
'contract/private/submit-tp-sl-order': 2.5,
|
279
280
|
'contract/private/modify-plan-order': 2.5,
|
280
281
|
'contract/private/modify-preset-plan-order': 2.5,
|
282
|
+
'contract/private/modify-limit-order': 2.5,
|
281
283
|
'contract/private/modify-tp-sl-order': 2.5,
|
282
284
|
'contract/private/submit-trail-order': 2.5, # weight is not provided by the exchange, is set order
|
283
285
|
'contract/private/cancel-trail-order': 1.5, # weight is not provided by the exchange, is set order
|
@@ -4875,6 +4877,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4875
4877
|
https://developer-pro.bitmart.com/en/futuresv2/#modify-plan-order-signed
|
4876
4878
|
https://developer-pro.bitmart.com/en/futuresv2/#modify-tp-sl-order-signed
|
4877
4879
|
https://developer-pro.bitmart.com/en/futuresv2/#modify-preset-plan-order-signed
|
4880
|
+
https://developer-pro.bitmart.com/en/futuresv2/#modify-limit-order-signed
|
4878
4881
|
|
4879
4882
|
:param str id: order id
|
4880
4883
|
:param str symbol: unified symbol of the market to edit an order in
|
@@ -4909,6 +4912,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4909
4912
|
isTakeProfit = takeProfitPrice is not None
|
4910
4913
|
isPresetStopLoss = presetStopLoss is not None
|
4911
4914
|
isPresetTakeProfit = presetTakeProfit is not None
|
4915
|
+
isLimitOrder = (type == 'limit')
|
4912
4916
|
request: dict = {
|
4913
4917
|
'symbol': market['id'],
|
4914
4918
|
}
|
@@ -4973,8 +4977,15 @@ class bitmart(Exchange, ImplicitAPI):
|
|
4973
4977
|
# "trace": "a5c3234534534a836bc476a203.123452.172716624359200197"
|
4974
4978
|
# }
|
4975
4979
|
#
|
4980
|
+
elif isLimitOrder:
|
4981
|
+
request['order_id'] = self.parse_to_int(id) # reparse id self endpoint is the only one requiring it
|
4982
|
+
if amount is not None:
|
4983
|
+
request['size'] = self.amount_to_precision(symbol, amount)
|
4984
|
+
if price is not None:
|
4985
|
+
request['price'] = self.price_to_precision(symbol, price)
|
4986
|
+
response = await self.privatePostContractPrivateModifyLimitOrder(self.extend(request, params))
|
4976
4987
|
else:
|
4977
|
-
raise NotSupported(self.id + ' editOrder() only supports trigger, stop loss and take profit orders')
|
4988
|
+
raise NotSupported(self.id + ' editOrder() only supports limit, trigger, stop loss and take profit orders')
|
4978
4989
|
data = self.safe_dict(response, 'data', {})
|
4979
4990
|
return self.parse_order(data, market)
|
4980
4991
|
|
ccxt/async_support/bitopro.py
CHANGED
ccxt/async_support/bitrue.py
CHANGED
@@ -57,6 +57,7 @@ class bitrue(Exchange, ImplicitAPI):
|
|
57
57
|
'createMarketOrderWithCost': False,
|
58
58
|
'createMarketSellOrderWithCost': False,
|
59
59
|
'createOrder': True,
|
60
|
+
'createReduceOnlyOrder': True,
|
60
61
|
'createStopLimitOrder': True,
|
61
62
|
'createStopMarketOrder': True,
|
62
63
|
'createStopOrder': True,
|