Accessing decentralized exchange (DEX) data on Ethereum has never been easier thanks to the power and flexibility of GraphQL APIs. Whether you're a developer building a DeFi analytics dashboard, a researcher tracking token movements, or a trader analyzing market trends, structured access to DEX trading data is essential. This guide walks you through real-world examples of querying Ethereum DEX data using GraphQL, covering everything from top protocols to OHLC price charts and token trading volumes.
With support for over 18 major DEX platforms—including Uniswap, Balancer, Kyber, 0x, and IDEX—these APIs deliver granular insights into trades, token pairs, block timestamps, and more.
👉 Discover how to build powerful blockchain queries in minutes with intuitive tools.
Core Keywords
- Ethereum DEX data
- GraphQL API
- DEX trading volume
- OHLC data
- Uniswap trades
- Token pair analysis
- Blockchain query language
- Real-time DEX analytics
Top DEX Protocols by Trade Volume
One of the most common use cases is identifying the most active decentralized exchanges on Ethereum. The following GraphQL query retrieves the top 100 DEX protocols ranked by the total number of trades:
{
ethereum(network: ethereum) {
dexTrades(options: { limit: 100, desc: "trades" }) {
protocol
started: minimum(of: date)
trades: count
}
}
}This query returns results like:
{
"protocol": "Uniswap v2",
"started": "2020-05-05",
"trades": 24836192
}From this output, you can observe that Uniswap v2 leads in trade volume, followed by legacy platforms like IDEX and EtherDelta. This kind of insight helps assess protocol adoption and user engagement trends across time.
Use this data to benchmark new DEX launches or evaluate market share shifts in the evolving DeFi landscape.
Latest Trades on a Specific DEX Protocol
Want to monitor real-time activity on a particular exchange? You can fetch the latest trades from any supported DEX. Here's an example for Uniswap v2:
{
ethereum(network: ethereum) {
dexTrades(
options: { limit: 10, desc: "trades" }
protocol: { is: "Uniswap v2" }
) {
protocol
buyCurrency {
symbol
address
}
buyAmount
sellCurrency {
symbol
address
}
sellAmount
trades: count
}
}
}Sample result:
{
"protocol": "Uniswap v2",
"buyCurrency": { "symbol": "USDT", "address": "0xdac17f958d2ee523a2206206994597c13d831ec7" },
"buyAmount": 1842158918.31,
"sellCurrency": { "symbol": "WETH", "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" },
"sellAmount": 4977863.83,
"trades": 379716
}These results show large-scale swaps between stablecoins and wrapped ETH—key indicators of liquidity movement and market sentiment.
👉 Learn how to integrate live DEX data into your applications seamlessly.
Latest Trades for a Specific Token Pair
To drill down further, you can query trades for a specific token pair, such as USDT-WETH on Uniswap v2. This requires passing the smart contract addresses of both tokens:
{
ethereum(network: ethereum) {
dexTrades(
options: { limit: 10, desc: ["block.height", "tradeIndex"] }
protocol: { is: "Uniswap v2" }
buyCurrency: { is: "0xdac17f958d2ee523a2206206994597c13d831ec7" }
sellCurrency: { is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" }
) {
block {
height
timestamp {
iso8601
}
}
transaction {
hash
}
tradeIndex
buyCurrency { symbol address }
buyAmount
sellCurrency { symbol address }
sellAmount
maker { address annotation }
taker { address annotation }
protocol
smartContract {
address { address annotation }
contractType
}
}
}
}Each result includes:
- Block height and timestamp
- Transaction hash
- Maker and taker addresses
- Exact amounts traded
This level of detail is invaluable for on-chain analysis, arbitrage detection, and smart money tracking.
OHLC Data for Price Analysis
For technical traders and charting tools, Open-High-Low-Close (OHLC) data is crucial. The following query generates OHLC candles for the USDT-WETH pair at 5-minute intervals:
{
ethereum(network: ethereum) {
dexTrades(
options: { limit: 10, asc: "timeInterval.minute" }
protocol: { is: "Uniswap v2" }
date: { is: "2020-10-10" }
buyCurrency: { is: "0xdac17f958d2ee523a2206206994597c13d831ec7" }
sellCurrency: { is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" }
) {
timeInterval { minute(count: 5) }
buyCurrency { symbol address }
buyAmount
sellCurrency { symbol address }
sellAmount
trades: count
maximum_price: price(calculate: maximum)
minimum_price: price(calculate: minimum)
open_price: minimum(of: block, get: price)
close_price: maximum(of: block, get: price)
}
}
}Result snippet:
{
"timeInterval": { "minute": "2020-10-10 00:00:00" },
"maximum_price": 0.002746,
"minimum_price": 0.002737,
"open_price": "0.002738",
"close_price": "0.002746"
}You can adjust the interval using units like second, hour, day, or month to generate custom candlesticks for different timeframes.
Monthly Trading Volume for a Token
To analyze long-term token performance, retrieve aggregated trading volume across all DEXs. Here's how to get monthly USDT trading volume:
{
ethereum(network: ethereum) {
dexTrades(
options: { asc: "date.date" }
buyOrSellCurrency: { is: "0xdac17f958d2ee523a2206206994597c13d831ec7" }
) {
date {
date(format: "%Y-%m")
}
amount
currency {
symbol
}
}
}
}This returns monthly totals like:
{ "date": { "date": "2018-08" }, "amount": 195789.09, "currency": { "symbol": "USDT" } }Use this to track adoption trends, detect anomalies, or compare volume spikes during market events.
FAQ Section
Q: What is GraphQL in the context of blockchain data?
A: GraphQL is a query language that allows you to request only the specific data fields you need from a blockchain index. Unlike REST APIs, it’s highly flexible and efficient for complex on-chain queries.
Q: Can I use these queries for real-time dashboards?
A: Yes. These GraphQL queries can be scheduled or triggered via scripts to feed live data into analytics platforms, trading bots, or monitoring tools.
Q: Do I need to know the token’s contract address?
A: Absolutely. The API identifies tokens by their smart contract addresses, not symbols. Always verify the correct address before querying.
Q: Which DEX protocols are supported?
A: Over 18 protocols including Uniswap (all versions), Balancer, Kyber, SushiSwap, Curve, and more are supported on Ethereum.
Q: Is there a rate limit on the API?
A: Rate limits depend on your subscription tier. Free tiers allow basic access, while enterprise plans offer higher throughput and priority support.
Q: How accurate is the OHLC data?
A: The OHLC values are calculated from actual trade records within each time window, ensuring high accuracy for technical analysis.
👉 Start building with real-time Ethereum DEX data today—no credit card required.
Final Notes
The ability to extract precise, structured DEX data from Ethereum opens up endless possibilities—from detecting wash trading to building predictive models based on liquidity flows. By leveraging GraphQL, developers gain fine-grained control over what data they retrieve, reducing overhead and improving performance.
Whether you're analyzing token pair dynamics, tracking trading volume trends, or generating OHLC charts, these examples provide a solid foundation for deeper exploration.
Remember to test queries in a GraphQL playground and always validate contract addresses when working with new tokens. With the right tools and approach, you can unlock powerful insights hidden within decentralized finance.