DEX Trades API: Track Address Balance and Transaction History

ยท

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

๐Ÿ‘‰ 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:

When to Use DEX Trade Cubes

This data structure is ideal for:

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:

๐Ÿ‘‰ Discover token trading strategies using our advanced filtering system.

Best Practices for Token Queries

  1. Always apply at least one token filter
  2. Use time intervals for OHLC charting
  3. 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.