-- Fetch the daily volume and number of senders for Uniswap v3 compatible blockchains on Ethereum, Fantom, Base, and Optimism in the last 6 months.
select
date(block_timestamp) as date,
chain,
sum(usd_amount) as usd_volume,
count(distinct transaction_from_address) as senders
from crosschain.dex.trades
where block_timestamp >= current_timestamp - interval '6 months'
and chain in ('ethereum', 'fantom', 'base', 'optimism')
and protocol = 'uniswap_v3'
group by all order by 1 desc
Key points to note when querying the data.
select *
from ethereum.dex.trades
where token_bought_address = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' -- weth contract address
and block_timestamp >= current_timestamp - interval '12 hours'
order by block_number desc
limit 100
select *
from ethereum.dex.trades
where token_bought_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -- weth contract address
and block_timestamp >= current_timestamp - interval '12 hours'
order by block_number desc
limit 100