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