fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-o
(self, symbols: Strings = None, params={})
| 1199 | return self.parse_order_book(result, market['symbol'], timestamp, 'bids', 'asks', 'px', 'sz') |
| 1200 | |
| 1201 | def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers: |
| 1202 | """ |
| 1203 | fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market |
| 1204 | |
| 1205 | https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc |
| 1206 | https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts |
| 1207 | |
| 1208 | :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned |
| 1209 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1210 | :param str [params.type]: 'spot' or 'swap', by default fetches both |
| 1211 | :param boolean [params.hip3]: set to True to fetch hip3 markets only |
| 1212 | :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/?id=ticker-structure>` |
| 1213 | """ |
| 1214 | self.load_markets() |
| 1215 | symbols = self.market_symbols(symbols) |
| 1216 | # at self stage, to get tickers data, we use fetchMarkets endpoints |
| 1217 | response = [] |
| 1218 | type = self.safe_string(params, 'type') |
| 1219 | params = self.omit(params, 'type') |
| 1220 | hip3 = False |
| 1221 | hip3, params = self.handle_option_and_params(params, 'fetchTickers', 'hip3', False) |
| 1222 | if symbols is not None: |
| 1223 | # infer from first symbol |
| 1224 | firstSymbol = self.safe_string(symbols, 0) |
| 1225 | if firstSymbol is not None: |
| 1226 | market = self.market(firstSymbol) |
| 1227 | if self.safe_bool(self.safe_dict(market, 'info'), 'hip3'): |
| 1228 | hip3 = True |
| 1229 | if hip3: |
| 1230 | params = self.omit(params, 'hip3') |
| 1231 | response = self.fetch_hip3_markets(params) |
| 1232 | elif type == 'spot': |
| 1233 | response = self.fetch_spot_markets(params) |
| 1234 | elif type == 'swap': |
| 1235 | response = self.fetch_swap_markets(params) |
| 1236 | else: |
| 1237 | response = self.fetch_markets(params) |
| 1238 | # same response "fetchMarkets" |
| 1239 | result = {} |
| 1240 | for i in range(0, len(response)): |
| 1241 | market = response[i] |
| 1242 | info = market['info'] |
| 1243 | ticker = self.parse_ticker(info, market) |
| 1244 | symbol = self.safe_string(ticker, 'symbol') |
| 1245 | result[symbol] = ticker |
| 1246 | return self.filter_by_array_tickers(result, 'symbol', symbols) |
| 1247 | |
| 1248 | def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates: |
| 1249 | """ |
nothing calls this directly
no test coverage detected