fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific 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-
(self, symbol: str, params={})
| 2740 | return result |
| 2741 | |
| 2742 | async def fetch_ticker(self, symbol: str, params={}) -> Ticker: |
| 2743 | """ |
| 2744 | fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market |
| 2745 | |
| 2746 | https://www.gate.com/docs/developers/apiv4/en/#get-currency-pair-ticker-information |
| 2747 | https://www.gate.com/docs/developers/apiv4/en/#get-all-futures-trading-statistics |
| 2748 | https://www.gate.com/docs/developers/apiv4/en/#get-all-futures-trading-statistics-2 |
| 2749 | https://www.gate.com/docs/developers/apiv4/en/#query-options-market-ticker-information |
| 2750 | |
| 2751 | :param str symbol: unified symbol of the market to fetch the ticker for |
| 2752 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 2753 | :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>` |
| 2754 | """ |
| 2755 | await self.load_markets() |
| 2756 | market = self.market(symbol) |
| 2757 | request, query = self.prepare_request(market, None, params) |
| 2758 | response: dict |
| 2759 | if market['spot'] or market['margin']: |
| 2760 | response = await self.publicSpotGetTickers(self.extend(request, query)) |
| 2761 | elif market['swap']: |
| 2762 | response = await self.publicFuturesGetSettleTickers(self.extend(request, query)) |
| 2763 | elif market['future']: |
| 2764 | response = await self.publicDeliveryGetSettleTickers(self.extend(request, query)) |
| 2765 | elif market['option']: |
| 2766 | marketId = market['id'] |
| 2767 | optionParts = marketId.split('-') |
| 2768 | request['underlying'] = self.safe_string(optionParts, 0) |
| 2769 | response = await self.publicOptionsGetTickers(self.extend(request, query)) |
| 2770 | else: |
| 2771 | raise NotSupported(self.id + ' fetchTicker() not support self market type') |
| 2772 | ticker = None |
| 2773 | if market['option']: |
| 2774 | for i in range(0, len(response)): |
| 2775 | entry = response[i] |
| 2776 | if entry['name'] == market['id']: |
| 2777 | ticker = entry |
| 2778 | break |
| 2779 | else: |
| 2780 | ticker = self.safe_value(response, 0) |
| 2781 | return self.parse_ticker(ticker, market) |
| 2782 | |
| 2783 | def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker: |
| 2784 | # |
nothing calls this directly
no test coverage detected