Skip to content
Dune Analytics

@rchen8 / yTRUMP



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

1SELECT block_time,
2       price
4  (SELECT block_time,
5          CASE
6              WHEN token_a_symbol = 'DAI' THEN token_a_amount / (token_b_amount_raw / 1e18) / 1000
7              WHEN token_b_symbol = 'DAI' THEN token_b_amount / (token_a_amount_raw / 1e18) / 1000
8          END AS price
9   FROM dex."trades" d
10   WHERE (token_a_address = '\x3af375d9f77ddd4f16f86a5d51a9386b7b4493fa'
11          AND token_b_symbol = 'DAI'
12          OR token_b_address = '\x3af375d9f77ddd4f16f86a5d51a9386b7b4493fa'
13          AND token_a_symbol = 'DAI')) a
14WHERE price < 1
15  AND block_time >= '2020-11-04'
16  AND block_time < '2020-11-05'

SQL query results