Search
K

Trades

The DEX trades table contains swaps made on decentralized exchanges, consolidated into a single table.

Project Coverage:

Currently, we support over 20 DEX projects on Ethereum.
Protocol
Projects
uniswap_v3
uniswap, kyberswap, pancakeswap
uniswap_v2
original: uniswap
forks: sushiswap, bitberryswap, cityswap, convergence, defiswap, dooar, equalizerfinance, fraxswap, gemswap, integralsize, linkswap, luaswap, mintyswap, nomiswap, orionprotocol, pancakeswap, plasmafinance, radioshackswap, safeswap, saitaswap, sakeswap, sashimiswap, shibaswap, sumswap, swapr, swipeswap, unicly, verse, vulcandex, wallstreetbetsdex, whiteswap
airswap_light_v0, airswap_light, airswap_v2, airswap_v3
airswap
balancer_v1, balancer_v2
balancer
bancor_v1, bancor_v3
bancor
curve_v1, curve_v2
curve
dodo_v1, dodo_v2
dodo

Methodology

We adopted a protocol-based and event log-based approach to index swap events.
In brief, the swap events for each protocol are identified by the event signature (topic0), which contains the amount of tokens swapped and the address of the sender and receiver.
For protocols such as Uniswap v2 and v3 the token address swapped is identified by the liquidity pool creation event using the pool address. The amount of tokens traded is adjusted by the token's decimal value and then multiplied by hourly price oracle data to give the USD value of the transaction.

Sample Query

Finding the swap volume of indexed projects on Ethereum in the last 7 days.
select
date(block_timestamp) as date,
project,
sum(usd_amount) as usd_volume
from ethereum.dex.trades
where current_date - date(block_timestamp) < 7
group by date, project
order by date desc

Table Columns

_str columns are numeric fields casted as varchar to retain precision when summing.
Column Name
Description
Example
project
The project (decentralized exchange) of the liquidity pool that the swap occurred from.
uniswap
protocol
Version of the protocol.
uniswap_v2
liquidity_pool_address
Contract address of the liquidity pool holding the asset.
For protocols such as airswap, this will be null.
0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc
sender_address
The address of the sender emitted on the swap event logs. This can be a router or pool address, which is different from the transaction initatior transaction_from_address that initiated the swap.
0x7a250d5630b4cf539739df2c5dacb4c659f2488d
to_address
Address of the recipient emitted on the swap event logs.
For example, we use the to_address from the uniswap v2 swap event log and the recipient_address from the uniswap v3 swap event log.
0xcbb2534c6898655d50fdac79d6e4b23b18a25b97
token_bought_address
Token address of the token bought, i.e. the asset acquired from the trade.
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
token_bought_name
Name of the token bought.
USD Coin
token_bought_symbol
Symbol of the token bought.
USDC
token_sold_address
Token address of the token sold.
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
token_sold_name
Name of the token sold.
Wrapped Ether
token_sold_symbol
Symbol of the token sold.
WETH
token_bought_amount_raw
Raw amount of tokens bought (unnormalized).
3,000,000,000
token_bought_amount_raw_str
Raw amount of tokens bought (unnormalized) in string.
3000000000
token_bought_amount
Amount of tokens bought.
3,000
usd_bought_amount
Amount of token bought in USD value.
3,000.90
token_bought_amount_str
Amount of tokens bought in string.
3000
token_sold_amount_raw
Raw amount of tokens sold (unnormalized).
2,288,149,153,584,170,000
token_sold_amount_raw_str
Raw amount of tokens sold (unnormalized) in string.
2.28815E+18
token_sold_amount
Amount of tokens sold.
2.288149154
token_sold_amount_str
Amount of tokens sold in string.
2.288149154
usd_sold_amount
Amount of token sold in USD value.
3,083.12
usd_amount
USD value of the swap. This field preferentially selects the USD value of ETH-priced tokens, as scam-related token prices can conflate the true swap value.
3,083.12
transaction_from_address
Transaction sender address. I.e. the address of the transaction initiator. (from_address in the raw.transactions field for the transaction_hash of this swap).
0xcbb2534c6898655d50fdac79d6e4b23b18a25b97
transaction_to_address
Transaction receiver. (to_address in the raw.transactions field for the transaction_hash of this swap).
0x7a250d5630b4cf539739df2c5dacb4c659f2488d
transaction_hash
Transaction hash that this swap belongs to.
0x5e2efbb5a7cd468a2bf89b732e42c9c48bd311e0bec50a5de0beead059d1d220
log_index
The position of the swap event log in the transaction.
191
block_timestamp
Block timestamp of the swap event.
2021-01-25 22:28:07
block_number
Block number of the swap event.
11,727,610
block_hash
Block hash of the swap event.
0xff32ce4497bfad832878d069ce956f4eac5a6518c89fe8c4268af5f27c2cc1a5
unique_id
Unique ID of the swap.
txn-0x5e2efbb5a7cd468a2bf89b732e42c9c48bd311e0bec50a5de0beead059d1d220_log_index-191