fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot :param str symbol: unified symbol of the market to fetch the order book for
(self, symbol: str, limit: Int = None, params={})
| 1151 | return self.safe_balance(result) |
| 1152 | |
| 1153 | def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook: |
| 1154 | """ |
| 1155 | fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data |
| 1156 | |
| 1157 | https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot |
| 1158 | |
| 1159 | :param str symbol: unified symbol of the market to fetch the order book for |
| 1160 | :param int [limit]: the maximum amount of order book entries to return |
| 1161 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 1162 | :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>` |
| 1163 | """ |
| 1164 | self.load_markets() |
| 1165 | market = self.market(symbol) |
| 1166 | request = { |
| 1167 | 'type': 'l2Book', |
| 1168 | 'coin': market['baseName'] if market['swap'] else market['id'], |
| 1169 | } |
| 1170 | response = self.publicPostInfo(self.extend(request, params)) |
| 1171 | # |
| 1172 | # { |
| 1173 | # "coin": "ETH", |
| 1174 | # "levels": [ |
| 1175 | # [ |
| 1176 | # { |
| 1177 | # "n": "2", |
| 1178 | # "px": "2216.2", |
| 1179 | # "sz": "74.0637" |
| 1180 | # } |
| 1181 | # ], |
| 1182 | # [ |
| 1183 | # { |
| 1184 | # "n": "2", |
| 1185 | # "px": "2216.5", |
| 1186 | # "sz": "70.5893" |
| 1187 | # } |
| 1188 | # ] |
| 1189 | # ], |
| 1190 | # "time": "1704290104840" |
| 1191 | # } |
| 1192 | # |
| 1193 | data = self.safe_list(response, 'levels', []) |
| 1194 | result = { |
| 1195 | 'bids': self.safe_list(data, 0, []), |
| 1196 | 'asks': self.safe_list(data, 1, []), |
| 1197 | } |
| 1198 | timestamp = self.safe_integer(response, 'time') |
| 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 | """ |
nothing calls this directly
no test coverage detected