All resources
Tutorial · Microstructure 8 min read

Filter whale prints from the raw trade tape in Python.

Optiom Research · runnable code, tested against the live API

Size talks. The trades endpoint serves the raw aggregated tape — every print with price, quantity and which side was the aggressor. Filter it for notional above a threshold and you get the whale feed: who is hitting bids, who is lifting offers, and what the net pressure looks like. This is the same data behind the Optiom Whales screen.

Fetch and filter

One call returns the recent tape. is_buyer_maker=true means the seller crossed the spread (aggressive sell); false means an aggressive buy. Multiply price by quantity, keep everything above your threshold, and aggregate by side.

import pandas as pd
import requests

BASE = "https://www.getoptiom.com/api/tradinghub"
SYMBOL = "BTCUSDT"
MIN_USD = 1_000_000  # whale threshold

res = requests.get(
    f"{BASE}/trades",
    params={"symbol": SYMBOL, "max_rows": 50_000},
    timeout=60,
)
res.raise_for_status()

df = pd.DataFrame(res.json()["rows"])
df["ts"] = pd.to_datetime(df["ts"], utc=True, format="mixed")
df["usd"] = df["price"] * df["qty"]
# is_buyer_maker=True means the SELLER hit the bid -> aggressive sell
df["side"] = df["is_buyer_maker"].map({True: "sell", False: "buy"})

whales = df[df["usd"] >= MIN_USD].sort_values("ts")
print(f"{len(whales)} whale prints >= {MIN_USD:,} USD out of {len(df)} trades "
      f"({df['ts'].min():%H:%M} → {df['ts'].max():%H:%M} UTC)\n")

print("Aggressive flow (whales only):")
print(whales.groupby("side")["usd"].agg(["count", "sum"]).round(0))

print("\nLast 10 whale prints:")
print(whales.tail(10)[["ts", "side", "price", "qty", "usd"]].round(2).to_string(index=False))

# net whale pressure over the window
net = whales.loc[whales["side"] == "buy", "usd"].sum() - whales.loc[whales["side"] == "sell", "usd"].sum()
print(f"\nNet whale pressure: {'+' if net >= 0 else ''}{net:,.0f} USD")

Reading the output

Repeated same-size prints seconds apart (like the 79.9 BTC clips in the sample output) are an execution algo slicing a large parent order — one player, not many. Net pressure over a window tells you which way size is leaning; it is most useful at levels you already care about, like the walls from the depth heatmap or the hot zones from liquidations.

Going further

Poll the endpoint every minute, keep a rolling window, and alert on prints above $5M or on net pressure crossing a threshold — the same pattern as the Telegram alerts tutorial. On Pro history you can join whale flow with subsequent returns and measure whether size actually predicts anything on your pairs.

Run it on your own data.

Create a free account for CSV exports, then move to API access as your workflow grows.