Understanding on-chain trading activity is essential for developers, traders, and analysts building or monitoring decentralized finance (DeFi) applications. The Get Trades API provides real-time access to recent token transactions across supported blockchains, enabling users to analyze trading behavior, track liquidity movements, and validate price actions directly from decentralized exchanges (DEXs).
This comprehensive API endpoint allows you to retrieve detailed trade records for any token on a specified chain, making it a powerful tool for market analysis, bot development, and data aggregation platforms.
How the Get Trades API Works
The Get Trades API is a RESTful endpoint that returns the most recent trades for a specific token contract address on a given blockchain. It's designed for seamless integration into DeFi dashboards, portfolio trackers, arbitrage bots, and analytics tools.
🔗 Request URL
GET https://web3.okx.com/api/v5/dex/market/tradesThis endpoint supports pagination and filtering, allowing efficient data retrieval with minimal latency.
Request Parameters Explained
To fetch accurate and relevant trade data, you must include the following parameters in your API call:
chainIndex(String, Required)
A unique identifier for the blockchain network. For example:1= Ethereum56= BNB Chain137= Polygon
See full list of supported chains in the ChainIndex documentation.
tokenContractAddress(String, Required)
The smart contract address of the token you want to query. For EVM-compatible chains, use lowercase addresses only (e.g.,0x382bb369d343125bfb2117af9c149795c6c65c50).after(String, Optional)
Used for pagination. Returns trades that occurred before the specified trade ID. Ideal for loading historical data incrementally.limit(String, Optional)
Controls how many records are returned per request. Maximum:500, Default:100.
👉 Discover how real-time trade data can power your next DeFi project.
Understanding the Response Structure
Each API response returns an array of trade objects containing rich metadata about the transaction. Here’s a breakdown of key fields:
id(String)
A unique identifier assigned to each trade event.chainIndex(String)
Indicates which blockchain the trade occurred on (e.g.,1for Ethereum).tokenContractAddress(String)
The contract address of the token involved in the trade.txHashUrl(String)
A link to view the transaction on a block explorer—useful for verification and auditing.userAddress(String)
The wallet address that initiated the trade.dexName(String)
Name of the decentralized exchange where the trade took place (e.g., Uniswap, PancakeSwap).poolLogoUrl(String)
Direct URL to the liquidity pool’s logo—ideal for UI rendering in apps.type(String)
Specifies whether the action was abuyorsell.changedTokenInfo(Object)
Contains details about the exchanged tokens:amount: Quantity tradedtokenSymbol: Token ticker (e.g., USDT)tokenContractAddress: Contract of the paired token
price(String)
The latest price of the queried token in USD at the time of trade.volume(String)
Total USD value of the trade.time(String)
Unix timestamp (in milliseconds) indicating when the trade occurred.isFiltered(String)
Flag indicating if this trade was excluded from price calculations:0: Not filtered1: Filtered (e.g., due to outliers or wash trading)
This level of granularity makes the Get Trades API ideal for detecting large swaps, sniper bot activity, or sudden liquidity shifts.
Practical Use Cases
📊 Market Surveillance
Monitor sudden spikes in buy/sell volume to detect potential pump-and-dump schemes or whale movements.
🤖 Trading Bots
Feed live trade data into automated strategies for arbitrage or trend-following systems.
🧠 On-Chain Analytics Platforms
Build dashboards that visualize real-time trading activity by token, DEX, or user.
💼 Portfolio Trackers
Enhance user experience by showing exact trade history and execution prices across DEXs.
👉 See how integrating live trade feeds can boost your application’s performance.
Frequently Asked Questions (FAQ)
What does "isFiltered = 1" mean?
When isFiltered is set to 1, the trade has been flagged and excluded from official price feeds and K-line calculations. This typically happens when a transaction shows abnormal pricing behavior—such as extreme slippage or self-trades—that could distort market data accuracy.
Can I use this API to track non-EVM blockchains?
Currently, the Get Trades API supports EVM-compatible chains only. Ensure you use correct chainIndex values and lowercase contract addresses for accurate results.
How often is the data updated?
Trade data is streamed in near real-time, with updates occurring within seconds of on-chain confirmation. For high-frequency use cases, consider polling every 5–10 seconds depending on rate limits.
Is there a rate limit for this API?
While specific rate limits aren't documented publicly, we recommend implementing throttling logic in your client to avoid service interruptions during peak usage.
Can I get historical trades beyond 500 entries?
Yes—by using the after parameter, you can paginate through older trades. Combine this with a loop in your script to retrieve thousands of records over time.
Does the API include failed transactions?
No. Only successfully confirmed on-chain swaps are included in the response. Failed or reverted transactions are automatically excluded.
Tips for Optimal Integration
- Always validate the
chainIndexand contract address before sending requests. - Use caching mechanisms to reduce redundant calls for stable tokens.
- Pair this API with price and pool endpoints for deeper insights.
- Monitor
volumeandpricefields to identify potential market manipulation.
With precise, structured data and broad chain support, the Get Trades API serves as a foundational component for next-generation DeFi tools.
👉 Unlock advanced trading insights with powerful Web3 APIs today.
Core Keywords
- Get Trades API
- DEX API
- Market Price API
- Token trade history
- On-chain trade data
- Decentralized exchange API
- Real-time trade tracking
- Web3 market data
By leveraging these keywords naturally throughout technical documentation and integrations, developers can improve discoverability while delivering high-value functionality to end users.