# Nado AlertsBot
A Telegram bot for Nado DEX that monitors your trades and positions in real time.
The bot is available on Telegram: @nado_alertstracker_bot
- Order fill alerts - instant notification when any of your orders is executed
- Open positions - view all your positions with unrealized PnL and liquidation price
- Margin health - check your account margin status at any time
- Auto margin alerts - automatic warning when your maintenance margin drops below a set threshold
- Session persistence - bot restores all sessions automatically after a restart
| Command | Description |
|---|---|
/setwallet 0x... |
Link your wallet and start monitoring |
/positions |
Open positions with PnL and liquidation price |
/health |
Margin health and account overview |
/status |
Current bot connection status |
/stop |
Disable notifications |
/help |
Show all commands |
- Python 3.11+
- Telegram bot token from @BotFather
git clone https://github.com/your-username/nado-bot.git
cd nado-bot
pip install -r requirements.txtCreate a .env file:
TELEGRAM_BOT_TOKEN=your_token_here
NETWORK=mainnetRun the bot:
python bot.pyAll settings are configured via environment variables in .env:
| Variable | Default | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
required | Token from @BotFather |
NETWORK |
mainnet |
mainnet or testnet |
HEALTH_CHECK_INTERVAL |
60 |
Seconds between margin checks |
MARGIN_ALERT_THRESHOLD |
10.0 |
Alert when margin ratio falls below this % |
MARGIN_ALERT_COOLDOWN |
3600 |
Seconds between repeated alerts (1 hour) |
The bot subscribes to a WebSocket stream for each linked wallet. When an order is filled on Nado, a notification is sent instantly with fill details: symbol, side, price, size, fee and order type.
Queries the Nado REST API (subaccount_info and isolated_positions) to fetch all open perp positions. Unrealized PnL is calculated as:
PnL = position_size * oracle_price + v_quote_balance
- Isolated positions - exact calculation: price at which isolated margin health = 0
- Cross positions - approximation: price move that would bring total account health to 0
Uses maintenance health from the API (healths[1]). Margin ratio is calculated as:
margin_ratio = health / assets * 100%
Status levels:
- 🟢 Healthy - ratio >= 25%
- 🟡 Caution - ratio >= 10%
- 🟠 Warning - ratio < 10% (alert triggered)
- 🔴 Danger - ratio < 0% (liquidation imminent)
- python-telegram-bot 21.9
- websockets 13.1
- httpx 0.28.1
- python-dotenv 1.0.1
MIT