ccxt 4.4.73__py2.py3-none-any.whl → 4.4.75__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.
Files changed (57) hide show
  1. ccxt/__init__.py +1 -5
  2. ccxt/abstract/bitmart.py +2 -0
  3. ccxt/abstract/coinlist.py +3 -0
  4. ccxt/ace.py +3 -0
  5. ccxt/alpaca.py +3 -0
  6. ccxt/ascendex.py +6 -0
  7. ccxt/async_support/__init__.py +1 -5
  8. ccxt/async_support/ace.py +3 -0
  9. ccxt/async_support/alpaca.py +3 -0
  10. ccxt/async_support/ascendex.py +6 -0
  11. ccxt/async_support/base/exchange.py +1 -1
  12. ccxt/async_support/bequant.py +1 -0
  13. ccxt/async_support/binanceusdm.py +1 -1
  14. ccxt/async_support/bit2c.py +26 -0
  15. ccxt/async_support/bitbank.py +32 -0
  16. ccxt/async_support/bitbns.py +1 -1
  17. ccxt/async_support/bitflyer.py +1 -0
  18. ccxt/async_support/bithumb.py +34 -0
  19. ccxt/async_support/bitmart.py +70 -6
  20. ccxt/async_support/bitopro.py +37 -0
  21. ccxt/async_support/blofin.py +1 -1
  22. ccxt/async_support/bybit.py +10 -1
  23. ccxt/async_support/coinlist.py +86 -11
  24. ccxt/async_support/deribit.py +19 -0
  25. ccxt/async_support/gate.py +11 -7
  26. ccxt/async_support/hitbtc.py +7 -1
  27. ccxt/async_support/okx.py +28 -24
  28. ccxt/base/exchange.py +33 -14
  29. ccxt/bequant.py +1 -0
  30. ccxt/binanceusdm.py +1 -1
  31. ccxt/bit2c.py +26 -0
  32. ccxt/bitbank.py +32 -0
  33. ccxt/bitbns.py +1 -1
  34. ccxt/bitflyer.py +1 -0
  35. ccxt/bithumb.py +34 -0
  36. ccxt/bitmart.py +70 -6
  37. ccxt/bitopro.py +37 -0
  38. ccxt/blofin.py +1 -1
  39. ccxt/bybit.py +10 -1
  40. ccxt/coinlist.py +86 -11
  41. ccxt/deribit.py +19 -0
  42. ccxt/gate.py +11 -7
  43. ccxt/hitbtc.py +7 -1
  44. ccxt/okx.py +28 -24
  45. ccxt/pro/__init__.py +1 -5
  46. ccxt/pro/ascendex.py +1 -1
  47. ccxt/pro/bingx.py +9 -1
  48. ccxt/pro/bitget.py +9 -1
  49. ccxt/pro/bitmart.py +9 -1
  50. ccxt/pro/bitopro.py +5 -4
  51. {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/METADATA +5 -5
  52. {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/RECORD +55 -57
  53. ccxt/abstract/bitcoincom.py +0 -115
  54. ccxt/abstract/bitpanda.py +0 -23
  55. {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/LICENSE.txt +0 -0
  56. {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/WHEEL +0 -0
  57. {ccxt-4.4.73.dist-info → ccxt-4.4.75.dist-info}/top_level.txt +0 -0
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.73'
7
+ __version__ = '4.4.75'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2913,9 +2913,6 @@ class Exchange(object):
2913
2913
 
2914
2914
  def safe_currency_structure(self, currency: object):
2915
2915
  # derive data from networks: deposit, withdraw, active, fee, limits, precision
2916
- currencyDeposit = self.safe_bool(currency, 'deposit')
2917
- currencyWithdraw = self.safe_bool(currency, 'withdraw')
2918
- currencyActive = self.safe_bool(currency, 'active')
2919
2916
  networks = self.safe_dict(currency, 'networks', {})
2920
2917
  keys = list(networks.keys())
2921
2918
  length = len(keys)
@@ -2924,20 +2921,24 @@ class Exchange(object):
2924
2921
  key = keys[i]
2925
2922
  network = networks[key]
2926
2923
  deposit = self.safe_bool(network, 'deposit')
2924
+ currencyDeposit = self.safe_bool(currency, 'deposit')
2927
2925
  if currencyDeposit is None or deposit:
2928
2926
  currency['deposit'] = deposit
2929
2927
  withdraw = self.safe_bool(network, 'withdraw')
2928
+ currencyWithdraw = self.safe_bool(currency, 'withdraw')
2930
2929
  if currencyWithdraw is None or withdraw:
2931
2930
  currency['withdraw'] = withdraw
2932
- active = self.safe_bool(network, 'active')
2933
- if currencyActive is None or active:
2934
- currency['active'] = active
2935
2931
  # set network 'active' to False if D or W is disabled
2936
- if self.safe_bool(network, 'active') is None:
2932
+ active = self.safe_bool(network, 'active')
2933
+ if active is None:
2937
2934
  if deposit and withdraw:
2938
2935
  currency['networks'][key]['active'] = True
2939
2936
  elif deposit is not None and withdraw is not None:
2940
2937
  currency['networks'][key]['active'] = False
2938
+ active = self.safe_bool(network, 'active')
2939
+ currencyActive = self.safe_bool(currency, 'active')
2940
+ if currencyActive is None or active:
2941
+ currency['active'] = active
2941
2942
  # find lowest fee(which is more desired)
2942
2943
  fee = self.safe_string(network, 'fee')
2943
2944
  feeMain = self.safe_string(currency, 'fee')
@@ -6472,18 +6473,36 @@ class Exchange(object):
6472
6473
  return result
6473
6474
 
6474
6475
  def remove_repeated_elements_from_array(self, input, fallbackToTimestamp: bool = True):
6475
- uniqueResult = {}
6476
+ uniqueDic = {}
6477
+ uniqueResult = []
6476
6478
  for i in range(0, len(input)):
6477
6479
  entry = input[i]
6478
6480
  uniqValue = self.safe_string_n(entry, ['id', 'timestamp', 0]) if fallbackToTimestamp else self.safe_string(entry, 'id')
6479
- if uniqValue is not None and not (uniqValue in uniqueResult):
6480
- uniqueResult[uniqValue] = entry
6481
- values = list(uniqueResult.values())
6482
- valuesLength = len(values)
6481
+ if uniqValue is not None and not (uniqValue in uniqueDic):
6482
+ uniqueDic[uniqValue] = 1
6483
+ uniqueResult.append(entry)
6484
+ valuesLength = len(uniqueResult)
6483
6485
  if valuesLength > 0:
6484
- return values
6486
+ return uniqueResult
6485
6487
  return input
6486
6488
 
6489
+ def remove_repeated_trades_from_array(self, input):
6490
+ uniqueResult = {}
6491
+ for i in range(0, len(input)):
6492
+ entry = input[i]
6493
+ id = self.safe_string(entry, 'id')
6494
+ if id is None:
6495
+ price = self.safe_string(entry, 'price')
6496
+ amount = self.safe_string(entry, 'amount')
6497
+ timestamp = self.safe_string(entry, 'timestamp')
6498
+ side = self.safe_string(entry, 'side')
6499
+ # unique trade identifier
6500
+ id = 't_' + str(timestamp) + '_' + side + '_' + price + '_' + amount
6501
+ if id is not None and not (id in uniqueResult):
6502
+ uniqueResult[id] = entry
6503
+ values = list(uniqueResult.values())
6504
+ return values
6505
+
6487
6506
  def handle_until_option(self, key: str, request, params, multiplier=1):
6488
6507
  until = self.safe_integer_2(params, 'until', 'till')
6489
6508
  if until is not None:
ccxt/bequant.py CHANGED
@@ -19,6 +19,7 @@ class bequant(hitbtc, ImplicitAPI):
19
19
  'urls': {
20
20
  'logo': 'https://github.com/user-attachments/assets/0583ef1f-29fe-4b7c-8189-63565a0e2867',
21
21
  'api': {
22
+ # v3
22
23
  'public': 'https://api.bequant.io/api/3',
23
24
  'private': 'https://api.bequant.io/api/3',
24
25
  },
ccxt/binanceusdm.py CHANGED
@@ -36,7 +36,7 @@ class binanceusdm(binance, ImplicitAPI):
36
36
  'fetchMarkets': ['linear'],
37
37
  'defaultSubType': 'linear',
38
38
  # https://www.binance.com/en/support/faq/360033162192
39
- # tier amount, maintenance margin, initial margin
39
+ # tier amount, maintenance margin, initial margin,
40
40
  'leverageBrackets': None,
41
41
  'marginTypes': {},
42
42
  'marginModes': {},
ccxt/bit2c.py CHANGED
@@ -36,36 +36,61 @@ class bit2c(Exchange, ImplicitAPI):
36
36
  'future': False,
37
37
  'option': False,
38
38
  'addMargin': False,
39
+ 'borrowCrossMargin': False,
40
+ 'borrowIsolatedMargin': False,
41
+ 'borrowMargin': False,
39
42
  'cancelAllOrders': False,
40
43
  'cancelOrder': True,
41
44
  'closeAllPositions': False,
42
45
  'closePosition': False,
43
46
  'createOrder': True,
47
+ 'createOrderWithTakeProfitAndStopLoss': False,
48
+ 'createOrderWithTakeProfitAndStopLossWs': False,
44
49
  'createReduceOnlyOrder': False,
45
50
  'fetchBalance': True,
51
+ 'fetchBorrowInterest': False,
52
+ 'fetchBorrowRate': False,
46
53
  'fetchBorrowRateHistories': False,
47
54
  'fetchBorrowRateHistory': False,
55
+ 'fetchBorrowRates': False,
56
+ 'fetchBorrowRatesPerSymbol': False,
48
57
  'fetchCrossBorrowRate': False,
49
58
  'fetchCrossBorrowRates': False,
50
59
  'fetchDepositAddress': True,
51
60
  'fetchDepositAddresses': False,
52
61
  'fetchDepositAddressesByNetwork': False,
53
62
  'fetchFundingHistory': False,
63
+ 'fetchFundingInterval': False,
64
+ 'fetchFundingIntervals': False,
54
65
  'fetchFundingRate': False,
55
66
  'fetchFundingRateHistory': False,
56
67
  'fetchFundingRates': False,
68
+ 'fetchGreeks': False,
57
69
  'fetchIndexOHLCV': False,
58
70
  'fetchIsolatedBorrowRate': False,
59
71
  'fetchIsolatedBorrowRates': False,
72
+ 'fetchIsolatedPositions': False,
60
73
  'fetchLeverage': False,
74
+ 'fetchLeverages': False,
61
75
  'fetchLeverageTiers': False,
76
+ 'fetchLiquidations': False,
77
+ 'fetchLongShortRatio': False,
78
+ 'fetchLongShortRatioHistory': False,
79
+ 'fetchMarginAdjustmentHistory': False,
62
80
  'fetchMarginMode': False,
81
+ 'fetchMarginModes': False,
82
+ 'fetchMarketLeverageTiers': False,
63
83
  'fetchMarkOHLCV': False,
84
+ 'fetchMarkPrices': False,
85
+ 'fetchMyLiquidations': False,
86
+ 'fetchMySettlementHistory': False,
64
87
  'fetchMyTrades': True,
65
88
  'fetchOpenInterest': False,
66
89
  'fetchOpenInterestHistory': False,
67
90
  'fetchOpenInterests': False,
68
91
  'fetchOpenOrders': True,
92
+ 'fetchOption': False,
93
+ 'fetchOptionChain': False,
69
94
  'fetchOrder': True,
70
95
  'fetchOrderBook': True,
71
96
  'fetchPosition': False,
@@ -84,6 +109,7 @@ class bit2c(Exchange, ImplicitAPI):
84
109
  'fetchTransfer': False,
85
110
  'fetchTransfers': False,
86
111
  'fetchUnderlyingAssets': False,
112
+ 'fetchVolatilityHistory': False,
87
113
  'reduceMargin': False,
88
114
  'repayCrossMargin': False,
89
115
  'repayIsolatedMargin': False,
ccxt/bitbank.py CHANGED
@@ -34,35 +34,62 @@ class bitbank(Exchange, ImplicitAPI):
34
34
  'future': False,
35
35
  'option': False,
36
36
  'addMargin': False,
37
+ 'borrowCrossMargin': False,
38
+ 'borrowIsolatedMargin': False,
39
+ 'borrowMargin': False,
37
40
  'cancelAllOrders': False,
38
41
  'cancelOrder': True,
39
42
  'closeAllPositions': False,
40
43
  'closePosition': False,
41
44
  'createOrder': True,
45
+ 'createOrderWithTakeProfitAndStopLoss': False,
46
+ 'createOrderWithTakeProfitAndStopLossWs': False,
42
47
  'createReduceOnlyOrder': False,
43
48
  'fetchBalance': True,
49
+ 'fetchBorrowInterest': False,
50
+ 'fetchBorrowRate': False,
44
51
  'fetchBorrowRateHistories': False,
45
52
  'fetchBorrowRateHistory': False,
53
+ 'fetchBorrowRates': False,
54
+ 'fetchBorrowRatesPerSymbol': False,
46
55
  'fetchCrossBorrowRate': False,
47
56
  'fetchCrossBorrowRates': False,
48
57
  'fetchDepositAddress': True,
49
58
  'fetchDepositAddresses': False,
50
59
  'fetchDepositAddressesByNetwork': False,
51
60
  'fetchFundingHistory': False,
61
+ 'fetchFundingInterval': False,
62
+ 'fetchFundingIntervals': False,
52
63
  'fetchFundingRate': False,
53
64
  'fetchFundingRateHistory': False,
54
65
  'fetchFundingRates': False,
66
+ 'fetchGreeks': False,
55
67
  'fetchIndexOHLCV': False,
56
68
  'fetchIsolatedBorrowRate': False,
57
69
  'fetchIsolatedBorrowRates': False,
70
+ 'fetchIsolatedPositions': False,
58
71
  'fetchLeverage': False,
72
+ 'fetchLeverages': False,
59
73
  'fetchLeverageTiers': False,
74
+ 'fetchLiquidations': False,
75
+ 'fetchLongShortRatio': False,
76
+ 'fetchLongShortRatioHistory': False,
77
+ 'fetchMarginAdjustmentHistory': False,
60
78
  'fetchMarginMode': False,
79
+ 'fetchMarginModes': False,
80
+ 'fetchMarketLeverageTiers': False,
61
81
  'fetchMarkOHLCV': False,
82
+ 'fetchMarkPrices': False,
83
+ 'fetchMyLiquidations': False,
84
+ 'fetchMySettlementHistory': False,
62
85
  'fetchMyTrades': True,
63
86
  'fetchOHLCV': True,
87
+ 'fetchOpenInterest': False,
64
88
  'fetchOpenInterestHistory': False,
89
+ 'fetchOpenInterests': False,
65
90
  'fetchOpenOrders': True,
91
+ 'fetchOption': False,
92
+ 'fetchOptionChain': False,
66
93
  'fetchOrder': True,
67
94
  'fetchOrderBook': True,
68
95
  'fetchPosition': False,
@@ -73,14 +100,19 @@ class bitbank(Exchange, ImplicitAPI):
73
100
  'fetchPositionsHistory': False,
74
101
  'fetchPositionsRisk': False,
75
102
  'fetchPremiumIndexOHLCV': False,
103
+ 'fetchSettlementHistory': False,
76
104
  'fetchTicker': True,
77
105
  'fetchTrades': True,
78
106
  'fetchTradingFee': False,
79
107
  'fetchTradingFees': True,
80
108
  'fetchTransfer': False,
81
109
  'fetchTransfers': False,
110
+ 'fetchVolatilityHistory': False,
82
111
  'reduceMargin': False,
112
+ 'repayCrossMargin': False,
113
+ 'repayIsolatedMargin': False,
83
114
  'setLeverage': False,
115
+ 'setMargin': False,
84
116
  'setMarginMode': False,
85
117
  'setPositionMode': False,
86
118
  'transfer': False,
ccxt/bitbns.py CHANGED
@@ -315,7 +315,7 @@ class bitbns(Exchange, ImplicitAPI):
315
315
  'swap': False,
316
316
  'future': False,
317
317
  'option': False,
318
- 'active': None,
318
+ 'active': self.safe_bool(market, 'active'),
319
319
  'contract': False,
320
320
  'linear': None,
321
321
  'inverse': None,
ccxt/bitflyer.py CHANGED
@@ -250,6 +250,7 @@ class bitflyer(Exchange, ImplicitAPI):
250
250
  # {"product_code": "BCH_BTC", "market_type": "Spot"},
251
251
  # # forex swap
252
252
  # {"product_code": "FX_BTC_JPY", "market_type": "FX"},
253
+ #
253
254
  # # future
254
255
  # {
255
256
  # "product_code": "BTCJPY11FEB2022",
ccxt/bithumb.py CHANGED
@@ -39,30 +39,59 @@ class bithumb(Exchange, ImplicitAPI):
39
39
  'future': False,
40
40
  'option': False,
41
41
  'addMargin': False,
42
+ 'borrowCrossMargin': False,
43
+ 'borrowIsolatedMargin': False,
44
+ 'borrowMargin': False,
42
45
  'cancelOrder': True,
43
46
  'closeAllPositions': False,
44
47
  'closePosition': False,
45
48
  'createMarketOrder': True,
46
49
  'createOrder': True,
50
+ 'createOrderWithTakeProfitAndStopLoss': False,
51
+ 'createOrderWithTakeProfitAndStopLossWs': False,
47
52
  'createReduceOnlyOrder': False,
48
53
  'fetchBalance': True,
54
+ 'fetchBorrowInterest': False,
55
+ 'fetchBorrowRate': False,
49
56
  'fetchBorrowRateHistories': False,
50
57
  'fetchBorrowRateHistory': False,
58
+ 'fetchBorrowRates': False,
59
+ 'fetchBorrowRatesPerSymbol': False,
51
60
  'fetchCrossBorrowRate': False,
52
61
  'fetchCrossBorrowRates': False,
53
62
  'fetchFundingHistory': False,
63
+ 'fetchFundingInterval': False,
64
+ 'fetchFundingIntervals': False,
54
65
  'fetchFundingRate': False,
55
66
  'fetchFundingRateHistory': False,
56
67
  'fetchFundingRates': False,
68
+ 'fetchGreeks': False,
57
69
  'fetchIndexOHLCV': False,
58
70
  'fetchIsolatedBorrowRate': False,
59
71
  'fetchIsolatedBorrowRates': False,
72
+ 'fetchIsolatedPositions': False,
60
73
  'fetchLeverage': False,
74
+ 'fetchLeverages': False,
75
+ 'fetchLeverageTiers': False,
76
+ 'fetchLiquidations': False,
77
+ 'fetchLongShortRatio': False,
78
+ 'fetchLongShortRatioHistory': False,
79
+ 'fetchMarginAdjustmentHistory': False,
80
+ 'fetchMarginMode': False,
81
+ 'fetchMarginModes': False,
82
+ 'fetchMarketLeverageTiers': False,
61
83
  'fetchMarkets': True,
62
84
  'fetchMarkOHLCV': False,
85
+ 'fetchMarkPrices': False,
86
+ 'fetchMyLiquidations': False,
87
+ 'fetchMySettlementHistory': False,
63
88
  'fetchOHLCV': True,
89
+ 'fetchOpenInterest': False,
64
90
  'fetchOpenInterestHistory': False,
91
+ 'fetchOpenInterests': False,
65
92
  'fetchOpenOrders': True,
93
+ 'fetchOption': False,
94
+ 'fetchOptionChain': False,
66
95
  'fetchOrder': True,
67
96
  'fetchOrderBook': True,
68
97
  'fetchPosition': False,
@@ -73,13 +102,18 @@ class bithumb(Exchange, ImplicitAPI):
73
102
  'fetchPositionsHistory': False,
74
103
  'fetchPositionsRisk': False,
75
104
  'fetchPremiumIndexOHLCV': False,
105
+ 'fetchSettlementHistory': False,
76
106
  'fetchTicker': True,
77
107
  'fetchTickers': True,
78
108
  'fetchTrades': True,
79
109
  'fetchTransfer': False,
80
110
  'fetchTransfers': False,
111
+ 'fetchVolatilityHistory': False,
81
112
  'reduceMargin': False,
113
+ 'repayCrossMargin': False,
114
+ 'repayIsolatedMargin': False,
82
115
  'setLeverage': False,
116
+ 'setMargin': False,
83
117
  'setMarginMode': False,
84
118
  'setPositionMode': False,
85
119
  'transfer': False,
ccxt/bitmart.py CHANGED
@@ -104,7 +104,7 @@ class bitmart(Exchange, ImplicitAPI):
104
104
  'fetchOrders': False,
105
105
  'fetchOrderTrades': True,
106
106
  'fetchPosition': True,
107
- 'fetchPositionMode': False,
107
+ 'fetchPositionMode': True,
108
108
  'fetchPositions': True,
109
109
  'fetchStatus': True,
110
110
  'fetchTicker': True,
@@ -126,6 +126,7 @@ class bitmart(Exchange, ImplicitAPI):
126
126
  'repayIsolatedMargin': True,
127
127
  'setLeverage': True,
128
128
  'setMarginMode': False,
129
+ 'setPositionMode': True,
129
130
  'transfer': True,
130
131
  'withdraw': True,
131
132
  },
@@ -231,6 +232,7 @@ class bitmart(Exchange, ImplicitAPI):
231
232
  'contract/private/affilate/rebate-list': 10,
232
233
  'contract/private/affilate/trade-list': 10,
233
234
  'contract/private/transaction-history': 10,
235
+ 'contract/private/get-position-mode': 1,
234
236
  },
235
237
  'post': {
236
238
  # sub-account endpoints
@@ -283,6 +285,7 @@ class bitmart(Exchange, ImplicitAPI):
283
285
  'contract/private/modify-tp-sl-order': 2.5,
284
286
  'contract/private/submit-trail-order': 2.5, # weight is not provided by the exchange, is set order
285
287
  'contract/private/cancel-trail-order': 1.5, # weight is not provided by the exchange, is set order
288
+ 'contract/private/set-position-mode': 1,
286
289
  },
287
290
  },
288
291
  },
@@ -1205,7 +1208,7 @@ class bitmart(Exchange, ImplicitAPI):
1205
1208
  # {
1206
1209
  # "message": "OK",
1207
1210
  # "code": 1000,
1208
- # "trace": "619294ecef584282b26a3be322b1e01f.66.17403093228242228",
1211
+ # "trace": "619294ecef584282b26a3be322b1e01f.66.17403093228242229",
1209
1212
  # "data": {
1210
1213
  # "currencies": [
1211
1214
  # {
@@ -3847,10 +3850,11 @@ class bitmart(Exchange, ImplicitAPI):
3847
3850
  timestamp = self.safe_integer(transaction, 'apply_time')
3848
3851
  currencyId = self.safe_string(transaction, 'currency')
3849
3852
  networkId: Str = None
3850
- if currencyId.find('NFT') < 0:
3851
- parts = currencyId.split('-')
3852
- currencyId = self.safe_string(parts, 0)
3853
- networkId = self.safe_string(parts, 1)
3853
+ if currencyId is not None:
3854
+ if currencyId.find('NFT') < 0:
3855
+ parts = currencyId.split('-')
3856
+ currencyId = self.safe_string(parts, 0)
3857
+ networkId = self.safe_string(parts, 1)
3854
3858
  code = self.safe_currency_code(currencyId, currency)
3855
3859
  status = self.parse_transaction_status(self.safe_string(transaction, 'status'))
3856
3860
  feeCost = self.safe_number(transaction, 'fee')
@@ -5212,6 +5216,66 @@ class bitmart(Exchange, ImplicitAPI):
5212
5216
  addresses.append(address)
5213
5217
  return addresses
5214
5218
 
5219
+ def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
5220
+ """
5221
+ set hedged to True or False for a market
5222
+
5223
+ https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
5224
+
5225
+ :param bool hedged: set to True to use dualSidePosition
5226
+ :param str symbol: not used by bingx setPositionMode()
5227
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5228
+ :returns dict: response from the exchange
5229
+ """
5230
+ self.load_markets()
5231
+ positionMode = None
5232
+ if hedged:
5233
+ positionMode = 'hedge_mode'
5234
+ else:
5235
+ positionMode = 'one_way_mode'
5236
+ request: dict = {
5237
+ 'position_mode': positionMode,
5238
+ }
5239
+ #
5240
+ # {
5241
+ # "code": 1000,
5242
+ # "trace": "0cc6f4c4-8b8c-4253-8e90-8d3195aa109c",
5243
+ # "message": "Ok",
5244
+ # "data": {
5245
+ # "position_mode":"one_way_mode"
5246
+ # }
5247
+ # }
5248
+ #
5249
+ return self.privatePostContractPrivateSetPositionMode(self.extend(request, params))
5250
+
5251
+ def fetch_position_mode(self, symbol: Str = None, params={}):
5252
+ """
5253
+ fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
5254
+
5255
+ https://developer-pro.bitmart.com/en/futuresv2/#get-position-mode-keyed
5256
+
5257
+ :param str symbol: not used
5258
+ :param dict [params]: extra parameters specific to the exchange API endpoint
5259
+ :returns dict: an object detailing whether the market is in hedged or one-way mode
5260
+ """
5261
+ response = self.privateGetContractPrivateGetPositionMode(params)
5262
+ #
5263
+ # {
5264
+ # "code": 1000,
5265
+ # "trace": "0cc6f4c4-8b8c-4253-8e90-8d3195aa109c",
5266
+ # "message": "Ok",
5267
+ # "data": {
5268
+ # "position_mode":"one_way_mode"
5269
+ # }
5270
+ # }
5271
+ #
5272
+ data = self.safe_dict(response, 'data')
5273
+ positionMode = self.safe_string(data, 'position_mode')
5274
+ return {
5275
+ 'info': response,
5276
+ 'hedged': (positionMode == 'hedge_mode'),
5277
+ }
5278
+
5215
5279
  def nonce(self):
5216
5280
  return self.milliseconds() - self.options['timeDifference']
5217
5281
 
ccxt/bitopro.py CHANGED
@@ -36,19 +36,29 @@ class bitopro(Exchange, ImplicitAPI):
36
36
  'swap': False,
37
37
  'future': False,
38
38
  'option': False,
39
+ 'addMargin': False,
40
+ 'borrowCrossMargin': False,
41
+ 'borrowIsolatedMargin': False,
42
+ 'borrowMargin': False,
39
43
  'cancelAllOrders': True,
40
44
  'cancelOrder': True,
41
45
  'cancelOrders': True,
42
46
  'closeAllPositions': False,
43
47
  'closePosition': False,
44
48
  'createOrder': True,
49
+ 'createOrderWithTakeProfitAndStopLoss': False,
50
+ 'createOrderWithTakeProfitAndStopLossWs': False,
45
51
  'createReduceOnlyOrder': False,
46
52
  'createStopOrder': True,
47
53
  'createTriggerOrder': True,
48
54
  'editOrder': False,
49
55
  'fetchBalance': True,
56
+ 'fetchBorrowInterest': False,
57
+ 'fetchBorrowRate': False,
50
58
  'fetchBorrowRateHistories': False,
51
59
  'fetchBorrowRateHistory': False,
60
+ 'fetchBorrowRates': False,
61
+ 'fetchBorrowRatesPerSymbol': False,
52
62
  'fetchClosedOrders': True,
53
63
  'fetchCrossBorrowRate': False,
54
64
  'fetchCrossBorrowRates': False,
@@ -59,19 +69,39 @@ class bitopro(Exchange, ImplicitAPI):
59
69
  'fetchDepositWithdrawFee': 'emulated',
60
70
  'fetchDepositWithdrawFees': True,
61
71
  'fetchFundingHistory': False,
72
+ 'fetchFundingInterval': False,
73
+ 'fetchFundingIntervals': False,
62
74
  'fetchFundingRate': False,
63
75
  'fetchFundingRateHistory': False,
64
76
  'fetchFundingRates': False,
77
+ 'fetchGreeks': False,
65
78
  'fetchIndexOHLCV': False,
66
79
  'fetchIsolatedBorrowRate': False,
67
80
  'fetchIsolatedBorrowRates': False,
81
+ 'fetchIsolatedPositions': False,
82
+ 'fetchLeverage': False,
83
+ 'fetchLeverages': False,
84
+ 'fetchLeverageTiers': False,
85
+ 'fetchLiquidations': False,
86
+ 'fetchLongShortRatio': False,
87
+ 'fetchLongShortRatioHistory': False,
88
+ 'fetchMarginAdjustmentHistory': False,
68
89
  'fetchMarginMode': False,
90
+ 'fetchMarginModes': False,
91
+ 'fetchMarketLeverageTiers': False,
69
92
  'fetchMarkets': True,
70
93
  'fetchMarkOHLCV': False,
94
+ 'fetchMarkPrices': False,
95
+ 'fetchMyLiquidations': False,
96
+ 'fetchMySettlementHistory': False,
71
97
  'fetchMyTrades': True,
72
98
  'fetchOHLCV': True,
99
+ 'fetchOpenInterest': False,
73
100
  'fetchOpenInterestHistory': False,
101
+ 'fetchOpenInterests': False,
74
102
  'fetchOpenOrders': True,
103
+ 'fetchOption': False,
104
+ 'fetchOptionChain': False,
75
105
  'fetchOrder': True,
76
106
  'fetchOrderBook': True,
77
107
  'fetchOrders': False,
@@ -84,6 +114,7 @@ class bitopro(Exchange, ImplicitAPI):
84
114
  'fetchPositionsHistory': False,
85
115
  'fetchPositionsRisk': False,
86
116
  'fetchPremiumIndexOHLCV': False,
117
+ 'fetchSettlementHistory': False,
87
118
  'fetchTicker': True,
88
119
  'fetchTickers': True,
89
120
  'fetchTime': False,
@@ -94,10 +125,16 @@ class bitopro(Exchange, ImplicitAPI):
94
125
  'fetchTransactions': False,
95
126
  'fetchTransfer': False,
96
127
  'fetchTransfers': False,
128
+ 'fetchVolatilityHistory': False,
97
129
  'fetchWithdrawal': True,
98
130
  'fetchWithdrawals': True,
131
+ 'reduceMargin': False,
132
+ 'repayCrossMargin': False,
133
+ 'repayIsolatedMargin': False,
99
134
  'setLeverage': False,
135
+ 'setMargin': False,
100
136
  'setMarginMode': False,
137
+ 'setPositionMode': False,
101
138
  'transfer': False,
102
139
  'withdraw': True,
103
140
  },
ccxt/blofin.py CHANGED
@@ -66,7 +66,7 @@ class blofin(Exchange, ImplicitAPI):
66
66
  'fetchBorrowRateHistory': False,
67
67
  'fetchCanceledOrders': False,
68
68
  'fetchClosedOrder': False,
69
- 'fetchClosedOrders': False,
69
+ 'fetchClosedOrders': True,
70
70
  'fetchCrossBorrowRate': False,
71
71
  'fetchCrossBorrowRates': False,
72
72
  'fetchCurrencies': False,
ccxt/bybit.py CHANGED
@@ -2389,6 +2389,7 @@ class bybit(Exchange, ImplicitAPI):
2389
2389
  :returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
2390
2390
  """
2391
2391
  self.load_markets()
2392
+ code = self.safe_string_n(params, ['code', 'currency', 'baseCoin'])
2392
2393
  market = None
2393
2394
  parsedSymbols = None
2394
2395
  if symbols is not None:
@@ -2410,6 +2411,12 @@ class bybit(Exchange, ImplicitAPI):
2410
2411
  currentType = market['type']
2411
2412
  elif market['type'] != currentType:
2412
2413
  raise BadRequest(self.id + ' fetchTickers can only accept a list of symbols of the same type')
2414
+ if market['option']:
2415
+ if code is not None and code != market['base']:
2416
+ raise BadRequest(self.id + ' fetchTickers the base currency must be the same for all symbols, self endpoint only supports one base currency at a time. Read more about it here: https://bybit-exchange.github.io/docs/v5/market/tickers')
2417
+ if code is None:
2418
+ code = market['base']
2419
+ params = self.omit(params, ['code', 'currency'])
2413
2420
  parsedSymbols.append(market['symbol'])
2414
2421
  request: dict = {
2415
2422
  # 'symbol': market['id'],
@@ -2429,7 +2436,9 @@ class bybit(Exchange, ImplicitAPI):
2429
2436
  request['category'] = 'spot'
2430
2437
  elif type == 'option':
2431
2438
  request['category'] = 'option'
2432
- request['baseCoin'] = self.safe_string(params, 'baseCoin', 'BTC')
2439
+ if code is None:
2440
+ code = 'BTC'
2441
+ request['baseCoin'] = code
2433
2442
  elif type == 'swap' or type == 'future' or subType is not None:
2434
2443
  request['category'] = subType
2435
2444
  response = self.publicGetV5MarketTickers(self.extend(request, params))