Learn how to integrate a reliable Solana DEX trade data API into your trading bot or analytics dashboard. Get real-time swap history and volume metrics.
May 8, 2026

Solana’s decentralized exchanges process billions of dollars in trades every day. If you are building a trading bot, portfolio tracker, or institutional analytics dashboard, getting reliable access to a Solana DEX trade data API isn’t optional. It is the foundational infrastructure everything else depends on.
The engineering challenge is significant. Solana’s 400ms block times and massive transaction throughput mean trade data moves fast across multiple decentralized exchanges, including Jupiter, Raydium, and Orca. Relying solely on raw RPCs to parse this data demands heavy infrastructure and continuous protocol maintenance. High-performance teams bypass this friction by integrating a structured Solana DEX trade data API that aggregates fragmented on-chain state and delivers it in a clean, queryable format.
To reliably fetch Solana DEX trade data, developers should use a structured data provider like Birdeye Data rather than querying raw public RPC nodes. A dedicated API decodes complex smart contract instructions across multiple DEXs into unified JSON responses, enabling instant access to historical swaps, real-time token volumes, and liquidity metrics without maintaining custom indexing infrastructure.
It helps to know exactly what data models you are working with before writing a single API call.
A comprehensive Solana DEX trade data API generally surfaces distinct categories of data. Here is a breakdown of what structured APIs provide compared to raw RPCs:
| Data Category | Description | Use Case |
| Swap History | Individual trade records, including token pairs, amounts, prices, and timestamps. | Powering granular trading tools and transaction analytics. |
| Volume Metrics | Aggregated trading volume by token, DEX, or time period. | Conducting market analysis and identifying trending tokens. |
| Liquidity Data | Pool reserves, available liquidity, and fee structures across different AMMs. | Calculating routing efficiency and slippage models. |
| Price Impact | How large trades move token prices. | Developing MEV strategies and optimizing trade execution. |
Going directly to Solana RPC nodes introduces severe friction for developers:
A well-designed Solana DEX trade data API handles this heavy lifting, giving you the speed and reliability production applications demand.
The examples below use Birdeye Data, which provides high-performance, structured Solana DEX data through a single API, eliminating the need to parse raw RPC node data.
Start with your API key and a basic configuration to prepare your Solana DEX trade data API integration:
// config.js
const API_KEY = 'your-api-key-here';
const BASE_URL = 'https://public-api.birdeye.so';
const headers = {
'X-API-KEY': API_KEY,
'Content-Type': 'application/json'
};
module.exports = { BASE_URL, headers };
A reusable client keeps your Solana DEX trade data API calls clean and scalable:
// birdeyeClient.js
const axios = require('axios');
const { BASE_URL, headers } = require('./config');
class BirdeyeClient {
constructor() {
this.client = axios.create({
baseURL: BASE_URL,
headers,
timeout: 10000
});
}
async makeRequest(endpoint, params = {}) {
try {
const response = await this.client.get(endpoint, { params });
return response.data;
} catch (error) {
console.error('API request failed:', error.message);
throw error;
}
}
}
module.exports = BirdeyeClient;
Individual swap transactions are the most granular endpoints in a Solana DEX trade data API. Here is how to pull and structure them.
const BirdeyeClient = require('./birdeyeClient');
async function getRecentTrades(tokenAddress, limit = 50) {
const client = new BirdeyeClient();
const trades = await client.makeRequest('/defi/txs/token', {
address: tokenAddress,
tx_type: 'swap',
limit: limit,
sort_type: 'desc'
});
return trades.data.items.map(trade => ({
signature: trade.txHash,
timestamp: new Date(trade.blockUnixTime * 1000),
fromToken: trade.from.symbol,
toToken: trade.to.symbol,
fromAmount: trade.from.uiAmount,
toAmount: trade.to.uiAmount,
pricePerToken: trade.to.uiAmount / trade.from.uiAmount,
dex: trade.source,
trader: trade.owner
}));
}
// Example usage: WSOL
getRecentTrades('So11111111111111111111111111111111111111112')
.then(trades => {
console.log(`Found ${trades.length} recent trades:`);
trades.slice(0, 5).forEach(trade => {
console.log(`${trade.fromAmount} ${trade.fromToken} → ${trade.toAmount} ${trade.toToken}`);
});
});
For historical analysis, query the Solana DEX trade data API within specific windows:
async function getTradesInTimeRange(tokenAddress, startTime, endTime) {
const client = new BirdeyeClient();
const trades = await client.makeRequest('/defi/txs/token', {
address: tokenAddress,
tx_type: 'swap',
before: Math.floor(endTime.getTime() / 1000),
after: Math.floor(startTime.getTime() / 1000),
limit: 1000
});
return trades.data.items;
}
Individual trades tell you what happened. Aggregated data tells you what it means. A robust Solana DEX trade data API aggregates this instantly.
async function getTokenVolume(tokenAddress, timeframe = '24h') {
const client = new BirdeyeClient();
const overview = await client.makeRequest('/defi/token_overview', {
address: tokenAddress
});
return {
volume24h: overview.data.v24hUSD,
volume24hChange: overview.data.v24hChangePercent,
trades24h: overview.data.trade24h,
uniqueWallets24h: overview.data.uniqueWallet24h
};
}
Each Solana AMM has its own characteristics. Leverage your Solana DEX trade data API to filter by exchange and spot cross-DEX arbitrage opportunities.
async function analyzeTradesByDEX(tokenAddress, timeHours = 24) {
const client = new BirdeyeClient();
const endTime = new Date();
const startTime = new Date(endTime.getTime() - timeHours * 60 * 60 * 1000);
const trades = await client.makeRequest('/defi/txs/token', {
address: tokenAddress,
tx_type: 'swap',
before: Math.floor(endTime.getTime() / 1000),
after: Math.floor(startTime.getTime() / 1000),
limit: 1000
});
const dexStats = {};
trades.data.items.forEach(trade => {
const dex = trade.source;
if (!dexStats[dex]) {
dexStats[dex] = { tradeCount: 0, totalVolume: 0, avgTradeSize: 0 };
}
dexStats[dex].tradeCount++;
dexStats[dex].totalVolume += trade.to.uiAmount;
});
Object.keys(dexStats).forEach(dex => {
dexStats[dex].avgTradeSize = dexStats[dex].totalVolume / dexStats[dex].tradeCount;
});
return dexStats;
}
For live data, safely poll the Solana DEX trade data API:
class TradeMonitor {
constructor(tokenAddress, callback) {
this.tokenAddress = tokenAddress;
this.callback = callback;
this.client = new BirdeyeClient();
this.lastTradeTime = Date.now();
this.isRunning = false;
}
async start(intervalMs = 5000) {
this.isRunning = true;
while (this.isRunning) {
try {
const newTrades = await this.getNewTrades();
if (newTrades.length > 0) {
this.callback(newTrades);
this.lastTradeTime = newTrades[0].blockUnixTime * 1000;
}
} catch (error) {
console.error('Error fetching new trades:', error.message);
}
await this.sleep(intervalMs);
}
}
async getNewTrades() {
const trades = await this.client.makeRequest('/defi/txs/token', {
address: this.tokenAddress,
tx_type: 'swap',
after: Math.floor(this.lastTradeTime / 1000),
limit: 50,
sort_type: 'desc'
});
return trades.data.items || [];
}
stop() { this.isRunning = false; }
sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
}
Production code must handle failures gracefully and stay within Solana DEX trade data API rate limits.
class RobustBirdeyeClient {
constructor(maxRetries = 3, retryDelay = 1000) {
this.client = new BirdeyeClient();
this.maxRetries = maxRetries;
this.retryDelay = retryDelay;
}
async makeRequestWithRetry(endpoint, params = {}) {
for (let attempt = 1; attempt <= this.maxRetries; attempt++) {
try {
return await this.client.makeRequest(endpoint, params);
} catch (error) {
if (error.response?.status === 429) {
const waitTime = this.retryDelay * Math.pow(2, attempt);
console.log(`Rate limited. Waiting ${waitTime}ms before retry...`);
await this.sleep(waitTime);
continue;
}
if (attempt === this.maxRetries) throw error;
await this.sleep(this.retryDelay);
}
}
}
sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
}
When querying a Solana DEX trade data API for multiple related data points, use Promise.all so they reflect the exact same block state:
async function getConsistentTokenData(tokenAddress) {
const client = new BirdeyeClient();
const [overview, trades, liquidity] = await Promise.all([
client.makeRequest('/defi/token_overview', { address: tokenAddress }),
client.makeRequest('/defi/txs/token', { address: tokenAddress, tx_type: 'swap', limit: 100 }),
client.makeRequest('/defi/token_liquidity', { address: tokenAddress })
]);
return {
timestamp: Date.now(),
overview: overview.data,
recentTrades: trades.data.items,
liquidityPools: liquidity.data.items
};
}
Getting programmatic access via a structured Solana DEX trade data API unlocks professional-grade applications: from basic portfolio trackers to automated MEV bots. The key engineering principles to carry into production are respecting rate limits, caching aggressively, and processing parallel requests for block consistency. The infrastructure cost of parsing raw RPC nodes is a bottleneck; leveraging Birdeye Data lets you skip the blockchain engineering and focus on your trading logic.
Parsing raw RPC data on Solana requires decoding complex instructions and maintaining massive databases to track state changes at 400ms intervals. A structured API processes this backend logic for you, delivering instant, clean JSON endpoints.
Yes. Platforms like Birdeye Data aggregate transactions across major Solana AMMs, including Jupiter, Raydium, and Orca, returning a unified data structure regardless of the source DEX.
Implement sliding window trackers in your application logic to process payload batches, and use exponential backoff mechanisms in your request clients to gracefully handle 429 Too Many Requests errors.
Birdeye provides expansive data covering tokens, wallets, trades, and protocols across 300+ exchanges on 10 chains.
Whether you’re a solo tinkerer or a large team looking to scale, Birdeye offers plans that caters for your data needs and budget.
Dive into our docs and start querying data on 60+ APIs and 8 WebSocket types today!
Insights is a feature that allows users to analyze market trends in various aspects and dive deep into many industry sectors.
Find Gems is a feature that helps user identify potential Tokens at the current time.
Launch Explorer is a feature that enables users to access real-time data of tokens on popular launchpads like pump.fun, letsbonk.fun,...
New insight article by Birdeye reveals USDC's breakout growth in recent years
Data by Birdeye shows total trading volume of xStocks, PreStocks, and Ondo Global Markets on Solana peaked in March 2026
After the Drift Protocol's hack, Solana Foundation initiated programs such as STRIDE and SIRIN to tighten security for ecosystem teams

May 10, 2026

May 10, 2026

May 10, 2026