|
| 1 | +# Hyperliquid Plugin for Eliza |
| 2 | + |
| 3 | +This plugin enables interaction with the Hyperliquid DEX through Eliza, providing spot trading capabilities. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- 💱 Spot Trading |
| 8 | + - Market orders (immediate execution) |
| 9 | + - Limit orders (price-specific) |
| 10 | + - Smart price validation to prevent mistakes |
| 11 | +- 📊 Price Checking |
| 12 | + - Real-time price information |
| 13 | + - 24h price change |
| 14 | + - Volume statistics |
| 15 | +- 🔄 Order Management |
| 16 | + - Cancel all open orders |
| 17 | + - Clear feedback on execution |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +Add the plugin to your Eliza configuration: |
| 22 | + |
| 23 | +```json |
| 24 | +{ |
| 25 | + "plugins": ["@elizaos/plugin-hyperliquid"] |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +## Configuration |
| 30 | + |
| 31 | +Set the following environment variables: |
| 32 | + |
| 33 | +```env |
| 34 | +HYPERLIQUID_PRIVATE_KEY=your_private_key # Required for trading and cancelling orders |
| 35 | +HYPERLIQUID_TESTNET=true_or_false # Optional, defaults to false |
| 36 | +``` |
| 37 | + |
| 38 | +## Available Actions |
| 39 | + |
| 40 | +### 1. SPOT_TRADE |
| 41 | + |
| 42 | +Place spot market or limit orders. |
| 43 | + |
| 44 | +Examples: |
| 45 | + |
| 46 | +``` |
| 47 | +# Market Orders |
| 48 | +"buy 1 PIP" -> Buys 1 PIP at market price |
| 49 | +"sell 2 HYPE" -> Sells 2 HYPE at market price |
| 50 | +"market buy 1 ETH" -> Buys 1 ETH at market price |
| 51 | +
|
| 52 | +# Limit Orders |
| 53 | +"buy 1 PIP at 20 USDC" -> Places buy order for 1 PIP at 20 USDC |
| 54 | +"sell 0.5 HYPE at 21 USDC" -> Places sell order for 0.5 HYPE at 21 USDC |
| 55 | +``` |
| 56 | + |
| 57 | +### 2. PRICE_CHECK |
| 58 | + |
| 59 | +Get current price information for any token. |
| 60 | + |
| 61 | +Examples: |
| 62 | + |
| 63 | +``` |
| 64 | +"What's the price of PIP?" |
| 65 | +"Check HYPE price" |
| 66 | +"Get ETH price" |
| 67 | +``` |
| 68 | + |
| 69 | +Returns: Current price, 24h change, and volume. |
| 70 | + |
| 71 | +### 3. CANCEL_ORDERS |
| 72 | + |
| 73 | +Cancel all your open orders. |
| 74 | + |
| 75 | +Examples: |
| 76 | + |
| 77 | +``` |
| 78 | +"Cancel all orders" |
| 79 | +"Cancel my orders" |
| 80 | +``` |
| 81 | + |
| 82 | +## Price Validation |
| 83 | + |
| 84 | +The plugin includes smart price validation to prevent mistakes: |
| 85 | + |
| 86 | +- Market Orders: Validates price is within ±50% of market price |
| 87 | +- Limit Orders: |
| 88 | + - Buy orders must be below market price |
| 89 | + - Sell orders must be above market price |
| 90 | + - Warns if price is very different from market (±80%) |
| 91 | + |
| 92 | +## Error Handling |
| 93 | + |
| 94 | +The plugin provides clear error messages for common issues: |
| 95 | + |
| 96 | +- Invalid token symbols |
| 97 | +- Price validation failures |
| 98 | +- Network connection issues |
| 99 | +- Order execution failures |
| 100 | + |
| 101 | +## Security Notes |
| 102 | + |
| 103 | +- Store your private key securely using environment variables |
| 104 | +- Test with small amounts first |
| 105 | +- Use testnet for initial testing |
| 106 | +- Monitor your orders regularly |
| 107 | +- Double-check prices before confirming trades |
| 108 | + |
| 109 | +## License |
| 110 | + |
| 111 | +MIT |
0 commit comments