Top traders of a token by volume
POST /api/token-top-tradersMost active traders of a token by volume over a recent block window on Base or Ethereum...
Details
Most active traders of a token by volume over a recent block window on Base or Ethereum, read from the token's Uniswap v2 and v3 pool Swap logs on chain. Each wallet (the sender of the swapping transaction, so router and aggregator swaps are credited to the signer) with its bought, sold and net amounts in the token and in USD, its trade and transaction counts, and its first and last block in the window. Rank by gross volume, net bought or net sold. Bounded reads: a capped window and transaction count, with a partial window flagged in fields. Amounts and counts only, not a rating or a recommendation.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
token | string | yes | ERC-20 token address (0x...). Also accepted as jwt, accessToken. The example sends 0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf. |
network | string | no | base (default) or ethereum. The example sends base. |
blocks | number | no | Window length in blocks up to the head: base default 1800 (about an hour), at most 7200; ethereum default 300, at most 1200. |
limit | number | no | Wallets returned, 1-50 (default 20). The example sends 5. |
rank | string | no | volume (gross USD volume, default), bought (largest net buyers) or sold (largest net sellers). |
Example request
curl -i -X POST https://agent402.tools/api/token-top-traders \
-H "Content-Type: application/json" \
-d '{"token":"0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf","network":"base","limit":5}'Watch a call get paid
POST /api/token-top-traders$0.01 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"network": "base",
"chainId": 8453,
"token": {
"address": "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf",
"symbol": "cbBTC",
"decimals": 8
},
"rank": "volume",
"window": {
"fromBlock": 63796100,
"toBlock": 63797899,
"blocks": 1800,
"approxSeconds": 3600,
"coveredFromBlock": 63796100,
"coveredBlocks": 1800,
"complete": true
},
"partial": false,
"partialReasons": [],
"pools": [
{
"address": "0xfbb6eed8e7aa03b138556eedaf5d271a5e1e43ef",
"version": "v3",
"fee": 500,
"quote": "USDC"
}
],
"quotePricesUsd": {
"USDC": 1,
"WETH": 1651.42
},
"totals": {
"swaps": 120,
"transactions": 95,
"traders": 30,
"volumeUsd": 149025.4,
"tokenVolume": 2.5
},
"traders": [
{
"address": "0x1a2b…9f0e",
"volumeUsd": 24440.16,
"boughtUsd": 12518.13,
"soldUsd": 11922.03,
"netUsd": 596.1,
"boughtToken": 0.21,
"soldToken": 0.2,
"netToken": 0.01,
"trades": 12,
"transactions": 9,
"firstSeenBlock": 63796210,
"lastSeenBlock": 63797880
}
],
"returned": 5,
"matched": 30,
"complete": false,
"truncated": true,
"method": {
"trader": "The trader is the sender (from) of the transaction that made the swap, read per transaction, so a swap routed through a router or aggregator is credited to the wallet that signed it. A contract that settles other wallets' orders in one transaction is credited as one trader.",
"amounts": "Per swap, the token amount the pool paid out is bought and the amount it took in is sold; a transaction that swaps through two of the token's pools counts both legs. net = bought - sold.",
"usd": "USD values are the quote side of each swap: stablecoin quotes at 1 USD, WETH at the reference WETH/USDC v3 pool's price at the window's last block (not at each swap's time).",
"window": "The window is the last `blocks` blocks up to two blocks under the head. firstSeenBlock and lastSeenBlock are the wallet's first and last swap blocks inside the covered window.",
"pools": "The token's Uniswap v3 pools (every fee tier) and v2 pair against each quote token listed in quotePricesUsd. Swaps on other venues are not read."
},
"reads": {
"httpRequests": 4,
"rpcCalls": 110,
"rpcCallCeiling": 171
},
"source": "onchain",
"fetchedAt": "2026-11-29T12:00:00.000Z"
}| Field | Type | Always present | In the example |
|---|---|---|---|
network | string | yes | base |
chainId | number | yes | 8453 |
token | object | yes | 3 fields: address, symbol, decimals |
rank | string | yes | volume |
window | object | yes | 7 fields: fromBlock, toBlock, blocks, approxSeconds, coveredFromBlock and 2 more |
partial | boolean | yes | false |
partialReasons | array | yes | 0 items in the example |
pools | array of objects | yes | 1 item in the example |
quotePricesUsd | object | yes | 2 fields: USDC, WETH |
totals | object | yes | 5 fields: swaps, transactions, traders, volumeUsd, tokenVolume |
traders | array of objects | yes | 1 item in the example |
returned | number | yes | 5 |
matched | number | yes | 30 |
complete | boolean | yes | false |
truncated | boolean | yes | true |
method | object | yes | 5 fields: trader, amounts, usd, window, pools |
reads | object | yes | 3 fields: httpRequests, rpcCalls and 1 more |
source | string | yes | onchain |
fetchedAt | string | yes | 2026-11-29T12:00:00.000Z |
From an MCP client
catalog.call {
"slug": "token-top-traders",
"params": {
"token": "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
"network": "base",
"limit": 5
}
}Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.18.0): pays from a wallet or an AGENT402_CREDITS_KEY issued earlier.
Errors and behavior
- Pay $0.01 per call over x402 or MPP. Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - Required:
token; a rejected input answers 4xx witherror,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key. A Tempo push credential pays before the call; a failure is a refund owed.
- A bodyless
GETorHEADreturns the same 402 quote. - An
Idempotency-Keyreplays the first 200 uncharged (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.01" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/token-top-traders", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"token": "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
"network": "base",
"limit": 5
}),
});Get a wallet or run npx -y agent402-mcp@0.18.0 wallet new.
The quote (Python)
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/api/token-top-traders", method="POST", data="{\"token\":\"0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf\",\"network\":\"base\",\"limit\":5}".encode(), headers={"Content-Type": "application/json"})
try:
urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]]) # the price, per chain, in base units