Query editor
witheth_temp as (selectdate_trunc('minute', "evt_block_time") as day,sum(value/1e18) as amtfrom erc20_ethereum.evt_Transferwhere "to" = 0xeD1840223484483C0cb050E6fC344d1eBF0778a9and "contract_address" = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2group by 1union allselectdate_trunc('minute', "evt_block_time") as day,- sum(value/1e18) as amtfrom erc20_ethereum.evt_Transferwhere "from" = 0xed1840223484483c0cb050e6fc344d1ebf0778a9and "contract_address" = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2group by 1),eth_available as (selectday,amt,sum(amt) over (order by day) as eth_balfrom eth_tempgroup by 1, 2),supply_temp as (selectdate_trunc('minute', "evt_block_time") as day,sum(amount) / 1e18 as amtfrom bend_ethereum.LendingPool_evt_Deposit lgroup by 1union allselectdate_trunc('minute', "evt_block_time") as day,- sum(amount) / 1e18 as amtfrom bend_ethereum.LendingPool_evt_Withdraw lgroup by 1),supply as (selectday,amt,sum(amt) over (order by day) as total_supplyfrom supply_tempgroup by 1, 2)selects1.day,s1.total_supply, --market sizeeth_bal as locked_ETH, --availabletotal_supply - eth_bal as borrowed_eth,1 - eth_bal/total_supply as utilization,(1 - eth_bal/total_supply) * 100 as utilization_perc,AVG(1 - eth_bal/total_supply) over (order by s1.day ROWS BETWEEN 179 PRECEDING and 0 FOLLOWING) as "MA(60min) U",