₿ BTC Loading... via Binance

Tuesday, April 21, 2026

How to Set Up a Free Crypto Alert Bot With Python and Telegram

How to Set Up a Free Crypto Alert Bot With Python and Telegram

Most crypto traders pay between $20 and $80 per month for alert platforms that run four lines of logic under the hood. That's not an exaggeration. Tools like Coinbase Advanced, TradingView Pro, and various SaaS alert bots are all doing one thing: checking a price API and firing a notification. The code behind that feature is not complex. It's not proprietary. And it's not worth your subscription fee when you can build the same thing in an afternoon with Python and Telegram for exactly $0.

This is not a tutorial for developers. This is for traders who are tired of paying for something they can own.


Why Most Alert Tools Fail You at the Exact Moment You Need Them

Third-party alert services have a dirty little secret: they throttle notifications during high-volume market events. That's the moment BTC drops 12% in 90 minutes and every retail trader is hammering the same alert conditions simultaneously. The platforms slow down. You get your "BTC fell below $X" notification 20 minutes late. The trade is gone.

According to a 2025 analysis by Messari, over 60% of retail crypto traders cite missed or delayed alerts as a direct cause of at least one significant missed trade in the prior 12 months. That's not a tool problem. That's an architecture problem. When thousands of users share the same alert infrastructure, you are always in a queue.

When you run your own Python bot on a VPS or even your home machine, you are the only user. Your bot checks the price. Your bot sends the message. Nobody else's conditions slow yours down.

That's the first reason to build your own. The second reason is customization. Most SaaS alert tools let you set price thresholds and maybe RSI. Your own bot can alert you on:

  • BTC moving more than 3% in under 15 minutes
  • Volume spiking beyond a rolling 7-day average
  • The spread between BTC and ETH diverging past a set threshold
  • Any combination of conditions that match your actual strategy

You are not boxed into what a product manager decided to build.


What You Actually Need to Build This

No CS degree required. Here's the real stack:

Python 3.10+ - Free. You likely already have it.

python-telegram-bot library - Open source, well-documented, actively maintained.

CoinGecko API or Binance API - Both have free tiers. CoinGecko's free tier gives you real-time BTC prices with no API key required for basic calls. Binance's public endpoints give you deeper market data including volume, order book depth, and candlestick data.

A Telegram account and a bot token - Free. You create a bot through Telegram's BotFather in under two minutes.

A place to run the script - This can be your laptop while you're at your desk, but if you want 24/7 alerts, a cheap VPS works. DigitalOcean, Linode, and Hetzner all have plans starting under $5/month. That's still a fraction of what most alert platforms charge.

The full setup from zero to first alert takes most people 45 to 90 minutes the first time.


Building the Bot: The Actual Code Logic

Here's what the script does at a high level, written in plain English first:

  1. Every 60 seconds, the script calls the CoinGecko API and pulls the current BTC price
  2. It compares that price against your defined conditions
  3. If a condition is met, it sends a message to your Telegram chat via your bot
  4. It logs the alert and resets the condition so you don't get spammed

Here's a minimal working version:

```python import requests import time from telegram import Bot from telegram.ext import Application

TELEGRAM_TOKEN = "your_bot_token_here" CHAT_ID = "your_chat_id_here" ALERT_PRICE_BELOW = 70000 ALERT_PRICE_ABOVE = 85000 CHECK_INTERVAL = 60 # seconds

bot = Bot(token=TELEGRAM_TOKEN)

def get_btc_price(): url = "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd" response = requests.get(url) data = response.json() return data["bitcoin"]["usd"]

async def send_alert(message): await bot.send_message(chat_id=CHAT_ID, text=message)

def main(): alerted_below = False alerted_above = False

while True:
    price = get_btc_price()
    print(f"BTC Price: ${price}")

    if price < ALERT_PRICE_BELOW and not alerted_below:
        import asyncio
        asyncio.run(send_alert(f"ALERT: BTC dropped below ${ALERT_PRICE_BELOW}. Current: ${price}"))
        alerted_below = True
    elif price >= ALERT_PRICE_BELOW:
        alerted_below = False

    if price > ALERT_PRICE_ABOVE and not alerted_above:
        import asyncio
        asyncio.run(send_alert(f"ALERT: BTC crossed above ${ALERT_PRICE_ABOVE}. Current: ${price}"))
        alerted_above = True
    elif price <= ALERT_PRICE_ABOVE:
        alerted_above = False

    time.sleep(CHECK_INTERVAL)

if name == "main": main() ```

This is production-usable logic. It's not a toy. Add error handling around the API call for production use, and wrap the main loop in a try/except that catches connection timeouts so a momentary internet hiccup doesn't kill your bot.


A Real Use Case From My Own Trading

In early 2025, BTC was consolidating between $92,000 and $98,000 for about three weeks. I had a version of this bot running with a volume condition layered on top of the price condition. My rule was simple: alert me only if BTC breaks below $92,000 AND 1-hour volume on Binance is more than 40% above the 7-day average for that hour.

Volume spikes alongside price breaks are meaningful. Volume spikes without price movement are noise. A plain price alert would have fired multiple false positives during that range. My combined condition fired twice in three weeks. Both times were real, tradeable moves.

I executed both trades on Kraken because the order execution and fee structure are more favorable for the trade sizes I run. If you're not using Kraken yet, it's worth the switch. You can sign up here: Join Kraken Exchange

The entire alert setup that supported that trade took me one afternoon to build. No subscription. No third-party dependency. No latency queue.


The Contrarian Point Most Crypto Blogs Miss

Everyone talks about alert fatigue as a problem of receiving too many notifications. The actual problem is the opposite.

Most traders set their alerts too far from current price because they don't want to get pinged constantly. So they set a BTC alert at $65,000 when price is at $76,000. Then they forget about the market. Then price drifts to $72,000. Then it moves fast to $68,000. By the time the $65,000 alert fires, the setup they wanted to trade has already played out and they're chasing.

A well-built custom bot solves this with dynamic alerts. Instead of a static price level, you alert on percentage moves from a rolling reference point. If BTC moves more than 4% in either direction from the price at 9am UTC, you get an alert. That keeps your alert proximity relevant no matter what the market does overnight.

No SaaS tool on the market does this out of the box at the free tier. Every one of them charges you for dynamic or conditional alert logic. Your Python bot does it in ten extra lines of code.


Security: Don't Build This and Leave Your Assets Exposed

Building a bot that monitors your trading conditions is one thing. Making sure that bot doesn't become a vulnerability is another.

Your Telegram bot token is essentially a password. Store it in an environment variable, not hardcoded in your script. Use a .env file and the python-dotenv library. If you push your code to GitHub with a hardcoded token, bots will find it within minutes.

For your actual BTC holdings, the bot should only ever have read access to price data. It should not connect to your exchange wallet or have withdrawal permissions. Keep your keys off the machine running the bot.

Hardware wallets are still the only answer for anything you're not actively trading. Trezor keeps your keys physically isolated from everything. Check them out here: Get Trezor Hardware Wallet

A 2025 report from Chainalysis found that over 34% of self-reported crypto losses from individual traders involved compromised API keys or bot credentials. Your alert bot is not a risk vector if you treat its credentials the same way you treat your exchange passwords.


Key Takeaways

  • SaaS alert tools fail under load. During fast market moves, shared infrastructure creates notification delays. Your own bot runs independently and alerts you first.
  • Custom logic beats preset conditions. Combining price thresholds with volume or percentage move conditions cuts false positives dramatically and improves trade quality.
  • The build cost is almost zero. Python, Telegram, and CoinGecko's free API tier cover everything. A VPS for 24/7 uptime costs less per month than a single TradingView alert tier upgrade.
  • Dynamic alerts beat static ones. Alerting on percentage moves from a rolling reference point keeps your alerts relevant as price evolves. Static levels become useless fast.
  • Security is not optional. Store credentials as environment variables. Never connect your bot to withdrawal-enabled API keys. Keep long-term holdings on a hardware wallet.

Frequently Asked Questions

Do I need to know how to code to build this? You need basic Python familiarity at a minimum. If you can copy, paste, and edit variable names, you can get this running. ChatGPT and Claude are both genuinely useful for helping debug the script if you get stuck. Most people hit their first working alert within two hours of starting.

Is the CoinGecko free API reliable enough for real trading alerts? For price-level alerts, yes. CoinGecko's free tier allows around 10 to 30 calls per minute and has solid uptime. For high-frequency checks under 30 seconds, move to Binance's public WebSocket API instead. It streams real-time price data without polling and has no rate limit concerns for personal use.

What happens if the bot crashes at 3am and I miss a move? You add a process manager. On Linux, use systemd or PM2 to auto-restart the script if it exits. On Windows, Task Scheduler handles this. A two-minute restart lag during a crash is far better than a 20-minute notification delay on a busy SaaS platform. Uptime monitoring services like UptimeRobot can also ping you if the bot stops sending heartbeat messages.


Start Here

Run the basic price script locally tonight. Set one alert above and one below the current BTC price, close enough that you'll actually see it fire within a few hours. Watch the Telegram message come through. Once you see it work, you'll immediately start thinking about the conditions you actually want to monitor. That's the moment this goes from a tutorial to a real tool.

Follow BitBrainers. Analysis that asks the questions mainstream crypto media won't.

No comments:

FOMC Week and Crypto: What Happens to Bitcoin When the Fed Speaks

Every FOMC week, crypto Twitter turns into a noise machine. Price targets fly. Leverage builds. Everyone has a hot take. Most of it is thea...

FOMC Week and Crypto: What Happens to Bitcoin When the Fed Speaks