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

Method fetch_ticker

python/ccxt/bybit.py:2470–2534  ·  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://bybit-exchange.github.io/docs/v5/market/tickers :param str symbol: unified symbol of the market to fetch the ticker for :param dic

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

Source from the content-addressed store, hash-verified

2468 }, market)
2469
2470 def fetch_ticker(self, symbol: str, params={}) -> Ticker:
2471 """
2472 fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
2473
2474 https://bybit-exchange.github.io/docs/v5/market/tickers
2475
2476 :param str symbol: unified symbol of the market to fetch the ticker for
2477 :param dict [params]: extra parameters specific to the exchange API endpoint
2478 :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
2479 """
2480 if symbol is None:
2481 raise ArgumentsRequired(self.id + ' fetchTicker() requires a symbol argument')
2482 self.load_markets()
2483 market = self.market(symbol)
2484 request = {
2485 'symbol': market['id'],
2486 # 'baseCoin': '', Base coin. For option only
2487 # 'expDate': '', Expiry date. e.g., 25DEC22. For option only
2488 }
2489 category = None
2490 category, params = self.get_bybit_type('fetchTicker', market, params)
2491 request['category'] = category
2492 response = self.publicGetV5MarketTickers(self.extend(request, params))
2493 #
2494 # {
2495 # "retCode": 0,
2496 # "retMsg": "OK",
2497 # "result": {
2498 # "category": "inverse",
2499 # "list": [
2500 # {
2501 # "symbol": "BTCUSD",
2502 # "lastPrice": "16597.00",
2503 # "indexPrice": "16598.54",
2504 # "markPrice": "16596.00",
2505 # "prevPrice24h": "16464.50",
2506 # "price24hPcnt": "0.008047",
2507 # "highPrice24h": "30912.50",
2508 # "lowPrice24h": "15700.00",
2509 # "prevPrice1h": "16595.50",
2510 # "openInterest": "373504107",
2511 # "openInterestValue": "22505.67",
2512 # "turnover24h": "2352.94950046",
2513 # "volume24h": "49337318",
2514 # "fundingRate": "-0.001034",
2515 # "nextFundingTime": "1672387200000",
2516 # "predictedDeliveryPrice": "",
2517 # "basisRate": "",
2518 # "deliveryFeeRate": "",
2519 # "deliveryTime": "0",
2520 # "ask1Size": "1",
2521 # "bid1Price": "16596.00",
2522 # "ask1Price": "16597.50",
2523 # "bid1Size": "1"
2524 # }
2525 # ]
2526 # },
2527 # "retExtInfo": {},

Callers

nothing calls this directly

Calls 9

get_bybit_typeMethod · 0.95
parse_tickerMethod · 0.95
ArgumentsRequiredClass · 0.90
safe_dictMethod · 0.80
safe_listMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected