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

Method fetch_ticker

python/ccxt/bitget.py:3308–3463  ·  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://www.bitget.com/api-doc/spot/market/Get-Tickers https://www.bitget.com/api-doc/contract/market/Get-Ticker https://www.bitget.com/api

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

Source from the content-addressed store, hash-verified

3306 }, market)
3307
3308 def fetch_ticker(self, symbol: str, params={}) -> Ticker:
3309 """
3310 fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
3311
3312 https://www.bitget.com/api-doc/spot/market/Get-Tickers
3313 https://www.bitget.com/api-doc/contract/market/Get-Ticker
3314 https://www.bitget.com/api-doc/uta/public/Tickers
3315
3316 :param str symbol: unified symbol of the market to fetch the ticker for
3317 :param dict [params]: extra parameters specific to the exchange API endpoint
3318 :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False
3319 :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
3320 """
3321 self.load_markets()
3322 market = self.market(symbol)
3323 request = {
3324 'symbol': market['id'],
3325 }
3326 productType = None
3327 productType, params = self.handle_product_type_and_params(market, params)
3328 response = None
3329 uta = None
3330 uta, params = self.handle_option_and_params(params, 'fetchTicker', 'uta', False)
3331 if uta:
3332 request['category'] = productType
3333 response = self.publicUtaGetV3MarketTickers(self.extend(request, params))
3334 elif market['spot']:
3335 response = self.publicSpotGetV2SpotMarketTickers(self.extend(request, params))
3336 else:
3337 request['productType'] = productType
3338 response = self.publicMixGetV2MixMarketTicker(self.extend(request, params))
3339 #
3340 # spot
3341 #
3342 # {
3343 # "code": "00000",
3344 # "msg": "success",
3345 # "requestTime": 1700532903782,
3346 # "data": [
3347 # {
3348 # "open": "37202.46",
3349 # "symbol": "BTCUSDT",
3350 # "high24h": "37744.75",
3351 # "low24h": "36666",
3352 # "lastPr": "37583.69",
3353 # "quoteVolume": "519127705.303",
3354 # "baseVolume": "13907.0386",
3355 # "usdtVolume": "519127705.302908",
3356 # "ts": "1700532903261",
3357 # "bidPr": "37583.68",
3358 # "askPr": "37583.69",
3359 # "bidSz": "0.0007",
3360 # "askSz": "0.0829",
3361 # "openUtc": "37449.4",
3362 # "changeUtc24h": "0.00359",
3363 # "change24h": "0.00321"
3364 # }
3365 # ]

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected