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

Method fetch_markets

python/ccxt/async_support/hyperliquid.py:512–537  ·  view source on GitHub ↗

retrieves data on all markets for hyperliquid https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc https://hyperliquid.gitbook.io/hyperliquid-docs

(self, params={})

Source from the content-addressed store, hash-verified

510 return result
511
512 async def fetch_markets(self, params={}) -> List[Market]:
513 """
514 retrieves data on all markets for hyperliquid
515
516 https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
517 https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
518
519 :param dict [params]: extra parameters specific to the exchange API endpoint
520 :returns dict[]: an array of objects representing market data
521 """
522 options = self.safe_dict(self.options, 'fetchMarkets', {})
523 types = self.safe_list(options, 'types', [])
524 rawPromises = []
525 for i in range(0, len(types)):
526 marketType = types[i]
527 if marketType == 'swap':
528 rawPromises.append(self.fetch_swap_markets(params))
529 elif marketType == 'spot':
530 rawPromises.append(self.fetch_spot_markets(params))
531 elif marketType == 'hip3':
532 rawPromises.append(self.fetch_hip3_markets(params))
533 promises = await asyncio.gather(*rawPromises)
534 result = []
535 for i in range(0, len(promises)):
536 result = self.array_concat(result, promises[i])
537 return result
538
539 async def fetch_hip3_markets(self, params={}) -> List[Market]:
540 """

Callers 1

fetch_tickersMethod · 0.95

Calls 8

fetch_swap_marketsMethod · 0.95
fetch_spot_marketsMethod · 0.95
fetch_hip3_marketsMethod · 0.95
safe_dictMethod · 0.80
safe_listMethod · 0.80
array_concatMethod · 0.80
rangeFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected