Skip to main content

Hyperliquid Vaults API

Hyperliquid vaults are accounts that trade with pooled deposits: HLP, the protocol's own liquidity vault, and user vaults run by individual traders. With Bitquery you can rank every vault by volume and PnL, read each fill a vault made, follow deposits and withdrawals as they happen, and see when a vault position was liquidated. Every event a vault makes carries its address in Trader.Vault, so one filter covers the whole set. Everything below runs on the Hyperliquid cube at https://streaming.bitquery.io/graphql over the rolling window described on the Hyperliquid API overview.

The worked vault is 0x25773676902085225ae5751075e4161369334897, one of the most active user vaults, and the HLP vault is 0xdfc24b077bc1425ad1dea75bcb6f8158e10df303.

API Key Required

To query or stream data outside the Bitquery IDE, you need an API access token.

Follow the steps here: How to generate Bitquery API token ➤

Which Hyperliquid vaults trade the most?

Filter fills to those with a vault set and group by Trader.Vault. Each row is one vault with its fills, markets traded, USD volume and realized PnL over the last day.

Run it in the IDE: Hyperliquid Top Vaults by Volume ➤

query HyperliquidTopVaultsByVolume {
Hyperliquid {
Trades(
limit: {count: 25}
orderBy: {descendingByField: "volumeUsd"}
where: {
Trade: {Trader: {Vault: {not: ""}}}
Block: {Time: {since_relative: {hours_ago: 24}}}
}
) {
Trade {
Trader {
Vault
}
}
fills: count
markets: uniq(of: Trade_Market_CoinRaw)
volumeUsd: sum(of: Trade_Execution_NotionalUSD)
realizedPnl: sum(of: Trade_Position_RealizedPnl)
}
}
}

A vault with hundreds of thousands of fills and PnL near zero is a market-making vault. HLP trades through child vaults, so its activity appears under those addresses rather than the HLP address itself.

Which vaults are the most profitable?

Every closing fill carries Position.NetPnl and Position.IsWin. Group by vault over a week to rank vaults by net realized PnL and count winning closes.

Run it in the IDE: Hyperliquid Vault PnL Leaderboard ➤

query HyperliquidVaultPnlLeaderboard {
Hyperliquid {
Trades(
limit: {count: 25}
orderBy: {descendingByField: "netPnl"}
where: {
Trade: {Trader: {Vault: {not: ""}}, Position: {IsClosing: true}}
Block: {Time: {since_relative: {days_ago: 7}}}
}
) {
Trade {
Trader {
Vault
}
}
closes: count
wins: count(if: {Trade: {Position: {IsWin: true}}})
netPnl: sum(of: Trade_Position_NetPnl)
volumeUsd: sum(of: Trade_Execution_NotionalUSD)
}
}
}

Win rate is wins / closes. Order by ascendingByField: "netPnl" for the biggest losers.

What did one vault trade?

Filter on the vault address. Each row is a fill with market, price, size, direction, leverage, fee and realized PnL. Trader.Address is the account that executed it; for a vault trading its own book it equals the vault.

Run it in the IDE: Hyperliquid Vault Fills ➤

query HyperliquidVaultFills {
Hyperliquid {
Trades(
limit: {count: 50}
orderBy: {descending: Block_Time}
where: {
Trade: {Trader: {Vault: {is: "0x25773676902085225ae5751075e4161369334897"}}}
Block: {Time: {since_relative: {hours_ago: 24}}}
}
) {
Block {
Time
}
Trade {
Market {
Symbol
Kind
}
Execution {
Price
Size
Side
Direction
NotionalUSD
}
Position {
Leverage
RealizedPnl
}
Fees {
Fee
}
Trader {
Address
Vault
}
}
}
}
}

Change query to subscription and drop limit and orderBy to stream a vault's fills live.

Who deposits into and withdraws from a vault?

Deposits and withdrawals are vaultTransfer actions in the SignedActions cube. The Action payload holds the vault address, isDeposit and the amount in usd with six decimals, so 100000000 is 100 USDC. User is the depositor. The example follows the HLP vault; swap in any vault address.

Run it in the IDE: Hyperliquid Vault Deposits and Withdrawals ➤

query HyperliquidVaultDepositsAndWithdrawals {
Hyperliquid {
SignedActions(
limit: {count: 50}
orderBy: {descending: Block_Time}
where: {
ActionType: {is: "vaultTransfer"}
Action: {includes: "0xdfc24b077bc1425ad1dea75bcb6f8158e10df303"}
}
) {
Block {
Time
}
User
Action
Status
Bundle {
Hash
}
}
}
}

Status is ok for accepted transfers. Rejected ones stay in the data with an error status, which is useful for spotting withdrawals that hit a lock-up.

Live vault deposits and withdrawals

The same action as a WebSocket stream, across every vault, filtered to successful transfers.

Run it in the IDE: Hyperliquid Vault Transfers Stream ➤

subscription HyperliquidVaultTransfersStream {
Hyperliquid {
SignedActions(where: {ActionType: {is: "vaultTransfer"}, Status: {is: "ok"}}) {
Block {
Time
}
User
Action
Bundle {
Hash
}
}
}
}

Parse Action on the client to alert on large deposits or on any transfer into a vault you follow.

Which vault positions were liquidated?

PerpLiquidations carries Trader.Vault too. This lists every liquidation of a vault position in the last week with the method, mark price and leverage at the time.

Run it in the IDE: Hyperliquid Vault Liquidations ➤

query HyperliquidVaultLiquidations {
Hyperliquid {
PerpLiquidations(
limit: {count: 50}
orderBy: {descending: Block_Time}
where: {
Liquidation: {Trader: {Vault: {not: ""}}}
Block: {Time: {since_relative: {days_ago: 7}}}
}
) {
Block {
Time
}
Liquidation {
Market {
Symbol
}
Method
MarkPx
Execution {
Price
Size
Side
}
Position {
Leverage
SizeBefore
}
Trader {
Address
Vault
}
}
}
}
}

Filter Liquidation: {Trader: {Vault: {is: "0x..."}}} to watch one vault, or turn it into a subscription for live alerts.

Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.