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
- Real-time trade data for any token
- Multi-chain support (Ethereum, BSC, etc.)
- Comprehensive trade details including price, volume, and participant addresses
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chainIndex | String | Yes | Unique chain identifier (e.g., 1 for Ethereum) |
tokenContractAddress | String | Yes | Token's contract address (EVM chains require lowercase format) |
after | String | No | Pagination cursor for older records |
limit | String | No | Results per request (max 500, default 100) |
๐ Explore supported networks
Response Parameters
| Field | Type | Description |
|---|---|---|
id | String | Unique trade identifier |
dexName | String | DEX platform name (e.g., Uniswap, PancakeSwap) |
type | String | Transaction type (buy/sell) |
price | String | Execution price per token |
volume | String | Trade value in USD |
time | String | Unix timestamp (milliseconds) |
Detailed Trade Information
Changed Token Info:
amount: Exchanged token quantitytokenSymbol: Asset symbol (e.g., ETH, USDC)tokenContractAddress: Corresponding contract address
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
- Rate Limiting: Implement proper request throttling (recommended: โค10 requests/second)
- Data Caching: Store frequently accessed token data locally to reduce API calls
- Error Handling: Always check for
isFilteredflag 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.