ccxt 4.3.89__py2.py3-none-any.whl → 4.3.90__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/alpaca.py +2 -2
- ccxt/ascendex.py +95 -97
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +2 -2
- ccxt/async_support/ascendex.py +95 -97
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +29 -17
- ccxt/async_support/bitfinex2.py +21 -22
- ccxt/async_support/bitget.py +2 -2
- ccxt/async_support/bitmart.py +4 -8
- ccxt/async_support/coinbaseinternational.py +2 -1
- ccxt/async_support/coinex.py +1 -16
- ccxt/async_support/hitbtc.py +1 -0
- ccxt/async_support/huobijp.py +0 -8
- ccxt/async_support/latoken.py +1 -0
- ccxt/async_support/okx.py +1 -8
- ccxt/async_support/whitebit.py +5 -3
- ccxt/base/exchange.py +1 -1
- ccxt/bingx.py +29 -17
- ccxt/bitfinex2.py +21 -22
- ccxt/bitget.py +2 -2
- ccxt/bitmart.py +4 -8
- ccxt/coinbaseinternational.py +2 -1
- ccxt/coinex.py +1 -16
- ccxt/hitbtc.py +1 -0
- ccxt/huobijp.py +0 -8
- ccxt/latoken.py +1 -0
- ccxt/okx.py +1 -8
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +280 -0
- ccxt/pro/bingx.py +235 -85
- ccxt/pro/bithumb.py +4 -0
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/coinex.py +941 -662
- ccxt/pro/lbank.py +1 -2
- ccxt/pro/okx.py +142 -2
- ccxt/whitebit.py +5 -3
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/METADATA +4 -4
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/RECORD +43 -43
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/WHEEL +0 -0
- {ccxt-4.3.89.dist-info → ccxt-4.3.90.dist-info}/top_level.txt +0 -0
ccxt/async_support/bingx.py
CHANGED
@@ -1036,8 +1036,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1036
1036
|
|
1037
1037
|
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1038
1038
|
#
|
1039
|
-
# spot
|
1040
|
-
# fetchTrades
|
1039
|
+
# spot fetchTrades
|
1041
1040
|
#
|
1042
1041
|
# {
|
1043
1042
|
# "id": 43148253,
|
@@ -1047,8 +1046,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
1047
1046
|
# "buyerMaker": False
|
1048
1047
|
# }
|
1049
1048
|
#
|
1050
|
-
# spot
|
1051
|
-
#
|
1049
|
+
# spot fetchMyTrades
|
1050
|
+
#
|
1052
1051
|
# {
|
1053
1052
|
# "symbol": "LTC-USDT",
|
1054
1053
|
# "id": 36237072,
|
@@ -1063,8 +1062,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1063
1062
|
# "isMaker": False
|
1064
1063
|
# }
|
1065
1064
|
#
|
1066
|
-
# swap
|
1067
|
-
# fetchTrades
|
1065
|
+
# swap fetchTrades
|
1068
1066
|
#
|
1069
1067
|
# {
|
1070
1068
|
# "time": 1672025549368,
|
@@ -1074,8 +1072,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1074
1072
|
# "quoteQty": "55723.87"
|
1075
1073
|
# }
|
1076
1074
|
#
|
1077
|
-
# swap
|
1078
|
-
# fetchMyTrades
|
1075
|
+
# swap fetchMyTrades
|
1079
1076
|
#
|
1080
1077
|
# {
|
1081
1078
|
# "volume": "0.1",
|
@@ -1089,10 +1086,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1089
1086
|
# "filledTime": "2023-07-04T20:56:01.000+0800"
|
1090
1087
|
# }
|
1091
1088
|
#
|
1092
|
-
#
|
1093
|
-
# ws
|
1094
|
-
#
|
1095
|
-
# spot
|
1089
|
+
# ws spot
|
1096
1090
|
#
|
1097
1091
|
# {
|
1098
1092
|
# "E": 1690214529432,
|
@@ -1105,7 +1099,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1105
1099
|
# "t": "57903921"
|
1106
1100
|
# }
|
1107
1101
|
#
|
1108
|
-
# swap
|
1102
|
+
# ws linear swap
|
1109
1103
|
#
|
1110
1104
|
# {
|
1111
1105
|
# "q": "0.0421",
|
@@ -1115,6 +1109,19 @@ class bingx(Exchange, ImplicitAPI):
|
|
1115
1109
|
# "s": "BTC-USDT"
|
1116
1110
|
# }
|
1117
1111
|
#
|
1112
|
+
# ws inverse swap
|
1113
|
+
#
|
1114
|
+
# {
|
1115
|
+
# "e": "trade",
|
1116
|
+
# "E": 1722920589665,
|
1117
|
+
# "s": "BTC-USD",
|
1118
|
+
# "t": "39125001",
|
1119
|
+
# "p": "55360.0",
|
1120
|
+
# "q": "1",
|
1121
|
+
# "T": 1722920589582,
|
1122
|
+
# "m": False
|
1123
|
+
# }
|
1124
|
+
#
|
1118
1125
|
# inverse swap fetchMyTrades
|
1119
1126
|
#
|
1120
1127
|
# {
|
@@ -2399,13 +2406,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
2399
2406
|
tpRequest['quantity'] = self.parse_to_numeric(self.amount_to_precision(symbol, tkQuantity))
|
2400
2407
|
request['takeProfit'] = self.json(tpRequest)
|
2401
2408
|
positionSide = None
|
2402
|
-
|
2403
|
-
|
2409
|
+
hedged = self.safe_bool(params, 'hedged', False)
|
2410
|
+
if hedged:
|
2411
|
+
if reduceOnly:
|
2412
|
+
positionSide = 'SHORT' if (side == 'buy') else 'LONG'
|
2413
|
+
else:
|
2414
|
+
positionSide = 'LONG' if (side == 'buy') else 'SHORT'
|
2404
2415
|
else:
|
2405
|
-
positionSide = '
|
2416
|
+
positionSide = 'BOTH'
|
2406
2417
|
request['positionSide'] = positionSide
|
2407
2418
|
request['quantity'] = amount if (market['inverse']) else self.parse_to_numeric(self.amount_to_precision(symbol, amount)) # precision not available for inverse contracts
|
2408
|
-
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2419
|
+
params = self.omit(params, ['hedged', 'reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2409
2420
|
return self.extend(request, params)
|
2410
2421
|
|
2411
2422
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
@@ -2435,6 +2446,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2435
2446
|
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
2436
2447
|
:param float [params.stopLoss.triggerPrice]: stop loss trigger price
|
2437
2448
|
:param boolean [params.test]: *swap only* whether to use the test endpoint or not, default is False
|
2449
|
+
:param boolean [params.hedged]: *swap only* whether the order is in hedged mode or one way mode
|
2438
2450
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2439
2451
|
"""
|
2440
2452
|
await self.load_markets()
|
ccxt/async_support/bitfinex2.py
CHANGED
@@ -397,6 +397,25 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
397
397
|
'withdraw': {
|
398
398
|
'includeFee': False,
|
399
399
|
},
|
400
|
+
'networks': {
|
401
|
+
'BTC': 'BITCOIN',
|
402
|
+
'LTC': 'LITECOIN',
|
403
|
+
'ERC20': 'ETHEREUM',
|
404
|
+
'OMNI': 'TETHERUSO',
|
405
|
+
'LIQUID': 'TETHERUSL',
|
406
|
+
'TRC20': 'TETHERUSX',
|
407
|
+
'EOS': 'TETHERUSS',
|
408
|
+
'AVAX': 'TETHERUSDTAVAX',
|
409
|
+
'SOL': 'TETHERUSDTSOL',
|
410
|
+
'ALGO': 'TETHERUSDTALG',
|
411
|
+
'BCH': 'TETHERUSDTBCH',
|
412
|
+
'KSM': 'TETHERUSDTKSM',
|
413
|
+
'DVF': 'TETHERUSDTDVF',
|
414
|
+
'OMG': 'TETHERUSDTOMG',
|
415
|
+
},
|
416
|
+
'networksById': {
|
417
|
+
'TETHERUSE': 'ERC20',
|
418
|
+
},
|
400
419
|
},
|
401
420
|
'exceptions': {
|
402
421
|
'exact': {
|
@@ -791,7 +810,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
791
810
|
networkId = self.safe_string(pair, 0)
|
792
811
|
currencyId = self.safe_string(self.safe_value(pair, 1, []), 0)
|
793
812
|
if currencyId == cleanId:
|
794
|
-
network = self.
|
813
|
+
network = self.network_id_to_code(networkId)
|
795
814
|
networks[network] = {
|
796
815
|
'info': networkId,
|
797
816
|
'id': networkId.lower(),
|
@@ -814,26 +833,6 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
814
833
|
result[code]['networks'] = networks
|
815
834
|
return result
|
816
835
|
|
817
|
-
def safe_network(self, networkId):
|
818
|
-
networksById: dict = {
|
819
|
-
'BITCOIN': 'BTC',
|
820
|
-
'LITECOIN': 'LTC',
|
821
|
-
'ETHEREUM': 'ERC20',
|
822
|
-
'TETHERUSE': 'ERC20',
|
823
|
-
'TETHERUSO': 'OMNI',
|
824
|
-
'TETHERUSL': 'LIQUID',
|
825
|
-
'TETHERUSX': 'TRC20',
|
826
|
-
'TETHERUSS': 'EOS',
|
827
|
-
'TETHERUSDTAVAX': 'AVAX',
|
828
|
-
'TETHERUSDTSOL': 'SOL',
|
829
|
-
'TETHERUSDTALG': 'ALGO',
|
830
|
-
'TETHERUSDTBCH': 'BCH',
|
831
|
-
'TETHERUSDTKSM': 'KSM',
|
832
|
-
'TETHERUSDTDVF': 'DVF',
|
833
|
-
'TETHERUSDTOMG': 'OMG',
|
834
|
-
}
|
835
|
-
return self.safe_string(networksById, networkId, networkId)
|
836
|
-
|
837
836
|
async def fetch_balance(self, params={}) -> Balances:
|
838
837
|
"""
|
839
838
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
@@ -2249,7 +2248,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2249
2248
|
currencyId = self.safe_string(transaction, 1)
|
2250
2249
|
code = self.safe_currency_code(currencyId, currency)
|
2251
2250
|
networkId = self.safe_string(transaction, 2)
|
2252
|
-
network = self.
|
2251
|
+
network = self.network_id_to_code(networkId)
|
2253
2252
|
timestamp = self.safe_integer(transaction, 5)
|
2254
2253
|
updated = self.safe_integer(transaction, 6)
|
2255
2254
|
status = self.parse_transaction_status(self.safe_string(transaction, 9))
|
ccxt/async_support/bitget.py
CHANGED
@@ -3847,7 +3847,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3847
3847
|
if feeCostString is not None:
|
3848
3848
|
# swap
|
3849
3849
|
fee = {
|
3850
|
-
'cost': self.parse_number(Precise.
|
3850
|
+
'cost': self.parse_number(Precise.string_neg(feeCostString)),
|
3851
3851
|
'currency': market['settle'],
|
3852
3852
|
}
|
3853
3853
|
feeDetail = self.safe_value(order, 'feeDetail')
|
@@ -3861,7 +3861,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3861
3861
|
feeObject = feeValue
|
3862
3862
|
break
|
3863
3863
|
fee = {
|
3864
|
-
'cost': self.parse_number(Precise.
|
3864
|
+
'cost': self.parse_number(Precise.string_neg(self.safe_string(feeObject, 'totalFee'))),
|
3865
3865
|
'currency': self.safe_currency_code(self.safe_string(feeObject, 'feeCoinCode')),
|
3866
3866
|
}
|
3867
3867
|
postOnly = None
|
ccxt/async_support/bitmart.py
CHANGED
@@ -3209,7 +3209,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3209
3209
|
parts = chain.split('-')
|
3210
3210
|
partsLength = len(parts)
|
3211
3211
|
networkId = self.safe_string(parts, partsLength - 1)
|
3212
|
-
|
3212
|
+
if networkId == self.safe_string(currency, 'name'):
|
3213
|
+
network = self.safe_string(currency, 'code')
|
3214
|
+
else:
|
3215
|
+
network = self.network_id_to_code(networkId)
|
3213
3216
|
self.check_address(address)
|
3214
3217
|
return {
|
3215
3218
|
'info': depositAddress,
|
@@ -3219,13 +3222,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3219
3222
|
'network': network,
|
3220
3223
|
}
|
3221
3224
|
|
3222
|
-
def safe_network_code(self, networkId, currency=None):
|
3223
|
-
name = self.safe_string(currency, 'name')
|
3224
|
-
if networkId == name:
|
3225
|
-
code = self.safe_string(currency, 'code')
|
3226
|
-
return code
|
3227
|
-
return self.network_id_to_code(networkId)
|
3228
|
-
|
3229
3225
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
3230
3226
|
"""
|
3231
3227
|
make a withdrawal
|
@@ -754,11 +754,12 @@ class coinbaseinternational(Exchange, ImplicitAPI):
|
|
754
754
|
currencyId = self.safe_string(network, 'asset_name')
|
755
755
|
currencyCode = self.safe_currency_code(currencyId)
|
756
756
|
networkId = self.safe_string(network, 'network_arn_id')
|
757
|
+
networkIdForCode = self.safe_string_n(network, ['network_name', 'display_name', 'network_arn_id'], '')
|
757
758
|
return self.safe_network({
|
758
759
|
'info': network,
|
759
760
|
'id': networkId,
|
760
761
|
'name': self.safe_string(network, 'display_name'),
|
761
|
-
'network': self.network_id_to_code(
|
762
|
+
'network': self.network_id_to_code(networkIdForCode, currencyCode),
|
762
763
|
'active': None,
|
763
764
|
'deposit': None,
|
764
765
|
'withdraw': None,
|
ccxt/async_support/coinex.py
CHANGED
@@ -3559,24 +3559,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
3559
3559
|
options = self.safe_dict(self.options, 'fetchDepositAddress', {})
|
3560
3560
|
fillResponseFromRequest = self.safe_bool(options, 'fillResponseFromRequest', True)
|
3561
3561
|
if fillResponseFromRequest:
|
3562
|
-
depositAddress['network'] = self.
|
3562
|
+
depositAddress['network'] = self.network_id_to_code(network, currency).upper()
|
3563
3563
|
return depositAddress
|
3564
3564
|
|
3565
|
-
def safe_network(self, networkId, currency: Currency = None):
|
3566
|
-
networks = self.safe_value(currency, 'networks', {})
|
3567
|
-
networksCodes = list(networks.keys())
|
3568
|
-
networksCodesLength = len(networksCodes)
|
3569
|
-
if networkId is None and networksCodesLength == 1:
|
3570
|
-
return networks[networksCodes[0]]
|
3571
|
-
return {
|
3572
|
-
'id': networkId,
|
3573
|
-
'network': None if (networkId is None) else networkId.upper(),
|
3574
|
-
}
|
3575
|
-
|
3576
|
-
def safe_network_code(self, networkId, currency: Currency = None):
|
3577
|
-
network = self.safe_network(networkId, currency)
|
3578
|
-
return network['network']
|
3579
|
-
|
3580
3565
|
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
3581
3566
|
#
|
3582
3567
|
# {
|
ccxt/async_support/hitbtc.py
CHANGED
ccxt/async_support/huobijp.py
CHANGED
@@ -1564,14 +1564,6 @@ class huobijp(Exchange, ImplicitAPI):
|
|
1564
1564
|
def currency_to_precision(self, code, fee, networkCode=None):
|
1565
1565
|
return self.decimal_to_precision(fee, 0, self.currencies[code]['precision'], self.precisionMode)
|
1566
1566
|
|
1567
|
-
def safe_network(self, networkId):
|
1568
|
-
lastCharacterIndex = len(networkId) - 1
|
1569
|
-
lastCharacter = networkId[lastCharacterIndex]
|
1570
|
-
if lastCharacter == '1':
|
1571
|
-
networkId = networkId[0:lastCharacterIndex]
|
1572
|
-
networksById: dict = {}
|
1573
|
-
return self.safe_string(networksById, networkId, networkId)
|
1574
|
-
|
1575
1567
|
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
1576
1568
|
#
|
1577
1569
|
# {
|
ccxt/async_support/latoken.py
CHANGED
@@ -1465,6 +1465,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
1465
1465
|
statuses: dict = {
|
1466
1466
|
'TRANSACTION_STATUS_CONFIRMED': 'ok',
|
1467
1467
|
'TRANSACTION_STATUS_EXECUTED': 'ok',
|
1468
|
+
'TRANSACTION_STATUS_CHECKING': 'pending',
|
1468
1469
|
'TRANSACTION_STATUS_CANCELLED': 'canceled',
|
1469
1470
|
}
|
1470
1471
|
return self.safe_string(statuses, status, status)
|
ccxt/async_support/okx.py
CHANGED
@@ -1063,6 +1063,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1063
1063
|
'ZEC': 'Zcash',
|
1064
1064
|
'ZIL': 'Zilliqa',
|
1065
1065
|
'ZKSYNC': 'ZKSYNC',
|
1066
|
+
'OMNI': 'Omni',
|
1066
1067
|
# 'NEON3': 'N3', # tbd
|
1067
1068
|
# undetermined : "CELO-TOKEN", "Digital Cash", Khala
|
1068
1069
|
# todo: uncomment below after consensus
|
@@ -1589,14 +1590,6 @@ class okx(Exchange, ImplicitAPI):
|
|
1589
1590
|
dataResponse = self.safe_list(response, 'data', [])
|
1590
1591
|
return self.parse_markets(dataResponse)
|
1591
1592
|
|
1592
|
-
def safe_network(self, networkId):
|
1593
|
-
networksById: dict = {
|
1594
|
-
'Bitcoin': 'BTC',
|
1595
|
-
'Omni': 'OMNI',
|
1596
|
-
'TRON': 'TRC20',
|
1597
|
-
}
|
1598
|
-
return self.safe_string(networksById, networkId, networkId)
|
1599
|
-
|
1600
1593
|
async def fetch_currencies(self, params={}) -> Currencies:
|
1601
1594
|
"""
|
1602
1595
|
fetches all available currencies on an exchange
|
ccxt/async_support/whitebit.py
CHANGED
@@ -2472,9 +2472,11 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2472
2472
|
if hasErrorStatus:
|
2473
2473
|
errorInfo = status
|
2474
2474
|
else:
|
2475
|
-
errorObject = self.
|
2476
|
-
|
2477
|
-
|
2475
|
+
errorObject = self.safe_dict(response, 'errors', {})
|
2476
|
+
errorKeys = list(errorObject.keys())
|
2477
|
+
errorsLength = len(errorKeys)
|
2478
|
+
if errorsLength > 0:
|
2479
|
+
errorKey = errorKeys[0]
|
2478
2480
|
errorMessageArray = self.safe_value(errorObject, errorKey, [])
|
2479
2481
|
errorMessageLength = len(errorMessageArray)
|
2480
2482
|
errorInfo = errorMessageArray[0] if (errorMessageLength > 0) else body
|
ccxt/base/exchange.py
CHANGED
ccxt/bingx.py
CHANGED
@@ -1035,8 +1035,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1035
1035
|
|
1036
1036
|
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1037
1037
|
#
|
1038
|
-
# spot
|
1039
|
-
# fetchTrades
|
1038
|
+
# spot fetchTrades
|
1040
1039
|
#
|
1041
1040
|
# {
|
1042
1041
|
# "id": 43148253,
|
@@ -1046,8 +1045,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
1046
1045
|
# "buyerMaker": False
|
1047
1046
|
# }
|
1048
1047
|
#
|
1049
|
-
# spot
|
1050
|
-
#
|
1048
|
+
# spot fetchMyTrades
|
1049
|
+
#
|
1051
1050
|
# {
|
1052
1051
|
# "symbol": "LTC-USDT",
|
1053
1052
|
# "id": 36237072,
|
@@ -1062,8 +1061,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1062
1061
|
# "isMaker": False
|
1063
1062
|
# }
|
1064
1063
|
#
|
1065
|
-
# swap
|
1066
|
-
# fetchTrades
|
1064
|
+
# swap fetchTrades
|
1067
1065
|
#
|
1068
1066
|
# {
|
1069
1067
|
# "time": 1672025549368,
|
@@ -1073,8 +1071,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1073
1071
|
# "quoteQty": "55723.87"
|
1074
1072
|
# }
|
1075
1073
|
#
|
1076
|
-
# swap
|
1077
|
-
# fetchMyTrades
|
1074
|
+
# swap fetchMyTrades
|
1078
1075
|
#
|
1079
1076
|
# {
|
1080
1077
|
# "volume": "0.1",
|
@@ -1088,10 +1085,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1088
1085
|
# "filledTime": "2023-07-04T20:56:01.000+0800"
|
1089
1086
|
# }
|
1090
1087
|
#
|
1091
|
-
#
|
1092
|
-
# ws
|
1093
|
-
#
|
1094
|
-
# spot
|
1088
|
+
# ws spot
|
1095
1089
|
#
|
1096
1090
|
# {
|
1097
1091
|
# "E": 1690214529432,
|
@@ -1104,7 +1098,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1104
1098
|
# "t": "57903921"
|
1105
1099
|
# }
|
1106
1100
|
#
|
1107
|
-
# swap
|
1101
|
+
# ws linear swap
|
1108
1102
|
#
|
1109
1103
|
# {
|
1110
1104
|
# "q": "0.0421",
|
@@ -1114,6 +1108,19 @@ class bingx(Exchange, ImplicitAPI):
|
|
1114
1108
|
# "s": "BTC-USDT"
|
1115
1109
|
# }
|
1116
1110
|
#
|
1111
|
+
# ws inverse swap
|
1112
|
+
#
|
1113
|
+
# {
|
1114
|
+
# "e": "trade",
|
1115
|
+
# "E": 1722920589665,
|
1116
|
+
# "s": "BTC-USD",
|
1117
|
+
# "t": "39125001",
|
1118
|
+
# "p": "55360.0",
|
1119
|
+
# "q": "1",
|
1120
|
+
# "T": 1722920589582,
|
1121
|
+
# "m": False
|
1122
|
+
# }
|
1123
|
+
#
|
1117
1124
|
# inverse swap fetchMyTrades
|
1118
1125
|
#
|
1119
1126
|
# {
|
@@ -2398,13 +2405,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
2398
2405
|
tpRequest['quantity'] = self.parse_to_numeric(self.amount_to_precision(symbol, tkQuantity))
|
2399
2406
|
request['takeProfit'] = self.json(tpRequest)
|
2400
2407
|
positionSide = None
|
2401
|
-
|
2402
|
-
|
2408
|
+
hedged = self.safe_bool(params, 'hedged', False)
|
2409
|
+
if hedged:
|
2410
|
+
if reduceOnly:
|
2411
|
+
positionSide = 'SHORT' if (side == 'buy') else 'LONG'
|
2412
|
+
else:
|
2413
|
+
positionSide = 'LONG' if (side == 'buy') else 'SHORT'
|
2403
2414
|
else:
|
2404
|
-
positionSide = '
|
2415
|
+
positionSide = 'BOTH'
|
2405
2416
|
request['positionSide'] = positionSide
|
2406
2417
|
request['quantity'] = amount if (market['inverse']) else self.parse_to_numeric(self.amount_to_precision(symbol, amount)) # precision not available for inverse contracts
|
2407
|
-
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2418
|
+
params = self.omit(params, ['hedged', 'reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2408
2419
|
return self.extend(request, params)
|
2409
2420
|
|
2410
2421
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
@@ -2434,6 +2445,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2434
2445
|
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
2435
2446
|
:param float [params.stopLoss.triggerPrice]: stop loss trigger price
|
2436
2447
|
:param boolean [params.test]: *swap only* whether to use the test endpoint or not, default is False
|
2448
|
+
:param boolean [params.hedged]: *swap only* whether the order is in hedged mode or one way mode
|
2437
2449
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2438
2450
|
"""
|
2439
2451
|
self.load_markets()
|
ccxt/bitfinex2.py
CHANGED
@@ -397,6 +397,25 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
397
397
|
'withdraw': {
|
398
398
|
'includeFee': False,
|
399
399
|
},
|
400
|
+
'networks': {
|
401
|
+
'BTC': 'BITCOIN',
|
402
|
+
'LTC': 'LITECOIN',
|
403
|
+
'ERC20': 'ETHEREUM',
|
404
|
+
'OMNI': 'TETHERUSO',
|
405
|
+
'LIQUID': 'TETHERUSL',
|
406
|
+
'TRC20': 'TETHERUSX',
|
407
|
+
'EOS': 'TETHERUSS',
|
408
|
+
'AVAX': 'TETHERUSDTAVAX',
|
409
|
+
'SOL': 'TETHERUSDTSOL',
|
410
|
+
'ALGO': 'TETHERUSDTALG',
|
411
|
+
'BCH': 'TETHERUSDTBCH',
|
412
|
+
'KSM': 'TETHERUSDTKSM',
|
413
|
+
'DVF': 'TETHERUSDTDVF',
|
414
|
+
'OMG': 'TETHERUSDTOMG',
|
415
|
+
},
|
416
|
+
'networksById': {
|
417
|
+
'TETHERUSE': 'ERC20',
|
418
|
+
},
|
400
419
|
},
|
401
420
|
'exceptions': {
|
402
421
|
'exact': {
|
@@ -791,7 +810,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
791
810
|
networkId = self.safe_string(pair, 0)
|
792
811
|
currencyId = self.safe_string(self.safe_value(pair, 1, []), 0)
|
793
812
|
if currencyId == cleanId:
|
794
|
-
network = self.
|
813
|
+
network = self.network_id_to_code(networkId)
|
795
814
|
networks[network] = {
|
796
815
|
'info': networkId,
|
797
816
|
'id': networkId.lower(),
|
@@ -814,26 +833,6 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
814
833
|
result[code]['networks'] = networks
|
815
834
|
return result
|
816
835
|
|
817
|
-
def safe_network(self, networkId):
|
818
|
-
networksById: dict = {
|
819
|
-
'BITCOIN': 'BTC',
|
820
|
-
'LITECOIN': 'LTC',
|
821
|
-
'ETHEREUM': 'ERC20',
|
822
|
-
'TETHERUSE': 'ERC20',
|
823
|
-
'TETHERUSO': 'OMNI',
|
824
|
-
'TETHERUSL': 'LIQUID',
|
825
|
-
'TETHERUSX': 'TRC20',
|
826
|
-
'TETHERUSS': 'EOS',
|
827
|
-
'TETHERUSDTAVAX': 'AVAX',
|
828
|
-
'TETHERUSDTSOL': 'SOL',
|
829
|
-
'TETHERUSDTALG': 'ALGO',
|
830
|
-
'TETHERUSDTBCH': 'BCH',
|
831
|
-
'TETHERUSDTKSM': 'KSM',
|
832
|
-
'TETHERUSDTDVF': 'DVF',
|
833
|
-
'TETHERUSDTOMG': 'OMG',
|
834
|
-
}
|
835
|
-
return self.safe_string(networksById, networkId, networkId)
|
836
|
-
|
837
836
|
def fetch_balance(self, params={}) -> Balances:
|
838
837
|
"""
|
839
838
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
@@ -2249,7 +2248,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2249
2248
|
currencyId = self.safe_string(transaction, 1)
|
2250
2249
|
code = self.safe_currency_code(currencyId, currency)
|
2251
2250
|
networkId = self.safe_string(transaction, 2)
|
2252
|
-
network = self.
|
2251
|
+
network = self.network_id_to_code(networkId)
|
2253
2252
|
timestamp = self.safe_integer(transaction, 5)
|
2254
2253
|
updated = self.safe_integer(transaction, 6)
|
2255
2254
|
status = self.parse_transaction_status(self.safe_string(transaction, 9))
|
ccxt/bitget.py
CHANGED
@@ -3846,7 +3846,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3846
3846
|
if feeCostString is not None:
|
3847
3847
|
# swap
|
3848
3848
|
fee = {
|
3849
|
-
'cost': self.parse_number(Precise.
|
3849
|
+
'cost': self.parse_number(Precise.string_neg(feeCostString)),
|
3850
3850
|
'currency': market['settle'],
|
3851
3851
|
}
|
3852
3852
|
feeDetail = self.safe_value(order, 'feeDetail')
|
@@ -3860,7 +3860,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3860
3860
|
feeObject = feeValue
|
3861
3861
|
break
|
3862
3862
|
fee = {
|
3863
|
-
'cost': self.parse_number(Precise.
|
3863
|
+
'cost': self.parse_number(Precise.string_neg(self.safe_string(feeObject, 'totalFee'))),
|
3864
3864
|
'currency': self.safe_currency_code(self.safe_string(feeObject, 'feeCoinCode')),
|
3865
3865
|
}
|
3866
3866
|
postOnly = None
|
ccxt/bitmart.py
CHANGED
@@ -3209,7 +3209,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3209
3209
|
parts = chain.split('-')
|
3210
3210
|
partsLength = len(parts)
|
3211
3211
|
networkId = self.safe_string(parts, partsLength - 1)
|
3212
|
-
|
3212
|
+
if networkId == self.safe_string(currency, 'name'):
|
3213
|
+
network = self.safe_string(currency, 'code')
|
3214
|
+
else:
|
3215
|
+
network = self.network_id_to_code(networkId)
|
3213
3216
|
self.check_address(address)
|
3214
3217
|
return {
|
3215
3218
|
'info': depositAddress,
|
@@ -3219,13 +3222,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3219
3222
|
'network': network,
|
3220
3223
|
}
|
3221
3224
|
|
3222
|
-
def safe_network_code(self, networkId, currency=None):
|
3223
|
-
name = self.safe_string(currency, 'name')
|
3224
|
-
if networkId == name:
|
3225
|
-
code = self.safe_string(currency, 'code')
|
3226
|
-
return code
|
3227
|
-
return self.network_id_to_code(networkId)
|
3228
|
-
|
3229
3225
|
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
3230
3226
|
"""
|
3231
3227
|
make a withdrawal
|
ccxt/coinbaseinternational.py
CHANGED
@@ -754,11 +754,12 @@ class coinbaseinternational(Exchange, ImplicitAPI):
|
|
754
754
|
currencyId = self.safe_string(network, 'asset_name')
|
755
755
|
currencyCode = self.safe_currency_code(currencyId)
|
756
756
|
networkId = self.safe_string(network, 'network_arn_id')
|
757
|
+
networkIdForCode = self.safe_string_n(network, ['network_name', 'display_name', 'network_arn_id'], '')
|
757
758
|
return self.safe_network({
|
758
759
|
'info': network,
|
759
760
|
'id': networkId,
|
760
761
|
'name': self.safe_string(network, 'display_name'),
|
761
|
-
'network': self.network_id_to_code(
|
762
|
+
'network': self.network_id_to_code(networkIdForCode, currencyCode),
|
762
763
|
'active': None,
|
763
764
|
'deposit': None,
|
764
765
|
'withdraw': None,
|
ccxt/coinex.py
CHANGED
@@ -3558,24 +3558,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
3558
3558
|
options = self.safe_dict(self.options, 'fetchDepositAddress', {})
|
3559
3559
|
fillResponseFromRequest = self.safe_bool(options, 'fillResponseFromRequest', True)
|
3560
3560
|
if fillResponseFromRequest:
|
3561
|
-
depositAddress['network'] = self.
|
3561
|
+
depositAddress['network'] = self.network_id_to_code(network, currency).upper()
|
3562
3562
|
return depositAddress
|
3563
3563
|
|
3564
|
-
def safe_network(self, networkId, currency: Currency = None):
|
3565
|
-
networks = self.safe_value(currency, 'networks', {})
|
3566
|
-
networksCodes = list(networks.keys())
|
3567
|
-
networksCodesLength = len(networksCodes)
|
3568
|
-
if networkId is None and networksCodesLength == 1:
|
3569
|
-
return networks[networksCodes[0]]
|
3570
|
-
return {
|
3571
|
-
'id': networkId,
|
3572
|
-
'network': None if (networkId is None) else networkId.upper(),
|
3573
|
-
}
|
3574
|
-
|
3575
|
-
def safe_network_code(self, networkId, currency: Currency = None):
|
3576
|
-
network = self.safe_network(networkId, currency)
|
3577
|
-
return network['network']
|
3578
|
-
|
3579
3564
|
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
3580
3565
|
#
|
3581
3566
|
# {
|
ccxt/hitbtc.py
CHANGED
ccxt/huobijp.py
CHANGED
@@ -1564,14 +1564,6 @@ class huobijp(Exchange, ImplicitAPI):
|
|
1564
1564
|
def currency_to_precision(self, code, fee, networkCode=None):
|
1565
1565
|
return self.decimal_to_precision(fee, 0, self.currencies[code]['precision'], self.precisionMode)
|
1566
1566
|
|
1567
|
-
def safe_network(self, networkId):
|
1568
|
-
lastCharacterIndex = len(networkId) - 1
|
1569
|
-
lastCharacter = networkId[lastCharacterIndex]
|
1570
|
-
if lastCharacter == '1':
|
1571
|
-
networkId = networkId[0:lastCharacterIndex]
|
1572
|
-
networksById: dict = {}
|
1573
|
-
return self.safe_string(networksById, networkId, networkId)
|
1574
|
-
|
1575
1567
|
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
1576
1568
|
#
|
1577
1569
|
# {
|
ccxt/latoken.py
CHANGED
@@ -1465,6 +1465,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
1465
1465
|
statuses: dict = {
|
1466
1466
|
'TRANSACTION_STATUS_CONFIRMED': 'ok',
|
1467
1467
|
'TRANSACTION_STATUS_EXECUTED': 'ok',
|
1468
|
+
'TRANSACTION_STATUS_CHECKING': 'pending',
|
1468
1469
|
'TRANSACTION_STATUS_CANCELLED': 'canceled',
|
1469
1470
|
}
|
1470
1471
|
return self.safe_string(statuses, status, status)
|