Generates bash/curl commands for fetching sample data from Hyperliquid API. Use when user wants curl examples, bash commands to test the API, or sample data fetch commands for mainnet.
Install
npx skillscat add cezar-r/hyperliquid-skills/hl-api-samples Install via the SkillsCat registry.
SKILL.md
Hyperliquid API Sample Data Fetcher
Generate ready-to-run bash/curl commands for fetching data from the Hyperliquid mainnet API.
Base URL
https://api.hyperliquid.xyz/infoAll requests are POST with Content-Type: application/json.
Public Data Commands
Get Exchange Metadata (assets, leverage, decimals)
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "meta"}' | jqGet All Mid Prices
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "allMids"}' | jqGet Meta + Asset Contexts (combined metadata)
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "metaAndAssetCtxs"}' | jqGet Order Book (L2)
# BTC order book
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "l2Book", "coin": "BTC"}' | jq
# ETH order book
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "l2Book", "coin": "ETH"}' | jq
# SOL order book
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "l2Book", "coin": "SOL"}' | jqGet Recent Trades
# BTC recent trades
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "recentTrades", "coin": "BTC"}' | jq
# ETH recent trades
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "recentTrades", "coin": "ETH"}' | jqGet Candle Data (OHLCV)
# BTC 1-hour candles (last 24 hours)
# Replace START_TIME and END_TIME with millisecond timestamps
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "candleSnapshot", "req": {"coin": "BTC", "interval": "1h", "startTime": 1704067200000, "endTime": 1704153600000}}' | jq
# ETH 15-minute candles
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "candleSnapshot", "req": {"coin": "ETH", "interval": "15m", "startTime": 1704067200000, "endTime": 1704153600000}}' | jqCandle Intervals: 1m, 5m, 15m, 1h, 4h, 1d
User-Specific Commands
Replace 0xYOUR_ADDRESS with your actual wallet address.
Get Account State (positions, margin, balance)
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "clearinghouseState", "user": "0xYOUR_ADDRESS"}' | jqGet Open Orders
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "openOrders", "user": "0xYOUR_ADDRESS"}' | jqGet Frontend Open Orders (includes TP/SL info)
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "frontendOpenOrders", "user": "0xYOUR_ADDRESS"}' | jqGet Trade Fills (history)
# Get fills from a start time (milliseconds)
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "userFills", "user": "0xYOUR_ADDRESS", "startTime": 1704067200000}' | jqGet Funding Payments
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "userFunding", "user": "0xYOUR_ADDRESS", "startTime": 1704067200000}' | jqGet Spot Balances
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "spotClearinghouseState", "user": "0xYOUR_ADDRESS"}' | jqHIP-3 Builder-Deployed Markets
For HIP-3 markets, add the dex parameter:
Get HIP-3 Market Metadata
# xyz dex metadata
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "meta", "dex": "xyz"}' | jqGet HIP-3 Positions
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "clearinghouseState", "user": "0xYOUR_ADDRESS", "dex": "xyz"}' | jqAvailable HIP-3 dexes: xyz, flx, vntl, hyna, km
Spot Market Commands
For spot markets, use @{index} format for candles:
Get Spot Market Metadata
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "spotMeta"}' | jqGet Spot Candles (use @index format)
# HYPE/USDC candles (index 107)
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "candleSnapshot", "req": {"coin": "@107", "interval": "1h", "startTime": 1704067200000, "endTime": 1704153600000}}' | jqTips
- Formatting: Pipe output to
jqfor pretty-printed JSON - Timestamps: All times are in milliseconds (e.g.,
Date.now()in JS,date +%s000in bash) - Get current timestamp:
date +%s000 - Get timestamp from 24h ago:
echo $(($(date +%s) - 86400))000 - Asset names: Use symbols like
BTC,ETH,SOL,HYPE(seemetaendpoint for full list)