Coverage
What you get
| Item | Detail |
|---|---|
| Product code | CR-DEFI |
| Coverage | DEX swaps by chain and protocol, starting with ethereum and uniswap_v3 |
| Granularity | One row per swap event |
| History | Back to each pool's creation block where we index the chain |
| Delivery | REST and WebSocket |
| Update speed | As blocks are produced and confirmed |
Centralised exchanges hand you a trade feed. DEXs don't; the trades are events inside blocks, and you rebuild them from contract logs. A row here is one swap event, identified by transaction_hash and log_index. One transaction can contain several swaps across pools, which is how aggregators and arbitrage bots route.
Schema
Schema
| Field | Type | Required | Description |
|---|---|---|---|
chain |
string | yes | e.g. ethereum |
protocol |
string | yes | e.g. uniswap_v3 |
pool_address |
string | yes | Pool contract |
block_number |
integer | yes | Block |
transaction_hash |
string | yes | Transaction |
log_index |
integer | yes | Event position in the block |
timestamp |
string | yes | Block time, ISO 8601 UTC |
base_token_address |
string | yes | Token being priced |
quote_token_address |
string | yes | Pricing token |
symbol |
string | yes | e.g. WETH-USDC |
side |
string | yes | buy or sell of the base token |
price |
number | yes | Quote per base |
base_amount |
number | yes | Base tokens swapped |
quote_amount |
number | yes | Quote tokens swapped |
amount_usd |
number | optional | USD value |
user_address |
string | optional | Wallet that swapped |
Example record:
{
"chain": "ethereum",
"protocol": "uniswap_v3",
"pool_address": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"block_number": 23794112,
"transaction_hash": "0x5f3c9a1e7b2d4c6f8a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f",
"log_index": 214,
"timestamp": "2026-11-19T14:31:47Z",
"base_token_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"quote_token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"symbol": "WETH-USDC",
"side": "buy",
"price": 2914.37,
"base_amount": 3.25,
"quote_amount": 9471.70,
"amount_usd": 9471.70,
"user_address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"
}
This is an example record. The price, amounts, transaction hash and block number are made up for illustration.
Sample data
Sample data
No free DEX sample is available. We'd rather wait until our own indexer produces it than repackage someone else's. Request a pool and a date range and we'll send a file when the first chain is indexed.
Use cases
Use cases
DEX versus CEX price gaps. Join swaps in the WETH-USDC pool to our ETH-USD trades by timestamp. The gap between DEX price and the centralised exchange price, after gas, is the arbitrage window.
Large swap alerts. Filter on amount_usd above a threshold to see big trades in a pool as they happen. Group by user_address to tell one large trader from many small ones.
Pool volume and fees. Sum quote_amount per pool_address per day for volume. Multiply by the pool's fee tier to estimate what liquidity providers earned.
Price impact research. Compare consecutive swaps in the same block. The change in price relative to base_amount shows how much a trade of that size moved the pool.
Code
Code examples
Example: swaps in one pool for an hour with curl.
curl "https://api.marketdata.co/v1/crypto/dex/trades?chain=ethereum&pool_address=0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640&start=2026-11-19T14:00:00Z&end=2026-11-19T15:00:00Z" \
-H "Authorization: Bearer $MARKETDATA_API_KEY"
Example: Python, hourly volume and the biggest swaps.
import os
import requests
import pandas as pd
resp = requests.get(
"https://api.marketdata.co/v1/crypto/dex/trades",
params={"chain": "ethereum", "protocol": "uniswap_v3", "symbol": "WETH-USDC",
"start": "2026-11-19T00:00:00Z", "end": "2026-11-19T23:59:59Z"},
headers={"Authorization": f"Bearer {os.environ['MARKETDATA_API_KEY']}"},
)
resp.raise_for_status()
swaps = pd.DataFrame(resp.json()["results"])
swaps["timestamp"] = pd.to_datetime(swaps["timestamp"])
print(swaps.set_index("timestamp")["amount_usd"].resample("1h").sum())
print(swaps.nlargest(5, "amount_usd")[["timestamp", "side", "price", "amount_usd"]])
Pricing
Pricing
DEX and DeFi data is not offered at launch and has no price yet. It won't be sold as a dataset at first.
Free tiers for pool data exist elsewhere. Paid plans from vendors we studied run $35 to $1,000 a month, median about $220.
Side by side
How we compare
9 of the 50 providers we studied sell some DEX or DeFi data, which makes it a crowded field. One of them gives pool candles away free. Our angle, when we build it: DEX swaps in the same API as our centralised exchange trades, with symbol, side, price and timestamp named the same way, so comparing the two takes a join instead of a mapping table. Files you download stay yours.
FAQ
Frequently asked questions
Which chains and DEXs will you cover?
We plan to start with Ethereum and Uniswap v3. More chains follow based on early access requests.
How do you get the USD value?
amount_usd uses the quote token's USD price at the block time. For stablecoin pairs it's close to quote_amount.
What time zone are timestamps in?
UTC. timestamp is the block time, which every swap in the same block shares; use log_index to order them.
Is it real-time?
Planned as near real time over WebSocket, as blocks are confirmed. Reorged blocks would be corrected.
Are amounts adjusted for token decimals?
Yes. base_amount and quote_amount are in whole tokens, not the raw integer units stored on chain.
What format does it come in?
JSON from REST and WebSocket. Bulk files per pool per day may follow.
Keep reading
Related
- Asset hub: Crypto
- Crypto: BTC-USD, ETH-USD, SOL-USD, XRP-USD, BNB-USD, DOGE-USD
- Docs: API reference: crypto
- Learn: Crypto order book depth