Skip to content
Dune Analytics

@rchen8 / TRU price

TRU price

Loading
 

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       CASE
3           WHEN token_a_symbol = 'WETH' THEN (token_a_amount / (token_b_amount_raw / 1e8)) * price
4           WHEN token_b_symbol = 'WETH' THEN (token_b_amount / (token_a_amount_raw / 1e8)) * price
5       END AS price_usd,
6       CASE
7           WHEN token_a_symbol = 'WETH' THEN (token_a_amount / (token_b_amount_raw / 1e8))
8           WHEN token_b_symbol = 'WETH' THEN (token_b_amount / (token_a_amount_raw / 1e8))
9       END AS price_eth
10FROM dex."trades" d
11INNER JOIN prices."layer1_usd_eth" p ON p.minute = date_trunc('minute', d.block_time)
12WHERE (token_a_address = '\x4c19596f5aaff459fa38b0f7ed92f11ae6543784'
13       AND token_b_symbol = 'WETH'
14       OR token_b_address = '\x4c19596f5aaff459fa38b0f7ed92f11ae6543784'
15       AND token_a_symbol = 'WETH')
16  AND block_time >= now() - interval '1 day'
17  AND block_time >= '2020-11-21 17:10'

SQL query results

Loading