
A production-grade copy trading bot built in TypeScript (Node.js) that mirrors trades from a target Hyperliquid wallet in real-time. It listens for fills/trades, copies opens, reduces, and closes positions while applying configurable risk parameters, supports dry-run and testnet modes, and offers safety/resilience features.
(ourAccountEquity / targetWalletEquity) * targetPositionSize * SIZE_MULTIPLIER.env + zod schema for strong typed configPRIVATE_KEY, TARGET_WALLET, TESTNET (boolean)SIZE_MULTIPLIER, MAX_LEVERAGE, BLOCKED_ASSETS (array), DRY_RUN, LOG_LEVELwinstonnpm start)hyperliquid-copy-bot/
├── package.json
├── tsconfig.json
├── .env.example
├── README.md
├── src/
│ ├── index.ts # Main entry point
│ ├── config.ts # Configuration with zod validation
│ ├── hyperliquidClient.ts # Hyperliquid SDK wrapper
│ ├── copyTrader.ts # Core copy trading logic
│ ├── logger.ts # Winston logger setup
│ ├── types.ts # TypeScript type definitions
│ ├── utils/
│ │ ├── risk.ts # Risk management utilities
│ │ └── healthCheck.ts # Health check utility
└── logs/ # Log files (auto-created)
Clone the repository
bash
git clone https://github.com/MarilynClarke/Hyperliquid-Copy-Trading-Bot
cd Hyperliquid-Copy-Trading-Bot
Configure environment variables
bash
cp .env.example .env
Edit .env and fill in your values:
env
PRIVATE_KEY=0xYourPrivateKeyHere
TARGET_WALLET=0xTargetWalletAddressHere
TESTNET=true
SIZE_MULTIPLIER=1.0
MAX_LEVERAGE=20
DRY_RUN=true
Install dependencies
bash
npm install
Start the bot
bash
npm start
| Variable | Description | Example |
|---|---|---|
PRIVATE_KEY |
Your wallet private key (0x prefix) | 0x1234... |
TARGET_WALLET |
Target wallet address to copy | 0x5678... |
TESTNET |
Use testnet (true/false) | true |
| Variable | Description | Default |
|---|---|---|
SIZE_MULTIPLIER |
Position size multiplier | 1.0 |
MAX_LEVERAGE |
Maximum leverage cap | 20 |
MAX_POSITION_SIZE_PERCENT |
Max position size as % of equity | 50 |
MIN_NOTIONAL |
Minimum order size in USD | 10 |
MAX_CONCURRENT_TRADES |
Max concurrent open positions | 10 |
BLOCKED_ASSETS |
Comma-separated blocked assets | `` |
DRY_RUN |
Simulation mode (true/false) | true |
LOG_LEVEL |
Logging level (error/warn/info/debug) | info |
HEALTH_CHECK_INTERVAL |
Health check interval in minutes | 5 |
Testnet Testing (Recommended first)
env
TESTNET=true
DRY_RUN=true
This allows you to test the bot without risking real funds.
Production Mode
env
TESTNET=false
DRY_RUN=false
(ourEquity / targetEquity) * targetSize * multiplierIf: - Target wallet equity: $10,000 - Our wallet equity: $5,000 - Target opens $1,000 position - SIZE_MULTIPLIER: 1.0
Then our position size = (5000 / 10000) * 1000 * 1.0 = $500
The bot includes multiple safety layers:
"1.5" not "1.50")⚠️ IMPORTANT WARNINGS:
MIT License — free to use, modify, but no warranty.
TESTNET=true in .envDRY_RUN=true for initial testingnpm start# Required
PRIVATE_KEY=0xYourPrivateKeyHere
TARGET_WALLET=0xTargetWalletAddressHere
TESTNET=true
# Position Sizing & Risk Management
SIZE_MULTIPLIER=1.0
MAX_LEVERAGE=20
MAX_POSITION_SIZE_PERCENT=50
MIN_NOTIONAL=10
MAX_CONCURRENT_TRADES=10
# Asset Filtering
BLOCKED_ASSETS=BTC,ETH
# Safety Features
DRY_RUN=true
LOG_LEVEL=info
# Optional: Health Check Interval (minutes)
HEALTH_CHECK_INTERVAL=5
If you have any questions or suggestions while using this, please contact me on Discord. Your feedback will be very helpful for future updates and improvements.
raymonddakus
$ claude mcp add Hyperliquid-Copy-Trading-Bot \
-- python -m otcore.mcp_server <graph>