Skip to content

dante4rt/meteora-telegram-bot

Repository files navigation

Meteora Telegram Bot

Telegram bot for monitoring and managing Meteora DLMM LP positions. View positions, track PnL, get alerts, and close positions -- all from Telegram. Powered by LP Agent API.

Meteora Bot Demo

Commands

Command Description
/positions Open LP positions with PnL, fees, range status
/history Last 10 closed positions
/overview Portfolio metrics (total PnL, win rate, APR)
/revenue Daily/weekly/monthly revenue breakdown
/balance Wallet token balances
/discover Top 5 pools by 24h volume
/pool <addr> Pool details (fees, liquidity, type)
/close Close a position and swap to SOL
/alerts Current alert thresholds

Close Position

/close walks you through an interactive flow:

  1. Shows your open positions as buttons
  2. Tap a position to see a quote
  3. Confirm to execute -- closes 100%, swaps to SOL via Jupiter
  4. Returns a Solscan transaction link

Caution

/close executes a real on-chain transaction. Double-check the position before confirming. There is no undo.

Alerts

The bot checks positions on a cron interval and notifies when:

  • PnL crosses upper/lower thresholds
  • Position goes out of range (or back in)
  • Unclaimed fees hit a milestone
  • DPR drops below minimum

No open positions = no alerts, the monitor idles.

Auto position updates

The bot sends a compact summary of all open positions at a configurable interval (default: every 1 minute). Each update shows pair, value, PnL%, range status, fees, and DPR. Only sends when there are open positions.

Set POSITION_UPDATE_INTERVAL in your .env to control the frequency (in minutes).

Auto TP/SL

Automatically closes positions when PnL crosses take-profit or stop-loss thresholds.

  • AUTO_TP_PERCENT=10 -- close when PnL >= +10%
  • AUTO_SL_PERCENT=-15 -- close when PnL <= -15%

Note

Requires SOLANA_PRIVATE_KEY to execute on-chain closes. Without it, the bot sends an alert but does not close the position.

Caution

Auto TP/SL executes real on-chain transactions. Set thresholds carefully. Each position is only auto-closed once -- if the close fails, it retries on the next check cycle.

Retry mechanism

All API calls retry up to 3 times on 429 (rate limit) and 5xx (server error) responses. Backoff is exponential: 2s, 4s, 8s. Non-retryable errors (4xx, network) fail immediately.

Setup

1. Get your keys

  • Telegram Bot Token -- create via @BotFather
  • Telegram Chat ID -- send a message to your bot, then check https://api.telegram.org/bot<TOKEN>/getUpdates
  • LP Agent API Key -- get from lpagent.io (free tier: 5 RPM)
  • Wallet Address -- your Solana wallet

2. Configure

cp .env.example .env

Edit .env with your values:

TELEGRAM_BOT_TOKEN=your_token
TELEGRAM_CHAT_ID=your_chat_id
LPAGENT_API_KEY=your_api_key
WALLET_ADDRESS=your_solana_wallet

# Required for /close and auto TP/SL (base58 private key)
# SOLANA_PRIVATE_KEY=

# Optional alert thresholds
ALERT_PNL_UPPER=20        # notify when PnL >= 20%
ALERT_PNL_LOWER=-10       # notify when PnL <= -10%
ALERT_FEE_MILESTONE=5     # notify every $5 in unclaimed fees
ALERT_DPR_MIN=1            # notify when DPR < 1%
ALERT_CHECK_INTERVAL=2    # check every 2 minutes

# Auto updates and TP/SL
POSITION_UPDATE_INTERVAL=1  # send position summary every N minutes
AUTO_TP_PERCENT=10          # auto close when PnL >= 10%
AUTO_SL_PERCENT=-15         # auto close when PnL <= -15%

3. Run

npm install
npm run build
npm start

For development:

npm run dev

Docker

docker build -t meteora-bot .
docker run -d --env-file .env --name meteora-bot meteora-bot

Note

Free tier is limited to 5 requests per minute. The bot queues requests automatically, but responses may be slightly delayed under heavy use.

Warning

Never commit your .env file. It contains your API keys and wallet address.

Rate Limiting

The API client tracks request timestamps and queues anything beyond 5 RPM. The alert monitor uses ~0.5 RPM (1 call every 2 minutes), leaving room for manual commands.

Stack

  • grammY -- Telegram bot framework
  • LP Agent API -- Meteora DLMM data + zap-out
  • TypeScript, node-cron, axios

License

MIT

About

Telegram bot that monitors your Meteora DLMM LP positions and sends alerts when thresholds are crossed. Powered by the LP Agent API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors