An automated limit order chasing system for Hyperliquid that dynamically adjusts limit orders to stay at the best bid/ask, improving fill rates while maintaining price control. But why even use a limit chase? I personally developed this limit chase in order to reduce fees compared to market orders. For me it worked to increase sharpe ratio (It worked well for my use case, does not guarante any success for other implementations)
- Install dependencies:
pip install -r requirements.txt- Configure environment:
cp .env.example .env
# Edit .env with your wallet credentials (ADDRESS, PK)- Verify setup:
python scripts/diagnose_setup.py- Run example:
# Mainnet (real money!)
python examples/limit_chase_usage.pyRequired .env variables:
ADDRESS- Your wallet addressPK- Your private keyTESTNET- Set totrue(Boolean => false forMainnet)
Optional:
POST_ONLY- Post-only orders (default:false)DATABASE_URL- For trade loggingNTFY_TOPIC/NTFY_ACCESS_TOKEN- For notifications
Never commit your .env file!
- Places initial limit order at best bid/ask
- Monitors order book via WebSocket
- Refreshes order when price drifts beyond
tolerance_ticksor order age exceedsmax_age_ms - Aborts if price moves beyond
max_chase_ticksfrom start - Polls for fill until filled or aborted
| Parameter | Description | Default |
|---|---|---|
tick_size |
Minimum price increment | 0.5 |
tolerance_ticks |
Price drift before refresh | 1 |
max_age_ms |
Max order age before refresh | 5000ms |
max_chase_ticks |
Max price movement before abort | 10 |
order_size |
Order size in asset units | 0.0002 |
from hl_limit_chase import (
HyperliquidExecutor,
LimitChaser,
LiveExchangeClient
)
executor = HyperliquidExecutor(testnet=False)
ex = LiveExchangeClient(executor, "BTC")
chaser = LimitChaser(
ex,
tick_size=0.5,
side="buy",
order_size=0.0002,
tolerance_ticks=1,
max_age_ms=5000,
max_chase_ticks=10
)Run integration test with CSV logging:
TESTNET=true python examples/test_limit_chase.py # Testnet
python examples/test_limit_chase.py # MainnetResults are logged to data/limit_chase_accuracy.csv.
HL_LIMIT_CHASE_V2/
├── hl_limit_chase/ # Main package
│ ├── __init__.py
│ ├── limit_chase.py # Core limit chase logic
│ ├── executor.py # Hyperliquid API executor
│ └── trade_logger.py # Trade logging
├── examples/ # Example scripts
│ ├── limit_chase_usage.py
│ └── test_limit_chase.py
├── scripts/ # Utility scripts
│ └── diagnose_setup.py
├── data/ # Test data/output
│ └── limit_chase_accuracy.csv
└── requirements.txt
MIT License - see LICENSE file.
This software is provided "as is" without warranty. Trading cryptocurrencies involves substantial risk. Use at your own risk.
