Skip to content
Dune Analytics

@rlg195 / DPI DEX # of Trades

DPI DEX # of Trades


About queries and results

Dune Analytics lets you explore, create, and share Ethereum analytics. You can find an endless amount of great queries and dashboards on Dune.

We have decoded Ethereum smart contract data so you can do powerful analysis with simple SQL queries and visualise the query results into beautiful graphs.

Dune Analytics is free for everyone forever. If you want extra features like private queries, export your results and more check out our Pro plan.

SQL query results


SQL query

2    project,
3    date_trunc('day', block_time) as day,
4    COUNT(*) AS fills
6    SELECT DISTINCT ON (tx_hash, trace_address, evt_index)
7        project ||
8        version as project,
9        token_a_address,
10        token_a_amount,
11        token_b_address,
12        token_b_amount,
13        p.contract_address AS price_address,
14        price,
15        block_time
16    FROM dex.trades t
17    INNER JOIN prices.usd p
18    ON date_trunc('minute', block_time) = p.minute AND (token_a_address = p.contract_address OR token_b_address = p.contract_address)
19    WHERE  (token_a_address = '\x1494ca1f11d487c2bbe4543e90080aeba4ba3c2b'
20        or token_b_address = '\x1494ca1f11d487c2bbe4543e90080aeba4ba3c2b')
21        and block_time  > now() - interval '3 months'
22) t
23GROUP BY 1,2