Skip to content
Dune Analytics

@pengiundev / curve.fi cumulative volume

curve.fi cumulative volume

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 day, sum(total) OVER ( ORDER BY day ASC ROWS BETWEEN unbounded preceding AND CURRENT ROW) AS cumulative_volume FROM (
2
3select day, sum(TriPool) as TriPool, sum(hbtc) as hbtc, sum(sbtc) as sbtc, sum(ren) as ren, sum(susdv2) as susdv2, sum(busd) as busd, sum(y) as y, sum(usdt) as usdt, sum(pax) as pax, sum(compound) as compound, sum(sbtc + ren + susdv2 + busd + y + usdt + pax + compound + hbtc + TriPool) as total from (
4
5select date_trunc('day', evt_block_time) AS day, 0 as sbtc, sum(tokens_sold/(case 
6when sold_id = 0 then 1e18
7when sold_id = 1 then 1e6
8when sold_id = 2 then 1e6
9end)) as TriPool, 0 as ren, 0 as susdv2, 0 as busd, 0 as y, 0 as usdt, 0 as pax, 0 as compound, 0 as hbtc from curvefi."dai_usdc_usdt_evt_TokenExchange" as cst
10group by 1
11
12union
13
14select date_trunc('day', evt_block_time) AS day, sum(tokens_sold/(case 
15when sold_id = 0 then 1e18
16when sold_id = 1 then 1e8
17end) * p.price) as hbtc, 0 as sbtc, 0 as ren, 0 as susdv2, 0 as busd, 0 as y, 0 as usdt, 0 as pax, 0 as compound, 0 as TriPool from curvefi."hbtc_evt_TokenExchange" as cst
18LEFT JOIN prices.usd_2260fac5e5542a773aa44fbcfedf7c193bc2c599 p ON p.minute = date_trunc('minute', evt_block_time)
19group by 1
20
21union
22
23select date_trunc('day', evt_block_time) AS day, sum(tokens_sold/(case 
24when sold_id = 0 then 1e8
25when sold_id = 1 then 1e8...

SQL query results

Loading