An automated copy trading bot powered by Oasis Protocol's secure TEE infrastructure that replicates trades from expert traders on Hyperliquid DEX.
- Clone the repository:
git clone https://github.com/oasisprotocol/template-rofl-hl-copy-trader.git
cd template-rofl-hl-copy-trader- Install dependencies:
pip install -r requirements.txt- Set environment variables and run:
export COPY_TRADE_ADDRESS="0x..."
export WITHDRAW_FUNDS_TO="0x..."
python -m src.maindocker compose uprm rofl.yaml
oasis rofl init
oasis rofl create
oasis rofl build
oasis rofl secret set COPY_TRADE_ADDRESS "0x..."
oasis rofl secret set WITHDRAW "true"
oasis rofl secret set WITHDRAW_FUNDS_TO "0x..."
oasis rofl update
oasis rofl deployCOPY_TRADE_ADDRESS: Address of the trader to copy (required)WITHDRAW_FUNDS_TO: Emergency withdrawal address (required)WITHDRAW: If set totrue, the service will withdraw all funds to theWITHDRAW_FUNDS_TOaddress and exit. (optional)
src/
├── clients/ # External API integrations
│ ├── hyperliquid.py # Hyperliquid DEX client
│ └── rofl.py # ROFL key management client
├── config/ # Configuration management
├── core/ # Core business logic
│ ├── copy_trader.py # Main orchestrator
│ ├── position_manager.py # Position sizing and ratios
│ ├── trade_executor.py # Order execution
│ ├── trade_monitor.py # Real-time trade monitoring
│ └── withdrawal_handler.py # Emergency withdrawals
├── models/ # Data models and types
└── main.py # Application entry point
- Initialization: Connects to Hyperliquid and generates secure keypair via ROFL
- Monitoring: Subscribes to target trader's fills via WebSocket
- Position Sizing: Calculates proportional trade sizes based on account ratios
- Execution: Replicates trades with appropriate leverage and sizing
- Safety: Includes emergency withdrawal mode for fund recovery
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
For issues and questions, please open a GitHub issue.