fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#24hr-ticker-price-change-statistics # spot https://dev
(self, symbol: str, params={})
| 4312 | } |
| 4313 | |
| 4314 | def fetch_ticker(self, symbol: str, params={}) -> Ticker: |
| 4315 | """ |
| 4316 | fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market |
| 4317 | |
| 4318 | https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#24hr-ticker-price-change-statistics # spot |
| 4319 | https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#rolling-window-price-change-statistics # spot |
| 4320 | https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/24hr-Ticker-Price-Change-Statistics # swap |
| 4321 | https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/24hr-Ticker-Price-Change-Statistics # future |
| 4322 | https://developers.binance.com/docs/derivatives/option/market-data/24hr-Ticker-Price-Change-Statistics # option |
| 4323 | |
| 4324 | :param str symbol: unified symbol of the market to fetch the ticker for |
| 4325 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 4326 | :param boolean [params.rolling]:(spot only) default False, if True, uses the rolling 24 hour ticker endpoint /api/v3/ticker |
| 4327 | :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>` |
| 4328 | """ |
| 4329 | self.load_markets() |
| 4330 | market = self.market(symbol) |
| 4331 | request = { |
| 4332 | 'symbol': market['id'], |
| 4333 | } |
| 4334 | response = None |
| 4335 | if market['option']: |
| 4336 | response = self.eapiPublicGetTicker(self.extend(request, params)) |
| 4337 | elif market['linear']: |
| 4338 | response = self.fapiPublicGetTicker24hr(self.extend(request, params)) |
| 4339 | elif market['inverse']: |
| 4340 | response = self.dapiPublicGetTicker24hr(self.extend(request, params)) |
| 4341 | else: |
| 4342 | rolling = self.safe_bool(params, 'rolling', False) |
| 4343 | params = self.omit(params, 'rolling') |
| 4344 | if rolling: |
| 4345 | response = self.publicGetTicker(self.extend(request, params)) |
| 4346 | else: |
| 4347 | response = self.publicGetTicker24hr(self.extend(request, params)) |
| 4348 | if isinstance(response, list): |
| 4349 | firstTicker = self.safe_dict(response, 0, {}) |
| 4350 | return self.parse_ticker(firstTicker, market) |
| 4351 | return self.parse_ticker(response, market) |
| 4352 | |
| 4353 | def fetch_bids_asks(self, symbols: Strings = None, params={}): |
| 4354 | """ |
nothing calls this directly
no test coverage detected