Query editor
selectcoalesce(t1.day, t2.day) as day,coalesce(t1.add_num, 0) as add_num,coalesce(t2.remove_num, 0) as remove_num,coalesce(t1.add_num, 0) - coalesce(t2.remove_num, 0) as net_add_num,sum(coalesce(t1.add_num, 0) - coalesce(t2.remove_num, 0)) over(order by coalesce(t1.day, t2.day)) as total_num,(sum(coalesce(t1.add_num, 0) - coalesce(t2.remove_num, 0)) over(order by coalesce(t1.day, t2.day)))*32*eth_price as tvl,ssv_pricefrom(select date(evt_block_time) as day, count(*) as add_num from ssv_ethereum.SSVNetwork_evt_ValidatorAdded group by 1) t1full outer join(select date(evt_block_time) as day, count(*) as remove_num from ssv_ethereum.SSVNetwork_evt_ValidatorRemoved group by 1) t2on t1.day = t2.dayright join(select DATE_TRUNC('day', minute) as day,avg(price) as eth_pricefrom prices.usdwhere symbol='ETH' and contract_address is NULL and minute>=date('2021-11-01') group by 1) t3on coalesce(t1.day, t2.day) = t3.dayleft join(SELECT DATE_TRUNC('day', minute) AS day,AVG(price) AS ssv_price FROM prices.usdWHERE blockchain = 'ethereum' and symbol='SSV' GROUP BY 1) t5on coalesce(t1.day, t2.day) = t5.day