pumpdata.funGet a free keyFor agents and builders →

How to build a pump.fun trading bot: watch coins live, buy and sell

In short

A working pump.fun bot runs one loop: find coins, check them, watch them trade, buy, and leave. This page shows each step on pumpdata.fun, with the call it uses and what to decide from the answer, and ends with one Python file that runs the whole loop in paper mode. The watching runs on the stream, a WebSocket of every trade on the coins you follow, about 1.5 seconds after each block. The stream has a 30-day free trial.

The loop

StepWhat the bot asksCallCost
1. FindWhich coins are worth a look?GET /screener.json, /launches/since.json, /graduations/since.json, /trending.jsonfree
2. CheckWho launched it, who holds it, is the volume real?GET /check/{mint}.json, GET /now/{mint}.jsonfree with a key
3. WatchAre different people buying? Is a big holder leaving?wss://pumpdata.fun/stream?mints=30-day free trial
4. BuyBuild, sign, send.POST /buy, POST /send0.4% of the trade
5. ExitHas a top holder sold? Has it hit the take or the stop?the stream, then POST /sell0.4% of the trade

Most bots fail at step 5. They poll a price every few seconds, and a coin can lose half its value between two polls when a large holder sells. The stream tells the bot about that sell about 1.5 seconds after it happens.

Set up

  1. Get a free key. Enter your email and we send a link; the key is shown once, when you open it. Send it as x-api-key on every call.
  2. The stream needs no sign-up: the key's 30-day free trial starts the first time it connects.
  3. Run in paper mode first. The example bot only prints what it would trade until you set LIVE=1.

1. Find coins

Poll one of the free feeds. Each answers with a cursor, so the bot sees every coin once.

  • GET /launches/since.json?check=1: every new launch, with the deployer's record and the first 10 seconds of buying.
  • GET /graduations/since.json: coins whose bonding curve just completed. A bot that buys only graduates skips the 98% of launches that never get there.
  • GET /screener.json: young coins that already pass five volume and holder rules.
  • GET /trending.json?window=1h: the coins with the most SOL flowing in.

Polling is the right tool here. Use the stream's one connection for the coins you follow (step 3).

2. Check before watching

GET /check/{mint}.json answers the questions that do not change: how many coins this deployer launched before and how many graduated, how much of the supply the first 10 seconds of buyers took, and how launches like it went. GET /now/{mint}.json answers the ones that do: market cap, holders, the top 10's share, buys and sells over 5 minutes to 12 hours, and whether the volume has the shape of a volume bot.

Decide your own skip rules from these. Common ones: skip a deployer with dozens of launches and no graduate, skip when the top 10 hold more than 30%, and treat "unknown" as a skip.

A bot that re-checks many coins every few seconds should ask for them together: GET /now.json?mints=a,b,c answers up to 50 coins in one call, on the monthly plan.

3. Watch several coins on the stream

Open one connection that follows every coin you watch or hold, up to 200:

wss://pumpdata.fun/stream?key=pdk_...&types=trade&mints=<mint>,<mint>,<mint>

Each buy and sell on those coins arrives as one JSON message:

{"type":"trade","venue":"pumpswap","slot":466369940,"idx":12,"ts":1794023998,"mint":"C5xph2...pump","pool":"9fZk3...x7","wallet":"7jQwHd...hch","side":"buy","sol":1.2,"token_amount":5770000000000}

Two decisions come straight from these messages.

  • Count different buyers. Each message has the trader's wallet. Count the different wallets that buy in a minute, from the moment you start following the coin. Wallets that buy a near-identical amount in the same slot are usually one buyer, so count them once.
  • Skip when a top holder is selling. Every sell carries the seller's place among the holders: seller_rank, seller_share_pct, sold_pct, and top_holder_sell, which is true when a top-10 holder with at least 1% of the supply sells 25% or more of its holding. One builder skips any coin where this fires before the buy. All four coins their bot skipped in its first days stopped trading within hours. Four coins is a small sample, so test it on your own.

The followed coins are set when the connection opens. When the list changes, close the socket and open it again with the new mints=. A client that falls a few seconds behind is disconnected, so always reconnect on close.

4. Buy

pumpdata builds the trade and your bot signs it. No key is ever sent to pumpdata.

POST /buy   {"mint": "<mint>", "sol": 0.05, "wallet": "<your wallet>"}
  -> {"tx": "<unsigned transaction, base64>", "venue": "pumpswap", "quote": {...}, "fee": ...}

sign tx with your wallet's key, on your machine

POST /send  {"tx": "<signed transaction, base64>"}
  -> {"signature": "...", "landed": true, "fills": {...}}
  • The same call works on the bonding curve and on PumpSwap after graduation.
  • fills has the exact tokens and SOL the trade moved, so the bot needs no second lookup.
  • Options: slippage_bps (default 1000), priority, tip_lamports.
  • A 409 "already sent" from /send means this transaction went out before. Look up its signature. Never send the same signed trade twice.
  • The fee is 0.4% of the SOL side, inside the same transaction.

5. Hold and exit

Keep the coins you hold in the same mints= list. The stream now does the watching:

  • A top holder sells: top_holder_sell is true on the sell message. Leave, or re-check the coin and leave if the price confirms it.
  • A run of large sells: add up sol on sells over the last few seconds.
  • Take and stop: compare GET /now/{mint}.json's market cap with the market cap at entry.

To hear only top-holder sells on the coins you hold, add top_holder_sells=1 to the URL. Sell everything with POST /sell {"mint", "tokens": "all", "wallet"}, then sign and send as in step 4.

The whole bot, in one file

This runs all five steps: it takes the screener's passes, watches them on the stream, buys when 8 different wallets buy within a minute, skips or sells when a top holder sells, and takes or stops on market cap. It trades on paper until you set LIVE=1. Copy it with the button in the block's corner, download bot.py, or clone it from GitHub.

"""A pump.fun bot on pumpdata.fun: find, watch on the stream, buy, exit. Paper mode unless LIVE=1.

  pip install requests websockets solders
  PUMPDATA_KEY=pdk_... python bot.py                       # paper: prints what it would do
  PUMPDATA_KEY=pdk_... WALLET_SECRET=... LIVE=1 python bot.py

The rules below are examples, not advice. Most pump.fun coins go to zero.
Guide: https://pumpdata.fun/pump-fun-trading-bot-guide
"""
import asyncio, base64, json, os, time
import requests, websockets

API = "https://pumpdata.fun"
KEY = os.environ["PUMPDATA_KEY"]
H = {"x-api-key": KEY}
LIVE = os.environ.get("LIVE") == "1"
SIZE_SOL = 0.05      # SOL per buy
MAX_FOLLOW = 20      # coins watched or held at once (the bot plan follows 20, the whole stream 200)
MIN_BUYERS = 8       # different buyers in a minute before buying
TAKE, STOP = 1.5, 0.7  # sell at 1.5x or 0.7x the market cap at entry

watching, holding = {}, {}   # mint -> state
changed = asyncio.Event()    # the followed coins changed: reconnect the stream


def get(path):
    r = requests.get(API + path, headers=H, timeout=10)
    return r.json() if r.ok else None


def post(path, body):
    r = requests.post(API + path, json=body, headers=H, timeout=30)
    return r.status_code, r.json()


def trade(side, mint):
    """Build with /buy or /sell, sign here, send with /send. The key never leaves this machine."""
    if not LIVE:
        print("paper", side, mint)
        return True
    from solders.keypair import Keypair
    from solders.transaction import VersionedTransaction
    kp = Keypair.from_base58_string(os.environ["WALLET_SECRET"])
    body = {"mint": mint, "wallet": str(kp.pubkey())}
    body.update({"sol": SIZE_SOL} if side == "buy" else {"tokens": "all"})
    code, built = post("/" + side, body)
    if code != 200:
        print(side, "not built:", built)
        return False
    tx = VersionedTransaction.from_bytes(base64.b64decode(built["tx"]))
    signed = VersionedTransaction(tx.message, [kp])
    code, sent = post("/send", {"tx": base64.b64encode(bytes(signed)).decode()})
    # 409 "already sent": this build went out before. Look the signature up; never send it twice.
    print(side, mint, code, sent.get("signature"), sent.get("fills"))
    return code == 200


async def find():
    """Step 1: candidates. Here, the coins that pass the screener; any feed works."""
    while True:
        screen = await asyncio.to_thread(get, "/screener.json") or {}
        for row in screen.get("pass", []):
            m = row["mint"]
            if m not in watching and m not in holding and len(watching) + len(holding) < MAX_FOLLOW:
                watching[m] = {"since": time.time(), "buys": [], "wallets": set(), "same": set()}
                changed.set()
        await asyncio.sleep(60)


async def leave(mint, why):
    if holding.pop(mint, None) is not None:
        print("exit", mint, why)
        await asyncio.to_thread(trade, "sell", mint)
        changed.set()


async def on_trade(ev):
    """Steps 3 and 5: every trade on a followed coin arrives here about 1.5 s after its block."""
    m = ev.get("mint")
    if ev.get("type") != "trade":
        return
    if ev["side"] == "sell" and ev.get("top_holder_sell"):
        if m in holding:
            await leave(m, "a top holder sold")
        elif watching.pop(m, None) is not None:
            print("skip", m, "a top holder sold before we bought")
            changed.set()
    elif ev["side"] == "buy" and m in watching:
        w = watching[m]
        # wallets buying a near-identical amount in the same slot count as one buyer
        same = (ev["slot"], round(ev.get("sol") or 0, 2))
        if ev["wallet"] not in w["wallets"] and same not in w["same"]:
            w["buys"].append(time.time())
        w["wallets"].add(ev["wallet"])
        w["same"].add(same)


async def listen():
    while True:
        mints = ",".join([*watching, *holding])
        if not mints:
            await asyncio.sleep(5)
            continue
        changed.clear()
        url = f"wss://pumpdata.fun/stream?key={KEY}&types=trade&mints={mints}"
        try:
            async with websockets.connect(url) as ws:
                while not changed.is_set():
                    try:
                        await on_trade(json.loads(await asyncio.wait_for(ws.recv(), 5)))
                    except asyncio.TimeoutError:
                        pass
        except Exception as e:   # closed, refused, or too slow to keep up: connect again
            print("stream:", e)
            await asyncio.sleep(2)


async def manage():
    """Steps 2, 4 and 5: decide on the coins watched, and take or stop on the coins held."""
    while True:
        now = time.time()
        for m, w in list(watching.items()):
            if now - w["since"] < 60:
                continue
            buyers = sum(1 for t in w["buys"] if now - t < 60)
            if buyers >= MIN_BUYERS:
                coin = await asyncio.to_thread(get, f"/now/{m}.json") or {}
                del watching[m]
                if coin.get("market_cap_usd") and await asyncio.to_thread(trade, "buy", m):
                    holding[m] = {"entry": coin["market_cap_usd"]}
                changed.set()
            elif now - w["since"] > 900:
                del watching[m]
                changed.set()
        for m, h in list(holding.items()):
            coin = await asyncio.to_thread(get, f"/now/{m}.json") or {}
            cap = coin.get("market_cap_usd")
            if cap and (cap >= h["entry"] * TAKE or cap <= h["entry"] * STOP):
                await leave(m, "take" if cap >= h["entry"] else "stop")
        await asyncio.sleep(10)


async def main():
    await asyncio.gather(find(), listen(), manage())

if __name__ == "__main__":
    asyncio.run(main())

The numbers in it (8 buyers, 1.5x, 0.7x) are placeholders. Run it on paper, log what it would have done, and change them from what you see. To test a rule over months of past launches instead of waiting, use the bulk files: every trade as daily Parquet.

Rules people use

These are the rules that come up again and again when people describe their bots. We list them so you can try them, with the call each one needs. We have not found any of them to be profitable, and the profit claims that travel with them are not ours.

RuleWhat it meansCall
Check first, refuse mostSkip a coin whose first 10 seconds of buyers took a large share of the supply, or whose deployer has many launches and no graduate. Bots built this way pass a few coins in a hundred.GET /check/{mint}.json
Buy survivorsIgnore launches. Buy only coins that graduated, or that already reached a market cap you choose.GET /graduations/since.json, GET /screener.json
Follow known walletsBuy only when a wallet you track has bought in the last minute.GET /trades/since.json?wallets=, or the wallet on each stream trade
Count different buyersBuy when enough different wallets are buying at once. The example bot's rule.the stream
Look for one holder behind many walletsSkip when the biggest holders are one bag split across wallets, or were funded from the same place.GET /holders/{mint}.json (same_size), GET /wallet/{address}/funding.json
Leave when a top holder sellsSell, or re-check, when a top-10 holder sells a large part of its holding.the stream (top_holder_sell)
Fixed exitsA hard stop and fixed takes, run by code that the rest of the bot cannot override. People use stops from 6% to 25% and sell in parts on the way up.GET /now/{mint}.json, POST /sell
Small, capped positionsOne position at a time, or a cap on the share of the wallet in one coin, with a slippage limit.slippage_bps on POST /buy

One rule we did measure is the dip bounce: a graduated coin 40% off its high, then four red and two green one-minute candles. Of 2,981 such entries from October 9 to November 7, 2026, 79.0% touched 10% above the entry, and 78.1% went on to halve. The whole study. Test a rule on past trades before you trust it with money.

What to know before going live

  • The stream is about 1.5 seconds behind the chain. It does not win the first block of a launch.
  • The trial is the whole stream on one connection for 30 days, once per key. After it, a bot like this one fits the bot plan: every trade on up to 20 coins you follow, $29 a month. The plans are on the stream page.
  • The holder fields cover coins the holder index has, which began Nov 8, 2026. A coin it does not cover has no seller_rank; treat that as unknown.
  • A coin whose pool trades in another token than SOL carries quote_mint and quote_amount on its trades in place of sol.
  • Nothing here is advice. On a typical day about 2% of new pump.fun coins graduate.

Questions

Is there a pump.fun WebSocket API?

Yes. wss://pumpdata.fun/stream sends every pump.fun create, bonding-curve and PumpSwap trade, curve completion and migration about 1.5 seconds after its block. Every free key has a 30-day free trial that starts on its first connect.

How do I watch several pump.fun coins at once?

Open one stream connection with mints= set to the coins, up to 200, and types=trade. Every buy and sell on those coins arrives as a JSON message. To change the coins, reconnect with the new list.

Can a bot buy and sell through pumpdata?

Yes. POST /buy or /sell returns an unsigned transaction for your wallet. Your bot signs it on its own machine and sends it with POST /send. pumpdata never holds a key. The fee is 0.4% of the SOL side.

Is the stream fast enough to snipe a launch?

No. Messages arrive about 1.5 seconds after the block, so a bot on it cannot win the first block. It suits bots that decide over seconds or minutes: watching buyers build, and leaving when a top holder sells.

How does a bot know when a top holder sells?

Each sell on a coin your connection follows carries seller_rank, seller_share_pct, sold_pct and top_holder_sell. top_holder_sell is true when a top-10 holder with at least 1% of the supply sells 25% or more of its holding.

Every message and field: the stream page. Every call: the docs and OpenAPI. Building something on this? Write to support@pumpdata.fun; several things on this page exist because a bot builder asked.