A streamlined algorithmic trading platform for HyperLiquid DEX, focusing on spot trading with technical indicator integration.
- Direct Exchange Connection: Connect to HyperLiquid mainnet/testnet
- Spot Trading: Execute market and limit orders with ease
- Balance Management: Real-time balance tracking
- Order Management: View, place, and cancel orders
- Technical Indicators:
- Customizable EMA (Exponential Moving Average)
- Automated Trading: Set up automated trading based on indicator signals
- Clean CLI: Simple and intuitive command-line interface
- Python 3.8 or higher
- HyperLiquid account with API credentials
- Basic understanding of spot trading
-
Clone the repository:
git clone https://github.com/AlwaysUbaid/AlgoHL.git cd algohl -
Install dependencies:
pip install -r requirements.txt
-
Run the setup script:
python setup.py
This will:
- Create your
.envfile from the template - Check all dependencies are installed
- Validate your Python version
- Create your
-
Configure your credentials:
Edit the
.envfile with your API credentials:# Open .env in your favorite editor nano .env # or vim, code, etc.
Replace the placeholder values:
# Mainnet credentials MAINNET_WALLET_ADDRESS=0xYOUR_ACTUAL_WALLET_ADDRESS MAINNET_PRIVATE_KEY=0xYOUR_ACTUAL_PRIVATE_KEY # Testnet credentials (optional) TESTNET_WALLET_ADDRESS=0xYOUR_TESTNET_WALLET_ADDRESS TESTNET_PRIVATE_KEY=0xYOUR_TESTNET_PRIVATE_KEY
β οΈ Security Best Practices:- Never commit your
.envfile (it's automatically gitignored) - Never share your private keys with anyone
- Consider using a dedicated trading wallet with limited funds
- Enable 2FA on your HyperLiquid account
- Never commit your
-
Run setup (first time only):
python setup.py
-
Start the platform:
python main.py
-
Connect to exchange:
>>> connect mainnet -
Check your balance:
>>> balance -
Place a trade:
>>> buy ETH 0.1
| Command | Description | Example |
|---|---|---|
connect [network] |
Connect to HyperLiquid | connect mainnet |
balance |
Show spot balances | balance |
| Command | Description | Example |
|---|---|---|
buy <symbol> <size> [slippage] |
Market buy order | buy ETH 0.1 0.05 |
sell <symbol> <size> [slippage] |
Market sell order | sell BTC 0.01 |
limit_buy <symbol> <size> <price> |
Limit buy order | limit_buy ETH 0.1 3000 |
limit_sell <symbol> <size> <price> |
Limit sell order | limit_sell BTC 0.01 65000 |
| Command | Description | Example |
|---|---|---|
orders [symbol] |
List open orders | orders ETH |
cancel <symbol> <order_id> |
Cancel specific order | cancel ETH 123456 |
cancel_all [symbol] |
Cancel all orders | cancel_all |
history [limit] |
Show trade history | history 20 |
| Command | Description | Example |
|---|---|---|
indicators |
List available indicators | indicators |
ema <symbol> |
Set up EMA trading with custom period | ema BTC |
| Command | Description |
|---|---|
help |
Show all commands |
clear |
Clear the screen |
exit |
Exit the application |
# Use testnet
python main.py --testnet
# Enable verbose logging
python main.py --verbose
# Log to file
python main.py --log-file trading.logMarket Buy with Custom Slippage:
>>> buy ETH 0.5 0.03
This buys 0.5 ETH with maximum 3% slippage.
Place Multiple Limit Orders:
>>> limit_buy ETH 0.1 3000
>>> limit_buy ETH 0.2 2950
>>> limit_buy ETH 0.3 2900
Cancel All ETH Orders:
>>> cancel_all ETH
- Trend-following indicator with customizable period
- User can set any EMA period (default: 20)
- Bullish when price is above EMA
- Bearish when price is below EMA
- Crossover signals for entry/exit
>>> ema BTC
Enter EMA period (default 20): 50
EMA period set to: 50
Current Price: $65,432.10
EMA(50): $64,890.25
Trend: BULLISH
algohl-trading/
βββ main.py # Entry point
βββ terminal_ui.py # CLI interface
βββ api_connector.py # HyperLiquid API connection
βββ order_handler.py # Order execution logic
βββ config.py # Configuration management
βββ ema_indicator.py # EMA indicator
βββ setup.py # Initial setup helper
βββ .env.example # Environment variables template
βββ .env # Your credentials (create from setup.py)
βββ requirements.txt # Python dependencies
βββ .gitignore # Git ignore file
βββ README.md # This file
- Never share your private keys
- Use environment variables for production
- Enable 2FA on your HyperLiquid account
- Start with small amounts on testnet
- Regularly monitor your positions
Connection Issues:
- Verify your wallet address and private key
- Check internet connection
- Ensure you're using the correct network (mainnet/testnet)
Order Failures:
- Check available balance
- Verify symbol format (e.g., ETH, BTC)
- Ensure price/size parameters are valid
Import Errors:
- Run
pip install -r requirements.txt - Check Python version (3.8+)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This software is for educational purposes only. Trading cryptocurrencies carries significant risk. Always do your own research and never trade more than you can afford to lose.
- HyperLiquid team for the excellent DEX and API
- Python community for the amazing libraries
- All contributors and users of AlgoHL
Made with β€οΈ for the HyperLiquid community