Building a Real-Time Crypto Sniper Bot for Detecting Pump & Short Opportunities

Must Read

In the fast-moving world of cryptocurrency trading, timing is everything—especially when dealing with volatile assets like meme coins. Identifying rapid price surges (pumps) and catching early signs of reversals can provide a significant trading edge.

In this guide, we’ll walk through how to build a real-time crypto sniper bot using Python. This bot monitors market activity, detects momentum shifts, and alerts you when a potential short opportunity appears—all without repeating signals during the same session.


🧠 How the Sniper Bot Works

The bot combines two powerful data sources:

  • Market filtering via CoinGecko API
  • Real-time price tracking via Binance WebSocket

Step-by-step logic:

  1. Filter Coins
    Select low market cap, high-volume coins that show recent upward movement.
  2. Track Prices in Real-Time
    Use WebSocket streams to receive live trade data.
  3. Calculate Momentum
    Compare current prices with previous ones to detect acceleration or slowdown.
  4. Detect Signals
    • 🚀 Pump → price accelerating upward
    • 🔥 Short Signal → momentum turns negative (possible top)
  5. Avoid Repeated Signals
    Each signal is only triggered once per session.
Full Python Code
import requests
import websocket
import json
import threading

# Prevent duplicate signals
sent_signals = set()

def get_candidates():
    url = "https://api.coingecko.com/api/v3/coins/markets"

    params = {
        "vs_currency": "usd",
        "order": "volume_desc",
        "per_page": 50,
        "page": 1,
        "price_change_percentage": "1h"
    }

    data = requests.get(url, params=params).json()
    pairs = []

    for coin in data:
        change = coin.get("price_change_percentage_1h_in_currency", 0)
        market_cap = coin.get("market_cap", 0)
        volume = coin.get("total_volume", 0)

        if change and change > 1 and market_cap < 500_000_000 and volume > 2_000_000:
            symbol = coin["symbol"].lower() + "usdt"
            pairs.append(symbol)

    return pairs


last_prices = {}
momentum = {}

def on_message(ws, message):
    msg = json.loads(message)

    if "data" not in msg:
        return

    data = msg["data"]

    symbol = data['s']
    price = float(data['p'])

    prev = last_prices.get(symbol)

    if prev:
        diff = price - prev

        momentum[symbol] = momentum.get(symbol, [])[-5:] + [diff]
        avg_momentum = sum(momentum[symbol]) / len(momentum[symbol])

        short_key = f"SHORT_{symbol}"
        pump_key = f"PUMP_{symbol}"

        if avg_momentum > 0 and pump_key not in sent_signals:
            print(f"🚀 {symbol} Pump detected")
            sent_signals.add(pump_key)

        if avg_momentum < 0 and len(momentum[symbol]) > 3:
            if short_key not in sent_signals:
                print(f"🔥 SHORT SIGNAL: {symbol} possible top")
                sent_signals.add(short_key)

    last_prices[symbol] = price


def start_socket(symbols):
    if not symbols:
        symbols = ["dogeusdt"]

    streams = "/".join([f"{s}@trade" for s in symbols])
    url = f"wss://stream.binance.com:9443/stream?streams={streams}"

    ws = websocket.WebSocketApp(url, on_message=on_message)
    ws.run_forever()


if __name__ == "__main__":
    symbols = get_candidates()

    if not symbols:
        symbols = ["dogeusdt"]

    thread = threading.Thread(target=start_socket, args=(symbols,))
    thread.start()

⚙️ Requirements

Install dependencies:

pip install requests websocket-client

📊 Example Output

🚀 DOGEUSDT Pump detected
🔥 SHORT SIGNAL: DOGEUSDT possible top

⚠️ Important Notes

  • This bot does not guarantee profits—it provides signals, not decisions.
  • Always confirm entries with price action or indicators.
  • Market conditions change quickly, especially with meme coins.

🚀 Conclusion

By combining real-time data with simple momentum analysis, you can build a powerful crypto sniper tool. This system helps you:

  • Detect fast-moving opportunities
  • Avoid emotional trading
  • Focus only on high-probability setups

With further improvements—like alerts, dashboards, or advanced indicators—you can turn this into a professional-grade trading assistant.


💡 Next Steps

Consider upgrading your bot with:

  • Telegram alerts
  • Volume spike detection
  • Confidence scoring system
  • Integration with trading dashboards

Start simple. Optimize later. Trade smart.

Building a Real-Time Crypto Sniper Bot for Detecting Pump & Short Opportunities

Telegram | Twitter | coinmarketcap

- Advertisement -
- Advertisement -
Latest News

Why CME wants phone traders slinging leveraged Nvidia contracts at 3 AM after earnings drop

At 4:05 pm in New York, a large tech company releases earnings. The main stock session has ended, executives...
- Advertisement -

More Articles Like This

- Advertisement -