Query editor
WITH getNuts as (select date_trunc('day',evt_block_time) as date,'GOOD' as label,SUM(sum(case when "from" = 0x0000000000000000000000000000000000000000 THEN (value/1e18) ELSE -(value/1e18) END)) OVER (ORDER BY date_trunc('day',evt_block_time)) as amountfrom erc20_arbitrum.evt_transferwhere contract_address = 0x17176a9868f321411b15ccb9b934cf95597e89c4and ("from" = 0x0000000000000000000000000000000000000000 or "to" = 0x0000000000000000000000000000000000000000)GROUP BY 1,2),getveNUTS as (select date_trunc('day',evt_block_time) as date,'esGOOD' as label,SUM(sum(case when "from" = 0x0000000000000000000000000000000000000000 THEN (value/1e18) ELSE -(value/1e18) END)) OVER (ORDER BY date_trunc('day',evt_block_time)) as amountfrom erc20_arbitrum.evt_transferwhere contract_address = 0xf360e073efc1fd4cc2d21551a13781ddefe888deand ("from" = 0x0000000000000000000000000000000000000000 or "to" = 0x0000000000000000000000000000000000000000)GROUP BY 1,2),gs as (SELECT date FROM unnest(sequence(cast('2023-12-04' AS TIMESTAMP),CAST(NOW() as TIMESTAMP),interval '1' day)) as t(date))SELECT date,label,COALESCE(amount,LAG(amount,1) IGNORE NULLS OVER (PARTITION BY label ORDER BY date)) as amountFROM gs LEFT JOIN (SELECT * FROM getNutsUNION ALLSELECT * FROM getveNUTS) x USING (date)