perpSnapshot
Unique endpoint allowing to get entire perps positioning of all Hyperliquid traders.
💧New endpoint - this endpoint is not a part of original Hyperliquid API and is added by us for builder convenience.
Overview
perpSnapshot endpoint allows you to access the entire positioning of all traders on Hyperliquid across all assets, including entries and liquidations.
There are two ways to access the data:
Metadata Endpoint (Fast): Check for updates without downloading data
Snapshots Endpoint (Heavy): Download actual market snapshot data
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.,
fzstd,@gera2ld/zstd)msgpack: For decoding (e.g.,
@msgpack/msgpack)
Python
zstd: For decompression (e.g.,
zstandard)msgpack: For decoding (e.g.,
msgpack)aiohttp: For async HTTP requests
✅ Best Practices
Always poll metadata first - Don't skip the lightweight metadata check.
Cache snapshots locally - Avoid unnecessary downloads of large files.
Handle errors gracefully - Network issues are common; implement retry logic.
Use appropriate poll intervals - 5-10 seconds is usually sufficient.
Request specific markets - Don't use
['ALL']unless you truly need all data.Monitor bandwidth usage - Snapshots can be large (1-13MB+).
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.
Perp Snapshot Metadata (Fast)
Endpoint:
POST /infoPurpose: Check if snapshots have been updated
Response Time: ~1ms
Request
Response
Perp Snapshots (Heavy)
Endpoint:
POST /infoPurpose: Download market snapshot data
Response Time: ~100ms+
Request
Query Options (HIP-3 Multi-Dex)
Specific markets:
["BTC", "ETH"]→ Defaults to the main dex["xyz:BTC", "vntl:ETH"]→ Specify DEX withdex:marketformat
All markets patterns:
["ALL"]→ All markets from the main dex["ALL:xyz"]→ All markets from xyz DEX["ALL:ALL_DEXES"]→ All markets from all available DEXes (takes precedence over everything)
Mixed queries:
["ALL", "ALL:xyz", "BTC"]→ All from main dex + all from xyz (BTC ignored, covered by main dex)["ALL:xyz", "vntl:ETH"]→ All from xyz + specific ETH from vntls
Rules:
ALL:ALL_DEXEStakes precedence - if present, returns everything from all dexesMultiple
ALLpatterns allowed - one per dex (e.g.,["ALL", "ALL:xyz"]gets all from both)Specific markets are filtered - if a dex is covered by an ALL pattern, specific markets from that dex are ignored
No duplicates - each dex's ALL pattern is deduplicated
Response Headers
Single Market:
x-payload-format: msgpack,Content-Encoding: zstdMultiple Markets:
x-payload-format: multi-zstd,x-compression: inner-zstd
Data Format
Single Market Response
Format: Raw zstd-compressed MessagePack data
Decompressed Structure:
ℹ️ Position Tuple Format The array p contains tuples with the following 8 values in order:
Unified & Portfolio Margin accounts: For unified account users, account_value includes spot collateral across all dexes. For Portfolio Margin users, account_value reflects the per-settlement-token equity and liquidation_price is recomputed using PM available margin. Use the accountValueSnapshots endpoint to get the full PM breakdown (pm_ratio, avail per branch).
Multiple Markets Response
Format: Custom binary format with length prefixes
Binary Structure:
ℹ️ Position Tuple Format The array p contains tuples with the following 8 values in order:
Unified & Portfolio Margin accounts: For unified account users, account_value includes spot collateral across all dexes. For Portfolio Margin users, account_value reflects the per-settlement-token equity and liquidation_price is recomputed using PM available margin. Use the accountValueSnapshots endpoint to get the full PM breakdown (pm_ratio, avail per branch).
Implementation examples
Note: Make sure to set HYDROMANCER_API_KEY in your .env file
Note: Make sure to download required packages
Last updated