Query editor
with reward as (selectsum("_LUSDFee"/1e18) as lusd_rewards,to_char("evt_block_time", 'yyyy-mm-dd') as dayfromliquity."BorrowerOperations_evt_LUSDBorrowingFeePaid"where"_LUSDFee" != 0group by dayorder by day),eth_reward as (selectsum("_ETHFee"/1e18) as eth_rewards,to_char("evt_block_time", 'yyyy-mm-dd') as dayfromliquity."TroveManager_evt_Redemption"group by dayorder by day),rewards as (selectcoalesce(lusd_rewards, 0) as lusd_rewards,coalesce(eth_rewards, 0) as eth_rewards,coalesce(r.day, er.day) as dayfromreward rfull outer join eth_reward eron er.day = r.day),stake as(selectavg("_totalLQTYStaked" / 1e18) as lqty_staked,to_char("evt_block_time", 'yyyy-mm-dd') as dayfromliquity."LQTYStaking_evt_TotalLQTYStakedUpdated"group by dayorder by day),lqty as (selectdate_trunc('minute', "evt_block_time") as minute,avg(("amount0In" + "amount0Out") /("amount1In" + "amount1Out")) as per_ethfrom uniswap_v2."Pair_evt_Swap"wherecontract_address = '\xb13201b48b1e61593df055576964d0b3aab66ea3' and -- WETH <=> LQTY pairevt_block_time >= now() - interval '90 days'group by minuteorder by per_eth),lqtyUsdHour as (selectdate_trunc('hour', lqty.minute) as date,avg(eth.price / lqty.per_eth) as lqty_price,avg(eth.price) as eth_pricefrom lqty left join prices.layer1_usd_eth eth on lqty.minute = eth.minutegroup by date