Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/withtemp as (selectDATE_TRUNC('{{granularity}}', evt_block_time) as day,sum(CAST("value" AS DOUBLE) / 1e18) as amtfrom bend_ethereum.DebtToken_evt_Mint borrowswhere "from" = {{address}}group by 1union allselectDATE_TRUNC('{{granularity}}', evt_block_time) as day,- sum(CAST("amount" AS DOUBLE) / 1e18) as amtfrom bend_ethereum.DebtToken_evt_Burn repayswhere "user" = {{address}}group by 1),daily as (selectday,sum(amt) as netfrom tempgroup by 1),all as (selectday,net,sum(net) over (order by day) as cumufrom dailygroup by 1, 2)selectday,net,cumufrom allwhere day >= now() - interval '{{no. of days}}' dayorder by 1 desc