The DEX Trades API provides comprehensive trading data from leading decentralized exchanges (DEXs) like Uniswap, PancakeSwap, and 0x. This powerful tool delivers both historical and real-time trade analytics, enabling developers and traders to monitor token prices, liquidity pools, and smart contract interactions across multiple dimensions.
Key Features of the DEX Trades API
- Multi-DEX Coverage: Aggregate data from top decentralized exchanges in a single interface
- Flexible Filtering: Query by exchange protocols, tokens, trading pairs, or liquidity pools
- Real-Time & Historical Data: Access both live market data and historical trade records
- Smart Contract Analytics: Track gas fees, trade volumes, and protocol usage trends
๐ Explore live DEX trading pairs with our interactive API demo.
Understanding DEX Trade Cubes
DEX Trade Cubes represent every token swap executed on decentralized exchanges. Each trade contains:
- Two participating currencies (tokens or native blockchain currency)
- Buyer/seller identification (when applicable)
- Pool smart contract details for automated market maker (AMM) trades
When to Use DEX Trade Cubes
This data structure is ideal for:
- Protocol-level analytics
- Smart contract performance tracking
- Gas fee optimization studies
- DEX adoption trend analysis
Token-Centric Trade Analysis
The DEX Trades By Tokens endpoint organizes each trade as two separate records - one for each participating token. This dual-perspective approach enables:
- Complete order book visibility (both buy and sell sides)
- Accurate price discovery for specific tokens
- OHLC (Open-High-Low-Close) chart generation
๐ Discover token trading strategies using our advanced filtering system.
Best Practices for Token Queries
- Always apply at least one token filter
- Use time intervals for OHLC charting
- Combine with protocol filters for precise market analysis
Practical API Implementation Examples
OHLC Price Data Implementation
query TokenOHLC {
EVM(dataset: archive) {
DEXTradeByTokens(
where: {
Trade: {
Currency: {
SmartContract: {is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"}
}
Side: {
Currency: {
SmartContract: {is: "0xdac17f958d2ee523a2206206994597c13d831ec7"}
}
}
Dex: {SmartContract: {is: "0x4e68ccd3e89f51c3074ca5072bbac773960dfa36"}}
PriceAsymmetry: {le: 0.1}
}
}
limit: {count: 10}
) {
Block {
datefield: Date(interval: {in: days, count: 1})
}
volume: sum(of: Trade_Amount)
Trade {
high: Price(maximum: Trade_Price)
low: Price(minimum: Trade_Price)
open: Price(minimum: Block_Number)
close: Price(maximum: Block_Number)
Currency { Name }
Dex {
ProtocolName
SmartContract
}
}
count
}
}
}Frequently Asked Questions
What types of DEXs does the API support?
The API covers all major decentralized exchange protocols including Uniswap, SushiSwap, PancakeSwap, Curve, and other AMM-based and order book DEXs.
How frequently is the trade data updated?
Our system processes blockchain data in real-time, typically displaying trades within 30 seconds of blockchain confirmation.
Can I filter trades by specific wallet addresses?
Yes, the API supports filtering by both buyer and seller addresses, allowing precise portfolio tracking.
What time ranges are available for historical data?
Historical data availability varies by blockchain, with Ethereum data available back to genesis block and other chains from their respective launch dates.
How accurate are the price calculations?
Prices reflect actual executed trades with precision to 18 decimal places, ensuring accurate market representation.
Can I access liquidity pool information?
Yes, the API provides comprehensive pool data including reserves, trading volumes, and fee structures.
What authentication methods are supported?
We offer both API key authentication and OAuth2.0 for enterprise users requiring higher rate limits.
Are there rate limits for API calls?
Standard plans include 10 requests per second, with customizable enterprise plans available for high-volume users.