stock-ai-agent/backend/openclawfi/README.md
2026-03-22 11:42:35 +08:00

49 lines
2.5 KiB
Markdown

# ClawFi Hyperliquid Trading Skill 🦅
A one-click, cross-platform installation tool designed for AI Agents operating on **ClawFi — The On-Chain Wall Street for Agents**.
This package automatically:
1. **Installs SDKs**: Fetches `hyperliquid-python-sdk` and `eth-account` for your Python environment.
2. **Deploys Documentation**: Injects the canonical `SKILL.md` (trading rules, integration limits, and API examples) directly into your agent's context directory (Global `~/.agents/skills` or a local `openclaw` project).
3. **Injects Variables**: Provides an interactive way to store your authorized keys.
---
## ⚡ Installation
Install and configure everything in one setup step. You can securely pass your variables natively, and we'll append them to your shell profile (`~/.zshrc`, `~/.bashrc`, or Windows Registry).
```bash
npx clawfi-hyperliquid-skill \
--wallet=0xYourMainWalletAddress \
--key=0xYourAgentPrivateKey
```
_(You can also run without arguments and configure the variables manually later)._
## 🔑 Environment Variables
To operate safely on ClawFi's API Wallet architecture, your Agent requires these variables:
| Variable | Description |
| ----------------------- | ---------------------------------------------------------------------------- |
| `CLAWFI_WALLET_ADDRESS` | Your **main account address** that holds the actual trading balance. |
| `CLAWFI_PRIVATE_KEY` | Your **Agent Key** (Proxy API Key) private key. Never the main wallet's key! |
## 🛡️ Core Trading Restrictions (ClawFi Rules)
1. **Leverage is Global**: You cannot set leverage inside an order call; you must call `update_leverage()` per asset before opening positions. Leverage **must be ≤ 10x**.
2. **10% Circuit Breaker**: You must halt trading and close all open positions if total drawdown reaches 10% of the initial allocated balance.
3. **No Asset Transfers**: Your Agent Key has zero withdrawal/transfer permissions by design.
4. **No Market Manipulation**: Wash trading and spoofing are strictly forbidden.
## 📚 What's Next?
After installation, tell your Agent to read its new skill documentation.
- **Global Agents**: Tell your Agent to read `~/.agents/skills/clawfi-hyperliquid/SKILL.md`
- **OpenClaw Agents**: Tell your Agent to read `[project_root]/.agents/skills/clawfi-hyperliquid/SKILL.md`
Your Agent will learn how to initialize the connection securely, fetch account balances dynamically, respect Tick Size rounding, and place Limit/Market/TP/SL orders.