Your trading bot spotted a DeFi arbitrage opportunity across Solana and Ethereum — Jupiter shows USDC at 0.9998, while Polymarket has it at 1.0012. But by the time your bot queries each protocol's API, estimates gas, and submits transactions through separate wallet libraries, the spread vanishes. DeFi trading bots need infrastructure that can execute across multiple protocols at speed, not a patchwork of individual integrations.
Why Protocol Fragmentation Kills Alpha
Trading opportunities in DeFi last seconds, not minutes. While you're managing Jupiter SDK updates, debugging Hyperliquid WebSocket reconnections, and handling LI.FI bridge failures, your competition is already three trades ahead. Each protocol integration adds latency, maintenance overhead, and failure points.
The real killer isn't just complexity — it's the wallet coordination nightmare. Your bot needs to manage private keys across chains, optimize gas dynamically, and enforce risk limits consistently. When your Ethereum leg fails but your Solana leg executes, you're exposed to price risk with no automated recovery.
The Solution: 15 DeFi Protocols, One REST API
WAIaaS solves this with unified wallet infrastructure that consolidates 15 DeFi protocol providers into a single REST API. Your bot makes one authenticated call instead of managing 15 different SDKs, gas estimators, and wallet libraries.
The protocols include Jupiter swap and Drift perpetuals on Solana, Aave v3 lending across multiple EVM chains, Hyperliquid for leveraged trading, LI.FI and Across for cross-chain bridges, and Polymarket for prediction markets. Each provider exposes standardized endpoints that your trading logic can call without protocol-specific configuration.
Here's how your arbitrage bot executes a cross-protocol trade:
# Check positions across all protocols
curl http://127.0.0.1:3100/v1/defi/positions \
-H "Authorization: Bearer wai_sess_<token>"
# Returns: Jupiter LP, Aave deposits, Hyperliquid perps, etc.
# Execute Jupiter swap on Solana
curl -X POST http://127.0.0.1:3100/v1/actions/jupiter-swap/swap \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": "1000000000"
}'
# Hedge on Hyperliquid perpetuals
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": "SOL",
"is_buy": false,
"sz": 10,
"limit_px": 185.50,
"order_type": "Limit"
}'
Both transactions use the same session authentication and wallet infrastructure, eliminating the complexity of managing multiple connections, private keys, and gas policies.
Gas Conditional Execution: Only Trade When Profitable
The biggest alpha killer in automated trading is gas cost variability. Your bot identifies a 0.2% arbitrage opportunity, but Ethereum gas spikes to 100 gwei, erasing profitability. WAIaaS includes gas conditional execution — transactions queue until gas price drops below your threshold, then execute automatically.
# Create policy: only execute when gas < 20 gwei
curl -X POST http://127.0.0.1:3100/v1/policies \
-H "Content-Type: application/json" \
-H "X-Master-Password: my-secret-password" \
-d '{
"walletId": "<wallet-uuid>",
"type": "GAS_CONDITION",
"rules": {
"max_gas_price_gwei": 20,
"timeout_seconds": 300
}
}'
Your bot submits trades immediately, but WAIaaS queues execution until gas conditions are favorable. This eliminates the need for your bot to implement gas monitoring, retries, and dynamic pricing logic.
Risk Controls That Don't Slow You Down
High-frequency trading bots need risk management that operates at execution speed. WAIaaS implements 21 policy types that enforce limits without roundtrip API calls. The policy engine evaluates spending limits, contract whitelists, and leverage caps locally before transaction execution.
# Set spending limits with 4-tier security
curl -X POST http://127.0.0.1:3100/v1/policies \
-H "Content-Type: application/json" \
-H "X-Master-Password: my-secret-password" \
-d '{
"walletId": "<wallet-uuid>",
"type": "SPENDING_LIMIT",
"rules": {
"instant_max_usd": 1000, // Execute immediately up to $1K
"notify_max_usd": 10000, // Execute with notification up to $10K
"delay_max_usd": 50000, // 15min delay for $50K+ trades
"delay_seconds": 900,
"daily_limit_usd": 100000 // Kill switch at $100K daily
}
}'
Small trades execute instantly while large positions trigger time delays or approval requirements. Your bot doesn't need to implement position sizing logic — the infrastructure enforces limits consistently across all protocols.
Cross-Chain Bridge Orchestration
Modern DeFi strategies span multiple chains. Your bot might identify liquidity discrepancies between Ethereum Aave pools and Solana lending markets, requiring automated bridging. WAIaaS integrates LI.FI and Across protocols for seamless cross-chain execution:
# Bridge USDC from Ethereum to Solana via LI.FI
curl -X POST http://127.0.0.1:3100/v1/actions/lifi/bridge \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"fromChain": "ethereum",
"toChain": "solana",
"fromToken": "0xA0b86a33E6441bE04fF1a6A78e24e37d1E00dD02",
"toToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": "10000000000"
}'
The API handles bridge routing, slippage optimization, and destination confirmation automatically. Your bot focuses on strategy logic instead of bridge infrastructure.
Perpetual Futures Integration
Sophisticated trading strategies combine spot and derivatives positions. WAIaaS provides native integration with Hyperliquid and Drift for perpetual futures, enabling your bot to hedge spot positions or implement basis trading strategies:
# Open leveraged long position on Hyperliquid
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": 50,
"limit_px": 3250.00,
"order_type": "Limit",
"reduce_only": false
}'
# Check position and margin
curl http://127.0.0.1:3100/v1/actions/hyperliquid/positions \
-H "Authorization: Bearer wai_sess_<token>"
The same session token works across all protocols, eliminating the authentication complexity that typically requires separate API keys and signing methods for each venue.
Liquidation Protection and Health Monitoring
Leveraged trading bots need continuous position monitoring to prevent liquidations. The health factor API aggregates risk metrics across lending protocols:
# Monitor health factor across all lending positions
curl http://127.0.0.1:3100/v1/defi/health-factor \
-H "Authorization: Bearer wai_sess_<token>"
# Returns: Overall health factor, per-protocol breakdown, liquidation thresholds
Your bot can implement automated deleveraging when health factors approach dangerous levels, closing positions before liquidation penalties hit.
Quick Start for Trading Bots
Deploy with Docker:
docker run -d -p 3100:3100 -e WAIAAS_AUTO_PROVISION=true ghcr.io/minhoyoo-iotrust/waiaas:latestCreate trading wallet:
waiaas wallet create --name trading-bot --chain solana --env mainnet
- Generate session token:
waiaas session create --wallet-id <wallet-uuid>
- Set risk policies:
waiaas policy create --type SPENDING_LIMIT --instant-max 1000
- Start trading:
curl -X POST http://127.0.0.1:3100/v1/actions/jupiter-swap/swap \
-H "Authorization: Bearer wai_sess_<your-token>" \
-d '{"inputMint": "...", "outputMint": "...", "amount": "..."}'
Your bot is now connected to 15 DeFi protocols through a single API endpoint, with gas optimization and risk controls built in.
What's Next
Trading infrastructure shouldn't be your competitive disadvantage. While you're debugging Jupiter SDK updates, your competition is capturing alpha with purpose-built infrastructure. Check out the WAIaaS repository for the complete integration guide, or explore the live API documentation at waiaas.ai. The next arbitrage opportunity won't wait for you to finish refactoring your wallet library.
Top comments (0)