◈   ⌬ bots · Intermediate

Binance Telegram Alerts with Python: Full Setup Guide

Learn how to build real-time Binance Telegram alerts using Python — from API setup to filtering signals and automating your trading notifications.

Uncle Solieditor · voc · 06.05.2026 ·views 13
◈   Contents
  1. → Why Python Is the Right Tool for Crypto Alerts
  2. → Setting Up Your Binance and Telegram Credentials
  3. → Building the Price Alert Engine
  4. → Signal Filtering: Separating Noise from Actionable Alerts
  5. → Signal-to-Action Workflows for Traders
  6. → Deploying Your Alert Bot to Run 24/7
  7. → Frequently Asked Questions
  8. → Putting It All Together

Missing a price move because you weren't watching the screen is one of the most frustrating experiences in crypto trading. The market hit your target at 3 AM, blew through your stop, and you woke up to a loss or a missed entry. Building a Binance Telegram alerts system in Python solves this — your bot watches the market around the clock and pings you the moment something actionable happens. This guide walks through the full setup: connecting to Binance's API, wiring up a Telegram bot, and writing clean filtering logic so your phone doesn't buzz on every 0.1% move.

Why Python Is the Right Tool for Crypto Alerts

Python sits at the intersection of readable code and powerful libraries, which makes it the default choice for traders who want to automate without spending weeks learning a language. The python-binance library wraps the entire REST and WebSocket API — you can subscribe to live price streams, order book updates, or kline (candlestick) data in under 20 lines of code. Telegram's Bot API is equally simple: one HTTP POST and a message lands in your chat.

Compared to manual dashboard monitoring across Binance, Bybit, or OKX, a Python script running on a cheap VPS gives you persistent, 24/7 coverage without keeping a browser tab open. It also scales — once the infrastructure is in place, adding a new alert condition is adding a few lines of logic, not rebuilding a workflow from scratch.

Setting Up Your Binance and Telegram Credentials

Before writing a line of code, you need two things: a Binance API key and a Telegram bot token. On Binance, go to API Management under your profile, create a new key, and enable read-only permissions — you don't need trading permissions just to receive price data, and keeping permissions minimal is basic security hygiene. Store the key and secret in environment variables, never hardcoded in your script.

For Telegram, open a chat with @BotFather, run /newbot, follow the prompts, and copy the token it gives you. Then message your new bot once — any text — so Telegram opens a chat thread. You'll also need your chat ID, which you can get by calling the getUpdates endpoint after sending that first message. With both credentials ready, the actual code comes together quickly.

pip install python-binance requests python-dotenv
import os
from dotenv import load_dotenv
from binance.client import Client
import requests

load_dotenv()

BINANCE_API_KEY = os.getenv("BINANCE_API_KEY")
BINANCE_SECRET = os.getenv("BINANCE_SECRET")
TELEGRAM_TOKEN = os.getenv("TELEGRAM_TOKEN")
TELEGRAM_CHAT_ID = os.getenv("TELEGRAM_CHAT_ID")

client = Client(BINANCE_API_KEY, BINANCE_SECRET)

def send_telegram(message: str):
    url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage"
    payload = {"chat_id": TELEGRAM_CHAT_ID, "text": message, "parse_mode": "HTML"}
    requests.post(url, json=payload)
Never commit API keys to GitHub. Use a .env file locally and environment variables on your VPS. A leaked Binance key with withdrawal permissions has emptied accounts — read-only is safer for alert bots.

Building the Price Alert Engine

The simplest alert pattern is a threshold check: if the price crosses a level you care about, fire a message. But a naive polling loop that hits the REST API every second will burn through your rate limits fast. The better approach is subscribing to Binance's WebSocket streams, which push data to your script as it happens — no polling, no rate limit headaches, and sub-second latency.

from binance import ThreadedWebsocketManager

ALERT_LEVELS = {
    "BTCUSDT": {"above": 70000, "below": 60000},
    "ETHUSDT": {"above": 4000, "below": 3200},
}

alerted = set()  # prevent duplicate alerts

def handle_message(msg):
    if msg.get("e") != "24hrTicker":
        return

    symbol = msg["s"]
    price = float(msg["c"])
    levels = ALERT_LEVELS.get(symbol)

    if not levels:
        return

    key_above = f"{symbol}_above"
    key_below = f"{symbol}_below"

    if price > levels["above"] and key_above not in alerted:
        send_telegram(f"🚀 {symbol} crossed ABOVE ${levels['above']:}\nCurrent: ${price:,.2f}")
        alerted.add(key_above)
    elif price < levels["below"] and key_below not in alerted:
        send_telegram(f"⚠️ {symbol} dropped BELOW ${levels['below']:}\nCurrent: ${price:,.2f}")
        alerted.add(key_below)

twm = ThreadedWebsocketManager(api_key=BINANCE_API_KEY, api_secret=BINANCE_SECRET)
twm.start()
twm.start_ticker_socket(callback=handle_message, symbol="BTCUSDT")
twm.start_ticker_socket(callback=handle_message, symbol="ETHUSDT")
twm.join()

The alerted set prevents your phone from being spammed every tick once a level is crossed. In production you'd reset this set on a timer or when price moves back through the level — that logic is a few extra lines but critically important for usability. Platforms like Bybit and OKX have similar WebSocket APIs if you want to extend the same pattern to multiple exchanges.

Signal Filtering: Separating Noise from Actionable Alerts

Raw price alerts are just the starting point. Most traders who build alert systems quickly realize that price alone isn't enough — you want context. Is volume spiking? Is this a breakout or a fake-out? Adding a few lightweight filters turns a noise machine into a signal worth acting on.

One effective filter is volume confirmation. If BTCUSDT breaks above $70,000 but 24-hour volume is below its 7-day average, the breakout is suspect. You can pull the 24hr ticker data from Binance's REST API and add a volume check before the alert fires. Another filter is the candle close — waiting for a 15-minute candle to close above the level rather than alerting on a wick reduces false positives significantly.

def get_volume_ratio(symbol: str, interval: str = "1d", lookback: int = 7) -> float:
    """Returns today's volume / average of last N days."""
    klines = client.get_klines(symbol=symbol, interval=interval, limit=lookback + 1)
    volumes = [float(k[5]) for k in klines]
    today_vol = volumes[-1]
    avg_vol = sum(volumes[:-1]) / len(volumes[:-1])
    return today_vol / avg_vol if avg_vol > 0 else 0

def should_alert(symbol: str, direction: str) -> bool:
    ratio = get_volume_ratio(symbol)
    if ratio < 0.8:  # volume below 80% of average — skip
        return False
    return True

This is exactly the kind of logic that separates a useful alert system from a noisy one. VoiceOfChain applies similar multi-factor filtering to its real-time trading signals — raw price movement gets cross-referenced against volume, volatility context, and momentum indicators before an alert reaches traders. Combining your own threshold alerts with aggregated signal feeds from platforms like VoiceOfChain gives you both customization and institutional-grade filtering without building everything from scratch.

Alert Filter Strategies and Their Use Cases
Filter TypeWhat It ChecksBest For
Price ThresholdClose above/below a fixed levelKey support/resistance levels
Volume RatioCurrent volume vs N-day averageBreakout confirmation
RSI ConditionRSI overbought (>70) or oversold (<30)Mean-reversion setups
Candle CloseWait for candle to close before alertingReducing wick false positives
Percent Change% move in last X minutesMomentum/volatility detection

Signal-to-Action Workflows for Traders

An alert is only as good as what you do when it fires. Having a pre-defined response for each alert type is the difference between disciplined trading and reactive decision-making. Before you deploy your bot, map out your signal-to-action workflow for each alert condition it monitors.

For example: your bot fires a Telegram alert — ETHUSDT closed above $3,800 on a 4-hour candle with 1.3x average volume. Your workflow: check the broader market context on Binance spot and futures, confirm BTC isn't in a local distribution phase, set a limit entry at $3,780 with a stop at $3,650 and a first target at $4,100. That workflow lives in your head before the alert ever fires, so when your phone buzzes at 2 AM you're executing, not thinking.

VoiceOfChain's signal feed integrates well into this kind of workflow. When their platform detects a momentum shift across on-chain and market data, you get a structured signal with context — not just a price number. Pairing that with your own Python-based threshold alerts on Binance means you're covered from two angles: custom levels you've identified from your own analysis, plus aggregated signals catching moves you might have missed.

Always test your alert bot on Binance Testnet before pointing it at live data. Testnet uses the same API structure but fake funds — it's the safest way to validate your logic without consequences.

Deploying Your Alert Bot to Run 24/7

A bot running on your laptop stops alerting the moment you close the lid. For continuous operation, you need a VPS — a small cloud server that runs independently. A $5/month instance on any major cloud provider is more than sufficient for a Python alert bot monitoring a handful of symbols. The script uses minimal CPU and RAM.

Once your script is on the server, use systemd or tmux to keep it running. Systemd is cleaner for production — it restarts your bot automatically if it crashes, logs output, and starts on server reboot. Here's a minimal service file:

# /etc/systemd/system/binance-alerts.service
[Unit]
Description=Binance Telegram Alert Bot
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/alerts-bot
EnvironmentFile=/home/ubuntu/alerts-bot/.env
ExecStart=/usr/bin/python3 /home/ubuntu/alerts-bot/main.py
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
sudo systemctl enable binance-alerts
sudo systemctl start binance-alerts
sudo systemctl status binance-alerts  # verify it's running

With this setup, your bot survives server reboots, network blips, and Python exceptions — it just restarts and resumes monitoring. If you're also tracking signals from Bitget or Gate.io alongside Binance, each exchange can run as a separate service or as async tasks within the same script.

Frequently Asked Questions

Do I need a paid Binance account to use the API for alerts?
No. A free Binance account gives you full access to the public market data API, including WebSocket streams for price, volume, and kline data. You only need additional permissions (and potentially a higher account tier) if you want to place trades programmatically.
How many symbols can I monitor simultaneously with Python WebSockets?
Binance allows up to 1024 streams per WebSocket connection, which covers far more symbols than most traders need. For large-scale monitoring across hundreds of pairs, use the combined stream endpoint to batch multiple symbols into a single connection and reduce overhead.
Will my Telegram bot work if Binance's API goes down briefly?
WebSocket connections will drop during outages and your script will need to reconnect. The ThreadedWebsocketManager handles reconnection automatically in most cases, but adding explicit error handling and a reconnect loop is good practice for a production setup.
Can I use this same setup with Bybit or OKX instead of Binance?
Yes, both Bybit and OKX have Python libraries (pybit and python-okx respectively) with similar WebSocket structures. The Telegram notification logic stays identical — only the exchange client and stream subscription code changes per exchange.
How is this different from just using Binance's built-in price alerts?
Binance's native alerts only support simple price thresholds. A Python bot lets you combine multiple conditions — price level AND volume AND indicator state — before firing an alert. You also control the message format, can log every alert to a database, and can trigger automated actions beyond just sending a notification.
Is there a risk of getting rate-limited by Binance when running a bot?
WebSocket streams don't count against REST rate limits, so they're the preferred method for continuous monitoring. If you do use REST polling, Binance's rate limit is 1200 requests per minute for most endpoints — well within reach for a small personal bot, but easy to exceed if you poll many symbols at high frequency.

Putting It All Together

Building a Binance Telegram alert system in Python is one of the highest-leverage things an active trader can do with a weekend's worth of effort. The core stack — python-binance for data, a simple HTTP call for Telegram delivery, and systemd for persistence — is stable, battle-tested, and cheap to run. The real value isn't the technology; it's the discipline it enforces. When your alerts are precise and your response playbook is defined, market moves stop being stressful surprises and start being pre-planned decision points.

Start simple: one or two symbols, a price threshold, a volume filter. Run it live for a week and see which alerts you actually act on versus which ones you ignore. Tune from there. For traders who want curated signal coverage beyond their own technical levels, VoiceOfChain's real-time signal platform complements this setup well — their aggregated signals catch momentum shifts that pure price alerts miss, and they integrate cleanly into a Telegram-based workflow. Whether you're monitoring BTC on Binance, altcoins on KuCoin, or perpetuals on Bybit, the monitoring infrastructure you build once keeps working for you indefinitely.

◈   more on this topic
⌘ api Kraken API Documentation for Crypto Traders: Essentials and Examples ◉ basics Mastering the ccxt library documentation for crypto traders