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

Method fetch_markets

python/ccxt/async_support/bitrue.py:833–936  ·  view source on GitHub ↗

retrieves data on all markets for bitrue https://github.com/Bitrue-exchange/Spot-official-api-docs#exchangeInfo_endpoint https://www.bitrue.com/api-docs#current-open-contract https://www.bitrue.com/api_docs_includes_file/delivery.html#current-open-contract

(self, params={})

Source from the content-addressed store, hash-verified

831 })
832
833 async def fetch_markets(self, params={}) -> List[Market]:
834 """
835 retrieves data on all markets for bitrue
836
837 https://github.com/Bitrue-exchange/Spot-official-api-docs#exchangeInfo_endpoint
838 https://www.bitrue.com/api-docs#current-open-contract
839 https://www.bitrue.com/api_docs_includes_file/delivery.html#current-open-contract
840
841 :param dict [params]: extra parameters specific to the exchange api endpoint
842 :returns dict[]: an array of objects representing market data
843 """
844 promisesRaw = []
845 types = None
846 defaultTypes = ['spot', 'linear', 'inverse']
847 fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
848 if fetchMarketsOptions is not None:
849 types = self.safe_list(fetchMarketsOptions, 'types', defaultTypes)
850 else:
851 # for backward-compatibility
852 types = self.safe_list(self.options, 'fetchMarkets', defaultTypes)
853 for i in range(0, len(types)):
854 marketType = types[i]
855 if marketType == 'spot':
856 promisesRaw.append(self.spotV1PublicGetExchangeInfo(params))
857 elif marketType == 'linear':
858 promisesRaw.append(self.fapiV1PublicGetContracts(params))
859 elif marketType == 'inverse':
860 promisesRaw.append(self.dapiV1PublicGetContracts(params))
861 else:
862 raise ExchangeError(self.id + ' fetchMarkets() self.options fetchMarkets "' + marketType + '" is not a supported market type')
863 promises = await asyncio.gather(*promisesRaw)
864 spotMarkets = self.safe_value(self.safe_value(promises, 0), 'symbols', [])
865 futureMarkets = self.safe_value(promises, 1)
866 deliveryMarkets = self.safe_value(promises, 2)
867 markets = spotMarkets
868 markets = self.array_concat(markets, futureMarkets)
869 markets = self.array_concat(markets, deliveryMarkets)
870 #
871 # spot
872 #
873 # {
874 # "timezone":"CTT",
875 # "serverTime":1635464889117,
876 # "rateLimits":[
877 # {"rateLimitType":"REQUESTS_WEIGHT","interval":"MINUTES","limit":6000},
878 # {"rateLimitType":"ORDERS","interval":"SECONDS","limit":150},
879 # {"rateLimitType":"ORDERS","interval":"DAYS","limit":288000},
880 # ],
881 # "exchangeFilters":[],
882 # "symbols":[
883 # {
884 # "symbol":"SHABTC",
885 # "status":"TRADING",
886 # "baseAsset":"sha",
887 # "baseAssetPrecision":0,
888 # "quoteAsset":"btc",
889 # "quotePrecision":10,
890 # "orderTypes":["MARKET","LIMIT"],

Callers

nothing calls this directly

Calls 12

ExchangeErrorClass · 0.90
safe_dictMethod · 0.80
safe_listMethod · 0.80
safe_valueMethod · 0.80
array_concatMethod · 0.80
rangeFunction · 0.50
appendMethod · 0.45
load_time_differenceMethod · 0.45
parse_marketsMethod · 0.45

Tested by

no test coverage detected