For the complete documentation index, see llms.txt. This page is also available as Markdown.
perpTwapSnapshots
Endpoint to get all active TWAP orders across all Hyperliquid perpetual markets.
💧New endpoint - this endpoint is not part of the original Hyperliquid API. Hydromancer added it for builder convenience.
Overview
perpTwapSnapshot endpoint allows you to access all active TWAP (Time-Weighted Average Price) orders on Hyperliquid perpetual markets. TWAPs are algorithmic orders that execute over time, splitting large orders into smaller pieces.
There are two ways to access the data:
Metadata Endpoint (Fast): Check for updates without downloading data
Snapshots Endpoint (Heavy): Download actual TWAP 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
Error handling
404: No TWAP 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 TWAP Snapshot Metadata (Fast)
Endpoint: POST /info
Purpose: Check if TWAP snapshots have been updated
Response Time: ~1ms
Request
Response
Perp TWAP Snapshots (Heavy)
Endpoint: POST /info
Purpose: Download TWAP snapshot data
Response Time: ~50ms+
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 TWAP markets from the main dex
["ALL:xyz"] -> All TWAP markets from xyz DEX
["ALL:ALL_DEXES"] -> All TWAP markets from all available DEXes
Mixed queries:
["ALL", "ALL:xyz", "BTC"] -> All from main dex + all from xyz
["ALL:xyz", "vntl:ETH"] -> All from xyz + specific ETH from vntls
Rules:
ALL:ALL_DEXES takes precedence - if present, returns everything from all dexes
Multiple ALL patterns allowed - one per dex
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: zstd