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