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

Method fetch_ticker

python/ccxt/extended.py:695–748  ·  view source on GitHub ↗

fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market https://api.docs.extended.exchange/#get-market-statistics :param str symbol: unified symbol of the market to fetch the ticker for :param d

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

Source from the content-addressed store, hash-verified

693 })
694
695 def fetch_ticker(self, symbol: str, params={}) -> Ticker:
696 """
697 fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
698
699 https://api.docs.extended.exchange/#get-market-statistics
700
701 :param str symbol: unified symbol of the market to fetch the ticker for
702 :param dict [params]: extra parameters specific to the exchange API endpoint
703 :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
704 """
705 self.load_markets()
706 market = self.market(symbol)
707 request = {
708 'market': market['id'],
709 }
710 response = self.v1PublicGetInfoMarketsMarketStats(self.extend(request, params))
711 #
712 # {
713 # "status": "OK",
714 # "data": {
715 # "dailyVolume": "231216165.666600",
716 # "dailyVolumeBase": "3027.36710",
717 # "dailyPriceChange": "181",
718 # "dailyPriceChangePercentage": "0.0024",
719 # "dailyLow": "75635",
720 # "dailyHigh": "77399",
721 # "lastPrice": "77026",
722 # "askPrice": "77026",
723 # "bidPrice": "77025",
724 # "markPrice": "77006.091897999984",
725 # "indexPrice": "77050.739529925005",
726 # "fundingRate": "0.000012",
727 # "nextFundingRate": 1777446000000,
728 # "openInterest": "114851569.088316",
729 # "openInterestBase": "1491.33012",
730 # "deleverageLevels": {
731 # "shortPositions": [
732 # {"level": 1, "rankingLowerBound": "-784.2884"},
733 # {"level": 2, "rankingLowerBound": "-2.1078"},
734 # {"level": 3, "rankingLowerBound": "-0.8754"},
735 # {"level": 4, "rankingLowerBound": "0.0000"}
736 # ],
737 # "longPositions": [
738 # {"level": 1, "rankingLowerBound": "-47747.2010"},
739 # {"level": 2, "rankingLowerBound": "-0.0131"},
740 # {"level": 3, "rankingLowerBound": "0.0019"},
741 # {"level": 4, "rankingLowerBound": "0.0032"}
742 # ]
743 # }
744 # }
745 # }
746 #
747 data = self.safe_dict(response, 'data', {})
748 return self.parse_ticker(data, market)
749
750 def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
751 """

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected