Get Trades | Market Price API & DEX API Reference

·

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/trades

This 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:

👉 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:

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

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

By leveraging these keywords naturally throughout technical documentation and integrations, developers can improve discoverability while delivering high-value functionality to end users.