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

Method fetch_markets

python/ccxt/bitrue.py:832–935  ·  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

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