ccxt 4.3.45__py2.py3-none-any.whl → 4.3.47__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +1 -1
- ccxt/abstract/binance.py +2 -0
- ccxt/abstract/binancecoinm.py +2 -0
- ccxt/abstract/binanceus.py +2 -0
- ccxt/abstract/binanceusdm.py +2 -0
- ccxt/abstract/mexc.py +2 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +2 -0
- ccxt/async_support/bingx.py +26 -18
- ccxt/async_support/bitget.py +1 -1
- ccxt/async_support/bitmart.py +5 -1
- ccxt/async_support/bitteam.py +6 -8
- ccxt/async_support/coinmetro.py +9 -18
- ccxt/async_support/hyperliquid.py +58 -23
- ccxt/async_support/idex.py +1 -0
- ccxt/async_support/mexc.py +8 -6
- ccxt/async_support/okx.py +1 -0
- ccxt/async_support/oxfun.py +2 -2
- ccxt/async_support/tokocrypto.py +9 -11
- ccxt/async_support/wavesexchange.py +1 -0
- ccxt/async_support/woofipro.py +1 -0
- ccxt/base/exchange.py +3 -3
- ccxt/binance.py +2 -0
- ccxt/bingx.py +26 -18
- ccxt/bitget.py +1 -1
- ccxt/bitmart.py +5 -1
- ccxt/bitteam.py +6 -8
- ccxt/coinmetro.py +9 -18
- ccxt/hyperliquid.py +58 -23
- ccxt/idex.py +1 -0
- ccxt/mexc.py +8 -6
- ccxt/okx.py +1 -0
- ccxt/oxfun.py +2 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binanceus.py +0 -8
- ccxt/pro/coinex.py +3 -2
- ccxt/tokocrypto.py +9 -11
- ccxt/wavesexchange.py +1 -0
- ccxt/woofipro.py +1 -0
- {ccxt-4.3.45.dist-info → ccxt-4.3.47.dist-info}/METADATA +128 -128
- {ccxt-4.3.45.dist-info → ccxt-4.3.47.dist-info}/RECORD +44 -44
- {ccxt-4.3.45.dist-info → ccxt-4.3.47.dist-info}/WHEEL +0 -0
- {ccxt-4.3.45.dist-info → ccxt-4.3.47.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/binance.py
CHANGED
@@ -616,6 +616,8 @@ class ImplicitAPI:
|
|
616
616
|
private_get_account_commission = privateGetAccountCommission = Entry('account/commission', 'private', 'GET', {'cost': 4})
|
617
617
|
private_post_order_oco = privatePostOrderOco = Entry('order/oco', 'private', 'POST', {'cost': 0.2})
|
618
618
|
private_post_orderlist_oco = privatePostOrderListOco = Entry('orderList/oco', 'private', 'POST', {'cost': 0.2})
|
619
|
+
private_post_orderlist_oto = privatePostOrderListOto = Entry('orderList/oto', 'private', 'POST', {'cost': 0.2})
|
620
|
+
private_post_orderlist_otoco = privatePostOrderListOtoco = Entry('orderList/otoco', 'private', 'POST', {'cost': 0.2})
|
619
621
|
private_post_sor_order = privatePostSorOrder = Entry('sor/order', 'private', 'POST', {'cost': 0.2})
|
620
622
|
private_post_sor_order_test = privatePostSorOrderTest = Entry('sor/order/test', 'private', 'POST', {'cost': 0.2})
|
621
623
|
private_post_order = privatePostOrder = Entry('order', 'private', 'POST', {'cost': 0.2})
|
ccxt/abstract/binancecoinm.py
CHANGED
@@ -616,6 +616,8 @@ class ImplicitAPI:
|
|
616
616
|
private_get_account_commission = privateGetAccountCommission = Entry('account/commission', 'private', 'GET', {'cost': 4})
|
617
617
|
private_post_order_oco = privatePostOrderOco = Entry('order/oco', 'private', 'POST', {'cost': 0.2})
|
618
618
|
private_post_orderlist_oco = privatePostOrderListOco = Entry('orderList/oco', 'private', 'POST', {'cost': 0.2})
|
619
|
+
private_post_orderlist_oto = privatePostOrderListOto = Entry('orderList/oto', 'private', 'POST', {'cost': 0.2})
|
620
|
+
private_post_orderlist_otoco = privatePostOrderListOtoco = Entry('orderList/otoco', 'private', 'POST', {'cost': 0.2})
|
619
621
|
private_post_sor_order = privatePostSorOrder = Entry('sor/order', 'private', 'POST', {'cost': 0.2})
|
620
622
|
private_post_sor_order_test = privatePostSorOrderTest = Entry('sor/order/test', 'private', 'POST', {'cost': 0.2})
|
621
623
|
private_post_order = privatePostOrder = Entry('order', 'private', 'POST', {'cost': 0.2})
|
ccxt/abstract/binanceus.py
CHANGED
@@ -668,6 +668,8 @@ class ImplicitAPI:
|
|
668
668
|
private_get_account_commission = privateGetAccountCommission = Entry('account/commission', 'private', 'GET', {'cost': 4})
|
669
669
|
private_post_order_oco = privatePostOrderOco = Entry('order/oco', 'private', 'POST', {'cost': 0.2})
|
670
670
|
private_post_orderlist_oco = privatePostOrderListOco = Entry('orderList/oco', 'private', 'POST', {'cost': 0.2})
|
671
|
+
private_post_orderlist_oto = privatePostOrderListOto = Entry('orderList/oto', 'private', 'POST', {'cost': 0.2})
|
672
|
+
private_post_orderlist_otoco = privatePostOrderListOtoco = Entry('orderList/otoco', 'private', 'POST', {'cost': 0.2})
|
671
673
|
private_post_sor_order = privatePostSorOrder = Entry('sor/order', 'private', 'POST', {'cost': 0.2})
|
672
674
|
private_post_sor_order_test = privatePostSorOrderTest = Entry('sor/order/test', 'private', 'POST', {'cost': 0.2})
|
673
675
|
private_post_order = privatePostOrder = Entry('order', 'private', 'POST', {'cost': 0.2})
|
ccxt/abstract/binanceusdm.py
CHANGED
@@ -616,6 +616,8 @@ class ImplicitAPI:
|
|
616
616
|
private_get_account_commission = privateGetAccountCommission = Entry('account/commission', 'private', 'GET', {'cost': 4})
|
617
617
|
private_post_order_oco = privatePostOrderOco = Entry('order/oco', 'private', 'POST', {'cost': 0.2})
|
618
618
|
private_post_orderlist_oco = privatePostOrderListOco = Entry('orderList/oco', 'private', 'POST', {'cost': 0.2})
|
619
|
+
private_post_orderlist_oto = privatePostOrderListOto = Entry('orderList/oto', 'private', 'POST', {'cost': 0.2})
|
620
|
+
private_post_orderlist_otoco = privatePostOrderListOtoco = Entry('orderList/otoco', 'private', 'POST', {'cost': 0.2})
|
619
621
|
private_post_sor_order = privatePostSorOrder = Entry('sor/order', 'private', 'POST', {'cost': 0.2})
|
620
622
|
private_post_sor_order_test = privatePostSorOrderTest = Entry('sor/order/test', 'private', 'POST', {'cost': 0.2})
|
621
623
|
private_post_order = privatePostOrder = Entry('order', 'private', 'POST', {'cost': 0.2})
|
ccxt/abstract/mexc.py
CHANGED
@@ -64,6 +64,7 @@ class ImplicitAPI:
|
|
64
64
|
spot_private_post_sub_account_margin = spotPrivatePostSubAccountMargin = Entry('sub-account/margin', ['spot', 'private'], 'POST', {'cost': 1})
|
65
65
|
spot_private_post_batchorders = spotPrivatePostBatchOrders = Entry('batchOrders', ['spot', 'private'], 'POST', {'cost': 10})
|
66
66
|
spot_private_post_capital_withdraw_apply = spotPrivatePostCapitalWithdrawApply = Entry('capital/withdraw/apply', ['spot', 'private'], 'POST', {'cost': 1})
|
67
|
+
spot_private_post_capital_withdraw = spotPrivatePostCapitalWithdraw = Entry('capital/withdraw', ['spot', 'private'], 'POST', {'cost': 1})
|
67
68
|
spot_private_post_capital_transfer = spotPrivatePostCapitalTransfer = Entry('capital/transfer', ['spot', 'private'], 'POST', {'cost': 1})
|
68
69
|
spot_private_post_capital_transfer_internal = spotPrivatePostCapitalTransferInternal = Entry('capital/transfer/internal', ['spot', 'private'], 'POST', {'cost': 1})
|
69
70
|
spot_private_post_capital_deposit_address = spotPrivatePostCapitalDepositAddress = Entry('capital/deposit/address', ['spot', 'private'], 'POST', {'cost': 1})
|
@@ -78,6 +79,7 @@ class ImplicitAPI:
|
|
78
79
|
spot_private_delete_margin_order = spotPrivateDeleteMarginOrder = Entry('margin/order', ['spot', 'private'], 'DELETE', {'cost': 1})
|
79
80
|
spot_private_delete_margin_openorders = spotPrivateDeleteMarginOpenOrders = Entry('margin/openOrders', ['spot', 'private'], 'DELETE', {'cost': 1})
|
80
81
|
spot_private_delete_userdatastream = spotPrivateDeleteUserDataStream = Entry('userDataStream', ['spot', 'private'], 'DELETE', {'cost': 1})
|
82
|
+
spot_private_delete_capital_withdraw = spotPrivateDeleteCapitalWithdraw = Entry('capital/withdraw', ['spot', 'private'], 'DELETE', {'cost': 1})
|
81
83
|
contract_public_get_ping = contractPublicGetPing = Entry('ping', ['contract', 'public'], 'GET', {'cost': 2})
|
82
84
|
contract_public_get_detail = contractPublicGetDetail = Entry('detail', ['contract', 'public'], 'GET', {'cost': 100})
|
83
85
|
contract_public_get_support_currencies = contractPublicGetSupportCurrencies = Entry('support_currencies', ['contract', 'public'], 'GET', {'cost': 2})
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/binance.py
CHANGED
ccxt/async_support/bingx.py
CHANGED
@@ -22,7 +22,7 @@ from ccxt.base.errors import OrderNotFound
|
|
22
22
|
from ccxt.base.errors import NotSupported
|
23
23
|
from ccxt.base.errors import OperationFailed
|
24
24
|
from ccxt.base.errors import DDoSProtection
|
25
|
-
from ccxt.base.decimal_to_precision import
|
25
|
+
from ccxt.base.decimal_to_precision import TICK_SIZE
|
26
26
|
from ccxt.base.precise import Precise
|
27
27
|
|
28
28
|
|
@@ -400,7 +400,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
400
400
|
'1w': '1w',
|
401
401
|
'1M': '1M',
|
402
402
|
},
|
403
|
-
'precisionMode':
|
403
|
+
'precisionMode': TICK_SIZE,
|
404
404
|
'exceptions': {
|
405
405
|
'exact': {
|
406
406
|
'400': BadRequest,
|
@@ -616,18 +616,26 @@ class bingx(Exchange, ImplicitAPI):
|
|
616
616
|
# "msg": "",
|
617
617
|
# "data": [
|
618
618
|
# {
|
619
|
-
#
|
620
|
-
#
|
621
|
-
#
|
622
|
-
#
|
623
|
-
#
|
624
|
-
#
|
625
|
-
#
|
626
|
-
#
|
627
|
-
#
|
628
|
-
#
|
629
|
-
#
|
630
|
-
#
|
619
|
+
# "contractId": "100",
|
620
|
+
# "symbol": "BTC-USDT",
|
621
|
+
# "size": "0.0001",
|
622
|
+
# "quantityPrecision": "4",
|
623
|
+
# "pricePrecision": "1",
|
624
|
+
# "feeRate": "0.0005",
|
625
|
+
# "makerFeeRate": "0.0002",
|
626
|
+
# "takerFeeRate": "0.0005",
|
627
|
+
# "tradeMinLimit": "0",
|
628
|
+
# "tradeMinQuantity": "0.0001",
|
629
|
+
# "tradeMinUSDT": "2",
|
630
|
+
# "maxLongLeverage": "125",
|
631
|
+
# "maxShortLeverage": "125",
|
632
|
+
# "currency": "USDT",
|
633
|
+
# "asset": "BTC",
|
634
|
+
# "status": "1",
|
635
|
+
# "apiStateOpen": "true",
|
636
|
+
# "apiStateClose": "true",
|
637
|
+
# "ensureTrigger": True,
|
638
|
+
# "triggerFeeRate": "0.00020000"
|
631
639
|
# },
|
632
640
|
# ...
|
633
641
|
# ]
|
@@ -645,12 +653,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
645
653
|
quote = self.safe_currency_code(quoteId)
|
646
654
|
currency = self.safe_string(market, 'currency')
|
647
655
|
settle = self.safe_currency_code(currency)
|
648
|
-
pricePrecision = self.
|
656
|
+
pricePrecision = self.safe_number(market, 'tickSize')
|
649
657
|
if pricePrecision is None:
|
650
|
-
pricePrecision = self.
|
651
|
-
quantityPrecision = self.
|
658
|
+
pricePrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'pricePrecision')))
|
659
|
+
quantityPrecision = self.safe_number(market, 'stepSize')
|
652
660
|
if quantityPrecision is None:
|
653
|
-
quantityPrecision = self.
|
661
|
+
quantityPrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'quantityPrecision')))
|
654
662
|
type = 'swap' if (settle is not None) else 'spot'
|
655
663
|
spot = type == 'spot'
|
656
664
|
swap = type == 'swap'
|
ccxt/async_support/bitget.py
CHANGED
@@ -4190,7 +4190,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4190
4190
|
request['clientOid'] = clientOrderId
|
4191
4191
|
if marginMode is not None:
|
4192
4192
|
request['loanType'] = 'normal'
|
4193
|
-
if
|
4193
|
+
if isMarketOrder and (side == 'buy'):
|
4194
4194
|
request['quoteSize'] = quantity
|
4195
4195
|
else:
|
4196
4196
|
request['baseSize'] = quantity
|
ccxt/async_support/bitmart.py
CHANGED
@@ -2238,7 +2238,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2238
2238
|
trailingActivationPrice = self.safe_number(order, 'activation_price')
|
2239
2239
|
return self.safe_order({
|
2240
2240
|
'id': id,
|
2241
|
-
'clientOrderId': self.
|
2241
|
+
'clientOrderId': self.safe_string_2(order, 'client_order_id', 'clientOrderId'),
|
2242
2242
|
'info': order,
|
2243
2243
|
'timestamp': timestamp,
|
2244
2244
|
'datetime': self.iso8601(timestamp),
|
@@ -2594,6 +2594,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2594
2594
|
request['type'] = 'limit_maker'
|
2595
2595
|
if ioc:
|
2596
2596
|
request['type'] = 'ioc'
|
2597
|
+
clientOrderId = self.safe_string(params, 'clientOrderId')
|
2598
|
+
if clientOrderId is not None:
|
2599
|
+
params = self.omit(params, 'clientOrderId')
|
2600
|
+
request['client_order_id'] = clientOrderId
|
2597
2601
|
return self.extend(request, params)
|
2598
2602
|
|
2599
2603
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
ccxt/async_support/bitteam.py
CHANGED
@@ -15,7 +15,7 @@ from ccxt.base.errors import BadSymbol
|
|
15
15
|
from ccxt.base.errors import InsufficientFunds
|
16
16
|
from ccxt.base.errors import OrderNotFound
|
17
17
|
from ccxt.base.errors import ExchangeNotAvailable
|
18
|
-
from ccxt.base.decimal_to_precision import
|
18
|
+
from ccxt.base.decimal_to_precision import TICK_SIZE
|
19
19
|
from ccxt.base.precise import Precise
|
20
20
|
|
21
21
|
|
@@ -199,7 +199,7 @@ class bitteam(Exchange, ImplicitAPI):
|
|
199
199
|
'maker': self.parse_number('0.002'),
|
200
200
|
},
|
201
201
|
},
|
202
|
-
'precisionMode':
|
202
|
+
'precisionMode': TICK_SIZE,
|
203
203
|
# exchange-specific options
|
204
204
|
'options': {
|
205
205
|
'networksById': {
|
@@ -358,8 +358,6 @@ class bitteam(Exchange, ImplicitAPI):
|
|
358
358
|
base = self.safe_currency_code(baseId)
|
359
359
|
quote = self.safe_currency_code(quoteId)
|
360
360
|
active = self.safe_value(market, 'active')
|
361
|
-
amountPrecision = self.safe_integer(market, 'baseStep')
|
362
|
-
pricePrecision = self.safe_integer(market, 'quoteStep')
|
363
361
|
timeStart = self.safe_string(market, 'timeStart')
|
364
362
|
created = self.parse8601(timeStart)
|
365
363
|
minCost = None
|
@@ -394,8 +392,8 @@ class bitteam(Exchange, ImplicitAPI):
|
|
394
392
|
'strike': None,
|
395
393
|
'optionType': None,
|
396
394
|
'precision': {
|
397
|
-
'amount':
|
398
|
-
'price':
|
395
|
+
'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'baseStep'))),
|
396
|
+
'price': self.parse_number(self.parse_precision(self.safe_string(market, 'quoteStep'))),
|
399
397
|
},
|
400
398
|
'limits': {
|
401
399
|
'leverage': {
|
@@ -549,7 +547,7 @@ class bitteam(Exchange, ImplicitAPI):
|
|
549
547
|
numericId = self.safe_integer(currency, 'id')
|
550
548
|
code = self.safe_currency_code(id)
|
551
549
|
active = self.safe_bool(currency, 'active', False)
|
552
|
-
precision = self.
|
550
|
+
precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'precision')))
|
553
551
|
txLimits = self.safe_value(currency, 'txLimits', {})
|
554
552
|
minWithdraw = self.safe_string(txLimits, 'minWithdraw')
|
555
553
|
maxWithdraw = self.safe_string(txLimits, 'maxWithdraw')
|
@@ -569,7 +567,7 @@ class bitteam(Exchange, ImplicitAPI):
|
|
569
567
|
withdraw = self.safe_value(statuses, 'withdrawStatus')
|
570
568
|
networkIds = list(feesByNetworkId.keys())
|
571
569
|
networks: dict = {}
|
572
|
-
networkPrecision = self.
|
570
|
+
networkPrecision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
|
573
571
|
for j in range(0, len(networkIds)):
|
574
572
|
networkId = networkIds[j]
|
575
573
|
networkCode = self.network_id_to_code(networkId, code)
|
ccxt/async_support/coinmetro.py
CHANGED
@@ -16,7 +16,7 @@ from ccxt.base.errors import InsufficientFunds
|
|
16
16
|
from ccxt.base.errors import InvalidOrder
|
17
17
|
from ccxt.base.errors import OrderNotFound
|
18
18
|
from ccxt.base.errors import RateLimitExceeded
|
19
|
-
from ccxt.base.decimal_to_precision import
|
19
|
+
from ccxt.base.decimal_to_precision import TICK_SIZE
|
20
20
|
from ccxt.base.precise import Precise
|
21
21
|
|
22
22
|
|
@@ -215,7 +215,7 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
215
215
|
'maker': self.parse_number('0'),
|
216
216
|
},
|
217
217
|
},
|
218
|
-
'precisionMode':
|
218
|
+
'precisionMode': TICK_SIZE,
|
219
219
|
# exchange-specific options
|
220
220
|
'options': {
|
221
221
|
'currenciesByIdForParseMarket': None,
|
@@ -317,7 +317,6 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
317
317
|
deposit = self.safe_value(currency, 'canDeposit')
|
318
318
|
canTrade = self.safe_value(currency, 'canTrade')
|
319
319
|
active = withdraw if canTrade else True
|
320
|
-
precision = self.safe_integer(currency, 'digits')
|
321
320
|
minAmount = self.safe_number(currency, 'minQty')
|
322
321
|
result[code] = self.safe_currency_structure({
|
323
322
|
'id': id,
|
@@ -328,7 +327,7 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
328
327
|
'deposit': deposit,
|
329
328
|
'withdraw': withdraw,
|
330
329
|
'fee': None,
|
331
|
-
'precision':
|
330
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'digits'))),
|
332
331
|
'limits': {
|
333
332
|
'amount': {'min': minAmount, 'max': None},
|
334
333
|
'withdraw': {'min': None, 'max': None},
|
@@ -354,19 +353,14 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
354
353
|
#
|
355
354
|
# [
|
356
355
|
# {
|
357
|
-
# "pair": "
|
358
|
-
# "precision": 5,
|
359
|
-
# "margin": False
|
360
|
-
# },
|
361
|
-
# {
|
362
|
-
# "pair": "PERPUSD",
|
356
|
+
# "pair": "YFIEUR",
|
363
357
|
# "precision": 5,
|
364
358
|
# "margin": False
|
365
359
|
# },
|
366
360
|
# {
|
367
|
-
# "pair": "
|
368
|
-
# "precision":
|
369
|
-
# "margin":
|
361
|
+
# "pair": "BTCEUR",
|
362
|
+
# "precision": 2,
|
363
|
+
# "margin": True
|
370
364
|
# },
|
371
365
|
# ...
|
372
366
|
# ]
|
@@ -412,9 +406,7 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
412
406
|
'optionType': None,
|
413
407
|
'precision': {
|
414
408
|
'amount': basePrecisionAndLimits['precision'],
|
415
|
-
'price':
|
416
|
-
'base': basePrecisionAndLimits['precision'],
|
417
|
-
'quote': quotePrecisionAndLimits['precision'],
|
409
|
+
'price': self.parse_number(self.parse_precision(self.safe_string(market, 'precision'))),
|
418
410
|
},
|
419
411
|
'limits': {
|
420
412
|
'leverage': {
|
@@ -464,12 +456,11 @@ class coinmetro(Exchange, ImplicitAPI):
|
|
464
456
|
def parse_market_precision_and_limits(self, currencyId):
|
465
457
|
currencies = self.safe_value(self.options, 'currenciesByIdForParseMarket', {})
|
466
458
|
currency = self.safe_value(currencies, currencyId, {})
|
467
|
-
precision = self.safe_integer(currency, 'precision')
|
468
459
|
limits = self.safe_value(currency, 'limits', {})
|
469
460
|
amountLimits = self.safe_value(limits, 'amount', {})
|
470
461
|
minLimit = self.safe_number(amountLimits, 'min')
|
471
462
|
result: dict = {
|
472
|
-
'precision': precision,
|
463
|
+
'precision': self.safe_number(currency, 'precision'),
|
473
464
|
'minLimit': minLimit,
|
474
465
|
}
|
475
466
|
return result
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hyperliquid import ImplicitAPI
|
8
8
|
import asyncio
|
9
|
-
from ccxt.base.types import Balances, Currencies, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Trade, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -32,6 +32,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
32
32
|
'rateLimit': 50, # 1200 requests per minute, 20 request per second
|
33
33
|
'certified': False,
|
34
34
|
'pro': True,
|
35
|
+
'dex': True,
|
35
36
|
'has': {
|
36
37
|
'CORS': None,
|
37
38
|
'spot': True,
|
@@ -949,11 +950,12 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
949
950
|
signature = self.sign_message(msg, self.privateKey)
|
950
951
|
return signature
|
951
952
|
|
952
|
-
def
|
953
|
+
def sign_user_signed_action(self, messageTypes, message):
|
953
954
|
zeroAddress = self.safe_string(self.options, 'zeroAddress')
|
955
|
+
chainId = 421614 # check self out
|
954
956
|
domain: dict = {
|
955
957
|
'chainId': chainId,
|
956
|
-
'name': '
|
958
|
+
'name': 'HyperliquidSignTransaction',
|
957
959
|
'verifyingContract': zeroAddress,
|
958
960
|
'version': '1',
|
959
961
|
}
|
@@ -962,28 +964,26 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
962
964
|
return signature
|
963
965
|
|
964
966
|
def build_transfer_sig(self, message):
|
965
|
-
isSandboxMode = self.safe_bool(self.options, 'sandboxMode')
|
966
|
-
chainId = 421614 if (isSandboxMode) else 42161
|
967
967
|
messageTypes: dict = {
|
968
|
-
'
|
968
|
+
'HyperliquidTransaction:UsdSend': [
|
969
|
+
{'name': 'hyperliquidChain', 'type': 'string'},
|
969
970
|
{'name': 'destination', 'type': 'string'},
|
970
971
|
{'name': 'amount', 'type': 'string'},
|
971
972
|
{'name': 'time', 'type': 'uint64'},
|
972
973
|
],
|
973
974
|
}
|
974
|
-
return self.
|
975
|
+
return self.sign_user_signed_action(messageTypes, message)
|
975
976
|
|
976
977
|
def build_withdraw_sig(self, message):
|
977
|
-
isSandboxMode = self.safe_bool(self.options, 'sandboxMode')
|
978
|
-
chainId = 421614 if (isSandboxMode) else 42161
|
979
978
|
messageTypes: dict = {
|
980
|
-
'
|
979
|
+
'HyperliquidTransaction:Withdraw': [
|
980
|
+
{'name': 'hyperliquidChain', 'type': 'string'},
|
981
981
|
{'name': 'destination', 'type': 'string'},
|
982
|
-
{'name': '
|
982
|
+
{'name': 'amount', 'type': 'string'},
|
983
983
|
{'name': 'time', 'type': 'uint64'},
|
984
984
|
],
|
985
985
|
}
|
986
|
-
return self.
|
986
|
+
return self.sign_user_signed_action(messageTypes, message)
|
987
987
|
|
988
988
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
989
989
|
"""
|
@@ -2277,8 +2277,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2277
2277
|
if code is not None:
|
2278
2278
|
code = code.upper()
|
2279
2279
|
if code != 'USDC':
|
2280
|
-
raise NotSupported(self.id + '
|
2280
|
+
raise NotSupported(self.id + 'transfer() only support USDC')
|
2281
2281
|
payload: dict = {
|
2282
|
+
'hyperliquidChain': 'Testnet' if isSandboxMode else 'Mainnet',
|
2282
2283
|
'destination': toAccount,
|
2283
2284
|
'amount': self.number_to_string(amount),
|
2284
2285
|
'time': nonce,
|
@@ -2286,9 +2287,12 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2286
2287
|
sig = self.build_transfer_sig(payload)
|
2287
2288
|
request: dict = {
|
2288
2289
|
'action': {
|
2289
|
-
'
|
2290
|
-
'
|
2291
|
-
'
|
2290
|
+
'hyperliquidChain': payload['hyperliquidChain'],
|
2291
|
+
'signatureChainId': '0x66eee', # check self out
|
2292
|
+
'destination': toAccount,
|
2293
|
+
'amount': str(amount),
|
2294
|
+
'time': nonce,
|
2295
|
+
'type': 'usdSend',
|
2292
2296
|
},
|
2293
2297
|
'nonce': nonce,
|
2294
2298
|
'signature': sig,
|
@@ -2296,7 +2300,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2296
2300
|
response = await self.privatePostExchange(self.extend(request, params))
|
2297
2301
|
return response
|
2298
2302
|
|
2299
|
-
async def withdraw(self, code: str, amount, address, tag=None, params={}):
|
2303
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
2300
2304
|
"""
|
2301
2305
|
make a withdrawal(only support USDC)
|
2302
2306
|
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
@@ -2314,25 +2318,56 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2314
2318
|
code = code.upper()
|
2315
2319
|
if code != 'USDC':
|
2316
2320
|
raise NotSupported(self.id + 'withdraw() only support USDC')
|
2317
|
-
isSandboxMode = self.safe_bool(self.options, 'sandboxMode')
|
2321
|
+
isSandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
|
2318
2322
|
nonce = self.milliseconds()
|
2319
2323
|
payload: dict = {
|
2324
|
+
'hyperliquidChain': 'Testnet' if isSandboxMode else 'Mainnet',
|
2320
2325
|
'destination': address,
|
2321
|
-
'
|
2326
|
+
'amount': str(amount),
|
2322
2327
|
'time': nonce,
|
2323
2328
|
}
|
2324
2329
|
sig = self.build_withdraw_sig(payload)
|
2325
2330
|
request: dict = {
|
2326
2331
|
'action': {
|
2327
|
-
'
|
2328
|
-
'
|
2329
|
-
'
|
2332
|
+
'hyperliquidChain': payload['hyperliquidChain'],
|
2333
|
+
'signatureChainId': '0x66eee', # check self out
|
2334
|
+
'destination': address,
|
2335
|
+
'amount': str(amount),
|
2336
|
+
'time': nonce,
|
2337
|
+
'type': 'withdraw3',
|
2330
2338
|
},
|
2331
2339
|
'nonce': nonce,
|
2332
2340
|
'signature': sig,
|
2333
2341
|
}
|
2334
2342
|
response = await self.privatePostExchange(self.extend(request, params))
|
2335
|
-
return response
|
2343
|
+
return self.parse_transaction(response)
|
2344
|
+
|
2345
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
2346
|
+
#
|
2347
|
+
# {status: 'ok', response: {type: 'default'}}
|
2348
|
+
#
|
2349
|
+
return {
|
2350
|
+
'info': transaction,
|
2351
|
+
'id': None,
|
2352
|
+
'txid': None,
|
2353
|
+
'timestamp': None,
|
2354
|
+
'datetime': None,
|
2355
|
+
'network': None,
|
2356
|
+
'address': None,
|
2357
|
+
'addressTo': None,
|
2358
|
+
'addressFrom': None,
|
2359
|
+
'tag': None,
|
2360
|
+
'tagTo': None,
|
2361
|
+
'tagFrom': None,
|
2362
|
+
'type': None,
|
2363
|
+
'amount': None,
|
2364
|
+
'currency': None,
|
2365
|
+
'status': self.safe_string(transaction, 'status'),
|
2366
|
+
'updated': None,
|
2367
|
+
'comment': None,
|
2368
|
+
'internal': None,
|
2369
|
+
'fee': None,
|
2370
|
+
}
|
2336
2371
|
|
2337
2372
|
def format_vault_address(self, address: Str = None):
|
2338
2373
|
if address is None:
|
ccxt/async_support/idex.py
CHANGED
ccxt/async_support/mexc.py
CHANGED
@@ -235,6 +235,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
235
235
|
'sub-account/margin': 1,
|
236
236
|
'batchOrders': 10,
|
237
237
|
'capital/withdraw/apply': 1,
|
238
|
+
'capital/withdraw': 1,
|
238
239
|
'capital/transfer': 1,
|
239
240
|
'capital/transfer/internal': 1,
|
240
241
|
'capital/deposit/address': 1,
|
@@ -253,6 +254,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
253
254
|
'margin/order': 1,
|
254
255
|
'margin/openOrders': 1,
|
255
256
|
'userDataStream': 1,
|
257
|
+
'capital/withdraw': 1,
|
256
258
|
},
|
257
259
|
},
|
258
260
|
},
|
@@ -1069,7 +1071,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
1069
1071
|
chains = self.safe_value(currency, 'networkList', [])
|
1070
1072
|
for j in range(0, len(chains)):
|
1071
1073
|
chain = chains[j]
|
1072
|
-
networkId = self.
|
1074
|
+
networkId = self.safe_string_2(chain, 'network', 'netWork')
|
1073
1075
|
network = self.network_id_to_code(networkId)
|
1074
1076
|
isDepositEnabled = self.safe_bool(chain, 'depositEnable', False)
|
1075
1077
|
isWithdrawEnabled = self.safe_bool(chain, 'withdrawEnable', False)
|
@@ -4894,7 +4896,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4894
4896
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4895
4897
|
"""
|
4896
4898
|
make a withdrawal
|
4897
|
-
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw
|
4899
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw-new
|
4898
4900
|
:param str code: unified currency code
|
4899
4901
|
:param float amount: the amount to withdraw
|
4900
4902
|
:param str address: the address to withdraw to
|
@@ -4904,7 +4906,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4904
4906
|
"""
|
4905
4907
|
tag, params = self.handle_withdraw_tag_and_params(tag, params)
|
4906
4908
|
networks = self.safe_value(self.options, 'networks', {})
|
4907
|
-
network = self.safe_string_2(params, 'network', '
|
4909
|
+
network = self.safe_string_2(params, 'network', 'netWork') # self line allows the user to specify either ERC20 or ETH
|
4908
4910
|
network = self.safe_string(networks, network, network) # handle ETH > ERC-20 alias
|
4909
4911
|
self.check_address(address)
|
4910
4912
|
await self.load_markets()
|
@@ -4917,9 +4919,9 @@ class mexc(Exchange, ImplicitAPI):
|
|
4917
4919
|
if tag is not None:
|
4918
4920
|
request['memo'] = tag
|
4919
4921
|
if network is not None:
|
4920
|
-
request['
|
4921
|
-
params = self.omit(params, ['network', '
|
4922
|
-
response = await self.
|
4922
|
+
request['netWork'] = network
|
4923
|
+
params = self.omit(params, ['network', 'netWork'])
|
4924
|
+
response = await self.spotPrivatePostCapitalWithdraw(self.extend(request, params))
|
4923
4925
|
#
|
4924
4926
|
# {
|
4925
4927
|
# "id":"7213fea8e94b4a5593d507237e5a555b"
|
ccxt/async_support/okx.py
CHANGED
@@ -2386,6 +2386,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2386
2386
|
:see: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-balance
|
2387
2387
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-balance
|
2388
2388
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2389
|
+
:param str [params.type]: wallet type, ['funding' or 'trading'] default is 'trading'
|
2389
2390
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
2390
2391
|
"""
|
2391
2392
|
await self.load_markets()
|
ccxt/async_support/oxfun.py
CHANGED
@@ -33,7 +33,7 @@ class oxfun(Exchange, ImplicitAPI):
|
|
33
33
|
def describe(self):
|
34
34
|
return self.deep_extend(super(oxfun, self).describe(), {
|
35
35
|
'id': 'oxfun',
|
36
|
-
'name': '
|
36
|
+
'name': 'OXFUN',
|
37
37
|
'countries': ['PA'], # Panama todo check
|
38
38
|
'version': 'v3',
|
39
39
|
'rateLimit': 120, # 100 requests per second and 25000 per 5 minutes
|
@@ -153,7 +153,7 @@ class oxfun(Exchange, ImplicitAPI):
|
|
153
153
|
'1d': '86400s',
|
154
154
|
},
|
155
155
|
'urls': {
|
156
|
-
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/
|
156
|
+
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/6a196124-c1ee-4fae-8573-962071b61a85',
|
157
157
|
'referral': 'https://ox.fun/register?shareAccountId=5ZUD4a7G',
|
158
158
|
'api': {
|
159
159
|
'public': 'https://api.ox.fun',
|