batchPortfolioStates
Get clearinghouse states for perp and spot of multiple users in a single request.
Get clearinghouse states for perp and spot of multiple users in a single request.
💧New endpoint - this endpoint is not a part of original Hyperliquid API and is added by us for builder convenience.
POST Request
type
string
Must be "batchPortfolioStates"
users
array
Array of Ethereum addresses
dex
string
(Optional) Perp DEX name. Omit for native DEX (default). Use a specific dex name (e.g., "xyz") to fetch that dex only, or "ALL_DEXES" to fetch clearinghouse state across all dexes (native + all HIP-3 dexes) in one request.
Limits
You can query 500 users at once. Note that with the ALL_DEXES field passed that limit is 100 users.
curl -X POST https://api.hydromancer.xyz/info \
-H "Authorization: Bearer $HYDROMANCER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "batchPortfolioStates",
"users": [
"0x0000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000002"
]
}'import requests
import os
response = requests.post(
'https://api.hydromancer.xyz/info',
json={
'type': 'batchPortfolioStates',
'users': [
'0x0000000000000000000000000000000000000001',
'0x0000000000000000000000000000000000000002'
]
},
headers={
'Authorization': f'Bearer {os.environ.get("HYDROMANCER_API_KEY")}',
'Content-Type': 'application/json'
}
)
print(response.json())Response Fields
successful_states
array
Array of [address, portfolioState] tuples
successful_states[n][0]
string
User address
successful_states[n][1].clearinghouseState
object
Perp clearinghouse state (marginSummary, crossMarginSummary, assetPositions, time)
successful_states[n][1].spotClearinghouseState
object
Spot clearinghouse state containing balances array
successful_states[n][1].userAbstraction
string
Account abstraction mode
failed_wallets
array
Array of addresses that failed to fetch
Last updated