API ReferenceTrading
Hyperliquid Trading
Single action-based endpoint for Hyperliquid perpetual futures trading.
Hyperliquid Trading
All Hyperliquid operations go through this single endpoint. The action field determines the operation.
Authentication
Requires X-API-Key header.
Request body
Additional parameters depend on the action.
Info actions (read-only)
These proxy to Hyperliquid's info API and do not require signatures.
| Action | Description | Parameters |
|---|---|---|
status | Full account state | -- |
positions | Open positions | -- |
orders | Open orders | -- |
fills | Recent fills | -- |
markets | Market metadata | -- |
ticker | Mid prices | symbol (optional) |
orderbook | L2 order book | symbol (default: "ETH") |
funding | Funding rates | -- |
Example: Get positions
curl -X POST http://localhost:4000/v1/trading/hyperliquid \
-H "X-API-Key: ak_your_key" \
-H "Content-Type: application/json" \
-d '{"walletId": "wallet-uuid", "action": "positions"}'{
"action": "positions",
"positions": [...],
"wallet_id": "wallet-uuid",
"address": "0x742d35Cc...",
"transaction_id": "audit-uuid"
}Example: Get ticker
curl -X POST http://localhost:4000/v1/trading/hyperliquid \
-H "X-API-Key: ak_your_key" \
-H "Content-Type: application/json" \
-d '{"walletId": "wallet-uuid", "action": "ticker", "symbol": "ETH"}'{
"action": "ticker",
"symbol": "ETH",
"mid_price": "3000.50",
"wallet_id": "wallet-uuid",
"address": "0x742d35Cc..."
}Exchange actions (write -- not yet implemented)
These actions require EIP-712 typed signatures and currently return 501 Not Implemented with the payload that would be sent.
| Action | Description | Parameters |
|---|---|---|
order | Place limit order | symbol, side, price, amount, tif |
cancel | Cancel order | symbol, orderId |
cancel_all | Cancel all orders | symbol |
set_leverage | Set leverage | symbol, leverage, cross |
withdraw | Withdraw from HL | amount, destination |
transfer | Internal USD transfer | amount, destination |
Example: Place order (returns 501)
curl -X POST http://localhost:4000/v1/trading/hyperliquid \
-H "X-API-Key: ak_your_key" \
-H "Content-Type: application/json" \
-d '{
"walletId": "wallet-uuid",
"action": "order",
"symbol": "ETH",
"side": "buy",
"price": "3000.00",
"amount": "0.1",
"tif": "Gtc"
}'Spending controls are enforced on exchange actions -- if the amount exceeds limits, the request is rejected with 403.
Errors
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_INPUT | Missing walletId, action, or unknown action |
| 403 | varies | Spending control violation |
| 404 | NOT_FOUND | Wallet not found |
| 501 | NOT_IMPLEMENTED | Exchange actions pending EIP-712 implementation |
| 502 | HYPERLIQUID_ERROR | Upstream Hyperliquid API error |