Hyperliquid
Integration with Hyperliquid decentralized perpetual exchange.
Overview
Hyperliquid is a high-performance decentralized exchange focused on perpetual futures trading. WalletAgent provides seamless integration with Hyperliquid through AI agents, enabling prompt-based trading operations, position management, and portfolio monitoring.
Getting Started
Account Setup
Wallet Import with MCP Tools:
Import my Hyperliquid trading wallet using private key 0x...AI Agent Response: Uses hl_import_wallet tool to:
Securely import your private key for Hyperliquid operations
Initialize Hyperliquid Info and Exchange clients
Derive and display your Ethereum trading address
Confirm wallet is ready for trading operations
Account Information:
Show me my Hyperliquid account information and balancesAI Agent Response: Uses hl_get_account_info tool to display:
USDC balance and available margin
Current open positions with unrealized PnL
Account equity and margin utilization
Withdrawal eligibility and trading permissions
Initial Configuration
API Connection:
AI Agent Response: The AI will:
Establish connection to Hyperliquid's API
Authenticate with your wallet
Verify trading permissions
Confirm successful connection
Trading Operations
Order Placement
Market Orders:
AI Agent Response: Uses hl_place_order tool with market order parameters:
Uses
hl_get_all_midsto check current BTC perpetual priceUses
hl_get_account_infoto verify sufficient marginExecutes
hl_place_orderwithorderType: "market"andisBuy: trueReports order execution details and transaction hash
Limit Orders:
AI Agent Response: Uses hl_place_order tool with limit order parameters:
Validates limit price against current market using
hl_get_all_midsChecks margin requirements with
hl_get_account_infoPlaces limit order with
limitPx: 1800andsz: 0.5Provides order ID from response for tracking with
hl_get_open_orders
Advanced Order Types:
AI Agent Response: The AI will:
Analyze your current ETH position
Calculate appropriate stop-loss parameters
Place the stop-loss order
Confirm risk management setup
Position Management
Position Monitoring:
AI Agent Response: Uses hl_get_positions tool to display:
All open positions with entry prices and current sizes
Real-time unrealized PnL calculated from
hl_get_all_midsPosition leverage and margin requirements
Overall portfolio performance and risk metrics
Position Adjustment:
AI Agent Response: Uses multiple MCP tools for position reduction:
Uses
hl_get_positionsto calculate current BTC position sizeDetermines exact amount to close (e.g., if holding 2 BTC, close 1 BTC)
Uses
hl_place_orderwithreduceOnly: trueto execute position reductionUses
hl_get_user_fillsto report execution details and realized PnL
Position Closing:
AI Agent Response: The AI will:
Identify current SOL position details
Place market order to close the position
Execute the close and realize PnL
Update portfolio overview
Order Management
Order Status:
AI Agent Response: The AI will show:
All open limit orders with prices and sizes
Order fill status and remaining quantity
Time in force and order validity
Estimated time to fill based on market conditions
Order Modification:
AI Agent Response: The AI will:
Cancel the existing order
Place new order at the updated price
Confirm order replacement
Provide new order tracking information
Order Cancellation:
AI Agent Response: The AI will:
Identify all BTC-related open orders
Cancel each order systematically
Confirm cancellation success
Update order book status
Portfolio Analytics
Performance Tracking
PnL Analysis:
AI Agent Response: The AI will provide:
Total realized and unrealized PnL
Win/loss ratio and average trade size
Best and worst performing assets
Daily PnL chart and trends
Risk Metrics:
AI Agent Response: The AI will calculate:
Total portfolio delta and exposure
Margin utilization and available leverage
Concentration risk by asset
Value at Risk (VaR) estimates
Trade History
Transaction History:
AI Agent Response: The AI will display:
All executed trades with timestamps
Entry and exit prices for each trade
Realized PnL per trade
Trading fees and costs
Fill Analysis:
AI Agent Response: The AI will provide:
Fill rate statistics by order type
Average slippage on market orders
Comparison with market conditions
Suggestions for improving execution
Advanced Trading Features
Multi-Asset Strategies
Portfolio Hedging:
AI Agent Response: The AI will:
Analyze correlation between ETH and BTC
Calculate optimal hedge ratio
Suggest BTC short position size
Execute hedging strategy if approved
Pair Trading:
AI Agent Response: The AI will:
Analyze historical price relationship
Identify current spread opportunity
Suggest trade sizes and entry points
Set up both legs of the pair trade
Risk Management
Position Sizing:
AI Agent Response: The AI will:
Analyze current portfolio value
Calculate 2% risk amount
Determine position size based on stop-loss distance
Recommend leverage and margin requirements
Automated Risk Controls:
AI Agent Response: The AI will configure:
Maximum position size per asset
Portfolio-wide leverage limits
Automatic stop-loss percentages
Daily loss limits and circuit breakers
Market Analysis
Market Data
Price Information:
AI Agent Response: The AI will provide:
Current mark price and index price
Real-time funding rate
Open interest and volume data
Recent price action and volatility
Order Book Analysis:
AI Agent Response: The AI will display:
Current bid/ask spread
Order book depth at various price levels
Market impact estimates for different trade sizes
Liquidity analysis and market conditions
Trading Opportunities
Market Scanning:
AI Agent Response: The AI will identify:
Assets with unusual volume or volatility
Funding rate arbitrage opportunities
Technical breakout patterns
Market inefficiencies and spreads
Troubleshooting
Common Issues
Connection Problems:
AI Agent Response: The AI will diagnose:
API connectivity and authentication status
Network connectivity issues
Account permissions and restrictions
Hyperliquid system status
Trading Errors:
AI Agent Response: The AI will check:
Insufficient margin or balance
Position limits and risk controls
Market conditions and liquidity
Order parameters and validation
Position Discrepancies:
AI Agent Response: The AI will verify:
Recent trade execution history
Partial fills and order modifications
Funding payments and adjustments
Account reconciliation with Hyperliquid
Performance Issues
Latency Problems:
AI Agent Response: The AI will analyze:
Network latency to Hyperliquid servers
Order routing and execution paths
Market conditions and volatility
System performance and optimization
Slippage Issues:
AI Agent Response: The AI will review:
Order sizing relative to market depth
Market timing and volatility periods
Order type optimization (limit vs market)
Execution strategy improvements
Best Practices
Trading Strategy
Risk Management:
Always use stop-losses for leveraged positions
Monitor margin levels and avoid over-leveraging
Diversify positions across multiple assets
Set daily and weekly loss limits
Execution Optimization:
Use limit orders during normal market conditions
Monitor funding rates for cost optimization
Time entries and exits based on market volatility
Consider order size impact on market price
Security and Safety
Account Security:
Use secure private key storage
Monitor account activity regularly
Enable all available security features
Keep trading capital separate from long-term holdings
Operational Security:
Regularly backup trading strategies and settings
Monitor API usage and permissions
Keep software and systems updated
Use secure networks for trading
Performance Monitoring
Regular Reviews:
Analyze trading performance weekly
Review and adjust risk parameters
Monitor market conditions and adapt strategies
Track and optimize trading costs
Integration Examples
DeFi Yield Strategies
Yield Arbitrage:
AI Agent Response: The AI will:
Compare funding rates across platforms
Calculate arbitrage profitability
Execute both legs of the arbitrage
Monitor and manage the position
Portfolio Management
Automated Rebalancing:
AI Agent Response: The AI will:
Define target allocations per asset
Monitor current portfolio weights
Execute rebalancing trades automatically
Report on rebalancing activities
Related Documentation
Private Keys - Secure key management for trading
User Instructions - Custom trading workflows
Transaction Tools - Transaction monitoring
Troubleshooting - General troubleshooting guide
Last updated
