Real-time liquidation alerts for Aster perpetual futures, delivered to Telegram.
The tracker connects to Aster's WebSocket stream, filters liquidations by USD size, and sends formatted messages to your Telegram channel.
🔴 #ETH Long Liquidation: $314.9k @ $4,319.2
🟢 #BTC Short Liquidation: $1.2M @ $64,647
- Real-time — WebSocket stream with sub-second latency
- Configurable threshold — only alert on liquidations above a USD amount you choose
- Auto-reconnect — exponential backoff, proactive reconnect before server-side 24 h limit
- Clean formatting — dynamic price precision, human-readable USD amounts (k / M)
- Structured logging — daily rotation with 7-day retention via loguru
git clone https://github.com/smvlx/aster-liquidations-tracker.git
cd aster-liquidations-tracker
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # then fill in your tokens (see below)
python main.py- Open Telegram and search for @BotFather.
- Send
/newbotand follow the prompts — pick a name and a username. - BotFather will reply with a bot token (e.g.
123456:ABC-DEF…). Copy it. - Create a channel (or group) where you want alerts to appear.
- Add your new bot to the channel as an admin with permission to post messages.
- Get the channel ID:
- The easiest way: forward any message from the channel to @userinfobot — it will reply with the chat ID.
- Channel IDs usually look like
-100xxxxxxxxxx.
- Put both values in your
.envfile:
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
TELEGRAM_CHANNEL_ID=-100xxxxxxxxxxAll settings are read from environment variables (or a .env file). See .env.example for the full list.
| Variable | Default | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
(required) | Bot token from @BotFather |
TELEGRAM_CHANNEL_ID |
(required) | Target channel / group ID |
MIN_LIQUIDATION_USD |
50000 |
Minimum USD value to trigger an alert |
ASTER_WS_URL |
wss://fstream.asterdex.com/ws/!forceOrder@arr |
WebSocket endpoint |
LOG_LEVEL |
INFO |
Logging verbosity (DEBUG, INFO, WARNING, ERROR) |
RECONNECT_DELAY |
5 |
Initial reconnect wait in seconds |
MAX_RECONNECT_ATTEMPTS |
10 |
Attempts per reconnection cycle |
WEBSOCKET_PING_INTERVAL |
20 |
Ping frequency in seconds |
WEBSOCKET_PING_TIMEOUT |
15 |
Ping timeout in seconds |
STATUS_UPDATE_INTERVAL |
300 |
Interval for status log entries (seconds) |
MAX_CONNECTION_LIFETIME |
3600 |
Force reconnect after this many seconds |
MIN_LIQUIDATION_USD controls the smallest liquidation (in USD notional) that generates an alert.
- Lower values (e.g.
1000) — more alerts, useful for monitoring smaller markets. - Higher values (e.g.
100000) — only whale liquidations, less noise.
The USD value is calculated as price * filled_quantity for each liquidation event.
Aster WebSocket (!forceOrder@arr)
│
▼
┌─────────────┐
│ Detector │ parse JSON → compute USD notional
│ (asyncio) │ filter by MIN_LIQUIDATION_USD
└──────┬──────┘
│
▼
┌─────────────┐
│ Telegram │ format message → send to channel
│ Bot API │
└─────────────┘
- Connect to Aster's all-market liquidation stream (
!forceOrder@arr). - Parse each
forceOrderevent — extract symbol, side, price, quantity. - Filter — skip anything below the USD threshold.
- Format — build a concise message with direction indicator, symbol hashtag, USD amount, and price.
- Send — post to the configured Telegram channel.
Liquidation direction:
SELLside = a long position was liquidated (forced sell) → 🔴BUYside = a short position was liquidated (forced buy) → 🟢
├── main.py # Entry point
├── src/
│ ├── aster_config.py # Configuration (env vars)
│ ├── aster_liquidation_detector.py # Core detection & alerting logic
│ └── aster_symbol_manager.py # Symbol metadata from exchange API
├── requirements.txt
├── .env.example # Template for your .env file
└── logs/ # Auto-created, daily rotation
MIT