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

Method fetch_tickers

python/ccxt/async_support/gate.py:2895–2932  ·  view source on GitHub ↗

fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market https://www.gate.com/docs/developers/apiv4/en/#get-currency-pair-ticker-information https://www.gate.com/docs/developers/apiv4/en/#get-all-futures-trading-s

(self, symbols: Strings = None, params={})

Source from the content-addressed store, hash-verified

2893 }, market)
2894
2895 async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
2896 """
2897 fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
2898
2899 https://www.gate.com/docs/developers/apiv4/en/#get-currency-pair-ticker-information
2900 https://www.gate.com/docs/developers/apiv4/en/#get-all-futures-trading-statistics
2901 https://www.gate.com/docs/developers/apiv4/en/#get-all-futures-trading-statistics-2
2902 https://www.gate.com/docs/developers/apiv4/en/#query-options-market-ticker-information
2903
2904 :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2905 :param dict [params]: extra parameters specific to the exchange API endpoint
2906 :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/?id=ticker-structure>`
2907 """
2908 await self.load_markets()
2909 symbols = self.market_symbols(symbols)
2910 first = self.safe_string(symbols, 0)
2911 market = None
2912 if first is not None:
2913 market = self.market(first)
2914 type, query = self.handle_market_type_and_params('fetchTickers', market, params)
2915 request, requestParams = self.prepare_request(None, type, query)
2916 response: dict
2917 request['timezone'] = 'utc0' # default to utc
2918 if type == 'spot' or type == 'margin':
2919 response = await self.publicSpotGetTickers(self.extend(request, requestParams))
2920 elif type == 'swap':
2921 response = await self.publicFuturesGetSettleTickers(self.extend(request, requestParams))
2922 elif type == 'future':
2923 response = await self.publicDeliveryGetSettleTickers(self.extend(request, requestParams))
2924 elif type == 'option':
2925 self.check_required_argument('fetchTickers', symbols, 'symbols')
2926 marketId = self.safe_string(market, 'id')
2927 optionParts = marketId.split('-')
2928 request['underlying'] = self.safe_string(optionParts, 0)
2929 response = await self.publicOptionsGetTickers(self.extend(request, requestParams))
2930 else:
2931 raise NotSupported(self.id + ' fetchTickers() not support self market type, provide symbols or set params["defaultType"] to one from spot/margin/swap/future/option')
2932 return self.parse_tickers(response, symbols)
2933
2934 def parse_balance_helper(self, entry):
2935 account = self.account()

Callers

nothing calls this directly

Calls 15

prepare_requestMethod · 0.95
publicSpotGetTickersMethod · 0.95
NotSupportedClass · 0.90
market_symbolsMethod · 0.80
safe_stringMethod · 0.80
splitMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45

Tested by

no test coverage detected