ccxt 4.4.85__py2.py3-none-any.whl → 4.4.87__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 +7 -5
- ccxt/abstract/modetrade.py +119 -0
- ccxt/abstract/myokx.py +2 -0
- ccxt/abstract/okx.py +2 -0
- ccxt/abstract/okxus.py +349 -0
- ccxt/ascendex.py +187 -151
- ccxt/async_support/__init__.py +7 -5
- ccxt/async_support/ascendex.py +187 -151
- ccxt/async_support/base/exchange.py +30 -26
- ccxt/async_support/bequant.py +1 -1
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bitget.py +4 -4
- ccxt/async_support/bitmart.py +1 -1
- ccxt/async_support/bitteam.py +31 -0
- ccxt/async_support/{huobijp.py → bittrade.py} +11 -11
- ccxt/async_support/coinbase.py +2 -5
- ccxt/async_support/coinmetro.py +3 -0
- ccxt/async_support/deribit.py +4 -5
- ccxt/async_support/gate.py +91 -73
- ccxt/async_support/hollaex.py +106 -49
- ccxt/async_support/htx.py +30 -51
- ccxt/async_support/hyperliquid.py +36 -20
- ccxt/async_support/kraken.py +5 -8
- ccxt/async_support/mexc.py +2 -2
- ccxt/async_support/modetrade.py +2727 -0
- ccxt/async_support/ndax.py +25 -24
- ccxt/async_support/okcoin.py +12 -29
- ccxt/async_support/okx.py +99 -3
- ccxt/async_support/okxus.py +54 -0
- ccxt/async_support/onetrading.py +10 -7
- ccxt/async_support/oxfun.py +40 -110
- ccxt/async_support/paradex.py +6 -0
- 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 +12 -9
- ccxt/bequant.py +1 -1
- ccxt/binance.py +1 -1
- ccxt/bitget.py +4 -4
- ccxt/bitmart.py +1 -1
- ccxt/bitteam.py +31 -0
- ccxt/{huobijp.py → bittrade.py} +11 -11
- ccxt/coinbase.py +2 -5
- ccxt/coinmetro.py +3 -0
- ccxt/deribit.py +4 -5
- ccxt/gate.py +91 -73
- ccxt/hollaex.py +106 -49
- ccxt/htx.py +30 -51
- ccxt/hyperliquid.py +36 -20
- ccxt/kraken.py +5 -8
- ccxt/mexc.py +2 -2
- ccxt/modetrade.py +2727 -0
- ccxt/ndax.py +25 -24
- ccxt/okcoin.py +12 -29
- ccxt/okx.py +99 -3
- ccxt/okxus.py +54 -0
- ccxt/onetrading.py +10 -7
- ccxt/oxfun.py +40 -110
- ccxt/paradex.py +6 -0
- ccxt/phemex.py +4 -6
- ccxt/poloniex.py +172 -159
- ccxt/pro/__init__.py +101 -3
- ccxt/pro/binance.py +1 -0
- ccxt/pro/{huobijp.py → bittrade.py} +3 -3
- ccxt/pro/luno.py +6 -5
- ccxt/pro/mexc.py +2 -0
- 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.85.dist-info → ccxt-4.4.87.dist-info}/METADATA +19 -8
- {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/RECORD +89 -84
- ccxt/abstract/kuna.py +0 -182
- ccxt/async_support/kuna.py +0 -1935
- ccxt/kuna.py +0 -1935
- /ccxt/abstract/{huobijp.py → bittrade.py} +0 -0
- {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/WHEEL +0 -0
- {ccxt-4.4.85.dist-info → ccxt-4.4.87.dist-info}/top_level.txt +0 -0
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):
|
ccxt/async_support/xt.py
CHANGED
@@ -912,48 +912,30 @@ class xt(Exchange, ImplicitAPI):
|
|
912
912
|
entry = currenciesData[i]
|
913
913
|
currencyId = self.safe_string(entry, 'currency')
|
914
914
|
code = self.safe_currency_code(currencyId)
|
915
|
-
minPrecision = self.parse_number(self.parse_precision(self.safe_string(entry, 'maxPrecision')))
|
916
915
|
networkEntry = self.safe_value(chainsDataIndexed, currencyId, {})
|
917
916
|
rawNetworks = self.safe_value(networkEntry, 'supportChains', [])
|
918
917
|
networks = {}
|
919
|
-
minWithdrawString = None
|
920
|
-
minWithdrawFeeString = None
|
921
|
-
active = False
|
922
|
-
deposit = False
|
923
|
-
withdraw = False
|
924
918
|
for j in range(0, len(rawNetworks)):
|
925
919
|
rawNetwork = rawNetworks[j]
|
926
920
|
networkId = self.safe_string(rawNetwork, 'chain')
|
927
|
-
|
928
|
-
|
929
|
-
deposit = depositEnabled if (depositEnabled) else deposit
|
930
|
-
withdrawEnabled = self.safe_value(rawNetwork, 'withdrawEnabled')
|
931
|
-
withdraw = withdrawEnabled if (withdrawEnabled) else withdraw
|
932
|
-
networkActive = depositEnabled and withdrawEnabled
|
933
|
-
active = networkActive if (networkActive) else active
|
934
|
-
withdrawFeeString = self.safe_string(rawNetwork, 'withdrawFeeAmount')
|
935
|
-
if withdrawFeeString is not None:
|
936
|
-
minWithdrawFeeString = withdrawFeeString if (minWithdrawFeeString is None) else Precise.string_min(withdrawFeeString, minWithdrawFeeString)
|
937
|
-
minNetworkWithdrawString = self.safe_string(rawNetwork, 'withdrawMinAmount')
|
938
|
-
if minNetworkWithdrawString is not None:
|
939
|
-
minWithdrawString = minNetworkWithdrawString if (minWithdrawString is None) else Precise.string_min(minNetworkWithdrawString, minWithdrawString)
|
940
|
-
networks[network] = {
|
921
|
+
networkCode = self.network_id_to_code(networkId, code)
|
922
|
+
networks[networkCode] = {
|
941
923
|
'info': rawNetwork,
|
942
924
|
'id': networkId,
|
943
|
-
'network':
|
925
|
+
'network': networkCode,
|
944
926
|
'name': None,
|
945
|
-
'active':
|
946
|
-
'fee': self.
|
947
|
-
'precision':
|
948
|
-
'deposit': depositEnabled,
|
949
|
-
'withdraw': withdrawEnabled,
|
927
|
+
'active': None,
|
928
|
+
'fee': self.safe_number(rawNetwork, 'withdrawFeeAmount'),
|
929
|
+
'precision': None,
|
930
|
+
'deposit': self.safe_bool(rawNetwork, 'depositEnabled'),
|
931
|
+
'withdraw': self.safe_bool(rawNetwork, 'withdrawEnabled'),
|
950
932
|
'limits': {
|
951
933
|
'amount': {
|
952
934
|
'min': None,
|
953
935
|
'max': None,
|
954
936
|
},
|
955
937
|
'withdraw': {
|
956
|
-
'min': self.
|
938
|
+
'min': self.safe_number(rawNetwork, 'withdrawMinAmount'),
|
957
939
|
'max': None,
|
958
940
|
},
|
959
941
|
'deposit': {
|
@@ -968,16 +950,16 @@ class xt(Exchange, ImplicitAPI):
|
|
968
950
|
type = 'crypto'
|
969
951
|
else:
|
970
952
|
type = 'other'
|
971
|
-
result[code] = {
|
953
|
+
result[code] = self.safe_currency_structure({
|
972
954
|
'info': entry,
|
973
955
|
'id': currencyId,
|
974
956
|
'code': code,
|
975
957
|
'name': self.safe_string(entry, 'fullName'),
|
976
|
-
'active':
|
977
|
-
'fee':
|
978
|
-
'precision':
|
979
|
-
'deposit':
|
980
|
-
'withdraw':
|
958
|
+
'active': None,
|
959
|
+
'fee': None,
|
960
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(entry, 'maxPrecision'))),
|
961
|
+
'deposit': self.safe_string(entry, 'depositStatus') == '1',
|
962
|
+
'withdraw': self.safe_string(entry, 'withdrawStatus') == '1',
|
981
963
|
'networks': networks,
|
982
964
|
'type': type,
|
983
965
|
'limits': {
|
@@ -986,7 +968,7 @@ class xt(Exchange, ImplicitAPI):
|
|
986
968
|
'max': None,
|
987
969
|
},
|
988
970
|
'withdraw': {
|
989
|
-
'min':
|
971
|
+
'min': None,
|
990
972
|
'max': None,
|
991
973
|
},
|
992
974
|
'deposit': {
|
@@ -994,7 +976,7 @@ class xt(Exchange, ImplicitAPI):
|
|
994
976
|
'max': None,
|
995
977
|
},
|
996
978
|
},
|
997
|
-
}
|
979
|
+
})
|
998
980
|
return result
|
999
981
|
|
1000
982
|
async def fetch_markets(self, params={}) -> List[Market]:
|
@@ -2850,17 +2832,21 @@ class xt(Exchange, ImplicitAPI):
|
|
2850
2832
|
if symbol is not None:
|
2851
2833
|
market = self.market(symbol)
|
2852
2834
|
request['symbol'] = market['id']
|
2835
|
+
if limit is not None:
|
2836
|
+
request['size'] = limit
|
2837
|
+
if since is not None:
|
2838
|
+
request['startTime'] = since
|
2853
2839
|
type = None
|
2854
2840
|
subType = None
|
2855
2841
|
response = None
|
2856
2842
|
type, params = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
2857
2843
|
subType, params = self.handle_sub_type_and_params('fetchOrdersByStatus', market, params)
|
2858
|
-
trigger = self.
|
2844
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
2859
2845
|
stopLossTakeProfit = self.safe_value(params, 'stopLossTakeProfit')
|
2860
2846
|
if status == 'open':
|
2861
2847
|
if trigger or stopLossTakeProfit:
|
2862
2848
|
request['state'] = 'NOT_TRIGGERED'
|
2863
|
-
elif
|
2849
|
+
elif type == 'swap':
|
2864
2850
|
request['state'] = 'NEW'
|
2865
2851
|
elif status == 'closed':
|
2866
2852
|
if trigger or stopLossTakeProfit:
|
@@ -2880,7 +2866,7 @@ class xt(Exchange, ImplicitAPI):
|
|
2880
2866
|
if limit is not None:
|
2881
2867
|
request['size'] = limit
|
2882
2868
|
if trigger:
|
2883
|
-
params = self.omit(params, 'stop')
|
2869
|
+
params = self.omit(params, ['stop', 'trigger'])
|
2884
2870
|
if subType == 'inverse':
|
2885
2871
|
response = await self.privateInverseGetFutureTradeV1EntrustPlanList(self.extend(request, params))
|
2886
2872
|
else:
|
@@ -2905,6 +2891,7 @@ class xt(Exchange, ImplicitAPI):
|
|
2905
2891
|
if since is not None:
|
2906
2892
|
request['startTime'] = since
|
2907
2893
|
if limit is not None:
|
2894
|
+
request = self.omit(request, 'size')
|
2908
2895
|
request['limit'] = limit
|
2909
2896
|
response = await self.privateSpotGetHistoryOrder(self.extend(request, params))
|
2910
2897
|
else:
|
@@ -3087,9 +3074,12 @@ class xt(Exchange, ImplicitAPI):
|
|
3087
3074
|
# }
|
3088
3075
|
# }
|
3089
3076
|
#
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3077
|
+
orders = []
|
3078
|
+
resultDict = self.safe_dict(response, 'result')
|
3079
|
+
if resultDict is not None:
|
3080
|
+
orders = self.safe_list(resultDict, 'items', [])
|
3081
|
+
else:
|
3082
|
+
orders = self.safe_list(response, 'result')
|
3093
3083
|
return self.parse_orders(orders, market, since, limit)
|
3094
3084
|
|
3095
3085
|
async def fetch_open_orders(self, symbol: str = None, since: Int = None, limit: Int = None, params={}):
|