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

Method fetch_ticker

python/ccxt/foxbit.py:561–610  ·  view source on GitHub ↗

Get last 24 hours ticker information, in real-time, for given market. https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_ticker :param str symbol: unified symbol of the market to fetch the ticker for :param dict [params]: extra paramete

(self, symbol: str, params={})

Source from the content-addressed store, hash-verified

559 return self.parse_markets(markets)
560
561 def fetch_ticker(self, symbol: str, params={}) -> Ticker:
562 """
563 Get last 24 hours ticker information, in real-time, for given market.
564
565 https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_ticker
566
567 :param str symbol: unified symbol of the market to fetch the ticker for
568 :param dict [params]: extra parameters specific to the exchange API endpoint
569 :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
570 """
571 self.load_markets()
572 market = self.market(symbol)
573 request = {
574 'market': market['id'],
575 }
576 response = self.v3PublicGetMarketsMarketTicker24hr(self.extend(request, params))
577 # {
578 # "data": [
579 # {
580 # "market_symbol": "btcbrl",
581 # "last_trade": {
582 # "price": "358504.69340000",
583 # "volume": "0.00027893",
584 # "date": "2024-01-01T00:00:00.000Z"
585 # },
586 # "rolling_24h": {
587 # "price_change": "3211.87290000",
588 # "price_change_percent": "0.90400726",
589 # "volume": "20.03206866",
590 # "trades_count": "4376",
591 # "open": "355292.82050000",
592 # "high": "362999.99990000",
593 # "low": "355002.88880000"
594 # },
595 # "best": {
596 # "ask": {
597 # "price": "358504.69340000",
598 # "volume": "0.00027893"
599 # },
600 # "bid": {
601 # "price": "358504.69340000",
602 # "volume": "0.00027893"
603 # }
604 # }
605 # }
606 # ]
607 # }
608 data = self.safe_list(response, 'data', [])
609 result = self.safe_dict(data, 0, {})
610 return self.parse_ticker(result, market)
611
612 def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
613 """

Callers

nothing calls this directly

Calls 7

parse_tickerMethod · 0.95
safe_listMethod · 0.80
safe_dictMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected