Query editor
SELECT day, sum(total) OVER ( ORDER BY day ASC ROWS BETWEEN unbounded preceding AND CURRENT ROW) AS cumulative_volume FROM (select day,sum(bbtc + hbtc + obtc + pbtc + renbtc + sbtc + tbtc +ankreth + reth + seth + steth +tricrypto + tricrypto2 +eurs + link +threepool + aave + alusd + busd + busdv2 + compound + dusd + frax + gusd + husd + ironbank + linkusd + lusd + mim + musd + pax + rsv + saave + susdv2 + tusd + usdk + usdn + usdp + usdt + ust + y) as totalfrom (-- bbtcselect date_trunc('day', evt_block_time) AS day,sum(casewhen sold_id = 0 then (tokens_sold / 1e8) * p.pricewhen sold_id = 1 then (tokens_sold / 1e18) * p.priceend) as bbtc, 0 as hbtc, 0 as obtc, 0 as pbtc, 0 as renbtc, 0 as sbtc, 0 as tbtc,0 as ankreth, 0 as reth, 0 as seth, 0 as steth,0 as tricrypto, 0 as tricrypto2,0 as eurs, 0 as link,0 as threepool, 0 as aave,0 as alusd,0 as busd,0 as busdv2,0 as compound, 0 as dusd,0 as frax,0 as gusd, 0 as husd, 0 as ironbank,0 as linkusd,0 as lusd,0 as mim,0 as musd,0 as pax,0 as rsv,0 as saave,0 as susdv2, 0 as tusd,0 as usdk, 0 as usdn, 0 as usdp,0 as usdt, 0 as ust,0 as yfrom curvefi."bbtc_swap_evt_TokenExchange" as cstLEFT JOIN prices.layer1_usd_btc p ON p.minute = date_trunc('minute', evt_block_time)group by 1unionselect date_trunc('day', evt_block_time) AS day,sum(casewhen sold_id = 0 then (tokens_sold / 1e8) * p.pricewhen sold_id = 1 then (tokens_sold / 1e8) * p.pricewhen sold_id = 2 then (tokens_sold / 1e8) * p.pricewhen sold_id = 3 then (tokens_sold / 1e18) * p.priceend) as bbtc, 0 as hbtc, 0 as obtc, 0 as pbtc, 0 as renbtc, 0 as sbtc, 0 as tbtc,0 as ankreth, 0 as reth, 0 as seth, 0 as steth,0 as tricrypto, 0 as tricrypto2,0 as eurs, 0 as link,0 as threepool, 0 as aave,0 as alusd,0 as busd,0 as busdv2,0 as compound, 0 as dusd,0 as frax,0 as gusd, 0 as husd, 0 as ironbank,0 as linkusd,0 as lusd,0 as mim,0 as musd,0 as pax,0 as rsv,0 as saave,0 as susdv2, 0 as tusd,0 as usdk, 0 as usdn, 0 as usdp,0 as usdt, 0 as ust,0 as yfrom curvefi."bbtc_swap_evt_TokenExchangeUnderlying" as cstLEFT JOIN prices.layer1_usd_btc p ON p.minute = date_trunc('minute', evt_block_time)group by 1union-- hbtcselect date_trunc('day', evt_block_time) AS day,0 as bbtc,sum(casewhen sold_id = 0 then (tokens_sold / 1e18) * p.pricewhen sold_id = 1 then (tokens_bought / 1e18) * p.priceend) as hbtc, 0 as obtc, 0 as pbtc, 0 as renbtc, 0 as sbtc, 0 as tbtc,0 as ankreth, 0 as reth, 0 as seth, 0 as steth,0 as tricrypto, 0 as tricrypto2,0 as eurs, 0 as link,0 as threepool, 0 as aave,0 as alusd,0 as busd,0 as busdv2,0 as compound, 0 as dusd,0 as frax,0 as gusd, 0 as husd, 0 as ironbank,0 as linkusd,0 as lusd,0 as mim,0 as musd,0 as pax,0 as rsv,0 as saave,0 as susdv2, 0 as tusd,0 as usdk, 0 as usdn, 0 as usdp,0 as usdt, 0 as ust,0 as yfrom curvefi."hbtc_swap_evt_TokenExchange" as cstLEFT JOIN prices.layer1_usd_btc p ON p.minute = date_trunc('minute', evt_block_time)group by 1union-- obtc