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

Method fetch_tickers

python/ccxt/gate.py:2894–2931  ·  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

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