Perpetual Contracts
Trade perpetual contracts on Hyperliquid — market data, account management, and order execution.
Overview
AgentsWallets integrates with Hyperliquid for perpetual contract trading. Hyperliquid is a high-performance L1 optimized for on-chain derivatives with deep liquidity and sub-second finality.
A builder fee of 0.05% is applied to all trades executed through AgentsWallets.
Market Data
Query perpetual market data. No unlock required.
aw perp assets
List available perpetual assets.
aw perp assets --json{
"ok": true,
"data": {
"assets": [
{ "name": "BTC", "max_leverage": 50, "min_size": "0.001" },
{ "name": "ETH", "max_leverage": 50, "min_size": "0.01" },
{ "name": "SOL", "max_leverage": 20, "min_size": "0.1" }
]
}
}aw perp prices
Get current perpetual prices.
aw perp prices --json{
"ok": true,
"data": {
"prices": [
{ "asset": "BTC", "mark_price": "67234.50", "index_price": "67230.00", "funding_rate": "0.0001" },
{ "asset": "ETH", "mark_price": "1824.80", "index_price": "1824.50", "funding_rate": "0.00008" }
]
}
}aw perp funding
Get funding rate history.
aw perp funding --asset BTC --json| Flag | Required | Description |
|---|---|---|
--asset <name> | Yes | Asset name (e.g., BTC, ETH) |
Account & Positions
aw perp account
Get perpetual account summary. Requires unlock.
aw perp account --wallet agent-01 --json| Flag | Required | Description |
|---|---|---|
--wallet <wallet> | Yes | Wallet (name, address, or UUID) |
{
"ok": true,
"data": {
"account_value": "10000.00",
"margin_used": "2500.00",
"margin_available": "7500.00",
"unrealized_pnl": "125.30"
}
}aw perp positions
List open positions. Requires unlock.
aw perp positions --wallet agent-01 --json| Flag | Required | Description |
|---|---|---|
--wallet <wallet> | Yes | Wallet (name, address, or UUID) |
{
"ok": true,
"data": {
"positions": [
{
"asset": "BTC",
"side": "long",
"size": "0.1",
"entry_price": "67000.00",
"mark_price": "67234.50",
"leverage": 10,
"unrealized_pnl": "23.45",
"liquidation_price": "60300.00"
}
]
}
}aw perp orders
List open orders. Requires unlock.
aw perp orders --wallet agent-01 --json| Flag | Required | Description |
|---|---|---|
--wallet <wallet> | Yes | Wallet (name, address, or UUID) |
Trading
aw perp open
Open a perpetual position. Requires unlock.
aw perp open \
--wallet agent-01 \
--asset BTC \
--side long \
--size 0.01 \
--leverage 10 \
--json| Flag | Required | Description |
|---|---|---|
--wallet <wallet> | Yes | Wallet (name, address, or UUID) |
--asset <name> | Yes | Asset name (e.g., BTC, ETH, SOL) |
--side <long|short> | Yes | Position direction |
--size <n> | Yes | Position size in asset units |
--leverage <n> | No | Leverage multiplier (default: 1) |
--idempotency-key <k> | No | Prevents duplicate orders (auto-generated if omitted) |
--dry-run | No | Validate without executing |
--force | No | Bypass yellow-line Security Guard warnings |
--yes | No | Confirm red-line Security Guard prompts |
{
"ok": true,
"data": {
"order_id": "ord_abc123",
"asset": "BTC",
"side": "long",
"size": "0.01",
"leverage": 10,
"entry_price": "67234.50",
"builder_fee": "0.34",
"status": "filled"
}
}aw perp close
Close an open position. Requires unlock.
aw perp close \
--wallet agent-01 \
--asset BTC \
--json| Flag | Required | Description |
|---|---|---|
--wallet <wallet> | Yes | Wallet (name, address, or UUID) |
--asset <name> | Yes | Asset to close position for |
--size <n> | No | Partial close size (omit to close entire position) |
--idempotency-key <k> | No | Prevents duplicate orders (auto-generated if omitted) |
--force | No | Bypass yellow-line Security Guard warnings |
--yes | No | Confirm red-line Security Guard prompts |
{
"ok": true,
"data": {
"order_id": "ord_def456",
"asset": "BTC",
"side": "sell",
"size": "0.01",
"exit_price": "67500.00",
"realized_pnl": "2.65",
"status": "filled"
}
}aw perp cancel
Cancel an open order. Requires unlock.
aw perp cancel --wallet agent-01 --order-id ord_abc123 --json| Flag | Required | Description |
|---|---|---|
--wallet <wallet> | Yes | Wallet (name, address, or UUID) |
--order-id <id> | Yes | Order ID to cancel |