MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_default_markets

Method fetch_default_markets

python/ccxt/bitget.py:1973–2213  ·  view source on GitHub ↗
(self, params)

Source from the content-addressed store, hash-verified

1971 return self.fetch_default_markets(params)
1972
1973 def fetch_default_markets(self, params) -> List[Market]:
1974 types = None
1975 fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
1976 defaultMarkets = ['spot', 'swap']
1977 if fetchMarketsOptions is not None:
1978 types = self.safe_list(fetchMarketsOptions, 'types', defaultMarkets)
1979 else:
1980 # for backward-compatibility
1981 types = self.safe_list(self.options, 'fetchMarkets', defaultMarkets)
1982 promises = []
1983 fetchMargins = False
1984 for i in range(0, len(types)):
1985 type = types[i]
1986 if (type == 'swap') or (type == 'future'):
1987 subTypes = ['USDT-FUTURES', 'COIN-FUTURES', 'USDC-FUTURES', 'SUSDT-FUTURES', 'SCOIN-FUTURES', 'SUSDC-FUTURES']
1988 for j in range(0, len(subTypes)):
1989 promises.append(self.publicMixGetV2MixMarketContracts(self.extend(params, {
1990 'productType': subTypes[j],
1991 })))
1992 elif type == 'spot':
1993 promises.append(self.publicSpotGetV2SpotPublicSymbols(params))
1994 fetchMargins = True
1995 promises.append(self.publicMarginGetV2MarginCurrencies(params))
1996 else:
1997 raise NotSupported(self.id + ' does not support ' + type + ' market')
1998 results = promises
1999 markets = []
2000 self.options['crossMarginPairsData'] = []
2001 self.options['isolatedMarginPairsData'] = []
2002 for i in range(0, len(results)):
2003 res = self.safe_dict(results, i)
2004 data = self.safe_list(res, 'data', [])
2005 firstData = self.safe_dict(data, 0, {})
2006 isBorrowable = self.safe_bool(firstData, 'isBorrowable')
2007 if fetchMargins and isBorrowable is not None:
2008 keysList = list(self.index_by(data, 'symbol').keys())
2009 self.options['crossMarginPairsData'] = keysList
2010 self.options['isolatedMarginPairsData'] = keysList
2011 else:
2012 markets = self.array_concat(markets, data)
2013 #
2014 # spot
2015 #
2016 # {
2017 # "symbol": "TRXUSDT",
2018 # "baseCoin": "TRX",
2019 # "quoteCoin": "USDT",
2020 # "minTradeAmount": "0",
2021 # "maxTradeAmount": "10000000000",
2022 # "takerFeeRate": "0.002",
2023 # "makerFeeRate": "0.002",
2024 # "pricePrecision": "6",
2025 # "quantityPrecision": "4",
2026 # "quotePrecision": "6",
2027 # "status": "online",
2028 # "minTradeUSDT": "5",
2029 # "buyLimitPriceRatio": "0.05",
2030 # "sellLimitPriceRatio": "0.05"

Callers 1

fetch_marketsMethod · 0.95

Calls 15

reduceMethod · 0.95
NotSupportedClass · 0.90
PreciseClass · 0.90
safe_dictMethod · 0.80
safe_listMethod · 0.80
safe_boolMethod · 0.80
index_byMethod · 0.80
array_concatMethod · 0.80
safe_stringMethod · 0.80
safe_valueMethod · 0.80
in_arrayMethod · 0.80
parse_numberMethod · 0.80

Tested by

no test coverage detected