Skip to content

About

Real-time crypto price alert bot for Telegram, built with the Binance API, asyncio and SQLAlchemy. Linted and tested with GitHub Actions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🤖 Telegram Crypto Alert Bot

A Telegram bot that monitors cryptocurrency prices and sends real-time alerts

CI Python Telegram Binance License GitHub Unofficial


📌 About the Project

A Telegram bot that monitors cryptocurrency prices in real time via the Binance API and sends customized alerts when prices hit the thresholds set by the user. Built with python-telegram-bot on a fully asynchronous architecture.

⚠️ Unofficial project — not affiliated with Telegram or Binance. It independently uses Binance's public API and Telegram's bot API.

Features

  • ✅ Real-time price lookup for any crypto pair (BTC/USDT, ETH/USDT, etc.)
  • ✅ Above/below price alerts with a user-defined value
  • ✅ List of active alerts per user
  • ✅ Asynchronous background monitoring
  • ✅ SQLite persistence — alerts survive restarts
  • ✅ Automatic rate limiting respecting Binance API limits

🛠️ Technologies

  • python-telegram-bot — Official framework for Telegram bots
  • aiohttp — Asynchronous HTTP client for the Binance API
  • SQLAlchemy — ORM for alert persistence
  • asyncio — Native asynchronous programming
  • APScheduler — Scheduling of periodic monitoring jobs

📁 Structure

telegram-crypto-alert-bot/
├── bot/
│   ├── main.py              # Entry point
│   ├── handlers.py          # Command handlers
│   ├── binance_client.py    # Binance API client
│   ├── database.py          # Alert persistence
│   └── monitor.py           # Background monitoring job
├── tests/
├── .github/workflows/ci.yml
├── requirements.txt
├── requirements-dev.txt
├── .env.example
└── README.md

🧪 Development

pip install -r requirements-dev.txt
ruff check . && ruff format --check .
pytest -v

Tests mock the Binance API and Telegram objects and run against an isolated in-memory SQLite database. The same checks run on every push and pull request via GitHub Actions.


📦 Installation

Prerequisites

Steps

git clone https://github.com/LacerdaTraderCode/telegram-crypto-alert-bot.git
cd telegram-crypto-alert-bot

python -m venv venv
source venv/bin/activate      # Linux/Mac
# venv\Scripts\activate       # Windows

pip install -r requirements.txt

cp .env.example .env
# Edit .env and add your TELEGRAM_BOT_TOKEN

python -m bot.main

💬 Available Commands

Command Description Example
/start Welcome message /start
/help Lists all commands /help
/price <pair> Current price of the pair /price BTCUSDT
/alert <pair> <above|below> <value> Creates an alert /alert BTCUSDT above 70000
/alerts Lists active alerts /alerts
/remove <id> Removes an alert by ID /remove 3

🖼️ Usage Example

User: /price BTCUSDT
Bot: 💰 BTCUSDT: $67,432.50 (+2.15% in 24h)

User: /alert BTCUSDT above 70000
Bot: ✅ Alert created! I'll notify you when BTCUSDT passes $70,000

[when the price rises...]
Bot: 🚨 ALERT! BTCUSDT reached $70,150 — your target was $70,000

🔒 Security

  • ✅ Bot token is never committed (kept in .env)
  • ✅ Each user only sees their own alerts
  • ✅ Rate limiting prevents Binance API abuse
  • ✅ Error handling on all asynchronous operations

🚀 24/7 Deploy

  • VPS — DigitalOcean, Linode, Contabo
  • Railway or Render — free tier available
  • Raspberry Pi — ideal for personal use

✅ Requirements

  • Python 3.11 or higher
  • Telegram bot token

👤 Author

Wagner Lacerda — Senior Software Engineer | Python, Backend, AI Apps, Automation & Systems

GitHub LinkedIn YouTube Telegram Telegram Bots

📍 Rio Grande do Sul, Brazil


📄 License

Distributed under the MIT license. See LICENSE for more details.

About

Real-time crypto price alert bot for Telegram, built with the Binance API, asyncio and SQLAlchemy. Linted and tested with GitHub Actions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages