Tools: Essential Guide: Building a Hyperliquid Trading Bot: Perps, Spot, and Sub-Accounts

Tools: Essential Guide: Building a Hyperliquid Trading Bot: Perps, Spot, and Sub-Accounts

Why Trading Infrastructure Matters

Professional Trading Infrastructure with WAIaaS

Hyperliquid Integration: Perps, Spot, and Sub-Accounts

Multi-Protocol Trading Through One API

Gas Conditional Execution

Risk Controls for Trading Bots

Real-Time Portfolio Monitoring

Cross-Chain Arbitrage Infrastructure

Quick Start: Deploy a Trading Bot

What's Next Your Hyperliquid perpetual bot spotted the perfect setup — funding rates are paying 50% APR while spot is trading at a discount. But by the time you've manually signed into three different platforms, connected wallets, and navigated UIs, the opportunity is gone. Professional traders need infrastructure that executes as fast as they think. Every millisecond counts in crypto trading. Whether you're running statistical arbitrage between Jupiter and centralized exchanges, or managing a complex delta-neutral strategy across perpetual futures and spot markets, your wallet infrastructure can make or break your edge. Manual wallet management, fragmented APIs, and missing risk controls turn profitable opportunities into costly delays. The best traders automate everything — not just strategy logic, but the entire execution pipeline from signal generation to settlement confirmation. You need wallet infrastructure that speaks your language: REST APIs, policy engines, and multi-protocol access through a single interface. WAIaaS provides the wallet infrastructure that serious trading operations require. Instead of managing multiple wallet connections and signing flows, your bot gets one REST API that spans 14 DeFi protocols across Solana and EVM chains — including Hyperliquid perpetuals, Jupiter swaps, and cross-chain bridges. Hyperliquid's unified API covers perpetual futures, spot trading, and sub-account management. Through WAIaaS, your trading bot can execute complex strategies without dealing with wallet connection hassles: Sub-accounts let you compartmentalize strategies while maintaining unified reporting: Professional strategies often span multiple venues. A typical delta-neutral play might involve shorting perpetuals on Hyperliquid while longing spot on Jupiter. WAIaaS handles the complexity: Gas costs can destroy trading profits, especially for high-frequency strategies. WAIaaS includes gas conditional execution — transactions only execute when gas prices meet your thresholds: Your arbitrage bot queues transactions during high gas periods and executes automatically when conditions improve. Automated trading requires automated risk management. WAIaaS's policy engine provides 21 policy types including position size limits, leverage caps, and spending controls: Position size limits prevent a single trade from risking the entire portfolio: Trading bots need continuous position monitoring. WAIaaS tracks DeFi positions across all 14 integrated protocols: This returns positions from Hyperliquid, Jupiter, Kamino, Drift, and other protocols in a standardized format. Your monitoring dashboard gets one API call instead of integrating with each protocol separately. Inter-chain arbitrage requires reliable bridging. WAIaaS integrates LI.FI and Across protocols for seamless asset movement: Your arbitrage bot can now capture opportunities across chains without manual intervention. Here's how to get trading infrastructure running in under 10 minutes: 1. Start WAIaaS with Docker 2. Create wallets for your strategies 3. Set up risk policies 4. Install the SDK in your trading bot 5. Connect your bot and start trading You now have professional-grade wallet infrastructure that scales with your trading operation. The complete WAIaaS documentation covers advanced topics like batch transactions, dry-run simulation, and integration with AI trading frameworks. Ready to build? Get the code at GitHub or learn more at waiaas.ai. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Command

Copy

# Open a 10x long position on ETH perpetual -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/place-order \ -H "Content-Type: application/json" \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "coin": "ETH", "is_buy": true, "sz": "1.0", "limit_px": "3500", "order_type": {"limit": {"tif": "Gtc"}}, "reduce_only": false }' # Open a 10x long position on ETH perpetual -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/place-order \ -H "Content-Type: application/json" \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "coin": "ETH", "is_buy": true, "sz": "1.0", "limit_px": "3500", "order_type": {"limit": {"tif": "Gtc"}}, "reduce_only": false }' # Open a 10x long position on ETH perpetual -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/place-order \ -H "Content-Type: application/json" \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "coin": "ETH", "is_buy": true, "sz": "1.0", "limit_px": "3500", "order_type": {"limit": {"tif": "Gtc"}}, "reduce_only": false }' # Create sub-account for delta-neutral strategy -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/create-sub-account \ -H "Content-Type: application/json" \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "name": "delta-neutral-arb" }' # Create sub-account for delta-neutral strategy -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/create-sub-account \ -H "Content-Type: application/json" \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "name": "delta-neutral-arb" }' # Create sub-account for delta-neutral strategy -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/create-sub-account \ -H "Content-Type: application/json" \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "name": "delta-neutral-arb" }' # Step 1: Short ETH perp on Hyperliquid -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/place-order \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "coin": "ETH", "is_buy": false, "sz": "2.0", "limit_px": "3500" }' # Step 2: Buy ETH spot via Jupiter swap -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/jupiter-swap/swap \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "outputMint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "amount": "7000000000" }' # Step 1: Short ETH perp on Hyperliquid -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/place-order \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "coin": "ETH", "is_buy": false, "sz": "2.0", "limit_px": "3500" }' # Step 2: Buy ETH spot via Jupiter swap -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/jupiter-swap/swap \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "outputMint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "amount": "7000000000" }' # Step 1: Short ETH perp on Hyperliquid -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/place-order \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "coin": "ETH", "is_buy": false, "sz": "2.0", "limit_px": "3500" }' # Step 2: Buy ETH spot via Jupiter swap -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/jupiter-swap/swap \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "outputMint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "amount": "7000000000" }' # Only execute when gas < 50 gwei -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/transactions/send \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "type": "TRANSFER", "to": "0x742d35cc1cf", "amount": "0.1", "gasCondition": { "maxGasPrice": "50000000000" } }' # Only execute when gas < 50 gwei -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/transactions/send \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "type": "TRANSFER", "to": "0x742d35cc1cf", "amount": "0.1", "gasCondition": { "maxGasPrice": "50000000000" } }' # Only execute when gas < 50 gwei -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/transactions/send \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "type": "TRANSFER", "to": "0x742d35cc1cf", "amount": "0.1", "gasCondition": { "maxGasPrice": "50000000000" } }' # Set max leverage for perpetual trading -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: my-secret-password" \ -d '{ "type": "PERP_MAX_LEVERAGE", "rules": { "max_leverage": 10, "markets": ["ETH", "BTC"] } }' # Set max leverage for perpetual trading -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: my-secret-password" \ -d '{ "type": "PERP_MAX_LEVERAGE", "rules": { "max_leverage": 10, "markets": ["ETH", "BTC"] } }' # Set max leverage for perpetual trading -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: my-secret-password" \ -d '{ "type": "PERP_MAX_LEVERAGE", "rules": { "max_leverage": 10, "markets": ["ETH", "BTC"] } }' # Cap position sizes by market -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: my-secret-password" \ -d '{ "type": "PERP_MAX_POSITION_USD", "rules": { "max_position_usd": 50000, "per_market_limits": { "ETH": 25000, "BTC": 25000 } } }' # Cap position sizes by market -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: my-secret-password" \ -d '{ "type": "PERP_MAX_POSITION_USD", "rules": { "max_position_usd": 50000, "per_market_limits": { "ETH": 25000, "BTC": 25000 } } }' # Cap position sizes by market -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: my-secret-password" \ -d '{ "type": "PERP_MAX_POSITION_USD", "rules": { "max_position_usd": 50000, "per_market_limits": { "ETH": 25000, "BTC": 25000 } } }' # Get unified portfolio view -weight: 500;">curl http://127.0.0.1:3100/v1/defi/positions \ -H "Authorization: Bearer wai_sess_<token>" # Get unified portfolio view -weight: 500;">curl http://127.0.0.1:3100/v1/defi/positions \ -H "Authorization: Bearer wai_sess_<token>" # Get unified portfolio view -weight: 500;">curl http://127.0.0.1:3100/v1/defi/positions \ -H "Authorization: Bearer wai_sess_<token>" # Bridge USDC from Ethereum to Solana for Jupiter trading -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/lifi/bridge \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "fromChain": "ethereum", "toChain": "solana", "fromToken": "0xA0b86a33E6441", "toToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "amount": "1000000000" }' # Bridge USDC from Ethereum to Solana for Jupiter trading -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/lifi/bridge \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "fromChain": "ethereum", "toChain": "solana", "fromToken": "0xA0b86a33E6441", "toToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "amount": "1000000000" }' # Bridge USDC from Ethereum to Solana for Jupiter trading -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/actions/lifi/bridge \ -H "Authorization: Bearer wai_sess_<token>" \ -d '{ "fromChain": "ethereum", "toChain": "solana", "fromToken": "0xA0b86a33E6441", "toToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "amount": "1000000000" }' -weight: 500;">git clone https://github.com/minhoyoo-iotrust/WAIaaS.-weight: 500;">git cd WAIaaS -weight: 500;">docker compose up -d -weight: 500;">git clone https://github.com/minhoyoo-iotrust/WAIaaS.-weight: 500;">git cd WAIaaS -weight: 500;">docker compose up -d -weight: 500;">git clone https://github.com/minhoyoo-iotrust/WAIaaS.-weight: 500;">git cd WAIaaS -weight: 500;">docker compose up -d -weight: 500;">npm -weight: 500;">install -g @waiaas/cli waiaas quickset --mode mainnet # Creates Ethereum + Solana wallets -weight: 500;">npm -weight: 500;">install -g @waiaas/cli waiaas quickset --mode mainnet # Creates Ethereum + Solana wallets -weight: 500;">npm -weight: 500;">install -g @waiaas/cli waiaas quickset --mode mainnet # Creates Ethereum + Solana wallets # Create spending limits and position caps -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: <password>" \ -d '{ "type": "SPENDING_LIMIT", "rules": { "instant_max_usd": 1000, "daily_limit_usd": 50000 } }' # Create spending limits and position caps -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: <password>" \ -d '{ "type": "SPENDING_LIMIT", "rules": { "instant_max_usd": 1000, "daily_limit_usd": 50000 } }' # Create spending limits and position caps -weight: 500;">curl -X POST http://127.0.0.1:3100/v1/policies \ -H "X-Master-Password: <password>" \ -d '{ "type": "SPENDING_LIMIT", "rules": { "instant_max_usd": 1000, "daily_limit_usd": 50000 } }' -weight: 500;">npm -weight: 500;">install @waiaas/sdk -weight: 500;">npm -weight: 500;">install @waiaas/sdk -weight: 500;">npm -weight: 500;">install @waiaas/sdk import { WAIaaSClient } from '@waiaas/sdk'; const client = new WAIaaSClient({ baseUrl: 'http://127.0.0.1:3100', sessionToken: process.env.WAIAAS_SESSION_TOKEN, }); // Your bot can now execute across 14 DeFi protocols const balance = await client.getBalance(); const positions = await client.getDeFiPositions(); import { WAIaaSClient } from '@waiaas/sdk'; const client = new WAIaaSClient({ baseUrl: 'http://127.0.0.1:3100', sessionToken: process.env.WAIAAS_SESSION_TOKEN, }); // Your bot can now execute across 14 DeFi protocols const balance = await client.getBalance(); const positions = await client.getDeFiPositions(); import { WAIaaSClient } from '@waiaas/sdk'; const client = new WAIaaSClient({ baseUrl: 'http://127.0.0.1:3100', sessionToken: process.env.WAIAAS_SESSION_TOKEN, }); // Your bot can now execute across 14 DeFi protocols const balance = await client.getBalance(); const positions = await client.getDeFiPositions();