Fetch Historical Trades
Fetch historical trade and swap data for any supported Solana AMM or DEX program. Filter by token, market, program, time range, authority, or fee payer—and use the results for flow analysis, charts, and execution analytics.
Why This Endpoint?
The Vybe historical trades endpoint provides:
- Filter by program, mints, or market — Base/quote token mint, single mint (either side), or market ID; when
marketAddressis provided, base/quote mint params are ignored - Time window —
timeStartandtimeEnd(unix timestamps) to scope the range - Pagination —
page(0-based) andlimit; default/max 1000 trades per page - Sorting — Sort by
priceorblockTimeascending or descending (only one sort at a time) - Rich per-trade fields — Price, base/quote sizes, fee, signature, slot, program, market, authority, fee payer
Use it to build token trade history tables, DEX flow dashboards, backtesting pipelines, and wallet activity views.
Endpoint
GET /v4/trades
Replaces: GET /token/trades
Parameters
All parameters are optional. Combine them to narrow results (e.g. token + time range + program).
| Parameter | Type | Description |
|---|---|---|
programAddress | string (pubkey) | DEX/AMM program where the trade occurred |
baseMintAddress | string (pubkey) | Base token mint |
quoteMintAddress | string (pubkey) | Quote token mint |
mintAddress | string (pubkey) | Either base or quote token; when used with marketAddress, base/quote filters are ignored |
marketAddress | string (pubkey) | Market/pool ID; when provided, base/quote mint params are ignored |
authorityAddress | string (pubkey) | Signer who authorized the trade |
feePayerAddress | string (pubkey) | Account that paid transaction fees (e.g. trading wallet) |
timeStart | number (int64) | Start time (unix timestamp) |
timeEnd | number (int64) | End time (unix timestamp) |
resolution | string | Deprecated; possible values 1h, 1d, 1w, 1m, 1y or seconds string |
page | number (int32) | Page index (0-based) |
limit | number (int32) | Trades per page; default/max 1000 |
sortByAsc | string | Sort ascending by price or blockTime; mutually exclusive with sortByDesc |
sortByDesc | string | Sort descending by price or blockTime; mutually exclusive with sortByAsc |
Example Request
curl "https://api.vybenetwork.com/v4/trades?mintAddress=So11111111111111111111111111111111111111112&limit=5&sortByDesc=blockTime" \
-H "X-API-Key: YOUR_API_KEY"With time range and program:
curl "https://api.vybenetwork.com/v4/trades?baseMintAddress=So11111111111111111111111111111111111111112"eMintAddress=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&programAddress=whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc&timeStart=1700000000&timeEnd=1700086400&limit=10" \
-H "X-API-Key: YOUR_API_KEY"Example Response
{
"data": [
{
"signature": "5Vv...",
"blockTime": 1769454123,
"slot": 312456789,
"marketAddress": "HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ",
"programAddress": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc",
"baseMintAddress": "So11111111111111111111111111111111111111112",
"quoteMintAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"baseSize": "1.5",
"quoteSize": "185.25",
"price": "123.5",
"fee": "0.002",
"authorityAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"feePayerAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"txIndex": 0,
"ixOrdinal": 1,
"iixOrdinal": 0,
"interIxOrdinal": 255
}
]
}Response Fields Explained
Each object in data is a single trade with these fields:
| Field | Description |
|---|---|
signature | The unique transaction signature on the blockchain |
blockTime | Unix timestamp at which the trade occurred |
slot | Slot of the trade |
marketAddress | Address of the market pair where the trade took place |
programAddress | Public key of the AMM or DEX program that facilitated the trade |
baseMintAddress | Mint address of the base token |
quoteMintAddress | Mint address of the quote token |
baseSize | Quantity of the base token (string) |
quoteSize | Amount of the quote token exchanged (string) |
price | Price of one unit of the base token in quote terms (string) |
fee | Fee amount paid for the trade (string) |
authorityAddress | Public key of the signer who authorized the trade |
feePayerAddress | Public key of the account that paid transaction fees |
txIndex | Transaction index of the trade |
ixOrdinal | Location of the trade instruction within the transaction |
iixOrdinal | Location of the trade inner instruction; 255 if not applicable |
interIxOrdinal | Location of the trade inside an instruction (e.g. 2-hop swaps); 255 if not applicable |
Common Use Cases
| Use Case | Implementation |
|---|---|
| Token trade history | Use mintAddress or baseMintAddress (and optional quoteMintAddress), plus optional timeStart / timeEnd |
| Market-level trades | Use marketAddress from Fetch Markets / Pools |
| DEX-specific flow | Filter by programAddress; see Available DEXs & AMMs for program IDs |
| Wallet or trader activity | Filter by authorityAddress or feePayerAddress |
| Charts / backtesting | Set timeStart and timeEnd, use limit and page, and sort by blockTime |
| Spam or low-size filtering | Fetch with token/market filters, then filter client-side by quoteSize or baseSize |
Best Practices
Combine with Markets
Use Fetch Markets / Pools to get marketAddress and program IDs, then call /v4/trades with marketAddress or programAddress for targeted results.
Set a time range
Set timeStart and/or timeEnd when you need a specific window; otherwise you rely on API defaults. Use limit and page to walk through large ranges.
Use one sort at a time
Use sortByAsc=blockTime or sortByDesc=blockTime for chronological order. Only one of sortByAsc or sortByDesc can be used per request.
Program IDs
Get canonical program addresses from Available DEXs & AMMs (e.g. Orca Whirlpool, Raydium CLMM, Phoenix).
Example: Fetch trades for a token
async function fetchTokenTrades(mintAddress, options = {}) {
const { timeStart, timeEnd, limit = 10 } = options;
const params = new URLSearchParams({
mintAddress,
limit: String(limit),
sortByDesc: "blockTime",
});
if (timeStart != null) params.set("timeStart", String(timeStart));
if (timeEnd != null) params.set("timeEnd", String(timeEnd));
const res = await fetch(
`https://api.vybenetwork.com/v4/trades?${params}`,
{ headers: { "X-API-Key": process.env.VYBE_API_KEY } }
);
const { data } = await res.json();
return data;
}
// Usage: last 10 trades for wSOL
const trades = await fetchTokenTrades("So11111111111111111111111111111111111111112");
console.log(`Fetched ${trades.length} trades`);
if (trades.length) console.log("Latest:", trades[0]);Related Endpoints
- Token Details & Metrics — Token metadata and price to pair with trade data
- Fetch Markets / Pools — Get market IDs and program info for filtering trades
- Fetch OHLC Candles — Aggregated OHLC for charting
- Available DEXs & AMMs — Supported programs for
programAddress - Real-Time Trades — Live trade stream via WebSocket
Updated 21 days ago