High-performance perpetual futures bot for Aster DEX, GRVT, and Hyperliquid — with three battle-tested strategies, real-time terminal UI, and production-ready PM2 deployment. Runs on Node.js with TypeScript.
Most exchange bots are either a black box or a spaghetti script. This one gives you:
- Three strategies — trend following, pure market making, offset market making
- Multi-exchange — switch between Aster, GRVT, and Hyperliquid via one config
- Live terminal UI — Ink/React dashboard for positions, PnL, and engine state
- WebSocket + REST — real-time market data with REST reconciliation on restart
- PM2 ready — one-command silent deployment for VPS hosting
- Vitest coverage — strategy and adapter tests included
Whether you're running Bollinger-gated trend trades or posting maker quotes with chase logic, the engine handles exchange filters, tick sizes, and position reconciliation.
| Strategy | Best for | Core logic |
|---|---|---|
| Trend | Directional moves | Bollinger bandwidth gate + trailing profit stop |
| Maker | Range-bound markets | Post limit orders with refresh and chase |
| Offset Maker | Spread capture | Offset quotes around mid with dynamic adjustment |
Select at runtime:
npm start -- --strategy trend
npm start -- --strategy maker
npm start -- --strategy offset-makerAdd --silent to disable the terminal UI (ideal for servers).
- Node.js 20+
- Exchange API credentials (see below)
- NTP-synced system clock (required for signed requests)
git clone https://github.com/metanode-trade/asterdex-trading-bot.git
cd asterdex-trading-bot
npm install
cp .env.example .envSet EXCHANGE and the matching credentials:
EXCHANGE |
Required env vars |
|---|---|
aster |
ASTER_API_KEY, ASTER_API_SECRET |
grvt |
GRVT_API_KEY, GRVT_API_SECRET, GRVT_SUB_ACCOUNT_ID |
hyperliquid |
HYPERLIQUID_WALLET_ADDRESS, HYPERLIQUID_PRIVATE_KEY |
npm start # interactive UI
npm run start:trend:silent # headless trend
npm run start:maker:silent # headless maker
npm test # vitestnpm run pm2:start:trend| Variable | Purpose |
|---|---|
TRADE_SYMBOL |
e.g. BTCUSDT |
TRADE_AMOUNT |
Base position size |
LOSS_LIMIT |
Max loss (USDT) before forced close |
TRAILING_PROFIT / TRAILING_CALLBACK_RATE |
Trailing stop |
BOLLINGER_LENGTH / MIN_BOLLINGER_BANDWIDTH |
Entry gate |
PRICE_TICK / QTY_STEP |
Exchange lot filters |
POLL_INTERVAL_MS |
Main loop cadence |
MAX_CLOSE_SLIPPAGE_PCT |
Cap close price vs mark |
See MAKER_* variables in .env.example — offsets, refresh interval, chase behavior.
index.ts (CLI)
└── src/index.tsx
├── exchanges/ # aster | grvt | hyperliquid adapters
├── strategy/ # trend | maker | offset-maker engines
├── ui/ # Ink terminal dashboard
├── cli/ # Argument parsing
└── core/ # Shared types, reconciliation
flowchart LR
WS[WebSocket Feed] --> Engine[Strategy Engine]
Engine --> Adapter[Exchange Adapter]
Adapter --> REST[REST API]
Engine --> UI[Ink Dashboard]
Before going live, confirm on your exchange:
- One-way position mode (not hedge mode)
- Leverage set manually (~50x suggested; bot does not set leverage)
- Minimum API permissions — trade only, no withdrawal
- Clock sync — drift breaks signatures
| Command | Description |
|---|---|
npm start |
Start with UI |
npm run dev |
Same as start (tsx watch-friendly) |
npm run start:trend:silent |
Trend, no UI |
npm run start:maker:silent |
Maker, no UI |
npm run start:offset:silent |
Offset maker, no UI |
npm test |
Run Vitest suite |
npm run pm2:start:trend |
PM2 trend deployment |
- Perpetual futures carry liquidation risk. Test with minimal size first.
- Rotate API keys immediately if leaked.
- No warranty. Authors not liable for trading losses.
- Use API keys with minimum required permissions.
Issues and PRs welcome — especially exchange adapter improvements and strategy tuning docs.