Query editor
WITHuser_balance AS (SELECTdate,address,SUM(SUM(amount)) OVER (PARTITION BYaddressORDER BYdate) as daily_cumulative_balance -- get the cumulative balance of the holdersFROM(SELECTdate_trunc('day', evt_block_time) as Date,tr."from" AS address,- (tr.value / 1e18) AS amountFROMerc20_ethereum.evt_transfer trWHERE"from" != 0x0000000000000000000000000000000000000000 -- exclude mint/burn addressesAND contract_address = 0xf1c9acdc66974dfb6decb12aa385b9cd01190e38 -- osETH contract addressUNION ALLSELECTdate_trunc('day', evt_block_time) as Date,tr."to" AS address,(tr.value / 1e18) AS amountFROMerc20_ethereum.evt_transfer trWHERE"to" != 0x0000000000000000000000000000000000000000 -- exclude mint/burn addressesAND contract_address = 0xf1c9acdc66974dfb6decb12aa385b9cd01190e38 -- osETH contract address) xGROUP BY1,2),setLeadData AS (SELECT*,lead(date, 1, NOW()) OVER (PARTITION BYaddressORDER BYdate) as latest_dayFROMuser_balance),gs AS (SELECTdateFROMUNNEST (sequence(date_trunc('day',CAST(NOW() - interval '5' year AS TIMESTAMP)),CAST(NOW() AS TIMESTAMP),