Query editor
withlast_updated_tmp as (selectdate_trunc('day', max(last_updated) - interval '15' minute) as latest_dayfromdune.ether_fi.result_etherfi_protocol_token_holderswhere day >= now() - interval '7' day -- filterunion allselectdate_trunc('day', now() - interval '4' hour) as latest_day),last_updated as (selectmin(latest_day) as latest_dayfromlast_updated_tmp),label_contracts as (selectq.*,l.project,l.label as categoryfromdune.ether_fi.result_etherfi_protocol_token_holders qleft joindune.ether_fi.result_addresses_traits l -- addresses traiton q.blockchain = l.blockchainand q.address = l.addresswhere q.day = (select latest_day from last_updated) -- use latest updated time-- and q.day = date_trunc('day', now() - interval '4' hour) -- allow at least 2hrs to passand token_symbol = 'weETH'),classifications as (select1 as order_num,sum(token_balance) as balance,'DeFi' as classfromlabel_contractswhere category in ('Lending Protocol', 'Yield', 'Farm', 'Restaking', 'Dex', 'CDP', 'Leveraged Farming', 'LRT Stablecoin', 'Yield Aggregator')group by 1, 3union allselect2 as order_num,sum(token_balance) as balance,'Aave' as classfromlabel_contractswhere project = 'Aave'group by 1, 3union all