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 marketAddress is provided, base/quote mint params are ignored
  • Time windowtimeStart and timeEnd (unix timestamps) to scope the range
  • Paginationpage (0-based) and limit; default/max 1000 trades per page
  • Sorting — Sort by price or blockTime ascending 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).

ParameterTypeDescription
programAddressstring (pubkey)DEX/AMM program where the trade occurred
baseMintAddressstring (pubkey)Base token mint
quoteMintAddressstring (pubkey)Quote token mint
mintAddressstring (pubkey)Either base or quote token; when used with marketAddress, base/quote filters are ignored
marketAddressstring (pubkey)Market/pool ID; when provided, base/quote mint params are ignored
authorityAddressstring (pubkey)Signer who authorized the trade
feePayerAddressstring (pubkey)Account that paid transaction fees (e.g. trading wallet)
timeStartnumber (int64)Start time (unix timestamp)
timeEndnumber (int64)End time (unix timestamp)
resolutionstringDeprecated; possible values 1h, 1d, 1w, 1m, 1y or seconds string
pagenumber (int32)Page index (0-based)
limitnumber (int32)Trades per page; default/max 1000
sortByAscstringSort ascending by price or blockTime; mutually exclusive with sortByDesc
sortByDescstringSort 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&quoteMintAddress=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:

FieldDescription
signatureThe unique transaction signature on the blockchain
blockTimeUnix timestamp at which the trade occurred
slotSlot of the trade
marketAddressAddress of the market pair where the trade took place
programAddressPublic key of the AMM or DEX program that facilitated the trade
baseMintAddressMint address of the base token
quoteMintAddressMint address of the quote token
baseSizeQuantity of the base token (string)
quoteSizeAmount of the quote token exchanged (string)
pricePrice of one unit of the base token in quote terms (string)
feeFee amount paid for the trade (string)
authorityAddressPublic key of the signer who authorized the trade
feePayerAddressPublic key of the account that paid transaction fees
txIndexTransaction index of the trade
ixOrdinalLocation of the trade instruction within the transaction
iixOrdinalLocation of the trade inner instruction; 255 if not applicable
interIxOrdinalLocation of the trade inside an instruction (e.g. 2-hop swaps); 255 if not applicable

Common Use Cases

Use CaseImplementation
Token trade historyUse mintAddress or baseMintAddress (and optional quoteMintAddress), plus optional timeStart / timeEnd
Market-level tradesUse marketAddress from Fetch Markets / Pools
DEX-specific flowFilter by programAddress; see Available DEXs & AMMs for program IDs
Wallet or trader activityFilter by authorityAddress or feePayerAddress
Charts / backtestingSet timeStart and timeEnd, use limit and page, and sort by blockTime
Spam or low-size filteringFetch 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