ccxt 4.4.88__py2.py3-none-any.whl → 4.4.91__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.
Files changed (101) hide show
  1. ccxt/__init__.py +1 -3
  2. ccxt/abstract/bitget.py +58 -0
  3. ccxt/abstract/bitrue.py +65 -65
  4. ccxt/abstract/cryptocom.py +2 -0
  5. ccxt/abstract/luno.py +1 -0
  6. ccxt/async_support/__init__.py +1 -3
  7. ccxt/async_support/base/exchange.py +6 -3
  8. ccxt/async_support/base/ws/client.py +173 -64
  9. ccxt/async_support/base/ws/future.py +23 -50
  10. ccxt/async_support/binance.py +2 -2
  11. ccxt/async_support/bingx.py +55 -29
  12. ccxt/async_support/bitget.py +469 -147
  13. ccxt/async_support/bitmex.py +2 -1
  14. ccxt/async_support/bitrue.py +72 -66
  15. ccxt/async_support/bitvavo.py +34 -0
  16. ccxt/async_support/btcalpha.py +35 -0
  17. ccxt/async_support/btcbox.py +35 -0
  18. ccxt/async_support/btcmarkets.py +35 -0
  19. ccxt/async_support/btcturk.py +35 -0
  20. ccxt/async_support/bybit.py +9 -3
  21. ccxt/async_support/cex.py +61 -0
  22. ccxt/async_support/coinbase.py +1 -3
  23. ccxt/async_support/cryptocom.py +66 -2
  24. ccxt/async_support/cryptomus.py +1 -1
  25. ccxt/async_support/delta.py +2 -2
  26. ccxt/async_support/digifinex.py +39 -99
  27. ccxt/async_support/exmo.py +14 -7
  28. ccxt/async_support/gate.py +14 -7
  29. ccxt/async_support/hashkey.py +15 -28
  30. ccxt/async_support/hollaex.py +27 -22
  31. ccxt/async_support/hyperliquid.py +104 -53
  32. ccxt/async_support/kraken.py +54 -50
  33. ccxt/async_support/luno.py +87 -1
  34. ccxt/async_support/mexc.py +1 -0
  35. ccxt/async_support/modetrade.py +2 -2
  36. ccxt/async_support/okx.py +2 -1
  37. ccxt/async_support/paradex.py +1 -1
  38. ccxt/async_support/phemex.py +16 -8
  39. ccxt/async_support/tradeogre.py +3 -3
  40. ccxt/async_support/xt.py +1 -1
  41. ccxt/base/exchange.py +20 -8
  42. ccxt/binance.py +2 -2
  43. ccxt/bingx.py +55 -29
  44. ccxt/bitget.py +469 -147
  45. ccxt/bitmex.py +2 -1
  46. ccxt/bitrue.py +72 -66
  47. ccxt/bitvavo.py +34 -0
  48. ccxt/btcalpha.py +35 -0
  49. ccxt/btcbox.py +35 -0
  50. ccxt/btcmarkets.py +35 -0
  51. ccxt/btcturk.py +35 -0
  52. ccxt/bybit.py +9 -3
  53. ccxt/cex.py +61 -0
  54. ccxt/coinbase.py +1 -3
  55. ccxt/cryptocom.py +66 -2
  56. ccxt/cryptomus.py +1 -1
  57. ccxt/delta.py +2 -2
  58. ccxt/digifinex.py +39 -99
  59. ccxt/exmo.py +13 -7
  60. ccxt/gate.py +14 -7
  61. ccxt/hashkey.py +15 -28
  62. ccxt/hollaex.py +27 -22
  63. ccxt/hyperliquid.py +104 -53
  64. ccxt/kraken.py +53 -50
  65. ccxt/luno.py +87 -1
  66. ccxt/mexc.py +1 -0
  67. ccxt/modetrade.py +2 -2
  68. ccxt/okx.py +2 -1
  69. ccxt/paradex.py +1 -1
  70. ccxt/phemex.py +16 -8
  71. ccxt/pro/__init__.py +1 -127
  72. ccxt/pro/bitstamp.py +1 -1
  73. ccxt/pro/bybit.py +6 -136
  74. ccxt/pro/coinbase.py +2 -0
  75. ccxt/pro/cryptocom.py +27 -0
  76. ccxt/pro/kraken.py +249 -267
  77. ccxt/pro/mexc.py +0 -1
  78. ccxt/tradeogre.py +3 -3
  79. ccxt/xt.py +1 -1
  80. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/METADATA +64 -23
  81. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/RECORD +84 -101
  82. ccxt/abstract/coinlist.py +0 -57
  83. ccxt/async_support/base/ws/aiohttp_client.py +0 -147
  84. ccxt/async_support/bitcoincom.py +0 -18
  85. ccxt/async_support/bitfinex1.py +0 -1711
  86. ccxt/async_support/bitpanda.py +0 -17
  87. ccxt/async_support/coinlist.py +0 -2542
  88. ccxt/async_support/poloniexfutures.py +0 -1875
  89. ccxt/bitcoincom.py +0 -18
  90. ccxt/bitfinex1.py +0 -1710
  91. ccxt/bitpanda.py +0 -17
  92. ccxt/coinlist.py +0 -2542
  93. ccxt/poloniexfutures.py +0 -1875
  94. ccxt/pro/bitcoincom.py +0 -35
  95. ccxt/pro/bitfinex1.py +0 -635
  96. ccxt/pro/bitpanda.py +0 -16
  97. ccxt/pro/poloniexfutures.py +0 -1004
  98. ccxt/pro/wazirx.py +0 -766
  99. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/LICENSE.txt +0 -0
  100. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/WHEEL +0 -0
  101. {ccxt-4.4.88.dist-info → ccxt-4.4.91.dist-info}/top_level.txt +0 -0
ccxt/bitget.py CHANGED
@@ -194,6 +194,7 @@ class bitget(Exchange, ImplicitAPI):
194
194
  'convert': 'https://api.{hostname}',
195
195
  'copy': 'https://api.{hostname}',
196
196
  'earn': 'https://api.{hostname}',
197
+ 'uta': 'https://api.{hostname}',
197
198
  },
198
199
  'www': 'https://www.bitget.com',
199
200
  'doc': [
@@ -310,6 +311,24 @@ class bitget(Exchange, ImplicitAPI):
310
311
  'v2/earn/loan/public/hour-interest': 2,
311
312
  },
312
313
  },
314
+ 'uta': {
315
+ 'get': {
316
+ 'v3/market/instruments': 1,
317
+ 'v3/market/tickers': 1,
318
+ 'v3/market/orderbook': 1,
319
+ 'v3/market/fills': 1,
320
+ 'v3/market/open-interest': 1,
321
+ 'v3/market/candles': 1,
322
+ 'v3/market/history-candles': 1,
323
+ 'v3/market/current-fund-rate': 1,
324
+ 'v3/market/history-fund-rate': 1,
325
+ 'v3/market/risk-reserve': 1,
326
+ 'v3/market/discount-rate': 1,
327
+ 'v3/market/margin-loans': 1,
328
+ 'v3/market/position-tier': 1,
329
+ 'v3/market/oi-limit': 2,
330
+ },
331
+ },
313
332
  },
314
333
  'private': {
315
334
  'spot': {
@@ -803,6 +822,56 @@ class bitget(Exchange, ImplicitAPI):
803
822
  'v2/common/trade-rate': 2,
804
823
  },
805
824
  },
825
+ 'uta': {
826
+ 'get': {
827
+ 'v3/account/assets': 1,
828
+ 'v3/account/settings': 1,
829
+ 'v3/account/financial-records': 1,
830
+ 'v3/account/repayable-coins': 2,
831
+ 'v3/account/payment-coins': 2,
832
+ 'v3/account/convert-records': 1,
833
+ 'v3/account/transferable-coins': 2,
834
+ 'v3/account/sub-transfer-record': 4,
835
+ 'v3/ins-loan/transfered': 6.6667,
836
+ 'v3/ins-loan/symbols': 6.6667,
837
+ 'v3/ins-loan/risk-unit': 6.6667,
838
+ 'v3/ins-loan/repaid-history': 6.6667,
839
+ 'v3/ins-loan/product-infos': 6.6667,
840
+ 'v3/ins-loan/loan-order': 6.6667,
841
+ 'v3/ins-loan/ltv-convert': 6.6667,
842
+ 'v3/ins-loan/ensure-coins-convert': 6.6667,
843
+ 'v3/position/current-position': 1,
844
+ 'v3/position/history-position': 1,
845
+ 'v3/trade/order-info': 1,
846
+ 'v3/trade/unfilled-orders': 1,
847
+ 'v3/trade/history-orders': 1,
848
+ 'v3/trade/fills': 1,
849
+ 'v3/user/sub-list': 2,
850
+ 'v3/user/sub-api-list': 2,
851
+ },
852
+ 'post': {
853
+ 'v3/account/set-leverage': 2,
854
+ 'v3/account/set-hold-mode': 2,
855
+ 'v3/account/repay': 4,
856
+ 'v3/account/transfer': 4,
857
+ 'v3/account/sub-transfer': 4,
858
+ 'v3/account/max-open-available': 4,
859
+ 'v3/ins-loan/bind-uid': 6.6667,
860
+ 'v3/trade/place-order': 2,
861
+ 'v3/trade/modify-order': 2,
862
+ 'v3/trade/cancel-order': 2,
863
+ 'v3/trade/place-batch': 4,
864
+ 'v3/trade/batch-modify-order': 2,
865
+ 'v3/trade/cancel-batch': 4,
866
+ 'v3/trade/cancel-symbol-order': 4,
867
+ 'v3/trade/close-positions': 4,
868
+ 'v3/user/create-sub': 2,
869
+ 'v3/user/freeze-sub': 2,
870
+ 'v3/user/create-sub-api': 2,
871
+ 'v3/user/update-sub-api': 2,
872
+ 'v3/user/delete-sub-api': 2,
873
+ },
874
+ },
806
875
  },
807
876
  },
808
877
  'fees': {
@@ -1346,6 +1415,7 @@ class bitget(Exchange, ImplicitAPI):
1346
1415
  'TONCOIN': 'TON',
1347
1416
  },
1348
1417
  'options': {
1418
+ 'uta': False,
1349
1419
  'timeDifference': 0, # the difference between system clock and Binance clock
1350
1420
  'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
1351
1421
  'timeframes': {
@@ -1380,10 +1450,9 @@ class bitget(Exchange, ImplicitAPI):
1380
1450
  '1M': '1Mutc',
1381
1451
  },
1382
1452
  },
1383
- 'fetchMarkets': [
1384
- 'spot',
1385
- 'swap', # there is future markets but they use the same endpoints
1386
- ],
1453
+ 'fetchMarkets': {
1454
+ 'types': ['spot', 'swap'], # there is future markets but they use the same endpoints
1455
+ },
1387
1456
  'defaultType': 'spot', # 'spot', 'swap', 'future'
1388
1457
  'defaultSubType': 'linear', # 'linear', 'inverse'
1389
1458
  'createMarketBuyOrderRequiresPrice': True,
@@ -1773,13 +1842,30 @@ class bitget(Exchange, ImplicitAPI):
1773
1842
  https://www.bitget.com/api-doc/spot/market/Get-Symbols
1774
1843
  https://www.bitget.com/api-doc/contract/market/Get-All-Symbols-Contracts
1775
1844
  https://www.bitget.com/api-doc/margin/common/support-currencies
1845
+ https://www.bitget.bike/api-doc/uta/public/Instruments
1776
1846
 
1777
1847
  :param dict [params]: extra parameters specific to the exchange API endpoint
1848
+ :param str [params.uta]: set to True to fetch markets for the unified trading account(uta), defaults to False
1778
1849
  :returns dict[]: an array of objects representing market data
1779
1850
  """
1780
1851
  if self.options['adjustForTimeDifference']:
1781
1852
  self.load_time_difference()
1782
- types = self.safe_value(self.options, 'fetchMarkets', ['spot', 'swap'])
1853
+ uta = None
1854
+ uta, params = self.handle_option_and_params(params, 'fetchMarkets', 'uta', False)
1855
+ if uta:
1856
+ return self.fetch_uta_markets(params)
1857
+ else:
1858
+ return self.fetch_default_markets(params)
1859
+
1860
+ def fetch_default_markets(self, params) -> List[Market]:
1861
+ types = None
1862
+ fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
1863
+ defaultMarkets = ['spot', 'swap']
1864
+ if fetchMarketsOptions is not None:
1865
+ types = self.safe_list(fetchMarketsOptions, 'types', defaultMarkets)
1866
+ else:
1867
+ # for backward-compatibility
1868
+ types = self.safe_list(self.options, 'fetchMarkets', defaultMarkets)
1783
1869
  promises = []
1784
1870
  fetchMargins = False
1785
1871
  for i in range(0, len(types)):
@@ -1811,12 +1897,6 @@ class bitget(Exchange, ImplicitAPI):
1811
1897
  self.options['isolatedMarginPairsData'] = keysList
1812
1898
  else:
1813
1899
  markets = self.array_concat(markets, data)
1814
- result = []
1815
- for i in range(0, len(markets)):
1816
- result.append(self.parse_market(markets[i]))
1817
- return result
1818
-
1819
- def parse_market(self, market: dict) -> Market:
1820
1900
  #
1821
1901
  # spot
1822
1902
  #
@@ -1874,146 +1954,388 @@ class bitget(Exchange, ImplicitAPI):
1874
1954
  # "maintainTime": ""
1875
1955
  # }
1876
1956
  #
1877
- marketId = self.safe_string(market, 'symbol')
1878
- quoteId = self.safe_string(market, 'quoteCoin')
1879
- baseId = self.safe_string(market, 'baseCoin')
1880
- quote = self.safe_currency_code(quoteId)
1881
- base = self.safe_currency_code(baseId)
1882
- supportMarginCoins = self.safe_value(market, 'supportMarginCoins', [])
1883
- settleId = None
1884
- if self.in_array(baseId, supportMarginCoins):
1885
- settleId = baseId
1886
- elif self.in_array(quoteId, supportMarginCoins):
1887
- settleId = quoteId
1888
- else:
1889
- settleId = self.safe_string(supportMarginCoins, 0)
1890
- settle = self.safe_currency_code(settleId)
1891
- symbol = base + '/' + quote
1892
- type = None
1893
- swap = False
1894
- spot = False
1895
- future = False
1896
- contract = False
1897
- pricePrecision = None
1898
- amountPrecision = None
1899
- linear = None
1900
- inverse = None
1901
- expiry = None
1902
- expiryDatetime = None
1903
- symbolType = self.safe_string(market, 'symbolType')
1904
- marginModes = None
1905
- isMarginTradingAllowed = False
1906
- if symbolType is None:
1907
- type = 'spot'
1908
- spot = True
1909
- pricePrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'pricePrecision')))
1910
- amountPrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'quantityPrecision')))
1911
- hasCrossMargin = self.in_array(marketId, self.options['crossMarginPairsData'])
1912
- hasIsolatedMargin = self.in_array(marketId, self.options['isolatedMarginPairsData'])
1913
- marginModes = {
1914
- 'cross': hasCrossMargin,
1915
- 'isolated': hasIsolatedMargin,
1916
- }
1917
- isMarginTradingAllowed = hasCrossMargin or hasCrossMargin
1918
- else:
1919
- if symbolType == 'perpetual':
1920
- type = 'swap'
1921
- swap = True
1922
- symbol = symbol + ':' + settle
1923
- elif symbolType == 'delivery':
1924
- expiry = self.safe_integer(market, 'deliveryTime')
1925
- expiryDatetime = self.iso8601(expiry)
1926
- expiryParts = expiryDatetime.split('-')
1927
- yearPart = self.safe_string(expiryParts, 0)
1928
- dayPart = self.safe_string(expiryParts, 2)
1929
- year = yearPart[2:4]
1930
- month = self.safe_string(expiryParts, 1)
1931
- day = dayPart[0:2]
1932
- expiryString = year + month + day
1933
- type = 'future'
1934
- future = True
1935
- symbol = symbol + ':' + settle + '-' + expiryString
1936
- contract = True
1937
- inverse = (base == settle)
1938
- linear = not inverse
1939
- priceDecimals = self.safe_integer(market, 'pricePlace')
1940
- amountDecimals = self.safe_integer(market, 'volumePlace')
1941
- priceStep = self.safe_string(market, 'priceEndStep')
1942
- amountStep = self.safe_string(market, 'sizeMultiplier')
1943
- precise = Precise(priceStep)
1944
- precise.decimals = max(precise.decimals, priceDecimals)
1945
- precise.reduce()
1946
- priceString = str(precise)
1947
- pricePrecision = self.parse_number(priceString)
1948
- preciseAmount = Precise(amountStep)
1949
- preciseAmount.decimals = max(preciseAmount.decimals, amountDecimals)
1950
- preciseAmount.reduce()
1951
- amountString = str(preciseAmount)
1952
- amountPrecision = self.parse_number(amountString)
1953
- marginModes = {
1954
- 'cross': True,
1955
- 'isolated': True,
1956
- }
1957
- status = self.safe_string_2(market, 'status', 'symbolStatus')
1958
- active = None
1959
- if status is not None:
1960
- active = ((status == 'online') or (status == 'normal'))
1961
- minCost = None
1962
- if quote == 'USDT':
1963
- minCost = self.safe_number(market, 'minTradeUSDT')
1964
- contractSize = 1 if contract else None
1965
- return {
1966
- 'id': marketId,
1967
- 'symbol': symbol,
1968
- 'base': base,
1969
- 'quote': quote,
1970
- 'settle': settle,
1971
- 'baseId': baseId,
1972
- 'quoteId': quoteId,
1973
- 'settleId': settleId,
1974
- 'type': type,
1975
- 'spot': spot,
1976
- 'margin': spot and isMarginTradingAllowed,
1977
- 'marginModes': marginModes,
1978
- 'swap': swap,
1979
- 'future': future,
1980
- 'option': False,
1981
- 'active': active,
1982
- 'contract': contract,
1983
- 'linear': linear,
1984
- 'inverse': inverse,
1985
- 'taker': self.safe_number(market, 'takerFeeRate'),
1986
- 'maker': self.safe_number(market, 'makerFeeRate'),
1987
- 'contractSize': contractSize,
1988
- 'expiry': expiry,
1989
- 'expiryDatetime': expiryDatetime,
1990
- 'strike': None,
1991
- 'optionType': None,
1992
- 'precision': {
1993
- 'amount': amountPrecision,
1994
- 'price': pricePrecision,
1995
- },
1996
- 'limits': {
1997
- 'leverage': {
1998
- 'min': self.safe_number(market, 'minLever'),
1999
- 'max': self.safe_number(market, 'maxLever'),
1957
+ result = []
1958
+ for i in range(0, len(markets)):
1959
+ market = markets[i]
1960
+ marketId = self.safe_string(market, 'symbol')
1961
+ quoteId = self.safe_string(market, 'quoteCoin')
1962
+ baseId = self.safe_string(market, 'baseCoin')
1963
+ quote = self.safe_currency_code(quoteId)
1964
+ base = self.safe_currency_code(baseId)
1965
+ supportMarginCoins = self.safe_value(market, 'supportMarginCoins', [])
1966
+ settleId = None
1967
+ if self.in_array(baseId, supportMarginCoins):
1968
+ settleId = baseId
1969
+ elif self.in_array(quoteId, supportMarginCoins):
1970
+ settleId = quoteId
1971
+ else:
1972
+ settleId = self.safe_string(supportMarginCoins, 0)
1973
+ settle = self.safe_currency_code(settleId)
1974
+ symbol = base + '/' + quote
1975
+ type = None
1976
+ swap = False
1977
+ spot = False
1978
+ future = False
1979
+ contract = False
1980
+ pricePrecision = None
1981
+ amountPrecision = None
1982
+ linear = None
1983
+ inverse = None
1984
+ expiry = None
1985
+ expiryDatetime = None
1986
+ symbolType = self.safe_string(market, 'symbolType')
1987
+ marginModes = None
1988
+ isMarginTradingAllowed = False
1989
+ if symbolType is None:
1990
+ type = 'spot'
1991
+ spot = True
1992
+ pricePrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'pricePrecision')))
1993
+ amountPrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'quantityPrecision')))
1994
+ hasCrossMargin = self.in_array(marketId, self.options['crossMarginPairsData'])
1995
+ hasIsolatedMargin = self.in_array(marketId, self.options['isolatedMarginPairsData'])
1996
+ marginModes = {
1997
+ 'cross': hasCrossMargin,
1998
+ 'isolated': hasIsolatedMargin,
1999
+ }
2000
+ isMarginTradingAllowed = hasCrossMargin or hasCrossMargin
2001
+ else:
2002
+ if symbolType == 'perpetual':
2003
+ type = 'swap'
2004
+ swap = True
2005
+ symbol = symbol + ':' + settle
2006
+ elif symbolType == 'delivery':
2007
+ expiry = self.safe_integer(market, 'deliveryTime')
2008
+ expiryDatetime = self.iso8601(expiry)
2009
+ expiryParts = expiryDatetime.split('-')
2010
+ yearPart = self.safe_string(expiryParts, 0)
2011
+ dayPart = self.safe_string(expiryParts, 2)
2012
+ year = yearPart[2:4]
2013
+ month = self.safe_string(expiryParts, 1)
2014
+ day = dayPart[0:2]
2015
+ expiryString = year + month + day
2016
+ type = 'future'
2017
+ future = True
2018
+ symbol = symbol + ':' + settle + '-' + expiryString
2019
+ contract = True
2020
+ inverse = (base == settle)
2021
+ linear = not inverse
2022
+ priceDecimals = self.safe_integer(market, 'pricePlace')
2023
+ amountDecimals = self.safe_integer(market, 'volumePlace')
2024
+ priceStep = self.safe_string(market, 'priceEndStep')
2025
+ amountStep = self.safe_string(market, 'sizeMultiplier')
2026
+ precise = Precise(priceStep)
2027
+ precise.decimals = max(precise.decimals, priceDecimals)
2028
+ precise.reduce()
2029
+ priceString = str(precise)
2030
+ pricePrecision = self.parse_number(priceString)
2031
+ preciseAmount = Precise(amountStep)
2032
+ preciseAmount.decimals = max(preciseAmount.decimals, amountDecimals)
2033
+ preciseAmount.reduce()
2034
+ amountString = str(preciseAmount)
2035
+ amountPrecision = self.parse_number(amountString)
2036
+ marginModes = {
2037
+ 'cross': True,
2038
+ 'isolated': True,
2039
+ }
2040
+ status = self.safe_string_2(market, 'status', 'symbolStatus')
2041
+ active = None
2042
+ if status is not None:
2043
+ active = ((status == 'online') or (status == 'normal'))
2044
+ minCost = None
2045
+ if quote == 'USDT':
2046
+ minCost = self.safe_number(market, 'minTradeUSDT')
2047
+ contractSize = 1 if contract else None
2048
+ result.append(self.safe_market_structure({
2049
+ 'id': marketId,
2050
+ 'symbol': symbol,
2051
+ 'base': base,
2052
+ 'quote': quote,
2053
+ 'settle': settle,
2054
+ 'baseId': baseId,
2055
+ 'quoteId': quoteId,
2056
+ 'settleId': settleId,
2057
+ 'type': type,
2058
+ 'spot': spot,
2059
+ 'margin': spot and isMarginTradingAllowed,
2060
+ 'marginModes': marginModes,
2061
+ 'swap': swap,
2062
+ 'future': future,
2063
+ 'option': False,
2064
+ 'active': active,
2065
+ 'contract': contract,
2066
+ 'linear': linear,
2067
+ 'inverse': inverse,
2068
+ 'taker': self.safe_number(market, 'takerFeeRate'),
2069
+ 'maker': self.safe_number(market, 'makerFeeRate'),
2070
+ 'contractSize': contractSize,
2071
+ 'expiry': expiry,
2072
+ 'expiryDatetime': expiryDatetime,
2073
+ 'strike': None,
2074
+ 'optionType': None,
2075
+ 'precision': {
2076
+ 'amount': amountPrecision,
2077
+ 'price': pricePrecision,
2000
2078
  },
2001
- 'amount': {
2002
- 'min': self.safe_number_2(market, 'minTradeNum', 'minTradeAmount'),
2003
- 'max': self.safe_number(market, 'maxTradeAmount'),
2079
+ 'limits': {
2080
+ 'leverage': {
2081
+ 'min': self.safe_number(market, 'minLever'),
2082
+ 'max': self.safe_number(market, 'maxLever'),
2083
+ },
2084
+ 'amount': {
2085
+ 'min': self.safe_number_2(market, 'minTradeNum', 'minTradeAmount'),
2086
+ 'max': self.safe_number(market, 'maxTradeAmount'),
2087
+ },
2088
+ 'price': {
2089
+ 'min': None,
2090
+ 'max': None,
2091
+ },
2092
+ 'cost': {
2093
+ 'min': minCost,
2094
+ 'max': None,
2095
+ },
2004
2096
  },
2005
- 'price': {
2006
- 'min': None,
2007
- 'max': None,
2097
+ 'created': self.safe_integer(market, 'launchTime'),
2098
+ 'info': market,
2099
+ }))
2100
+ return result
2101
+
2102
+ def fetch_uta_markets(self, params) -> List[Market]:
2103
+ subTypes = ['SPOT', 'USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES']
2104
+ promises = []
2105
+ for i in range(0, len(subTypes)):
2106
+ req = self.extend(params, {
2107
+ 'category': subTypes[i],
2108
+ })
2109
+ promises.append(self.publicUtaGetV3MarketInstruments(req))
2110
+ results = promises
2111
+ markets = []
2112
+ for i in range(0, len(results)):
2113
+ res = self.safe_dict(results, i)
2114
+ data = self.safe_list(res, 'data', [])
2115
+ markets = self.array_concat(markets, data)
2116
+ #
2117
+ # spot uta
2118
+ #
2119
+ # {
2120
+ # "symbol": "BTCUSDT",
2121
+ # "category": "SPOT",
2122
+ # "baseCoin": "BTC",
2123
+ # "quoteCoin": "USDT",
2124
+ # "buyLimitPriceRatio": "0.05",
2125
+ # "sellLimitPriceRatio": "0.05",
2126
+ # "minOrderQty": "0.000001",
2127
+ # "maxOrderQty": "0",
2128
+ # "pricePrecision": "2",
2129
+ # "quantityPrecision": "6",
2130
+ # "quotePrecision": "8",
2131
+ # "minOrderAmount": "1",
2132
+ # "maxSymbolOrderNum": "400",
2133
+ # "maxProductOrderNum": "400",
2134
+ # "status": "online",
2135
+ # "maintainTime": ""
2136
+ # }
2137
+ #
2138
+ # margin uta
2139
+ #
2140
+ # {
2141
+ # "symbol": "BTCUSDC",
2142
+ # "category": "MARGIN",
2143
+ # "baseCoin": "BTC",
2144
+ # "quoteCoin": "USDC",
2145
+ # "buyLimitPriceRatio": "0.05",
2146
+ # "sellLimitPriceRatio": "0.05",
2147
+ # "minOrderQty": "0.00001",
2148
+ # "maxOrderQty": "0",
2149
+ # "pricePrecision": "2",
2150
+ # "quantityPrecision": "5",
2151
+ # "quotePrecision": "7",
2152
+ # "minOrderAmount": "1",
2153
+ # "maxSymbolOrderNum": "400",
2154
+ # "maxProductOrderNum": "400",
2155
+ # "status": "online",
2156
+ # "maintainTime": "",
2157
+ # "isIsolatedBaseBorrowable": "NO",
2158
+ # "isIsolatedQuotedBorrowable": "NO",
2159
+ # "warningRiskRatio": "0.8",
2160
+ # "liquidationRiskRatio": "1",
2161
+ # "maxCrossedLeverage": "3",
2162
+ # "maxIsolatedLeverage": "0",
2163
+ # "userMinBorrow": "0.00000001",
2164
+ # "areaSymbol": "no"
2165
+ # }
2166
+ #
2167
+ # swap and future uta
2168
+ #
2169
+ # {
2170
+ # "symbol": "BTCPERP",
2171
+ # "category": "USDC-FUTURES",
2172
+ # "baseCoin": "BTC",
2173
+ # "quoteCoin": "USDC",
2174
+ # "buyLimitPriceRatio": "0.02",
2175
+ # "sellLimitPriceRatio": "0.02",
2176
+ # "feeRateUpRatio": "0.005",
2177
+ # "makerFeeRate": "0.0002",
2178
+ # "takerFeeRate": "0.0006",
2179
+ # "openCostUpRatio": "0.01",
2180
+ # "minOrderQty": "0.0001",
2181
+ # "maxOrderQty": "",
2182
+ # "pricePrecision": "1",
2183
+ # "quantityPrecision": "4",
2184
+ # "quotePrecision": null,
2185
+ # "priceMultiplier": "0.5",
2186
+ # "quantityMultiplier": "0.0001",
2187
+ # "type": "perpetual",
2188
+ # "minOrderAmount": "5",
2189
+ # "maxSymbolOrderNum": "200",
2190
+ # "maxProductOrderNum": "1000",
2191
+ # "maxPositionNum": "150",
2192
+ # "status": "online",
2193
+ # "offTime": "-1",
2194
+ # "limitOpenTime": "-1",
2195
+ # "deliveryTime": "",
2196
+ # "deliveryStartTime": "",
2197
+ # "deliveryPeriod": "",
2198
+ # "launchTime": "",
2199
+ # "fundInterval": "8",
2200
+ # "minLeverage": "1",
2201
+ # "maxLeverage": "125",
2202
+ # "maintainTime": ""
2203
+ # }
2204
+ #
2205
+ result = []
2206
+ for i in range(0, len(markets)):
2207
+ market = markets[i]
2208
+ category = self.safe_string(market, 'category')
2209
+ marketId = self.safe_string(market, 'symbol')
2210
+ quoteId = self.safe_string(market, 'quoteCoin')
2211
+ baseId = self.safe_string(market, 'baseCoin')
2212
+ quote = self.safe_currency_code(quoteId)
2213
+ base = self.safe_currency_code(baseId)
2214
+ settleId = None
2215
+ settle = None
2216
+ if category == 'USDT-FUTURES':
2217
+ settleId = 'USDT'
2218
+ elif category == 'USDC-FUTURES':
2219
+ settleId = 'USDC'
2220
+ elif category == 'COIN-FUTURES':
2221
+ settleId = base
2222
+ if settleId is not None:
2223
+ settle = self.safe_currency_code(settleId)
2224
+ symbol = base + '/' + quote
2225
+ type = None
2226
+ swap = False
2227
+ spot = False
2228
+ future = False
2229
+ contract = False
2230
+ pricePrecision = None
2231
+ amountPrecision = None
2232
+ linear = None
2233
+ inverse = None
2234
+ expiry = None
2235
+ expiryDatetime = None
2236
+ symbolType = self.safe_string(market, 'type')
2237
+ marginModes = None
2238
+ isMarginTradingAllowed = False
2239
+ isUtaMargin = (category == 'MARGIN')
2240
+ if isUtaMargin or (category == 'SPOT'):
2241
+ type = 'spot'
2242
+ spot = True
2243
+ if isUtaMargin:
2244
+ isolatedBase = self.safe_string(market, 'isIsolatedBaseBorrowable')
2245
+ isolatedQuote = self.safe_string(market, 'isIsolatedQuotedBorrowable')
2246
+ isolated = (isolatedBase == 'YES') or (isolatedQuote == 'YES')
2247
+ maxCrossLeverage = self.safe_string(market, 'maxCrossedLeverage')
2248
+ cross = (maxCrossLeverage != '0')
2249
+ marginModes = {
2250
+ 'cross': cross,
2251
+ 'isolated': isolated,
2252
+ }
2253
+ isMarginTradingAllowed = True
2254
+ else:
2255
+ if symbolType == 'perpetual':
2256
+ type = 'swap'
2257
+ swap = True
2258
+ symbol = symbol + ':' + settle
2259
+ elif symbolType == 'delivery':
2260
+ expiry = self.safe_integer(market, 'deliveryTime')
2261
+ expiryDatetime = self.iso8601(expiry)
2262
+ expiryParts = expiryDatetime.split('-')
2263
+ yearPart = self.safe_string(expiryParts, 0)
2264
+ dayPart = self.safe_string(expiryParts, 2)
2265
+ year = yearPart[2:4]
2266
+ month = self.safe_string(expiryParts, 1)
2267
+ day = dayPart[0:2]
2268
+ expiryString = year + month + day
2269
+ type = 'future'
2270
+ future = True
2271
+ symbol = symbol + ':' + settle + '-' + expiryString
2272
+ contract = True
2273
+ inverse = (base == settle)
2274
+ linear = not inverse
2275
+ marginModes = {
2276
+ 'cross': True,
2277
+ 'isolated': True,
2278
+ }
2279
+ pricePrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'pricePrecision')))
2280
+ amountPrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'quantityPrecision')))
2281
+ status = self.safe_string(market, 'status')
2282
+ active = None
2283
+ if status is not None:
2284
+ active = ((status == 'online') or (status == 'normal'))
2285
+ contractSize = 1 if contract else None
2286
+ result.append(self.safe_market_structure({
2287
+ 'id': marketId,
2288
+ 'symbol': symbol,
2289
+ 'base': base,
2290
+ 'quote': quote,
2291
+ 'settle': settle,
2292
+ 'baseId': baseId,
2293
+ 'quoteId': quoteId,
2294
+ 'settleId': settleId,
2295
+ 'type': type,
2296
+ 'spot': spot,
2297
+ 'margin': spot and isMarginTradingAllowed,
2298
+ 'marginModes': marginModes,
2299
+ 'swap': swap,
2300
+ 'future': future,
2301
+ 'option': False,
2302
+ 'active': active,
2303
+ 'contract': contract,
2304
+ 'linear': linear,
2305
+ 'inverse': inverse,
2306
+ 'taker': self.safe_number(market, 'takerFeeRate'),
2307
+ 'maker': self.safe_number(market, 'makerFeeRate'),
2308
+ 'contractSize': contractSize,
2309
+ 'expiry': expiry,
2310
+ 'expiryDatetime': expiryDatetime,
2311
+ 'strike': None,
2312
+ 'optionType': None,
2313
+ 'precision': {
2314
+ 'amount': amountPrecision,
2315
+ 'price': pricePrecision,
2008
2316
  },
2009
- 'cost': {
2010
- 'min': minCost,
2011
- 'max': None,
2317
+ 'limits': {
2318
+ 'leverage': {
2319
+ 'min': self.safe_number(market, 'minLeverage'),
2320
+ 'max': self.safe_number(market, 'maxLeverage'),
2321
+ },
2322
+ 'amount': {
2323
+ 'min': self.safe_number(market, 'minOrderQty'),
2324
+ 'max': self.safe_number(market, 'maxOrderQty'),
2325
+ },
2326
+ 'price': {
2327
+ 'min': None,
2328
+ 'max': None,
2329
+ },
2330
+ 'cost': {
2331
+ 'min': None,
2332
+ 'max': None,
2333
+ },
2012
2334
  },
2013
- },
2014
- 'created': self.safe_integer(market, 'launchTime'),
2015
- 'info': market,
2016
- }
2335
+ 'created': self.safe_integer(market, 'launchTime'),
2336
+ 'info': market,
2337
+ }))
2338
+ return result
2017
2339
 
2018
2340
  def fetch_currencies(self, params={}) -> Currencies:
2019
2341
  """