Get Trades API Reference: Market Price and DEX Trading Data

ยท

Overview

This API enables developers to retrieve recent token transactions across decentralized exchanges (DEXs), providing essential market price data and trading activity insights.

API Endpoint

Request Method: GET
๐Ÿ‘‰ Access DEX API now
https://web3.okx.com/api/v5/dex/market/trades

Key Features


Request Parameters

ParameterTypeRequiredDescription
chainIndexStringYesUnique chain identifier (e.g., 1 for Ethereum)
tokenContractAddressStringYesToken's contract address (EVM chains require lowercase format)
afterStringNoPagination cursor for older records
limitStringNoResults per request (max 500, default 100)

๐Ÿ‘‰ Explore supported networks


Response Parameters

FieldTypeDescription
idStringUnique trade identifier
dexNameStringDEX platform name (e.g., Uniswap, PancakeSwap)
typeStringTransaction type (buy/sell)
priceStringExecution price per token
volumeStringTrade value in USD
timeStringUnix timestamp (milliseconds)

Detailed Trade Information


Usage Examples

Sample Request

curl -X GET "https://web3.okx.com/api/v5/dex/market/trades?chainIndex=1&tokenContractAddress=0x382bb369d343125bfb2117af9c149795c6c65c50"

Sample Response

{
  "id": "trade_12345",
  "dexName": "Uniswap V3",
  "type": "buy",
  "price": "1850.42",
  "volume": "12500.00",
  "time": "1685432100000"
}

FAQ Section

Q1: How frequently is trade data updated?

A: The API provides real-time data with sub-second latency, ensuring you receive the latest market activity.

Q2: Can I filter trades by transaction type?

A: Yes, analyze the type field to distinguish between buy and sell transactions.

Q3: What chains are supported?

A: All major EVM chains including Ethereum, BSC, and Polygon. See our ๐Ÿ‘‰ network documentation for details.

Q4: How do I handle pagination?

A: Use the after parameter to retrieve older trades beyond the initial 500-record limit.


Best Practices

  1. Rate Limiting: Implement proper request throttling (recommended: โ‰ค10 requests/second)
  2. Data Caching: Store frequently accessed token data locally to reduce API calls
  3. Error Handling: Always check for isFiltered flag when calculating price metrics

This API serves as critical infrastructure for building trading analytics dashboards, price oracles, and arbitrage detection systems in the decentralized finance ecosystem.