Query editor
/* Success! If you're still running into issues, check out https://dune.com/docs/query/syntax-differences/ or reach out in the #dune-sql Discord channel. *//* amount in and out */WITH deposit AS (SELECTDATE_TRUNC('day', evt_block_time) AS timea,SUM(CAST(amount AS DOUBLE) / 1e18) AS "ETH Deposited"FROMnear_ethereum.EthCustodian_evt_DepositedGROUP BY1),withdrawal AS (SELECTDATE_TRUNC('day', evt_block_time) AS timeb,-SUM(CAST(amount AS DOUBLE) / 1e18) AS "ETH Withdrawn"FROMnear_ethereum.EthCustodian_evt_WithdrawnGROUP BY1),net_transactions AS (SELECTCOALESCE(d.timea, w.timeb) AS time,COALESCE(d."ETH Deposited", 0) AS "ETH Deposited",COALESCE(w."ETH Withdrawn", 0) AS "ETH Withdrawn"FROMdeposit dFULL OUTER JOINwithdrawal w ON d.timea = w.timeb)SELECTtime,SUM("ETH Deposited") OVER (ORDER BY time ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS "Cumulative Deposits",SUM("ETH Withdrawn") OVER (ORDER BY time ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS "Cumulative Withdrawals",SUM("ETH Deposited" + "ETH Withdrawn") OVER (ORDER BY time ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS "Cumulative Deposits + Withdrawals",AVG("ETH Deposited") OVER (ORDER BY time ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) AS depma,AVG("ETH Withdrawn") OVER (ORDER BY time ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) AS whmaFROMnet_transactionsWHEREtime > CURRENT_TIMESTAMP - INTERVAL '5' month;