ccxt 4.4.87__py2.py3-none-any.whl → 4.4.90__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +1 -1
- ccxt/abstract/bitget.py +58 -0
- ccxt/abstract/bitrue.py +65 -65
- ccxt/abstract/cryptocom.py +2 -0
- ccxt/abstract/luno.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +4 -1
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bingx.py +55 -29
- ccxt/async_support/bitget.py +469 -147
- ccxt/async_support/bitrue.py +72 -66
- ccxt/async_support/bitvavo.py +34 -0
- ccxt/async_support/btcalpha.py +35 -0
- ccxt/async_support/btcbox.py +35 -0
- ccxt/async_support/btcmarkets.py +35 -0
- ccxt/async_support/btcturk.py +35 -0
- ccxt/async_support/bybit.py +28 -60
- ccxt/async_support/coinbase.py +1 -3
- ccxt/async_support/cryptocom.py +49 -0
- ccxt/async_support/delta.py +2 -2
- ccxt/async_support/digifinex.py +39 -99
- ccxt/async_support/gate.py +12 -5
- ccxt/async_support/hashkey.py +15 -28
- ccxt/async_support/hollaex.py +27 -22
- ccxt/async_support/kraken.py +28 -49
- ccxt/async_support/luno.py +87 -1
- ccxt/async_support/modetrade.py +7 -7
- ccxt/async_support/okx.py +2 -1
- ccxt/async_support/phemex.py +16 -8
- ccxt/async_support/tradeogre.py +3 -3
- ccxt/async_support/xt.py +1 -1
- ccxt/base/exchange.py +15 -5
- ccxt/binance.py +1 -1
- ccxt/bingx.py +55 -29
- ccxt/bitget.py +469 -147
- ccxt/bitrue.py +72 -66
- ccxt/bitvavo.py +34 -0
- ccxt/btcalpha.py +35 -0
- ccxt/btcbox.py +35 -0
- ccxt/btcmarkets.py +35 -0
- ccxt/btcturk.py +35 -0
- ccxt/bybit.py +28 -60
- ccxt/coinbase.py +1 -3
- ccxt/cryptocom.py +49 -0
- ccxt/delta.py +2 -2
- ccxt/digifinex.py +39 -99
- ccxt/gate.py +12 -5
- ccxt/hashkey.py +15 -28
- ccxt/hollaex.py +27 -22
- ccxt/kraken.py +27 -49
- ccxt/luno.py +87 -1
- ccxt/modetrade.py +7 -7
- ccxt/okx.py +2 -1
- ccxt/phemex.py +16 -8
- ccxt/pro/__init__.py +1 -119
- ccxt/pro/coinbase.py +2 -0
- ccxt/pro/cryptocom.py +27 -0
- ccxt/pro/kraken.py +3 -9
- ccxt/test/tests_async.py +1 -1
- ccxt/test/tests_sync.py +1 -1
- ccxt/tradeogre.py +3 -3
- ccxt/xt.py +1 -1
- {ccxt-4.4.87.dist-info → ccxt-4.4.90.dist-info}/METADATA +62 -20
- {ccxt-4.4.87.dist-info → ccxt-4.4.90.dist-info}/RECORD +67 -67
- {ccxt-4.4.87.dist-info → ccxt-4.4.90.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.87.dist-info → ccxt-4.4.90.dist-info}/WHEEL +0 -0
- {ccxt-4.4.87.dist-info → ccxt-4.4.90.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
|
-
|
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
|
-
|
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
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
'
|
1915
|
-
'
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
'
|
1994
|
-
'
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
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
|
-
'
|
2002
|
-
'
|
2003
|
-
|
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
|
-
'
|
2006
|
-
|
2007
|
-
|
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
|
-
'
|
2010
|
-
'
|
2011
|
-
|
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
|
-
|
2015
|
-
|
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
|
"""
|