Query editor
withd as (selectDATE_TRUNC('hour', minute) as time,AVG(price) as pricefromprices.usdwherecontract_address = 0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d -- LQTYand blockchain = 'ethereum'group by1),l as (select*fromd),b as (selectDATE_TRUNC('hour', evt_block_time) as time,SUM(_LUSDFee / 1e18) as revenuefromliquity_ethereum.BorrowerOperations_evt_LUSDBorrowingFeePaidgroup by1),r as (selectDATE_TRUNC('hour', evt_block_time) as time,SUM(_ETHFee / 1e18 * e.price) as revenuefromliquity_ethereum.TroveManager_evt_Redemption rjoin prices.usd e on DATE_TRUNC('minute', r.evt_block_time) = e.minutewheree.contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETHand e.blockchain = 'ethereum'group by1),s as (selectDATE_TRUNC('hour', evt_block_time) as time,AVG(_totalLQTYStaked / 1e18) as lqtyfromliquity_ethereum.LQTYStaking_evt_TotalLQTYStakedUpdatedgroup by1),ttt as (selectCOALESCE(b.time, r.time, s.time, l.time) as time,COALESCE(b.revenue, 0) + COALESCE(r.revenue, 0) as revenue,s.lqty,l.pricefrombfull outer join r on b.time = r.timefull outer join s on COALESCE(b.time, r.time) = s.time