ccxt 4.4.86__py2.py3-none-any.whl → 4.4.88__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 +5 -1
- ccxt/abstract/modetrade.py +119 -0
- ccxt/abstract/okxus.py +349 -0
- ccxt/async_support/__init__.py +5 -1
- ccxt/async_support/base/exchange.py +8 -5
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bitteam.py +31 -0
- ccxt/async_support/bybit.py +19 -57
- ccxt/async_support/coinmetro.py +3 -0
- ccxt/async_support/gate.py +91 -73
- ccxt/async_support/htx.py +10 -8
- ccxt/async_support/hyperliquid.py +32 -16
- ccxt/async_support/kraken.py +5 -8
- ccxt/async_support/modetrade.py +2727 -0
- ccxt/async_support/okx.py +90 -3
- ccxt/async_support/okxus.py +54 -0
- ccxt/async_support/paradex.py +4 -1
- ccxt/async_support/phemex.py +4 -6
- ccxt/async_support/poloniex.py +172 -159
- ccxt/async_support/probit.py +18 -47
- ccxt/async_support/timex.py +5 -10
- ccxt/async_support/vertex.py +3 -4
- ccxt/async_support/whitebit.py +41 -11
- ccxt/async_support/woo.py +101 -75
- ccxt/async_support/woofipro.py +25 -20
- ccxt/async_support/xt.py +31 -41
- ccxt/base/exchange.py +13 -9
- ccxt/binance.py +1 -1
- ccxt/bitteam.py +31 -0
- ccxt/bybit.py +19 -57
- ccxt/coinmetro.py +3 -0
- ccxt/gate.py +91 -73
- ccxt/htx.py +10 -8
- ccxt/hyperliquid.py +32 -16
- ccxt/kraken.py +5 -8
- ccxt/modetrade.py +2727 -0
- ccxt/okx.py +90 -3
- ccxt/okxus.py +54 -0
- ccxt/paradex.py +4 -1
- ccxt/phemex.py +4 -6
- ccxt/poloniex.py +172 -159
- ccxt/pro/__init__.py +69 -1
- ccxt/pro/modetrade.py +1271 -0
- ccxt/pro/okxus.py +38 -0
- ccxt/probit.py +18 -47
- ccxt/test/tests_async.py +17 -1
- ccxt/test/tests_sync.py +17 -1
- ccxt/timex.py +5 -10
- ccxt/vertex.py +3 -4
- ccxt/whitebit.py +41 -11
- ccxt/woo.py +100 -75
- ccxt/woofipro.py +24 -20
- ccxt/xt.py +31 -41
- {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/METADATA +18 -6
- {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/RECORD +58 -50
- {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/WHEEL +0 -0
- {ccxt-4.4.86.dist-info → ccxt-4.4.88.dist-info}/top_level.txt +0 -0
ccxt/async_support/probit.py
CHANGED
@@ -483,32 +483,23 @@ class probit(Exchange, ImplicitAPI):
|
|
483
483
|
# ]
|
484
484
|
# }
|
485
485
|
#
|
486
|
-
currencies = self.
|
486
|
+
currencies = self.safe_list(response, 'data', [])
|
487
487
|
result: dict = {}
|
488
488
|
for i in range(0, len(currencies)):
|
489
489
|
currency = currencies[i]
|
490
490
|
id = self.safe_string(currency, 'id')
|
491
491
|
code = self.safe_currency_code(id)
|
492
|
-
displayName = self.
|
492
|
+
displayName = self.safe_dict(currency, 'display_name')
|
493
493
|
name = self.safe_string(displayName, 'en-us')
|
494
|
-
platforms = self.
|
494
|
+
platforms = self.safe_list(currency, 'platform', [])
|
495
495
|
platformsByPriority = self.sort_by(platforms, 'priority')
|
496
|
-
platform = None
|
497
496
|
networkList: dict = {}
|
498
497
|
for j in range(0, len(platformsByPriority)):
|
499
498
|
network = platformsByPriority[j]
|
500
499
|
idInner = self.safe_string(network, 'id')
|
501
500
|
networkCode = self.network_id_to_code(idInner)
|
502
|
-
|
503
|
-
|
504
|
-
currentDeposit = not currentDepositSuspended
|
505
|
-
currentWithdraw = not currentWithdrawalSuspended
|
506
|
-
currentActive = currentDeposit and currentWithdraw
|
507
|
-
if currentActive:
|
508
|
-
platform = network
|
509
|
-
precision = self.parse_precision(self.safe_string(network, 'precision'))
|
510
|
-
withdrawFee = self.safe_value(network, 'withdrawal_fee', [])
|
511
|
-
networkFee = self.safe_value(withdrawFee, 0, {})
|
501
|
+
withdrawFee = self.safe_list(network, 'withdrawal_fee', [])
|
502
|
+
networkFee = self.safe_dict(withdrawFee, 0, {})
|
512
503
|
for k in range(0, len(withdrawFee)):
|
513
504
|
withdrawPlatform = withdrawFee[k]
|
514
505
|
feeCurrencyId = self.safe_string(withdrawPlatform, 'currency_id')
|
@@ -518,11 +509,11 @@ class probit(Exchange, ImplicitAPI):
|
|
518
509
|
networkList[networkCode] = {
|
519
510
|
'id': idInner,
|
520
511
|
'network': networkCode,
|
521
|
-
'active':
|
522
|
-
'deposit':
|
523
|
-
'withdraw':
|
512
|
+
'active': None,
|
513
|
+
'deposit': not self.safe_bool(network, 'deposit_suspended'),
|
514
|
+
'withdraw': not self.safe_bool(network, 'withdrawal_suspended'),
|
524
515
|
'fee': self.safe_number(networkFee, 'amount'),
|
525
|
-
'precision': self.parse_number(precision),
|
516
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(network, 'precision'))),
|
526
517
|
'limits': {
|
527
518
|
'withdraw': {
|
528
519
|
'min': self.safe_number(network, 'min_withdrawal_amount'),
|
@@ -535,53 +526,33 @@ class probit(Exchange, ImplicitAPI):
|
|
535
526
|
},
|
536
527
|
'info': network,
|
537
528
|
}
|
538
|
-
|
539
|
-
platform = self.safe_value(platformsByPriority, 0, {})
|
540
|
-
depositSuspended = self.safe_value(platform, 'deposit_suspended')
|
541
|
-
withdrawalSuspended = self.safe_value(platform, 'withdrawal_suspended')
|
542
|
-
deposit = not depositSuspended
|
543
|
-
withdraw = not withdrawalSuspended
|
544
|
-
active = deposit and withdraw
|
545
|
-
withdrawalFees = self.safe_value(platform, 'withdrawal_fee', {})
|
546
|
-
fees = []
|
547
|
-
# sometimes the withdrawal fee is an empty object
|
548
|
-
# [{'amount': '0.015', 'priority': 1, 'currency_id': 'ETH'}, {}]
|
549
|
-
for j in range(0, len(withdrawalFees)):
|
550
|
-
withdrawalFeeInner = withdrawalFees[j]
|
551
|
-
amount = self.safe_number(withdrawalFeeInner, 'amount')
|
552
|
-
priority = self.safe_integer(withdrawalFeeInner, 'priority')
|
553
|
-
if (amount is not None) and (priority is not None):
|
554
|
-
fees.append(withdrawalFeeInner)
|
555
|
-
withdrawalFeesByPriority = self.sort_by(fees, 'priority')
|
556
|
-
withdrawalFee = self.safe_value(withdrawalFeesByPriority, 0, {})
|
557
|
-
fee = self.safe_number(withdrawalFee, 'amount')
|
558
|
-
result[code] = {
|
529
|
+
result[code] = self.safe_currency_structure({
|
559
530
|
'id': id,
|
560
531
|
'code': code,
|
561
532
|
'info': currency,
|
562
533
|
'name': name,
|
563
|
-
'active':
|
564
|
-
'deposit':
|
565
|
-
'withdraw':
|
534
|
+
'active': None,
|
535
|
+
'deposit': None,
|
536
|
+
'withdraw': None,
|
566
537
|
'type': 'crypto',
|
567
|
-
'fee':
|
568
|
-
'precision':
|
538
|
+
'fee': None,
|
539
|
+
'precision': None,
|
569
540
|
'limits': {
|
570
541
|
'amount': {
|
571
542
|
'min': None,
|
572
543
|
'max': None,
|
573
544
|
},
|
574
545
|
'deposit': {
|
575
|
-
'min':
|
546
|
+
'min': None,
|
576
547
|
'max': None,
|
577
548
|
},
|
578
549
|
'withdraw': {
|
579
|
-
'min':
|
550
|
+
'min': None,
|
580
551
|
'max': None,
|
581
552
|
},
|
582
553
|
},
|
583
554
|
'networks': networkList,
|
584
|
-
}
|
555
|
+
})
|
585
556
|
return result
|
586
557
|
|
587
558
|
def parse_balance(self, response) -> Balances:
|
ccxt/async_support/timex.py
CHANGED
@@ -1393,11 +1393,6 @@ class timex(Exchange, ImplicitAPI):
|
|
1393
1393
|
#
|
1394
1394
|
id = self.safe_string(currency, 'symbol')
|
1395
1395
|
code = self.safe_currency_code(id)
|
1396
|
-
name = self.safe_string(currency, 'name')
|
1397
|
-
depositEnabled = self.safe_value(currency, 'depositEnabled')
|
1398
|
-
withdrawEnabled = self.safe_value(currency, 'withdrawalEnabled')
|
1399
|
-
isActive = self.safe_value(currency, 'active')
|
1400
|
-
active = depositEnabled and withdrawEnabled and isActive
|
1401
1396
|
# fee = self.safe_number(currency, 'withdrawalFee')
|
1402
1397
|
feeString = self.safe_string(currency, 'withdrawalFee')
|
1403
1398
|
tradeDecimals = self.safe_integer(currency, 'tradeDecimals')
|
@@ -1419,14 +1414,14 @@ class timex(Exchange, ImplicitAPI):
|
|
1419
1414
|
'code': code,
|
1420
1415
|
'info': currency,
|
1421
1416
|
'type': None,
|
1422
|
-
'name': name,
|
1423
|
-
'active': active,
|
1424
|
-
'deposit': depositEnabled,
|
1425
|
-
'withdraw':
|
1417
|
+
'name': self.safe_string(currency, 'name'),
|
1418
|
+
'active': self.safe_bool(currency, 'active'),
|
1419
|
+
'deposit': self.safe_bool(currency, 'depositEnabled'),
|
1420
|
+
'withdraw': self.safe_bool(currency, 'withdrawalEnabled'),
|
1426
1421
|
'fee': fee,
|
1427
1422
|
'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals'))),
|
1428
1423
|
'limits': {
|
1429
|
-
'withdraw': {'min':
|
1424
|
+
'withdraw': {'min': None, 'max': None},
|
1430
1425
|
'amount': {'min': None, 'max': None},
|
1431
1426
|
},
|
1432
1427
|
'networks': {},
|
ccxt/async_support/vertex.py
CHANGED
@@ -457,11 +457,10 @@ class vertex(Exchange, ImplicitAPI):
|
|
457
457
|
tickerId = self.safe_string(data, 'ticker_id')
|
458
458
|
if (tickerId is not None) and (tickerId.find('PERP') > 0):
|
459
459
|
continue
|
460
|
-
id = self.safe_string(data, 'product_id')
|
461
460
|
name = self.safe_string(data, 'symbol')
|
462
461
|
code = self.safe_currency_code(name)
|
463
|
-
result[code] = {
|
464
|
-
'id':
|
462
|
+
result[code] = self.safe_currency_structure({
|
463
|
+
'id': self.safe_string(data, 'product_id'),
|
465
464
|
'name': name,
|
466
465
|
'code': code,
|
467
466
|
'precision': None,
|
@@ -481,7 +480,7 @@ class vertex(Exchange, ImplicitAPI):
|
|
481
480
|
'max': None,
|
482
481
|
},
|
483
482
|
},
|
484
|
-
}
|
483
|
+
})
|
485
484
|
return result
|
486
485
|
|
487
486
|
def parse_market(self, market) -> Market:
|
ccxt/async_support/whitebit.py
CHANGED
@@ -623,25 +623,51 @@ class whitebit(Exchange, ImplicitAPI):
|
|
623
623
|
for i in range(0, len(ids)):
|
624
624
|
id = ids[i]
|
625
625
|
currency = response[id]
|
626
|
-
# breaks down in Python due to utf8 encoding issues on the exchange side
|
627
|
-
# name = self.safe_string(currency, 'name')
|
628
|
-
canDeposit = self.safe_bool(currency, 'can_deposit', True)
|
629
|
-
canWithdraw = self.safe_bool(currency, 'can_withdraw', True)
|
630
|
-
active = canDeposit and canWithdraw
|
626
|
+
# name = self.safe_string(currency, 'name') # breaks down in Python due to utf8 encoding issues on the exchange side
|
631
627
|
code = self.safe_currency_code(id)
|
632
628
|
hasProvider = ('providers' in currency)
|
633
|
-
|
629
|
+
networks = {}
|
630
|
+
rawNetworks = self.safe_dict(currency, 'networks', {})
|
631
|
+
depositsNetworks = self.safe_list(rawNetworks, 'deposits', [])
|
632
|
+
withdrawsNetworks = self.safe_list(rawNetworks, 'withdraws', [])
|
633
|
+
networkLimits = self.safe_dict(currency, 'limits', {})
|
634
|
+
depositLimits = self.safe_dict(networkLimits, 'deposit', {})
|
635
|
+
withdrawLimits = self.safe_dict(networkLimits, 'withdraw', {})
|
636
|
+
allNetworks = self.array_concat(depositsNetworks, withdrawsNetworks)
|
637
|
+
for j in range(0, len(allNetworks)):
|
638
|
+
networkId = allNetworks[j]
|
639
|
+
networkCode = self.network_id_to_code(networkId)
|
640
|
+
networks[networkCode] = {
|
641
|
+
'id': networkId,
|
642
|
+
'network': networkCode,
|
643
|
+
'active': None,
|
644
|
+
'deposit': self.in_array(networkId, depositsNetworks),
|
645
|
+
'withdraw': self.in_array(networkId, withdrawsNetworks),
|
646
|
+
'fee': None,
|
647
|
+
'precision': None,
|
648
|
+
'limits': {
|
649
|
+
'deposit': {
|
650
|
+
'min': self.safe_number(depositLimits, 'min', None),
|
651
|
+
'max': self.safe_number(depositLimits, 'max', None),
|
652
|
+
},
|
653
|
+
'withdraw': {
|
654
|
+
'min': self.safe_number(withdrawLimits, 'min', None),
|
655
|
+
'max': self.safe_number(withdrawLimits, 'max', None),
|
656
|
+
},
|
657
|
+
},
|
658
|
+
}
|
659
|
+
result[code] = self.safe_currency_structure({
|
634
660
|
'id': id,
|
635
661
|
'code': code,
|
636
662
|
'info': currency, # the original payload
|
637
663
|
'name': None, # see the comment above
|
638
|
-
'active':
|
639
|
-
'deposit':
|
640
|
-
'withdraw':
|
664
|
+
'active': None,
|
665
|
+
'deposit': self.safe_bool(currency, 'can_deposit'),
|
666
|
+
'withdraw': self.safe_bool(currency, 'can_withdraw'),
|
641
667
|
'fee': None,
|
642
668
|
'networks': None, # todo
|
643
669
|
'type': 'fiat' if hasProvider else 'crypto',
|
644
|
-
'precision':
|
670
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(currency, 'currency_precision'))),
|
645
671
|
'limits': {
|
646
672
|
'amount': {
|
647
673
|
'min': None,
|
@@ -651,8 +677,12 @@ class whitebit(Exchange, ImplicitAPI):
|
|
651
677
|
'min': self.safe_number(currency, 'min_withdraw'),
|
652
678
|
'max': self.safe_number(currency, 'max_withdraw'),
|
653
679
|
},
|
680
|
+
'deposit': {
|
681
|
+
'min': self.safe_number(currency, 'min_deposit'),
|
682
|
+
'max': self.safe_number(currency, 'max_deposit'),
|
683
|
+
},
|
654
684
|
},
|
655
|
-
}
|
685
|
+
})
|
656
686
|
return result
|
657
687
|
|
658
688
|
async def fetch_transaction_fees(self, codes: Strings = None, params={}):
|
ccxt/async_support/woo.py
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.woo import ImplicitAPI
|
8
|
+
import asyncio
|
8
9
|
import hashlib
|
9
10
|
from ccxt.base.types import Account, Any, Balances, Bool, Conversion, Currencies, Currency, DepositAddress, Int, LedgerEntry, Leverage, MarginModification, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction, TransferEntry
|
10
11
|
from typing import List
|
@@ -311,6 +312,11 @@ class woo(Exchange, ImplicitAPI):
|
|
311
312
|
'TRC20': 'TRON',
|
312
313
|
'ERC20': 'ETH',
|
313
314
|
'BEP20': 'BSC',
|
315
|
+
'ARB': 'Arbitrum',
|
316
|
+
},
|
317
|
+
'networksById': {
|
318
|
+
'TRX': 'TRC20',
|
319
|
+
'TRON': 'TRC20',
|
314
320
|
},
|
315
321
|
# override defaultNetworkCodePriorities for a specific currency
|
316
322
|
'defaultNetworkCodeForCurrencies': {
|
@@ -817,33 +823,45 @@ class woo(Exchange, ImplicitAPI):
|
|
817
823
|
:returns dict: an associative dictionary of currencies
|
818
824
|
"""
|
819
825
|
result: dict = {}
|
820
|
-
|
826
|
+
tokenResponsePromise = self.v1PublicGetToken(params)
|
821
827
|
#
|
822
|
-
#
|
823
|
-
#
|
828
|
+
# {
|
829
|
+
# "rows": [
|
824
830
|
# {
|
825
831
|
# "token": "ETH_USDT",
|
826
832
|
# "fullname": "Tether",
|
827
|
-
# "
|
833
|
+
# "network": "ETH",
|
834
|
+
# "decimals": "6",
|
835
|
+
# "delisted": False,
|
828
836
|
# "balance_token": "USDT",
|
829
|
-
# "created_time": "
|
830
|
-
# "updated_time": "
|
837
|
+
# "created_time": "1710123398",
|
838
|
+
# "updated_time": "1746528481",
|
839
|
+
# "can_collateral": True,
|
840
|
+
# "can_short": True
|
831
841
|
# },
|
832
842
|
# {
|
833
843
|
# "token": "BSC_USDT",
|
834
844
|
# "fullname": "Tether",
|
835
|
-
# "
|
845
|
+
# "network": "BSC",
|
846
|
+
# "decimals": "18",
|
847
|
+
# "delisted": False,
|
836
848
|
# "balance_token": "USDT",
|
837
|
-
# "created_time": "
|
838
|
-
# "updated_time": "
|
849
|
+
# "created_time": "1710123395",
|
850
|
+
# "updated_time": "1746528601",
|
851
|
+
# "can_collateral": True,
|
852
|
+
# "can_short": True
|
839
853
|
# },
|
840
854
|
# {
|
841
|
-
# "token": "
|
842
|
-
# "fullname": "
|
843
|
-
# "
|
844
|
-
# "
|
845
|
-
# "
|
846
|
-
# "
|
855
|
+
# "token": "ALGO",
|
856
|
+
# "fullname": "Algorand",
|
857
|
+
# "network": "ALGO",
|
858
|
+
# "decimals": "6",
|
859
|
+
# "delisted": False,
|
860
|
+
# "balance_token": "ALGO",
|
861
|
+
# "created_time": "1710123394",
|
862
|
+
# "updated_time": "1723087518",
|
863
|
+
# "can_collateral": True,
|
864
|
+
# "can_short": True
|
847
865
|
# },
|
848
866
|
# ...
|
849
867
|
# ],
|
@@ -851,58 +869,66 @@ class woo(Exchange, ImplicitAPI):
|
|
851
869
|
# }
|
852
870
|
#
|
853
871
|
# only make one request for currrencies...
|
854
|
-
|
872
|
+
tokenNetworkResponsePromise = self.v1PublicGetTokenNetwork(params)
|
855
873
|
#
|
856
874
|
# {
|
857
875
|
# "rows": [
|
858
876
|
# {
|
859
877
|
# "protocol": "ERC20",
|
878
|
+
# "network": "ETH",
|
860
879
|
# "token": "USDT",
|
861
|
-
# "name": "Ethereum",
|
862
|
-
# "minimum_withdrawal":
|
863
|
-
# "withdrawal_fee":
|
864
|
-
# "allow_deposit": 1,
|
865
|
-
# "allow_withdraw": 1
|
880
|
+
# "name": "Ethereum(ERC20)",
|
881
|
+
# "minimum_withdrawal": "10.00000000",
|
882
|
+
# "withdrawal_fee": "2.00000000",
|
883
|
+
# "allow_deposit": "1",
|
884
|
+
# "allow_withdraw": "1"
|
866
885
|
# },
|
867
886
|
# {
|
868
887
|
# "protocol": "TRC20",
|
888
|
+
# "network": "TRX",
|
869
889
|
# "token": "USDT",
|
870
|
-
# "name": "Tron",
|
871
|
-
# "minimum_withdrawal":
|
872
|
-
# "withdrawal_fee":
|
873
|
-
# "allow_deposit": 1,
|
874
|
-
# "allow_withdraw": 1
|
890
|
+
# "name": "Tron(TRC20)",
|
891
|
+
# "minimum_withdrawal": "10.00000000",
|
892
|
+
# "withdrawal_fee": "4.50000000",
|
893
|
+
# "allow_deposit": "1",
|
894
|
+
# "allow_withdraw": "1"
|
875
895
|
# },
|
876
896
|
# ...
|
877
897
|
# ],
|
878
898
|
# "success": True
|
879
899
|
# }
|
880
900
|
#
|
901
|
+
tokenResponse, tokenNetworkResponse = await asyncio.gather(*[tokenResponsePromise, tokenNetworkResponsePromise])
|
881
902
|
tokenRows = self.safe_list(tokenResponse, 'rows', [])
|
882
|
-
|
883
|
-
|
903
|
+
tokenNetworkRows = self.safe_list(tokenNetworkResponse, 'rows', [])
|
904
|
+
networksById = self.group_by(tokenNetworkRows, 'token')
|
905
|
+
tokensById = self.group_by(tokenRows, 'balance_token')
|
906
|
+
currencyIds = list(tokensById.keys())
|
884
907
|
for i in range(0, len(currencyIds)):
|
885
908
|
currencyId = currencyIds[i]
|
886
|
-
networks = networksByCurrencyId[currencyId]
|
887
909
|
code = self.safe_currency_code(currencyId)
|
888
|
-
|
889
|
-
|
910
|
+
tokensByNetworkId = self.index_by(tokensById[currencyId], 'network')
|
911
|
+
chainsByNetworkId = self.index_by(networksById[currencyId], 'network')
|
912
|
+
keys = list(chainsByNetworkId.keys())
|
890
913
|
resultingNetworks: dict = {}
|
891
|
-
for j in range(0, len(
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
if precision is not None:
|
899
|
-
minPrecision = precision if (minPrecision is None) else Precise.string_min(precision, minPrecision)
|
900
|
-
resultingNetworks[unifiedNetwork] = {
|
914
|
+
for j in range(0, len(keys)):
|
915
|
+
networkId = keys[j]
|
916
|
+
tokenEntry = self.safe_dict(tokensByNetworkId, networkId, {})
|
917
|
+
networkEntry = self.safe_dict(chainsByNetworkId, networkId, {})
|
918
|
+
networkCode = self.network_id_to_code(networkId, code)
|
919
|
+
specialNetworkId = self.safe_string(tokenEntry, 'token')
|
920
|
+
resultingNetworks[networkCode] = {
|
901
921
|
'id': networkId,
|
902
|
-
'
|
922
|
+
'currencyNetworkId': specialNetworkId, # exchange uses special crrency-ids(coin + network junction)
|
923
|
+
'network': networkCode,
|
924
|
+
'active': None,
|
925
|
+
'deposit': self.safe_string(networkEntry, 'allow_deposit') == '1',
|
926
|
+
'withdraw': self.safe_string(networkEntry, 'allow_withdraw') == '1',
|
927
|
+
'fee': self.safe_number(networkEntry, 'withdrawal_fee'),
|
928
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(tokenEntry, 'decimals'))),
|
903
929
|
'limits': {
|
904
930
|
'withdraw': {
|
905
|
-
'min':
|
931
|
+
'min': self.safe_number(networkEntry, 'minimum_withdrawal'),
|
906
932
|
'max': None,
|
907
933
|
},
|
908
934
|
'deposit': {
|
@@ -910,18 +936,13 @@ class woo(Exchange, ImplicitAPI):
|
|
910
936
|
'max': None,
|
911
937
|
},
|
912
938
|
},
|
913
|
-
'
|
914
|
-
'deposit': None,
|
915
|
-
'withdraw': None,
|
916
|
-
'fee': None,
|
917
|
-
'precision': self.parse_number(precision),
|
918
|
-
'info': network,
|
939
|
+
'info': [networkEntry, tokenEntry],
|
919
940
|
}
|
920
|
-
result[code] = {
|
941
|
+
result[code] = self.safe_currency_structure({
|
921
942
|
'id': currencyId,
|
922
|
-
'name':
|
943
|
+
'name': None,
|
923
944
|
'code': code,
|
924
|
-
'precision':
|
945
|
+
'precision': None,
|
925
946
|
'active': None,
|
926
947
|
'fee': None,
|
927
948
|
'networks': resultingNetworks,
|
@@ -938,8 +959,8 @@ class woo(Exchange, ImplicitAPI):
|
|
938
959
|
'max': None,
|
939
960
|
},
|
940
961
|
},
|
941
|
-
'info':
|
942
|
-
}
|
962
|
+
'info': [tokensByNetworkId, chainsByNetworkId],
|
963
|
+
})
|
943
964
|
return result
|
944
965
|
|
945
966
|
async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
@@ -1511,7 +1532,7 @@ class woo(Exchange, ImplicitAPI):
|
|
1511
1532
|
if limit is not None:
|
1512
1533
|
request['size'] = limit
|
1513
1534
|
else:
|
1514
|
-
request['size'] = 500
|
1535
|
+
request['size'] = 50 if trailing else 500
|
1515
1536
|
if trigger:
|
1516
1537
|
request['algoType'] = 'stop'
|
1517
1538
|
elif trailing:
|
@@ -2071,12 +2092,10 @@ class woo(Exchange, ImplicitAPI):
|
|
2071
2092
|
# self method is TODO because of networks unification
|
2072
2093
|
await self.load_markets()
|
2073
2094
|
currency = self.currency(code)
|
2074
|
-
|
2075
|
-
|
2076
|
-
params = self.omit(params, 'network')
|
2077
|
-
codeForExchange = networkCode + '_' + currency['code']
|
2095
|
+
specialNetworkId: Str = None
|
2096
|
+
specialNetworkId, params = self.get_dedicated_network_id(currency, params)
|
2078
2097
|
request: dict = {
|
2079
|
-
'token':
|
2098
|
+
'token': specialNetworkId,
|
2080
2099
|
}
|
2081
2100
|
response = await self.v1PrivateGetAssetDeposit(self.extend(request, params))
|
2082
2101
|
# {
|
@@ -2084,15 +2103,28 @@ class woo(Exchange, ImplicitAPI):
|
|
2084
2103
|
# "address": "3Jmtjx5544T4smrit9Eroe4PCrRkpDeKjP",
|
2085
2104
|
# "extra": ''
|
2086
2105
|
# }
|
2087
|
-
|
2088
|
-
|
2106
|
+
return self.parse_deposit_address(response, currency)
|
2107
|
+
|
2108
|
+
def get_dedicated_network_id(self, currency, params: dict) -> Any:
|
2109
|
+
networkCode = None
|
2110
|
+
networkCode, params = self.handle_network_code_and_params(params)
|
2111
|
+
networkCode = self.network_id_to_code(networkCode, currency['code'])
|
2112
|
+
networkEntry = self.safe_dict(currency['networks'], networkCode)
|
2113
|
+
if networkEntry is None:
|
2114
|
+
supportedNetworks = list(currency['networks'].keys())
|
2115
|
+
raise BadRequest(self.id + ' can not determine a network code, please provide unified "network" param, one from the following: ' + self.json(supportedNetworks))
|
2116
|
+
currentyNetworkId = self.safe_string(networkEntry, 'currencyNetworkId')
|
2117
|
+
return [currentyNetworkId, params]
|
2118
|
+
|
2119
|
+
def parse_deposit_address(self, depositEntry, currency: Currency = None) -> DepositAddress:
|
2120
|
+
address = self.safe_string(depositEntry, 'address')
|
2089
2121
|
self.check_address(address)
|
2090
2122
|
return {
|
2091
|
-
'info':
|
2092
|
-
'currency': code,
|
2093
|
-
'network':
|
2123
|
+
'info': depositEntry,
|
2124
|
+
'currency': self.safe_string(currency, 'code'),
|
2125
|
+
'network': None,
|
2094
2126
|
'address': address,
|
2095
|
-
'tag':
|
2127
|
+
'tag': self.safe_string(depositEntry, 'extra'),
|
2096
2128
|
}
|
2097
2129
|
|
2098
2130
|
async def get_asset_history_rows(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> Any:
|
@@ -2484,15 +2516,9 @@ class woo(Exchange, ImplicitAPI):
|
|
2484
2516
|
}
|
2485
2517
|
if tag is not None:
|
2486
2518
|
request['extra'] = tag
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
networkId = self.safe_string(networks, network, network)
|
2491
|
-
coinNetwork = self.safe_dict(currencyNetworks, networkId, {})
|
2492
|
-
coinNetworkId = self.safe_string(coinNetwork, 'id')
|
2493
|
-
if coinNetworkId is None:
|
2494
|
-
raise BadRequest(self.id + ' withdraw() require network parameter')
|
2495
|
-
request['token'] = coinNetworkId
|
2519
|
+
specialNetworkId: Str = None
|
2520
|
+
specialNetworkId, params = self.get_dedicated_network_id(currency, params)
|
2521
|
+
request['token'] = specialNetworkId
|
2496
2522
|
response = await self.v1PrivatePostAssetWithdraw(self.extend(request, params))
|
2497
2523
|
#
|
2498
2524
|
# {
|
ccxt/async_support/woofipro.py
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.woofipro import ImplicitAPI
|
8
|
+
import asyncio
|
8
9
|
from ccxt.base.types import Any, Balances, Currencies, Currency, Int, LedgerEntry, Leverage, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, FundingRate, FundingRates, Trade, TradingFees, Transaction
|
9
10
|
from typing import List
|
10
11
|
from ccxt.base.errors import ExchangeError
|
@@ -633,13 +634,14 @@ class woofipro(Exchange, ImplicitAPI):
|
|
633
634
|
"""
|
634
635
|
fetches all available currencies on an exchange
|
635
636
|
|
636
|
-
https://orderly.network/docs/build-on-
|
637
|
+
https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-collateral-info#get-supported-collateral-info
|
638
|
+
https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-chains-per-builder#get-supported-chains-per-builder
|
637
639
|
|
638
640
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
639
641
|
:returns dict: an associative dictionary of currencies
|
640
642
|
"""
|
641
643
|
result: dict = {}
|
642
|
-
|
644
|
+
tokenPromise = self.v1PublicGetPublicToken(params)
|
643
645
|
#
|
644
646
|
# {
|
645
647
|
# "success": True,
|
@@ -662,25 +664,28 @@ class woofipro(Exchange, ImplicitAPI):
|
|
662
664
|
# }
|
663
665
|
# }
|
664
666
|
#
|
665
|
-
|
666
|
-
|
667
|
+
chainPromise = self.v1PublicGetPublicChainInfo(params)
|
668
|
+
tokenResponse, chainResponse = await asyncio.gather(*[tokenPromise, chainPromise])
|
669
|
+
tokenData = self.safe_dict(tokenResponse, 'data', {})
|
670
|
+
tokenRows = self.safe_list(tokenData, 'rows', [])
|
671
|
+
chainData = self.safe_dict(chainResponse, 'data', {})
|
672
|
+
chainRows = self.safe_list(chainData, 'rows', [])
|
673
|
+
indexedChains = self.index_by(chainRows, 'chain_id')
|
667
674
|
for i in range(0, len(tokenRows)):
|
668
675
|
token = tokenRows[i]
|
669
676
|
currencyId = self.safe_string(token, 'token')
|
670
677
|
networks = self.safe_list(token, 'chain_details')
|
671
678
|
code = self.safe_currency_code(currencyId)
|
672
|
-
minPrecision = None
|
673
679
|
resultingNetworks: dict = {}
|
674
680
|
for j in range(0, len(networks)):
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
resultingNetworks[networkId] = {
|
681
|
+
networkEntry = networks[j]
|
682
|
+
networkId = self.safe_string(networkEntry, 'chain_id')
|
683
|
+
networkRow = self.safe_dict(indexedChains, networkId)
|
684
|
+
networkName = self.safe_string(networkRow, 'name')
|
685
|
+
networkCode = self.network_id_to_code(networkName, code)
|
686
|
+
resultingNetworks[networkCode] = {
|
682
687
|
'id': networkId,
|
683
|
-
'network':
|
688
|
+
'network': networkCode,
|
684
689
|
'limits': {
|
685
690
|
'withdraw': {
|
686
691
|
'min': None,
|
@@ -694,15 +699,15 @@ class woofipro(Exchange, ImplicitAPI):
|
|
694
699
|
'active': None,
|
695
700
|
'deposit': None,
|
696
701
|
'withdraw': None,
|
697
|
-
'fee': self.safe_number(
|
698
|
-
'precision': self.parse_number(
|
699
|
-
'info':
|
702
|
+
'fee': self.safe_number(networkEntry, 'withdrawal_fee'),
|
703
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(networkEntry, 'decimals'))),
|
704
|
+
'info': [networkEntry, networkRow],
|
700
705
|
}
|
701
|
-
result[code] = {
|
706
|
+
result[code] = self.safe_currency_structure({
|
702
707
|
'id': currencyId,
|
703
|
-
'name':
|
708
|
+
'name': None,
|
704
709
|
'code': code,
|
705
|
-
'precision':
|
710
|
+
'precision': None,
|
706
711
|
'active': None,
|
707
712
|
'fee': None,
|
708
713
|
'networks': resultingNetworks,
|
@@ -719,7 +724,7 @@ class woofipro(Exchange, ImplicitAPI):
|
|
719
724
|
},
|
720
725
|
},
|
721
726
|
'info': token,
|
722
|
-
}
|
727
|
+
})
|
723
728
|
return result
|
724
729
|
|
725
730
|
def parse_token_and_fee_temp(self, item, feeTokenKey, feeAmountKey):
|