For developers

Check Token Unlock Risk Before Your Bot Buys (Python)

Before your bot buys an ERC-20 token, compare its upcoming unlocks with the liquidity and volume that must absorb them. One Python file, two API calls.

·8 min read·By Non Fungible Howard

A token can look fine on a chart a week before a large unlock lands on it. When a team or investor tranche releases, those holders can sell into the same pool your bot just bought from. If the unlock is worth more than a day of trading, the price usually has to move to absorb it.

This guide adds an unlock check to a Python trading bot for EVM chains (Ethereum, Base, BNB Chain, Arbitrum and others). It asks the Vestream API two questions: how much unlocks in the next 30 days compared with the token's liquidity, volume and market cap, and whether any locked supply can be pulled back by the sender. There's a Solana version too.

⚡The short version

Call GET /token/{chainId}/{address}/pressure for unlocks against liquidity, 24-hour volume and market cap, and GET /token/{chainId}/{address}/summary for locked supply, what can be cancelled and the next unlock. Flag a token when unlock_to_daily_volume is above 1 or the biggest single day is a large share of a day's volume. Treat every result as an input to your own rules. Not trading advice.

What the two calls tell you

QuestionFieldEndpoint
Is the next month's unlock bigger than a day of trading?ratios.unlock_to_daily_volume/pressure
Is one day's unlock a big share of a day's trading?ratios.biggest_day_to_daily_volume/pressure
Could the unlock drain the pool?ratios.unlock_to_liquidity/pressure
How much of the supply is still locked?locked_now, locked_share_of_supply/summary
Can the sender cancel part of the lock?cancelable_locked/summary
When is the next unlock, and how big?next_unlock/summary

Ratios are null when the token has no market deep enough to value the unlock honestly. Your rules should treat that as "unknown", not as "safe".

Set up

  • A Vestream key. Get one free at vestream.io/build. It appears on screen straight away; confirm your email within 24 hours to keep it. Put it in VESTREAM_API_KEY.
  • Python 3.9 or later and requests (pip install requests).
  • The chain id of the token: 1 Ethereum, 10 Optimism, 56 BNB Chain, 137 Polygon, 8453 Base, 42161 Arbitrum, 43114 Avalanche. The full list.

The check, in one file

Save this as unlock_risk.py. It caches each token for an hour, because vesting schedules change daily, not by the second.

python
# unlock_risk.py: token unlock risk check for an EVM trading bot
import os
import time
import requests

API = "https://www.vestream.io/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['VESTREAM_API_KEY']}"}
CACHE_SECONDS = 3600
_cache: dict[tuple, tuple[float, dict]] = {}


def _get(path: str, params: dict | None = None) -> dict:
    key = (path, tuple(sorted((params or {}).items())))
    hit = _cache.get(key)
    if hit and time.time() - hit[0] < CACHE_SECONDS:
        return hit[1]
    res = requests.get(f"{API}{path}", headers=HEADERS, params=params, timeout=20)
    if res.status_code == 429:
        raise RuntimeError(f"Vestream limit reached: {res.json().get('error')}")
    res.raise_for_status()
    body = res.json()
    _cache[key] = (time.time(), body)
    return body


def unlock_risk(chain_id: int, address: str, days: int = 30) -> dict:
    # EVM addresses are case-insensitive; Solana mints (chain 101) are not.
    addr = address.lower() if address.startswith("0x") else address
    token = f"/token/{chain_id}/{addr}"
    pressure = _get(f"{token}/pressure", {"days": days})
    summary = _get(f"{token}/summary")

    flags = []
    r = pressure["ratios"]
    if r["unlock_to_daily_volume"] is not None and r["unlock_to_daily_volume"] > 1:
        flags.append(f"next {days}d unlocks are {r['unlock_to_daily_volume']:.1f}x a day of volume")
    if r["biggest_day_to_daily_volume"] is not None and r["biggest_day_to_daily_volume"] > 0.5:
        day = pressure["biggest_day"]["date"]
        flags.append(f"{day}: one day's unlock is over half a day of volume")
    if r["unlock_to_liquidity"] is not None and r["unlock_to_liquidity"] > 0.25:
        flags.append(f"unlocks are {r['unlock_to_liquidity']:.0%} of pool liquidity")
    if int(summary["cancelable_locked"]) > 0:
        flags.append("some locked supply can be cancelled by the sender")
    if pressure["market"] is None:
        flags.append("no market deep enough to value the unlocks (unknown, not safe)")

    return {
        "token": summary["token_symbol"],
        "flags": flags,
        "locked_share_of_supply": summary["locked_share_of_supply"],
        "next_unlock": summary["next_unlock"],
        "coverage": summary["coverage"],
    }


if __name__ == "__main__":
    import sys
    print(unlock_risk(int(sys.argv[1]), sys.argv[2]))

Run it on any token from the command line (python unlock_risk.py 8453 0x…), or call it before every buy:

python
from unlock_risk import unlock_risk

check = unlock_risk(chain_id=8453, address=candidate_address)
if check["flags"]:
    print(f"skip {check['token']}: " + "; ".join(check["flags"]))
else:
    place_order(candidate_address)  # your buy logic

Choosing your thresholds

The numbers in the file are a starting point, not a recommendation. Some ways to tune them:

  • Hold time. A bot that exits within hours cares about next_unlock and the biggest day this week. A bot holding for weeks should look at the 30 or 90-day window (days goes up to 90).
  • Linear streams. Streams release a little every second, so they count toward the window's total but never make a "biggest day". A token that vests linearly can have a high unlock_to_daily_volume and no single scary date.
  • Unlocking isn't selling. Recipients often hold, stake or claim weeks later. Our research on claim timing found most unlocked tokens aren't claimed on the day. The ratios measure what could be sold, not what will be.

Keeping it inside your limits

  • Two calls per new token. The free plan is 250 calls a month and 50 a day, so it suits testing or a bot that shortlists a handful of tokens a day. Run your cheap filters (liquidity, age, honeypot checks) first and only check the tokens that pass.
  • Cache. The file caches each answer for an hour, in memory. For a bot that restarts often, cache to disk or Redis.
  • A watchlist in one request. POST /batch/tokens returns summaries for up to 25 tokens in one request (each token counts as one call).
  • More volume. Starter is $49 a month for 1,000 calls, with commercial use and webhooks. See plans.
⚠️No vesting found is not the same as safe

Many tokens have no team or investor allocation in a vesting contract at all, and some vest on platforms or in custom contracts Vestream doesn't read. Then locked_now is 0 and next_unlock is null. That means no schedule was found on the platforms we index, not that none exists. The coverage field says what was checked.

Where to go next

Frequently Asked Questions

Which chains does this work on?

Every EVM chain Vestream indexes, including Ethereum, Base, BNB Chain, Arbitrum, Polygon, Optimism and Avalanche. For Solana, use chain id 101 and the mint address exactly as it is (Solana addresses are case-sensitive).

Where do the liquidity and volume figures come from?

From the token's DEX markets, refreshed every few minutes. The ratios are null when the market is too thin to value the unlock honestly.

Does a high ratio mean the price will fall?

No. It means the unlock is large compared with how much trades each day. Whether recipients sell, and whether buyers absorb it, is a separate question. This is information, not trading advice.

Is it free?

For testing and light use: 250 calls a month and 50 a day on the free plan. A bot that checks many tokens a day needs a paid plan.

Track your own token vesting

Paste any wallet, see every unlock across 13 protocols and 13 chains. Free, no sign-up.

Build with the same data

A free API key and MCP server for token vesting, lock and unlock data across every protocol we index.

Get a free API key →

Read the developer docs

More from Vestream Resources