ccxt 4.3.60__py2.py3-none-any.whl → 4.3.62__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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/fast_client.py +2 -2
- ccxt/async_support/binance.py +37 -29
- ccxt/async_support/bingx.py +41 -33
- ccxt/async_support/bybit.py +9 -1
- ccxt/async_support/hyperliquid.py +10 -2
- ccxt/async_support/mexc.py +2 -1
- ccxt/async_support/tradeogre.py +1 -1
- ccxt/async_support/vertex.py +10 -1
- ccxt/async_support/xt.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +37 -29
- ccxt/bingx.py +41 -33
- ccxt/bybit.py +9 -1
- ccxt/hyperliquid.py +10 -2
- ccxt/mexc.py +2 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +3 -3
- ccxt/pro/binance.py +2 -4
- ccxt/pro/bingx.py +2 -2
- ccxt/pro/bitfinex2.py +2 -2
- ccxt/pro/bitget.py +1 -1
- ccxt/pro/bitmex.py +1 -1
- ccxt/pro/bitopro.py +1 -1
- ccxt/pro/bybit.py +5 -5
- ccxt/pro/coinbaseexchange.py +2 -2
- ccxt/pro/coincheck.py +1 -1
- ccxt/pro/coinone.py +1 -1
- ccxt/pro/cryptocom.py +1 -1
- ccxt/pro/deribit.py +1 -1
- ccxt/pro/gate.py +2 -2
- ccxt/pro/hollaex.py +1 -1
- ccxt/pro/htx.py +1 -1
- ccxt/pro/hyperliquid.py +3 -3
- ccxt/pro/kraken.py +1 -1
- ccxt/pro/kucoin.py +3 -4
- ccxt/pro/mexc.py +1 -1
- ccxt/pro/okx.py +1 -1
- ccxt/pro/oxfun.py +1 -1
- ccxt/pro/phemex.py +1 -1
- ccxt/pro/upbit.py +1 -1
- ccxt/pro/vertex.py +2 -2
- ccxt/pro/whitebit.py +1 -1
- ccxt/pro/woo.py +1 -1
- ccxt/tradeogre.py +1 -1
- ccxt/vertex.py +10 -1
- ccxt/xt.py +1 -1
- {ccxt-4.3.60.dist-info → ccxt-4.3.62.dist-info}/METADATA +4 -4
- {ccxt-4.3.60.dist-info → ccxt-4.3.62.dist-info}/RECORD +54 -54
- {ccxt-4.3.60.dist-info → ccxt-4.3.62.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.60.dist-info → ccxt-4.3.62.dist-info}/WHEEL +0 -0
- {ccxt-4.3.60.dist-info → ccxt-4.3.62.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/async_support/__init__.py
CHANGED
@@ -35,7 +35,7 @@ class FastClient(AiohttpClient):
|
|
35
35
|
self.stack.append(message)
|
36
36
|
|
37
37
|
def feed_eof():
|
38
|
-
if self._close_code == 1000: # OK close
|
38
|
+
if self.connection._close_code == 1000: # OK close
|
39
39
|
self.on_close(1000)
|
40
40
|
else:
|
41
41
|
self.on_error(1006) # ABNORMAL_CLOSURE
|
@@ -58,7 +58,7 @@ class FastClient(AiohttpClient):
|
|
58
58
|
try:
|
59
59
|
await _self._writer.close(code, message)
|
60
60
|
_self._response.close()
|
61
|
-
|
61
|
+
_self._close_code = 1000
|
62
62
|
except asyncio.CancelledError:
|
63
63
|
_self._response.close()
|
64
64
|
_self._close_code = 1006
|
ccxt/async_support/binance.py
CHANGED
@@ -9104,34 +9104,38 @@ class binance(Exchange, ImplicitAPI):
|
|
9104
9104
|
if marginMode == 'cross':
|
9105
9105
|
# calculate collateral
|
9106
9106
|
precision = self.safe_dict(market, 'precision', {})
|
9107
|
-
|
9108
|
-
|
9109
|
-
|
9110
|
-
|
9111
|
-
if
|
9112
|
-
|
9113
|
-
|
9114
|
-
|
9115
|
-
|
9116
|
-
|
9117
|
-
|
9118
|
-
|
9119
|
-
|
9120
|
-
|
9121
|
-
|
9122
|
-
|
9123
|
-
|
9124
|
-
|
9125
|
-
if side == 'short':
|
9126
|
-
onePlusMaintenanceMarginPercentageString = Precise.string_sub('1', maintenanceMarginPercentageString)
|
9107
|
+
basePrecisionValue = self.safe_string(precision, 'base')
|
9108
|
+
quotePrecisionValue = self.safe_string_2(precision, 'quote', 'price')
|
9109
|
+
precisionIsUndefined = (basePrecisionValue is None) and (quotePrecisionValue is None)
|
9110
|
+
if not precisionIsUndefined:
|
9111
|
+
if linear:
|
9112
|
+
# walletBalance = (liquidationPrice * (±1 + mmp) ± entryPrice) * contracts
|
9113
|
+
onePlusMaintenanceMarginPercentageString = None
|
9114
|
+
entryPriceSignString = entryPriceString
|
9115
|
+
if side == 'short':
|
9116
|
+
onePlusMaintenanceMarginPercentageString = Precise.string_add('1', maintenanceMarginPercentageString)
|
9117
|
+
entryPriceSignString = Precise.string_mul('-1', entryPriceSignString)
|
9118
|
+
else:
|
9119
|
+
onePlusMaintenanceMarginPercentageString = Precise.string_add('-1', maintenanceMarginPercentageString)
|
9120
|
+
inner = Precise.string_mul(liquidationPriceString, onePlusMaintenanceMarginPercentageString)
|
9121
|
+
leftSide = Precise.string_add(inner, entryPriceSignString)
|
9122
|
+
quotePrecision = self.precision_from_string(self.safe_string_2(precision, 'quote', 'price'))
|
9123
|
+
if quotePrecision is not None:
|
9124
|
+
collateralString = Precise.string_div(Precise.string_mul(leftSide, contractsAbs), '1', quotePrecision)
|
9127
9125
|
else:
|
9128
|
-
|
9129
|
-
|
9130
|
-
|
9131
|
-
|
9132
|
-
|
9133
|
-
|
9134
|
-
|
9126
|
+
# walletBalance = (contracts * contractSize) * (±1/entryPrice - (±1 - mmp) / liquidationPrice)
|
9127
|
+
onePlusMaintenanceMarginPercentageString = None
|
9128
|
+
entryPriceSignString = entryPriceString
|
9129
|
+
if side == 'short':
|
9130
|
+
onePlusMaintenanceMarginPercentageString = Precise.string_sub('1', maintenanceMarginPercentageString)
|
9131
|
+
else:
|
9132
|
+
onePlusMaintenanceMarginPercentageString = Precise.string_sub('-1', maintenanceMarginPercentageString)
|
9133
|
+
entryPriceSignString = Precise.string_mul('-1', entryPriceSignString)
|
9134
|
+
leftSide = Precise.string_mul(contractsAbs, contractSizeString)
|
9135
|
+
rightSide = Precise.string_sub(Precise.string_div('1', entryPriceSignString), Precise.string_div(onePlusMaintenanceMarginPercentageString, liquidationPriceString))
|
9136
|
+
basePrecision = self.precision_from_string(self.safe_string(precision, 'base'))
|
9137
|
+
if basePrecision is not None:
|
9138
|
+
collateralString = Precise.string_div(Precise.string_mul(leftSide, rightSide), '1', basePrecision)
|
9135
9139
|
else:
|
9136
9140
|
collateralString = self.safe_string(position, 'isolatedMargin')
|
9137
9141
|
collateralString = '0' if (collateralString is None) else collateralString
|
@@ -9696,9 +9700,10 @@ class binance(Exchange, ImplicitAPI):
|
|
9696
9700
|
#
|
9697
9701
|
result = []
|
9698
9702
|
for i in range(0, len(response)):
|
9699
|
-
|
9700
|
-
entryPrice = self.safe_string(
|
9703
|
+
rawPosition = response[i]
|
9704
|
+
entryPrice = self.safe_string(rawPosition, 'entryPrice')
|
9701
9705
|
if (entryPrice != '0') and (entryPrice != '0.0') and (entryPrice != '0.00000000'):
|
9706
|
+
parsed = self.parse_position_risk(response[i])
|
9702
9707
|
result.append(parsed)
|
9703
9708
|
symbols = self.market_symbols(symbols)
|
9704
9709
|
return self.filter_by_array_positions(result, 'symbol', symbols, False)
|
@@ -11201,6 +11206,8 @@ class binance(Exchange, ImplicitAPI):
|
|
11201
11206
|
request: dict = {}
|
11202
11207
|
if market['option']:
|
11203
11208
|
request['underlyingAsset'] = market['baseId']
|
11209
|
+
if market['expiry'] is None:
|
11210
|
+
raise NotSupported(self.id + ' fetchOpenInterest does not support ' + symbol)
|
11204
11211
|
request['expiration'] = self.yymmdd(market['expiry'])
|
11205
11212
|
else:
|
11206
11213
|
request['symbol'] = market['id']
|
@@ -11242,6 +11249,7 @@ class binance(Exchange, ImplicitAPI):
|
|
11242
11249
|
# ]
|
11243
11250
|
#
|
11244
11251
|
if market['option']:
|
11252
|
+
symbol = market['symbol']
|
11245
11253
|
result = self.parse_open_interests(response, market)
|
11246
11254
|
for i in range(0, len(result)):
|
11247
11255
|
item = result[i]
|
ccxt/async_support/bingx.py
CHANGED
@@ -528,37 +528,40 @@ class bingx(Exchange, ImplicitAPI):
|
|
528
528
|
response = await self.walletsV1PrivateGetCapitalConfigGetall(params)
|
529
529
|
#
|
530
530
|
# {
|
531
|
-
#
|
532
|
-
#
|
533
|
-
#
|
531
|
+
# "code": 0,
|
532
|
+
# "timestamp": 1702623271477,
|
533
|
+
# "data": [
|
534
|
+
# {
|
535
|
+
# "coin": "BTC",
|
536
|
+
# "name": "BTC",
|
537
|
+
# "networkList": [
|
534
538
|
# {
|
535
|
-
# "coin": "BTC",
|
536
539
|
# "name": "BTC",
|
537
|
-
# "
|
538
|
-
#
|
539
|
-
#
|
540
|
-
#
|
541
|
-
#
|
542
|
-
#
|
543
|
-
#
|
544
|
-
#
|
545
|
-
#
|
546
|
-
#
|
547
|
-
#
|
548
|
-
#
|
549
|
-
#
|
550
|
-
#
|
551
|
-
#
|
552
|
-
#
|
553
|
-
#
|
554
|
-
#
|
555
|
-
#
|
556
|
-
#
|
557
|
-
#
|
558
|
-
#
|
559
|
-
#
|
560
|
-
#
|
561
|
-
#
|
540
|
+
# "network": "BTC",
|
541
|
+
# "isDefault": True,
|
542
|
+
# "minConfirm": 2,
|
543
|
+
# "withdrawEnable": True,
|
544
|
+
# "depositEnable": True,
|
545
|
+
# "withdrawFee": "0.0006",
|
546
|
+
# "withdrawMax": "1.17522",
|
547
|
+
# "withdrawMin": "0.0005",
|
548
|
+
# "depositMin": "0.0002"
|
549
|
+
# },
|
550
|
+
# {
|
551
|
+
# "name": "BTC",
|
552
|
+
# "network": "BEP20",
|
553
|
+
# "isDefault": False,
|
554
|
+
# "minConfirm": 15,
|
555
|
+
# "withdrawEnable": True,
|
556
|
+
# "depositEnable": True,
|
557
|
+
# "withdrawFee": "0.0000066",
|
558
|
+
# "withdrawMax": "1.17522",
|
559
|
+
# "withdrawMin": "0.0000066",
|
560
|
+
# "depositMin": "0.0002"
|
561
|
+
# }
|
562
|
+
# ]
|
563
|
+
# }
|
564
|
+
# ]
|
562
565
|
# }
|
563
566
|
#
|
564
567
|
data = self.safe_list(response, 'data', [])
|
@@ -572,6 +575,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
572
575
|
networks: dict = {}
|
573
576
|
fee = None
|
574
577
|
active = None
|
578
|
+
depositEnabled = None
|
575
579
|
withdrawEnabled = None
|
576
580
|
defaultLimits: dict = {}
|
577
581
|
for j in range(0, len(networkList)):
|
@@ -579,13 +583,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
579
583
|
network = self.safe_string(rawNetwork, 'network')
|
580
584
|
networkCode = self.network_id_to_code(network)
|
581
585
|
isDefault = self.safe_bool(rawNetwork, 'isDefault')
|
586
|
+
depositEnabled = self.safe_bool(rawNetwork, 'depositEnable')
|
582
587
|
withdrawEnabled = self.safe_bool(rawNetwork, 'withdrawEnable')
|
583
588
|
limits: dict = {
|
584
|
-
'
|
589
|
+
'withdraw': {
|
590
|
+
'min': self.safe_number(rawNetwork, 'withdrawMin'),
|
591
|
+
'max': self.safe_number(rawNetwork, 'withdrawMax'),
|
592
|
+
},
|
585
593
|
}
|
586
594
|
if isDefault:
|
587
595
|
fee = self.safe_number(rawNetwork, 'withdrawFee')
|
588
|
-
active = withdrawEnabled
|
596
|
+
active = depositEnabled or withdrawEnabled
|
589
597
|
defaultLimits = limits
|
590
598
|
networks[networkCode] = {
|
591
599
|
'info': rawNetwork,
|
@@ -593,7 +601,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
593
601
|
'network': networkCode,
|
594
602
|
'fee': fee,
|
595
603
|
'active': active,
|
596
|
-
'deposit':
|
604
|
+
'deposit': depositEnabled,
|
597
605
|
'withdraw': withdrawEnabled,
|
598
606
|
'precision': None,
|
599
607
|
'limits': limits,
|
@@ -605,7 +613,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
605
613
|
'precision': None,
|
606
614
|
'name': name,
|
607
615
|
'active': active,
|
608
|
-
'deposit':
|
616
|
+
'deposit': depositEnabled,
|
609
617
|
'withdraw': withdrawEnabled,
|
610
618
|
'networks': networks,
|
611
619
|
'fee': fee,
|
ccxt/async_support/bybit.py
CHANGED
@@ -4052,6 +4052,10 @@ class bybit(Exchange, ImplicitAPI):
|
|
4052
4052
|
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
|
4053
4053
|
await self.load_markets()
|
4054
4054
|
market = self.market(symbol)
|
4055
|
+
types = await self.is_unified_enabled()
|
4056
|
+
enableUnifiedAccount = types[1]
|
4057
|
+
if not enableUnifiedAccount:
|
4058
|
+
raise NotSupported(self.id + ' cancelOrders() supports UTA accounts only')
|
4055
4059
|
category = None
|
4056
4060
|
category, params = self.get_bybit_type('cancelOrders', market, params)
|
4057
4061
|
if category == 'inverse':
|
@@ -4153,6 +4157,10 @@ class bybit(Exchange, ImplicitAPI):
|
|
4153
4157
|
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
4154
4158
|
"""
|
4155
4159
|
await self.load_markets()
|
4160
|
+
types = await self.is_unified_enabled()
|
4161
|
+
enableUnifiedAccount = types[1]
|
4162
|
+
if not enableUnifiedAccount:
|
4163
|
+
raise NotSupported(self.id + ' cancelOrdersForSymbols() supports UTA accounts only')
|
4156
4164
|
ordersRequests = []
|
4157
4165
|
category = None
|
4158
4166
|
for i in range(0, len(orders)):
|
@@ -5870,6 +5878,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5870
5878
|
:param str [params.settleCoin]: Settle coin. Supports linear, inverse & option
|
5871
5879
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
5872
5880
|
"""
|
5881
|
+
await self.load_markets()
|
5873
5882
|
symbol = None
|
5874
5883
|
if (symbols is not None) and isinstance(symbols, list):
|
5875
5884
|
symbolsLength = len(symbols)
|
@@ -5881,7 +5890,6 @@ class bybit(Exchange, ImplicitAPI):
|
|
5881
5890
|
elif symbols is not None:
|
5882
5891
|
symbol = symbols
|
5883
5892
|
symbols = [self.symbol(symbol)]
|
5884
|
-
await self.load_markets()
|
5885
5893
|
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
5886
5894
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
5887
5895
|
request: dict = {}
|
@@ -256,8 +256,16 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
256
256
|
'withdraw': None,
|
257
257
|
'networks': None,
|
258
258
|
'fee': None,
|
259
|
-
|
260
|
-
|
259
|
+
'limits': {
|
260
|
+
'amount': {
|
261
|
+
'min': None,
|
262
|
+
'max': None,
|
263
|
+
},
|
264
|
+
'withdraw': {
|
265
|
+
'min': None,
|
266
|
+
'max': None,
|
267
|
+
},
|
268
|
+
},
|
261
269
|
}
|
262
270
|
return result
|
263
271
|
|
ccxt/async_support/mexc.py
CHANGED
@@ -4905,9 +4905,10 @@ class mexc(Exchange, ImplicitAPI):
|
|
4905
4905
|
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
4906
4906
|
"""
|
4907
4907
|
tag, params = self.handle_withdraw_tag_and_params(tag, params)
|
4908
|
-
networks = self.
|
4908
|
+
networks = self.safe_dict(self.options, 'networks', {})
|
4909
4909
|
network = self.safe_string_2(params, 'network', 'netWork') # self line allows the user to specify either ERC20 or ETH
|
4910
4910
|
network = self.safe_string(networks, network, network) # handle ETH > ERC-20 alias
|
4911
|
+
network = self.network_code_to_id(network)
|
4911
4912
|
self.check_address(address)
|
4912
4913
|
await self.load_markets()
|
4913
4914
|
currency = self.currency(code)
|
ccxt/async_support/tradeogre.py
CHANGED
@@ -221,7 +221,7 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
221
221
|
'inverse': None,
|
222
222
|
'contractSize': None,
|
223
223
|
'taker': self.fees['trading']['taker'],
|
224
|
-
'maker': self.fees['trading']['
|
224
|
+
'maker': self.fees['trading']['maker'],
|
225
225
|
'expiry': None,
|
226
226
|
'expiryDatetime': None,
|
227
227
|
'strike': None,
|
ccxt/async_support/vertex.py
CHANGED
@@ -400,7 +400,16 @@ class vertex(Exchange, ImplicitAPI):
|
|
400
400
|
'withdraw': self.safe_bool(data, 'can_withdraw'),
|
401
401
|
'networks': None,
|
402
402
|
'fee': None,
|
403
|
-
'limits':
|
403
|
+
'limits': {
|
404
|
+
'amount': {
|
405
|
+
'min': None,
|
406
|
+
'max': None,
|
407
|
+
},
|
408
|
+
'withdraw': {
|
409
|
+
'min': None,
|
410
|
+
'max': None,
|
411
|
+
},
|
412
|
+
},
|
404
413
|
}
|
405
414
|
return result
|
406
415
|
|
ccxt/async_support/xt.py
CHANGED
@@ -4490,7 +4490,7 @@ class xt(Exchange, ImplicitAPI):
|
|
4490
4490
|
if isUndefinedBody:
|
4491
4491
|
if urlencoded:
|
4492
4492
|
url += '?' + urlencoded
|
4493
|
-
payloadString += '#' + method + '#' + payload + '#' +
|
4493
|
+
payloadString += '#' + method + '#' + payload + '#' + self.rawencode(self.keysort(query))
|
4494
4494
|
else:
|
4495
4495
|
payloadString += '#' + method + '#' + payload
|
4496
4496
|
else:
|
ccxt/base/exchange.py
CHANGED
ccxt/binance.py
CHANGED
@@ -9103,34 +9103,38 @@ class binance(Exchange, ImplicitAPI):
|
|
9103
9103
|
if marginMode == 'cross':
|
9104
9104
|
# calculate collateral
|
9105
9105
|
precision = self.safe_dict(market, 'precision', {})
|
9106
|
-
|
9107
|
-
|
9108
|
-
|
9109
|
-
|
9110
|
-
if
|
9111
|
-
|
9112
|
-
|
9113
|
-
|
9114
|
-
|
9115
|
-
|
9116
|
-
|
9117
|
-
|
9118
|
-
|
9119
|
-
|
9120
|
-
|
9121
|
-
|
9122
|
-
|
9123
|
-
|
9124
|
-
if side == 'short':
|
9125
|
-
onePlusMaintenanceMarginPercentageString = Precise.string_sub('1', maintenanceMarginPercentageString)
|
9106
|
+
basePrecisionValue = self.safe_string(precision, 'base')
|
9107
|
+
quotePrecisionValue = self.safe_string_2(precision, 'quote', 'price')
|
9108
|
+
precisionIsUndefined = (basePrecisionValue is None) and (quotePrecisionValue is None)
|
9109
|
+
if not precisionIsUndefined:
|
9110
|
+
if linear:
|
9111
|
+
# walletBalance = (liquidationPrice * (±1 + mmp) ± entryPrice) * contracts
|
9112
|
+
onePlusMaintenanceMarginPercentageString = None
|
9113
|
+
entryPriceSignString = entryPriceString
|
9114
|
+
if side == 'short':
|
9115
|
+
onePlusMaintenanceMarginPercentageString = Precise.string_add('1', maintenanceMarginPercentageString)
|
9116
|
+
entryPriceSignString = Precise.string_mul('-1', entryPriceSignString)
|
9117
|
+
else:
|
9118
|
+
onePlusMaintenanceMarginPercentageString = Precise.string_add('-1', maintenanceMarginPercentageString)
|
9119
|
+
inner = Precise.string_mul(liquidationPriceString, onePlusMaintenanceMarginPercentageString)
|
9120
|
+
leftSide = Precise.string_add(inner, entryPriceSignString)
|
9121
|
+
quotePrecision = self.precision_from_string(self.safe_string_2(precision, 'quote', 'price'))
|
9122
|
+
if quotePrecision is not None:
|
9123
|
+
collateralString = Precise.string_div(Precise.string_mul(leftSide, contractsAbs), '1', quotePrecision)
|
9126
9124
|
else:
|
9127
|
-
|
9128
|
-
|
9129
|
-
|
9130
|
-
|
9131
|
-
|
9132
|
-
|
9133
|
-
|
9125
|
+
# walletBalance = (contracts * contractSize) * (±1/entryPrice - (±1 - mmp) / liquidationPrice)
|
9126
|
+
onePlusMaintenanceMarginPercentageString = None
|
9127
|
+
entryPriceSignString = entryPriceString
|
9128
|
+
if side == 'short':
|
9129
|
+
onePlusMaintenanceMarginPercentageString = Precise.string_sub('1', maintenanceMarginPercentageString)
|
9130
|
+
else:
|
9131
|
+
onePlusMaintenanceMarginPercentageString = Precise.string_sub('-1', maintenanceMarginPercentageString)
|
9132
|
+
entryPriceSignString = Precise.string_mul('-1', entryPriceSignString)
|
9133
|
+
leftSide = Precise.string_mul(contractsAbs, contractSizeString)
|
9134
|
+
rightSide = Precise.string_sub(Precise.string_div('1', entryPriceSignString), Precise.string_div(onePlusMaintenanceMarginPercentageString, liquidationPriceString))
|
9135
|
+
basePrecision = self.precision_from_string(self.safe_string(precision, 'base'))
|
9136
|
+
if basePrecision is not None:
|
9137
|
+
collateralString = Precise.string_div(Precise.string_mul(leftSide, rightSide), '1', basePrecision)
|
9134
9138
|
else:
|
9135
9139
|
collateralString = self.safe_string(position, 'isolatedMargin')
|
9136
9140
|
collateralString = '0' if (collateralString is None) else collateralString
|
@@ -9695,9 +9699,10 @@ class binance(Exchange, ImplicitAPI):
|
|
9695
9699
|
#
|
9696
9700
|
result = []
|
9697
9701
|
for i in range(0, len(response)):
|
9698
|
-
|
9699
|
-
entryPrice = self.safe_string(
|
9702
|
+
rawPosition = response[i]
|
9703
|
+
entryPrice = self.safe_string(rawPosition, 'entryPrice')
|
9700
9704
|
if (entryPrice != '0') and (entryPrice != '0.0') and (entryPrice != '0.00000000'):
|
9705
|
+
parsed = self.parse_position_risk(response[i])
|
9701
9706
|
result.append(parsed)
|
9702
9707
|
symbols = self.market_symbols(symbols)
|
9703
9708
|
return self.filter_by_array_positions(result, 'symbol', symbols, False)
|
@@ -11200,6 +11205,8 @@ class binance(Exchange, ImplicitAPI):
|
|
11200
11205
|
request: dict = {}
|
11201
11206
|
if market['option']:
|
11202
11207
|
request['underlyingAsset'] = market['baseId']
|
11208
|
+
if market['expiry'] is None:
|
11209
|
+
raise NotSupported(self.id + ' fetchOpenInterest does not support ' + symbol)
|
11203
11210
|
request['expiration'] = self.yymmdd(market['expiry'])
|
11204
11211
|
else:
|
11205
11212
|
request['symbol'] = market['id']
|
@@ -11241,6 +11248,7 @@ class binance(Exchange, ImplicitAPI):
|
|
11241
11248
|
# ]
|
11242
11249
|
#
|
11243
11250
|
if market['option']:
|
11251
|
+
symbol = market['symbol']
|
11244
11252
|
result = self.parse_open_interests(response, market)
|
11245
11253
|
for i in range(0, len(result)):
|
11246
11254
|
item = result[i]
|
ccxt/bingx.py
CHANGED
@@ -527,37 +527,40 @@ class bingx(Exchange, ImplicitAPI):
|
|
527
527
|
response = self.walletsV1PrivateGetCapitalConfigGetall(params)
|
528
528
|
#
|
529
529
|
# {
|
530
|
-
#
|
531
|
-
#
|
532
|
-
#
|
530
|
+
# "code": 0,
|
531
|
+
# "timestamp": 1702623271477,
|
532
|
+
# "data": [
|
533
|
+
# {
|
534
|
+
# "coin": "BTC",
|
535
|
+
# "name": "BTC",
|
536
|
+
# "networkList": [
|
533
537
|
# {
|
534
|
-
# "coin": "BTC",
|
535
538
|
# "name": "BTC",
|
536
|
-
# "
|
537
|
-
#
|
538
|
-
#
|
539
|
-
#
|
540
|
-
#
|
541
|
-
#
|
542
|
-
#
|
543
|
-
#
|
544
|
-
#
|
545
|
-
#
|
546
|
-
#
|
547
|
-
#
|
548
|
-
#
|
549
|
-
#
|
550
|
-
#
|
551
|
-
#
|
552
|
-
#
|
553
|
-
#
|
554
|
-
#
|
555
|
-
#
|
556
|
-
#
|
557
|
-
#
|
558
|
-
#
|
559
|
-
#
|
560
|
-
#
|
539
|
+
# "network": "BTC",
|
540
|
+
# "isDefault": True,
|
541
|
+
# "minConfirm": 2,
|
542
|
+
# "withdrawEnable": True,
|
543
|
+
# "depositEnable": True,
|
544
|
+
# "withdrawFee": "0.0006",
|
545
|
+
# "withdrawMax": "1.17522",
|
546
|
+
# "withdrawMin": "0.0005",
|
547
|
+
# "depositMin": "0.0002"
|
548
|
+
# },
|
549
|
+
# {
|
550
|
+
# "name": "BTC",
|
551
|
+
# "network": "BEP20",
|
552
|
+
# "isDefault": False,
|
553
|
+
# "minConfirm": 15,
|
554
|
+
# "withdrawEnable": True,
|
555
|
+
# "depositEnable": True,
|
556
|
+
# "withdrawFee": "0.0000066",
|
557
|
+
# "withdrawMax": "1.17522",
|
558
|
+
# "withdrawMin": "0.0000066",
|
559
|
+
# "depositMin": "0.0002"
|
560
|
+
# }
|
561
|
+
# ]
|
562
|
+
# }
|
563
|
+
# ]
|
561
564
|
# }
|
562
565
|
#
|
563
566
|
data = self.safe_list(response, 'data', [])
|
@@ -571,6 +574,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
571
574
|
networks: dict = {}
|
572
575
|
fee = None
|
573
576
|
active = None
|
577
|
+
depositEnabled = None
|
574
578
|
withdrawEnabled = None
|
575
579
|
defaultLimits: dict = {}
|
576
580
|
for j in range(0, len(networkList)):
|
@@ -578,13 +582,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
578
582
|
network = self.safe_string(rawNetwork, 'network')
|
579
583
|
networkCode = self.network_id_to_code(network)
|
580
584
|
isDefault = self.safe_bool(rawNetwork, 'isDefault')
|
585
|
+
depositEnabled = self.safe_bool(rawNetwork, 'depositEnable')
|
581
586
|
withdrawEnabled = self.safe_bool(rawNetwork, 'withdrawEnable')
|
582
587
|
limits: dict = {
|
583
|
-
'
|
588
|
+
'withdraw': {
|
589
|
+
'min': self.safe_number(rawNetwork, 'withdrawMin'),
|
590
|
+
'max': self.safe_number(rawNetwork, 'withdrawMax'),
|
591
|
+
},
|
584
592
|
}
|
585
593
|
if isDefault:
|
586
594
|
fee = self.safe_number(rawNetwork, 'withdrawFee')
|
587
|
-
active = withdrawEnabled
|
595
|
+
active = depositEnabled or withdrawEnabled
|
588
596
|
defaultLimits = limits
|
589
597
|
networks[networkCode] = {
|
590
598
|
'info': rawNetwork,
|
@@ -592,7 +600,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
592
600
|
'network': networkCode,
|
593
601
|
'fee': fee,
|
594
602
|
'active': active,
|
595
|
-
'deposit':
|
603
|
+
'deposit': depositEnabled,
|
596
604
|
'withdraw': withdrawEnabled,
|
597
605
|
'precision': None,
|
598
606
|
'limits': limits,
|
@@ -604,7 +612,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
604
612
|
'precision': None,
|
605
613
|
'name': name,
|
606
614
|
'active': active,
|
607
|
-
'deposit':
|
615
|
+
'deposit': depositEnabled,
|
608
616
|
'withdraw': withdrawEnabled,
|
609
617
|
'networks': networks,
|
610
618
|
'fee': fee,
|