Skip to content

Info

Read-only request-response client.

http

Source code in pkg/src/hyperliquid/info/core.py
@classmethod
def http(
  cls, *, mainnet: bool = True, validate: bool = True,
  http: HttpClient | None = None
):
  domain = HYPERLIQUID_MAINNET if mainnet else HYPERLIQUID_TESTNET
  http = http or HttpClient()
  return cls(client=InfoHttpClient(domain=domain, http=http), validate=validate)

ws_of

Source code in pkg/src/hyperliquid/info/core.py
@classmethod
def ws_of(cls, ws: SocketClient, *, validate: bool = True):
  return cls(client=InfoSocketClient(ws=ws), validate=validate)

ws

Source code in pkg/src/hyperliquid/info/core.py
@classmethod
def ws(cls, *, mainnet: bool = True, validate: bool = True, timeout: timedelta = timedelta(seconds=10)):
  domain = HYPERLIQUID_MAINNET if mainnet else HYPERLIQUID_TESTNET
  ws = SocketClient(url=f'wss://{domain}/ws', timeout=timeout)
  return cls.ws_of(ws, validate=validate)

aligned_quote_token_info

Return aligned quote token status for a token index.

  • token: Token index.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/aligned_quote_token_info.py
async def aligned_quote_token_info(
  self, token: int
) -> AlignedQuoteTokenInfoResponse:
  """Return aligned quote token status for a token index.

  - `token`: Token index.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-aligned-quote-token-status)
  """
  r = await self.request({'type': 'alignedQuoteTokenInfo', 'token': token})
  return adapter.validate_python(r) if self.validate else r

all_borrow_lend_reserve_states

Return all borrow/lend reserve states.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/all_borrow_lend_reserve_states.py
async def all_borrow_lend_reserve_states(self) -> AllBorrowLendReserveStatesResponse:
  """Return all borrow/lend reserve states.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-all-borrow-lend-reserve-states)
  """
  r = await self.request({'type': 'allBorrowLendReserveStates'})
  return adapter.validate_python(r) if self.validate else r

all_mids

Return mids for all coins.

  • dex: Perp dex name. Defaults to the empty string which represents the first perp dex.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/all_mids.py
async def all_mids(self, dex: str | None = None) -> AllMidsResponse:
  """Return mids for all coins.

  - `dex`: Perp dex name. Defaults to the empty string which represents the
    first perp dex.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins)
  """
  params = {'type': 'allMids'}
  if dex is not None:
    params['dex'] = dex
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

borrow_lend_reserve_state

Return borrow/lend reserve state for a token index.

  • token: Token index.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/borrow_lend_reserve_state.py
async def borrow_lend_reserve_state(
  self, token: int
) -> BorrowLendReserveStateResponse:
  """Return borrow/lend reserve state for a token index.

  - `token`: Token index.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-borrow-lend-reserve-state)
  """
  r = await self.request({'type': 'borrowLendReserveState', 'token': token})
  return adapter.validate_python(r) if self.validate else r

borrow_lend_user_state

Return borrow/lend user state.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/borrow_lend_user_state.py
async def borrow_lend_user_state(
  self, user: str
) -> BorrowLendUserStateResponse:
  """Return borrow/lend user state.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-borrow-lend-user-state)
  """
  r = await self.request({'type': 'borrowLendUserState', 'user': user})
  return adapter.validate_python(r) if self.validate else r

builder_fee_approved

Return the max builder fee approved.

  • user: Account address.
  • builder: Builder address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/builder_fee_approved.py
async def builder_fee_approved(
  self, user: str, builder: str
) -> BuilderFeeApprovedResponse:
  """Return the max builder fee approved.

  - `user`: Account address.
  - `builder`: Builder address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#check-builder-fee-approval)
  """
  r = await self.request({
    'type': 'maxBuilderFee',
    'user': user,
    'builder': builder,
  })
  return adapter.validate_python(r) if self.validate else r

candle_snapshot

Return a candle snapshot.

  • coin: Asset being queried.
  • interval: Time interval of the candles.
  • start_time: Timestamp of the first candle in the snapshot (epoch ms).
  • end_time: Timestamp of the last candle in the snapshot (epoch ms).

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/candle_snapshot.py
async def candle_snapshot(
  self, *, coin: str, interval: str,
  start_time: int, end_time: int
) -> CandleSnapshotResponse:
  """Return a candle snapshot.

  - `coin`: Asset being queried.
  - `interval`: Time interval of the candles.
  - `start_time`: Timestamp of the first candle in the snapshot (epoch ms).
  - `end_time`: Timestamp of the last candle in the snapshot (epoch ms).

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot)
  """
  r = await self.request({
    'type': 'candleSnapshot',
    'req': {
      'coin': coin,
      'interval': interval,
      'startTime': start_time,
      'endTime': end_time,
    },
  })
  return adapter.validate_python(r) if self.validate else r

frontend_open_orders

Return open orders with additional frontend info.

  • user: Account address.
  • dex: Perp dex name. Defaults to the empty string which represents the first perp dex.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/frontend_open_orders.py
async def frontend_open_orders(
  self, user: str, *, dex: str | None = None
) -> FrontendOpenOrdersResponse:
  """Return open orders with additional frontend info.

  - `user`: Account address.
  - `dex`: Perp dex name. Defaults to the empty string which represents the
    first perp dex.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders-with-additional-frontend-info)
  """
  params = {'type': 'frontendOpenOrders', 'user': user}
  if dex is not None:
    params['dex'] = dex
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

l2_book

Return an L2 book snapshot.

  • coin: from spot_meta['universe'][idx]['name'] or perp_meta['universe'][idx]['name']. See the docs for full details.
  • n_sig_figs: Aggregate levels to significant figures.
  • mantissa: Only allowed when n_sig_figs is 5.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/l2_book.py
async def l2_book(
  self, coin: str, *,
  n_sig_figs: int | None = None,
  mantissa: int | None = None
) -> L2BookResponse:
  """Return an L2 book snapshot.

  - `coin`: from `spot_meta['universe'][idx]['name']` or `perp_meta['universe'][idx]['name']`. See the [docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/asset-ids) for full details.
  - `n_sig_figs`: Aggregate levels to significant figures.
  - `mantissa`: Only allowed when `n_sig_figs` is 5.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot)
  """
  params: dict[str, object] = {'type': 'l2Book', 'coin': coin}
  if n_sig_figs is not None:
    params['nSigFigs'] = n_sig_figs
  if mantissa is not None:
    params['mantissa'] = mantissa
  r = await self.request(params)
  if r is None:
    raise ApiError(f'L2 book "{coin}" not found')
  return adapter.validate_python(r) if self.validate else r

open_orders

Return a user's open orders.

  • user: Account address.
  • dex: Perp dex name. Defaults to the empty string which represents the first perp dex.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/open_orders.py
async def open_orders(
  self, user: str, *, dex: str | None = None
) -> list[OpenOrder]:
  """Return a user's open orders.

  - `user`: Account address.
  - `dex`: Perp dex name. Defaults to the empty string which represents the
    first perp dex.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders)
  """
  params = {'type': 'openOrders', 'user': user}
  if dex is not None:
    params['dex'] = dex
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

order_status

Return order status by order id or client order id.

  • user: Account address.
  • oid: Order id or 16-byte client order id hex string.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/order_status.py
async def order_status(
  self, user: str, oid: int | str
) -> OrderStatusResponse:
  """Return order status by order id or client order id.

  - `user`: Account address.
  - `oid`: Order id or 16-byte client order id hex string.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid)
  """
  r = await self.request({'type': 'orderStatus', 'user': user, 'oid': oid})
  return adapter.validate_python(r) if self.validate else r

staking_delegations

Return a user's staking delegations.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/staking_delegations.py
async def staking_delegations(self, user: str) -> StakingDelegationsResponse:
  """Return a user's staking delegations.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-delegations)
  """
  r = await self.request({'type': 'delegations', 'user': user})
  return adapter.validate_python(r) if self.validate else r

staking_history

Return a user's staking history.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/staking_history.py
async def staking_history(self, user: str) -> StakingHistoryResponse:
  """Return a user's staking history.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-history)
  """
  r = await self.request({'type': 'delegatorHistory', 'user': user})
  return adapter.validate_python(r) if self.validate else r

staking_rewards

Return a user's staking rewards.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/staking_rewards.py
async def staking_rewards(self, user: str) -> StakingRewardsResponse:
  """Return a user's staking rewards.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-rewards)
  """
  r = await self.request({'type': 'delegatorRewards', 'user': user})
  return adapter.validate_python(r) if self.validate else r

staking_summary

Return a user's staking summary.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/staking_summary.py
async def staking_summary(self, user: str) -> StakingSummaryResponse:
  """Return a user's staking summary.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-summary)
  """
  r = await self.request({'type': 'delegatorSummary', 'user': user})
  return adapter.validate_python(r) if self.validate else r

sub_accounts

Return a user's subaccounts.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/sub_accounts.py
async def sub_accounts(self, user: str) -> SubAccountsResponse:
  """Return a user's subaccounts.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-subaccounts)
  """
  r = await self.request({'type': 'subAccounts', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_abstraction

Return a user's abstraction state.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_abstraction.py
async def user_abstraction(self, user: str) -> UserAbstractionResponse:
  """Return a user's abstraction state.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-abstraction-state)
  """
  r = await self.request({'type': 'userAbstraction', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_dex_abstraction

Return a user's HIP-3 DEX abstraction state.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_dex_abstraction.py
async def user_dex_abstraction(self, user: str) -> UserDexAbstractionResponse:
  """Return a user's HIP-3 DEX abstraction state.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-hip-3-dex-abstraction-state)
  """
  r = await self.request({'type': 'userDexAbstraction', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_fees

Return a user's fee schedule and rates.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_fees.py
async def user_fees(self, user: str) -> UserFeesResponse:
  """Return a user's fee schedule and rates.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-fees)
  """
  r = await self.request({'type': 'userFees', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_fills

Return a user's most recent fills.

  • user: Account address.
  • aggregate_by_time: Aggregate partial fills in the same block.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_fills.py
async def user_fills(
  self, user: str, *, aggregate_by_time: bool | None = None
) -> UserFillsResponse:
  """Return a user's most recent fills.

  - `user`: Account address.
  - `aggregate_by_time`: Aggregate partial fills in the same block.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills)
  """
  params: dict[str, object] = {'type': 'userFills', 'user': user}
  if aggregate_by_time is not None:
    params['aggregateByTime'] = aggregate_by_time
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

user_fills_by_time

Return a user's fills within a time range.

  • user: Account address.
  • start_time: Start time in milliseconds, inclusive.
  • end_time: End time in milliseconds, inclusive.
  • aggregate_by_time: Aggregate partial fills in the same block.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_fills_by_time.py
async def user_fills_by_time(
  self, user: str, start_time: int, *, end_time: int | None = None,
  aggregate_by_time: bool | None = None
) -> list[UserFill]:
  """Return a user's fills within a time range.

  - `user`: Account address.
  - `start_time`: Start time in milliseconds, inclusive.
  - `end_time`: End time in milliseconds, inclusive.
  - `aggregate_by_time`: Aggregate partial fills in the same block.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time)
  """
  params: dict[str, object] = {
    'type': 'userFillsByTime',
    'user': user,
    'startTime': start_time,
  }
  if end_time is not None:
    params['endTime'] = end_time
  if aggregate_by_time is not None:
    params['aggregateByTime'] = aggregate_by_time
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

user_fills_by_time_paged

Return a user's fills within a time range, automatically paginating the results.

  • user: Account address.
  • start_time: Start time in milliseconds, inclusive.
  • end_time: End time in milliseconds, inclusive.
  • aggregate_by_time: Aggregate partial fills in the same block.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_fills_by_time.py
async def user_fills_by_time_paged(
  self, user: str, start_time: int, *, end_time: int | None = None,
  aggregate_by_time: bool | None = None
) -> AsyncIterable[list[UserFill]]:
  """Return a user's fills within a time range, automatically paginating the results.

  - `user`: Account address.
  - `start_time`: Start time in milliseconds, inclusive.
  - `end_time`: End time in milliseconds, inclusive.
  - `aggregate_by_time`: Aggregate partial fills in the same block.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time)
  """
  while end_time is None or start_time < end_time:
    fills = await self.user_fills_by_time(user, start_time, end_time=end_time, aggregate_by_time=aggregate_by_time)
    if not fills:
      break
    yield fills
    start_time = fills[-1]['time'] + 1

user_historical_orders

Return a user's historical orders.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_historical_orders.py
async def user_historical_orders(
  self, user: str
) -> UserHistoricalOrdersResponse:
  """Return a user's historical orders.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-historical-orders)
  """
  r = await self.request({'type': 'historicalOrders', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_portfolio

Return a user's portfolio.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_portfolio.py
async def user_portfolio(self, user: str) -> UserPortfolioResponse:
  """Return a user's portfolio.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-portfolio)
  """
  r = await self.request({'type': 'portfolio', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_rate_limit

Return rate limit info for a user.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_rate_limit.py
async def user_rate_limit(self, user: str) -> UserRateLimitResponse:
  """Return rate limit info for a user.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-user-rate-limits)
  """
  r = await self.request({'type': 'userRateLimit', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_referral

Return a user's referral information.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_referral.py
async def user_referral(self, user: str) -> UserReferralResponse:
  """Return a user's referral information.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-referral-information)
  """
  r = await self.request({'type': 'referral', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_role

Return a user's role.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_role.py
async def user_role(self, user: str) -> UserRoleResponse:
  """Return a user's role.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-role)
  """
  r = await self.request({'type': 'userRole', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_twap_slice_fills

Return a user's TWAP slice fills.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_twap_slice_fills.py
async def user_twap_slice_fills(
  self, user: str
) -> UserTwapSliceFillsResponse:
  """Return a user's TWAP slice fills.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-twap-slice-fills)
  """
  r = await self.request({'type': 'userTwapSliceFills', 'user': user})
  return adapter.validate_python(r) if self.validate else r

user_vault_equities

Return a user's vault equities.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/user_vault_equities.py
async def user_vault_equities(
  self, user: str
) -> UserVaultEquitiesResponse:
  """Return a user's vault equities.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-vault-deposits)
  """
  r = await self.request({'type': 'userVaultEquities', 'user': user})
  return adapter.validate_python(r) if self.validate else r

vault_details

Return details for a vault.

  • vault_address: Vault address.
  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/methods/vault_details.py
async def vault_details(
  self, vault_address: str, *, user: str | None = None
) -> VaultDetailsResponse:
  """Return details for a vault.

  - `vault_address`: Vault address.
  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-details-for-a-vault)
  """
  params: dict[str, object] = {
    'type': 'vaultDetails',
    'vaultAddress': vault_address,
  }
  if user is not None:
    params['user'] = user
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

active_asset_data

Return user's active asset data.

  • user: Account address.
  • coin: Coin, e.g. "ETH".

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/active_asset_data.py
async def active_asset_data(
  self, user: str, coin: str
) -> ActiveAssetDataResponse:
  """Return user's active asset data.

  - `user`: Account address.
  - `coin`: Coin, e.g. "ETH".

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-users-active-asset-data)
  """
  r = await self.request({'type': 'activeAssetData', 'user': user, 'coin': coin})
  return adapter.validate_python(r) if self.validate else r

all_perp_metas

Return all perpetuals metadata and asset contexts.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/all_perp_metas.py
async def all_perp_metas(self) -> AllPerpMetasResponse:
  """Return all perpetuals metadata and asset contexts.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-all-perpetuals-metadata-universe-and-margin-tables)
  """
  r = await self.request({'type': 'allPerpMetas'})
  return adapter.validate_python(r) if self.validate else r

clearinghouse_state

Return a user's perpetuals account summary.

  • user: Account address.
  • dex: Perp dex name. Defaults to the empty string which represents the first perp dex.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/clearinghouse_state.py
async def clearinghouse_state(
  self, user: str, *, dex: str | None = None
) -> ClearinghouseStateResponse:
  """Return a user's perpetuals account summary.

  - `user`: Account address.
  - `dex`: Perp dex name. Defaults to the empty string which represents the
    first perp dex.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-users-perpetuals-account-summary)
  """
  params: dict[str, object] = {'type': 'clearinghouseState', 'user': user}
  if dex is not None:
    params['dex'] = dex
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

funding_history

Return historical funding rates, at most 500 entries. Use funding_history_paged for more.

  • coin: Coin, e.g. "ETH".
  • start_time: Start time in milliseconds, inclusive.
  • end_time: End time in milliseconds, inclusive.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/funding_history.py
async def funding_history(
  self, coin: str, start_time: int, *, end_time: int | None = None
) -> list[FundingHistoryEntry]:
  """Return historical funding rates, at most 500 entries. Use `funding_history_paged` for more.

  - `coin`: Coin, e.g. "ETH".
  - `start_time`: Start time in milliseconds, inclusive.
  - `end_time`: End time in milliseconds, inclusive.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-historical-funding-rates)
  """
  params: dict[str, object] = {
    'type': 'fundingHistory',
    'coin': coin,
    'startTime': start_time,
  }
  if end_time is not None:
    params['endTime'] = end_time
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

funding_history_paged

Return historical funding rates, automatically paginating the results.

  • coin: Coin, e.g. "ETH".
  • start_time: Start time in milliseconds, inclusive.
  • end_time: End time in milliseconds, inclusive.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/funding_history.py
async def funding_history_paged(
  self, coin: str, start_time: int, *, end_time: int | None = None
) -> AsyncIterable[list[FundingHistoryEntry]]:
  """Return historical funding rates, automatically paginating the results.

  - `coin`: Coin, e.g. "ETH".
  - `start_time`: Start time in milliseconds, inclusive.
  - `end_time`: End time in milliseconds, inclusive.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-historical-funding-rates)
  """
  while end_time is None or start_time < end_time:
    fundings = await self.funding_history(coin, start_time, end_time=end_time)
    if not fundings:
      break
    yield fundings
    start_time = fundings[-1]['time'] + 1

perp_annotation

Return perp annotation for a coin.

  • coin: Coin name, e.g. "BTC".

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perp_annotation.py
async def perp_annotation(self, coin: str) -> PerpAnnotationResponse:
  """Return perp annotation for a coin.

  - `coin`: Coin name, e.g. "BTC".

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-perp-annotation)
  """
  r = await self.request({'type': 'perpAnnotation', 'coin': coin})
  return adapter.validate_python(r) if self.validate else r

perp_categories

Return perp categories.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perp_categories.py
async def perp_categories(self) -> PerpCategoriesResponse:
  """Return perp categories.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-perp-categories)
  """
  r = await self.request({'type': 'perpCategories'})
  return adapter.validate_python(r) if self.validate else r

perp_deploy_auction_status

Return perp deploy auction status.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perp_deploy_auction_status.py
async def perp_deploy_auction_status(self) -> PerpDeployAuctionStatusResponse:
  """Return perp deploy auction status.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-information-about-the-perp-deploy-auction)
  """
  r = await self.request({'type': 'perpDeployAuctionStatus'})
  return adapter.validate_python(r) if self.validate else r

perp_dex_limits

Return builder-deployed perp market limits.

  • dex: Perp dex name (empty string not allowed).

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perp_dex_limits.py
async def perp_dex_limits(self, dex: str) -> PerpDexLimitsResponse:
  """Return builder-deployed perp market limits.

  - `dex`: Perp dex name (empty string not allowed).

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-builder-deployed-perp-market-limits)
  """
  r = await self.request({'type': 'perpDexLimits', 'dex': dex})
  return adapter.validate_python(r) if self.validate else r

perp_dex_status

Return perp dex status.

  • dex: Perp dex name. The empty string represents the first perp dex.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perp_dex_status.py
async def perp_dex_status(self, dex: str = '') -> PerpDexStatusResponse:
  """Return perp dex status.

  - `dex`: Perp dex name. The empty string represents the first perp dex.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#get-perp-market-status)
  """
  r = await self.request({'type': 'perpDexStatus', 'dex': dex})
  return adapter.validate_python(r) if self.validate else r

perp_dexs

Return all perp dexes.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perp_dexs.py
async def perp_dexs(self) -> list[PerpDex|None]:
  """Return all perp dexes.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-all-perpetual-dexs)
  """
  r = await self.request({'type': 'perpDexs'})
  return adapter.validate_python(r) if self.validate else r

perp_meta

Return perpetuals metadata (universe and margin tables).

  • dex: Perp dex name. Defaults to the empty string which represents the first perp dex.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perp_meta.py
async def perp_meta(self, dex: str | None = None) -> PerpMetaResponse:
  """Return perpetuals metadata (universe and margin tables).

  - `dex`: Perp dex name. Defaults to the empty string which represents the
    first perp dex.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata-universe-and-margin-tables)
  """
  params: dict[str, object] = {'type': 'meta'}
  if dex is not None:
    params['dex'] = dex
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

perp_meta_and_asset_ctxs

Return perpetuals metadata and asset contexts.

  • dex: Perp dex name. Defaults to the empty string which represents the first perp dex.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perp_meta_and_asset_ctxs.py
async def perp_meta_and_asset_ctxs(
  self, dex: str | None = None
) -> PerpMetaAndAssetCtxsResponse:
  """Return perpetuals metadata and asset contexts.

  - `dex`: Perp dex name. Defaults to the empty string which represents the
    first perp dex.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc)
  """
  params: dict[str, object] = {'type': 'metaAndAssetCtxs'}
  if dex is not None:
    params['dex'] = dex
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

perps_at_open_interest_cap

Return perps at open interest caps.

  • dex: Perp dex name. Defaults to the empty string which represents the first perp dex.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/perps_at_open_interest_cap.py
async def perps_at_open_interest_cap(
  self, dex: str | None = None
) -> PerpsAtOpenInterestCapResponse:
  """Return perps at open interest caps.

  - `dex`: Perp dex name. Defaults to the empty string which represents the
    first perp dex.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-perps-at-open-interest-caps)
  """
  params: dict[str, object] = {'type': 'perpsAtOpenInterestCap'}
  if dex is not None:
    params['dex'] = dex
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

predicted_fundings

Return predicted funding rates for different venues.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/predicted_fundings.py
async def predicted_fundings(self) -> PredictedFundingsResponse:
  """Return predicted funding rates for different venues.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-predicted-funding-rates-for-different-venues)
  """
  r = await self.request({'type': 'predictedFundings'})
  return adapter.validate_python(r) if self.validate else r

user_funding

Return a user's funding history.

  • user: Account address.
  • start_time: Start time in milliseconds, inclusive.
  • end_time: End time in milliseconds, inclusive.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/user_funding.py
async def user_funding(
  self, user: str, start_time: int, *, end_time: int | None = None
) -> list[UserFundingEntry]:
  """Return a user's funding history.

  - `user`: Account address.
  - `start_time`: Start time in milliseconds, inclusive.
  - `end_time`: End time in milliseconds, inclusive.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates)
  """
  params: dict[str, object] = {
    'type': 'userFunding',
    'user': user,
    'startTime': start_time,
  }
  if end_time is not None:
    params['endTime'] = end_time
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

user_funding_paged

Return a user's funding history, automatically paginating the results.

  • user: Account address.
  • start_time: Start time in milliseconds, inclusive.
  • end_time: End time in milliseconds, inclusive.
Source code in pkg/src/hyperliquid/info/perps/user_funding.py
async def user_funding_paged(
  self, user: str, start_time: int, *, end_time: int | None = None
) -> AsyncIterable[list[UserFundingEntry]]:
  """Return a user's funding history, automatically paginating the results.

  - `user`: Account address.
  - `start_time`: Start time in milliseconds, inclusive.
  - `end_time`: End time in milliseconds, inclusive.
  """
  while end_time is None or start_time < end_time:
    fundings = await self.user_funding(user, start_time, end_time=end_time)
    if not fundings:
      break
    yield fundings
    start_time = fundings[-1]['time'] + 1

user_non_funding_ledger_updates

Return a user's non-funding ledger updates.

  • user: Account address.
  • start_time: Start time in milliseconds, inclusive.
  • end_time: End time in milliseconds, inclusive.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/perps/user_non_funding_ledger_updates.py
async def user_non_funding_ledger_updates(
  self, user: str, start_time: int, *, end_time: int | None = None
) -> UserNonFundingLedgerUpdatesResponse:
  """Return a user's non-funding ledger updates.

  - `user`: Account address.
  - `start_time`: Start time in milliseconds, inclusive.
  - `end_time`: End time in milliseconds, inclusive.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates)
  """
  params: dict[str, object] = {
    'type': 'userNonFundingLedgerUpdates',
    'user': user,
    'startTime': start_time,
  }
  if end_time is not None:
    params['endTime'] = end_time
  r = await self.request(params)
  return adapter.validate_python(r) if self.validate else r

spot_clearinghouse_state

Return a user's spot token balances.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/spot/spot_clearinghouse_state.py
async def spot_clearinghouse_state(self, user: str) -> SpotClearinghouseStateResponse:
  """Return a user's spot token balances.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances)
  """
  r = await self.request({'type': 'spotClearinghouseState', 'user': user})
  return adapter.validate_python(r) if self.validate else r

spot_deploy_state

Return spot deploy auction status.

  • user: Account address.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/spot/spot_deploy_state.py
async def spot_deploy_state(self, user: str) -> SpotDeployStateResponse:
  """Return spot deploy auction status.

  - `user`: Account address.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-information-about-the-spot-deploy-auction)
  """
  r = await self.request({'type': 'spotDeployState', 'user': user})
  return adapter.validate_python(r) if self.validate else r

spot_meta

Return spot universe and token metadata.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/spot/spot_meta.py
async def spot_meta(self) -> SpotMetaResponse:
  """Return spot universe and token metadata.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot)
  """
  r = await self.request({'type': 'spotMeta'})
  return adapter.validate_python(r) if self.validate else r

spot_meta_and_asset_ctxs

Return spot metadata and asset contexts.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/spot/spot_meta_and_asset_ctxs.py
async def spot_meta_and_asset_ctxs(self) -> SpotMetaAndAssetCtxsResponse:
  """Return spot metadata and asset contexts.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-spot-asset-contexts)
  """
  r = await self.request({'type': 'spotMetaAndAssetCtxs'})
  return adapter.validate_python(r) if self.validate else r

spot_pair_deploy_auction_status

Return spot pair deploy auction status.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/spot/spot_pair_deploy_auction_status.py
async def spot_pair_deploy_auction_status(self) -> SpotPairDeployAuctionStatusResponse:
  """Return spot pair deploy auction status.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-information-about-the-spot-pair-deploy-auction)
  """
  r = await self.request({'type': 'spotPairDeployAuctionStatus'})
  return adapter.validate_python(r) if self.validate else r

token_details

Return token details.

  • token_id: Onchain token id.

Hyperliquid API docs

Source code in pkg/src/hyperliquid/info/spot/token_details.py
async def token_details(self, token_id: str) -> TokenDetailsResponse:
  """Return token details.

  - `token_id`: Onchain token id.

  > [Hyperliquid API docs](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-information-about-a-token)
  """
  r = await self.request({'type': 'tokenDetails', 'tokenId': token_id})
  return adapter.validate_python(r) if self.validate else r