accountValueSnapshot
Unique endpoint allowing to get an account value snapshot of all accounts on Hyperliquid, including filtering by a specific type of collateral or HIP-3 DEX.
accountValueSnapshot
💧New endpoint - this endpoint is not a part of original Hyperliquid API and is added by us for builder convenience.
Overview
The accountValueSnapshot endpoint provides access to aggregated account value data for all users holding positions in specific collateral tokens. This data includes total account values, long/short notional exposures, and is updated in real-time.
There are two ways to access the data:
Metadata Endpoint (Fast): Check for updates without downloading data
Snapshots Endpoint (Heavy): Download actual account value snapshot data
Use Cases:
Track total value locked (TVL) per collateral token
Analyze user distribution and concentration
Monitor leverage and exposure across the platform
Build leaderboards and analytics dashboards
Monitor Portfolio Margin users' cross-collateral health (pm_ratio, avail per branch)
Efficient polling pattern
To minimize bandwidth and server load, you should:
Poll the metadata endpoint to check for updates
Only call the snapshots endpoint when data has changed
Cache the snapshot ID locally to avoid unnecessary downloads
Dependencies and best practices
Dependencies
JavaScript
zstd: For decompression (e.g.,
@mongodb-js/zstd)msgpack: For decoding (e.g.,
msgpack-lite)
Python
zstd: For decompression (e.g.,
zstandard)msgpack: For decoding (e.g.,
msgpack)aiohttp: For async HTTP requests
✅ Best Practices
Request specific tokens - Don't use
['ALL']unless you truly need all collateral data.Handle errors gracefully - Network issues are common; implement retry logic.
Use appropriate poll intervals - 10-30 seconds is usually sufficient for account value data.
Monitor bandwidth usage - Snapshots can be large depending on user count.
Cache locally - Store snapshots to avoid unnecessary repeated downloads.
Error handling
404: No snapshots are available yet. Wait and retry.
500: A server error occurred. Retry with exponential backoff.
Network errors: Implement retry logic with jitter to avoid overwhelming the server.
Parse errors: Log the issue and continue using cached data if available.
Account Value Snapshot Metadata (Fast)
Endpoint:
POST /infoPurpose: Check if snapshots have been updated
Response Time: ~1ms
Request
Response
Note: Account value snapshots are generated at the same time as perp snapshots, so they share the same timestamp. This endpoint returns the perp snapshot metadata which applies to account values as well.
Account Value Snapshots (Heavy)
Endpoint:
POST /infoPurpose: Download account value snapshot data for specific collateral tokens
Response Time: ~100ms+
Request
Query Options
Token-only (gets all DEXes using that collateral):
["USDC"]→ Gets account values for all DEXes that use USDC as collateral["USDE"]→ Gets account values for all DEXes that use USDE as collateral
Specific DEX:Token combinations:
["hyperliquid:USDC"]→ Only Hyperliquid's USDC collateral accounts["xyz:USDC", "vntls:USDE"]→ Specific DEX:token combinations
Mixed queries:
["USDC", "xyz:USDE"]→ All USDC collateral across DEXes + specific xyz:USDE
Practical Query Examples:
Response Headers
Single Snapshot Result:
x-payload-format: msgpack,Content-Encoding: zstdMultiple Snapshot Results:
x-payload-format: multi-zstd,x-compression: inner-zstd
Note: The response format depends on the number of snapshots found, not the number of tokens requested:
["USDC"]might return multiple snapshots if USDC is used on multiple DEXes["hyperliquid:USDC"]will return a single snapshot (specific DEX:token combination)
Data Format
Single Token Response
Format: Raw zstd-compressed MessagePack data
Decompressed Structure:
ℹ️ User Data Format
Each user entry is a tuple. Standard users have 5 values; Portfolio Margin users have 8 values:
Standard / Unified users (5 values):
Portfolio Margin users (8 values):
Detecting account type: Check account_mode (index 4) to determine the user's margin mode. For Portfolio Margin users (account_mode == 3), the tuple contains 3 additional fields at indices 5-7. For backwards compatibility, always check the array length before accessing PM fields.
Example PM user data:
Alternative Object Format:
Multiple Tokens Response
Format: Custom binary format with length prefixes
Binary Structure:
Each zstd_data segment contains a msgpack-encoded AccountValueSnapshot with the same structure as the single token response.
Implementation Examples
Note: Make sure to set HYDROMANCER_API_KEY in your .env file
Last updated