Query editor
WITH deposits AS (SELECTDATE_TRUNC('day', evt_block_time) AS day,SUM(value) / POWER(10, 6) AS depositFROM erc20_optimism.evt_TransferWHEREcontract_address = 0x62BB4fc73094c83B5e952C2180B23fA7054954c4AND "from" = 0x0000000000000000000000000000000000000000GROUP BY1order by 1), withdrawals AS (SELECTDATE_TRUNC('day', evt_block_time) AS day,SUM(value) / POWER(10, 6) AS withdrawalFROM erc20_optimism.evt_TransferWHEREcontract_address = 0x62BB4fc73094c83B5e952C2180B23fA7054954c4AND "to" = 0x0000000000000000000000000000000000000000GROUP BY1order by 1), time_series AS (SELECTdays_tsFROM UNNEST(SEQUENCE(TRY_CAST('2022-07-07' AS DATE), CURRENT_DATE) /* WARNING: Check out the docs for example of time series generation: https://dune.com/docs/query/syntax-differences/ */) AS t(days_ts)), combo1 AS (SELECTtime_series.days_ts AS days_ts,COALESCE(deposits.deposit, 0) AS deposit,COALESCE(withdrawals.withdrawal, 0) AS withdrawalFROM time_seriesLEFT JOIN depositsON deposits.day = time_series.days_tsLEFT JOIN withdrawalsON withdrawals.day = time_series.days_ts), combo2 AS (SELECTdays_ts,SUM((deposit) - (withdrawal)) OVER (ORDER BY days_ts) AS sum1FROM combo1)SELECT*FROM combo2ORDER BY1