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.

⚠️ This is an add-on endpoint - access has to be purchased separately.

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:

  1. Metadata Endpoint (Fast): Check for updates without downloading data

  2. Snapshots Endpoint (Heavy): Download actual market snapshot data

Efficient polling pattern

To minimize bandwidth and server load, you should:

  1. Poll the metadata endpoint to check for updates

  2. Only call the snapshots endpoint when data has changed

  3. 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

  1. Always poll metadata first - Don't skip the lightweight metadata check.

  2. Cache snapshots locally - Avoid unnecessary downloads of large files.

  3. Handle errors gracefully - Network issues are common; implement retry logic.

  4. Use appropriate poll intervals - 5-10 seconds is usually sufficient.

  5. Request specific markets - Don't use ['ALL'] unless you truly need all data.

  6. 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 /info

  • Purpose: Check if snapshots have been updated

  • Response Time: ~1ms

Request

Response

Perp Snapshots (Heavy)

  • Endpoint: POST /info

  • Purpose: 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 with dex:market format

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:

  1. ALL:ALL_DEXES takes precedence - if present, returns everything from all dexes

  2. Multiple ALL patterns allowed - one per dex (e.g., ["ALL", "ALL:xyz"] gets all from both)

  3. Specific markets are filtered - if a dex is covered by an ALL pattern, specific markets from that dex are ignored

  4. No duplicates - each dex's ALL pattern is deduplicated

Response Headers

  • Single Market: x-payload-format: msgpack, Content-Encoding: zstd

  • Multiple 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