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

Method fetch_mark_prices

python/ccxt/binance.py:4578–4604  ·  view source on GitHub ↗

fetches mark prices for multiple markets https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-and-Mark-Price https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price :par

(self, symbols: Strings = None, params={})

Source from the content-addressed store, hash-verified

4576 return self.parse_ticker(response, market)
4577
4578 def fetch_mark_prices(self, symbols: Strings = None, params={}) -> Tickers:
4579 """
4580 fetches mark prices for multiple markets
4581
4582 https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Index-Price-and-Mark-Price
4583 https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Mark-Price
4584
4585 :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
4586 :param dict [params]: extra parameters specific to the exchange API endpoint
4587 :param str [params.subType]: "linear" or "inverse"
4588 :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/?id=ticker-structure>`
4589 """
4590 self.load_markets()
4591 symbols = self.market_symbols(symbols, None, True, True, True)
4592 market = self.get_market_from_symbols(symbols)
4593 type = None
4594 type, params = self.handle_market_type_and_params('fetchMarkPrices', market, params, 'swap')
4595 subType = None
4596 subType, params = self.handle_sub_type_and_params('fetchMarkPrices', market, params, 'linear')
4597 response = None
4598 if self.is_linear(type, subType):
4599 response = self.fapiPublicGetPremiumIndex(params)
4600 elif self.is_inverse(type, subType):
4601 response = self.dapiPublicGetPremiumIndex(params)
4602 else:
4603 raise NotSupported(self.id + ' fetchMarkPrices() does not support ' + type + ' markets yet')
4604 return self.parse_tickers(response, symbols)
4605
4606 def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
4607 # when api method = publicGetKlines or fapiPublicGetKlines or dapiPublicGetKlines

Callers

nothing calls this directly

Calls 11

is_linearMethod · 0.95
is_inverseMethod · 0.95
NotSupportedClass · 0.90
market_symbolsMethod · 0.80
load_marketsMethod · 0.45
parse_tickersMethod · 0.45

Tested by

no test coverage detected