Query editor
SELECT time,UST as "UST", three_pool as "USDC/USDT/DAI",cast(UST/total as float) as "UST%", cast(three_pool/total as float) as "USDC/USDT/DAI%",0.5 as ideal, totalfrom(SELECT time, UST as UST, three_pool as three_pool, SUM(UST + three_pool) as totalFROM(SELECT time, SUM(UST) over (ORDER BY time) as UST, SUM(three_pool) over (ORDER BY time) as three_poolFROM(SELECT DATE_TRUNC('hour', evt_block_time) as time,SUM((CASE WHEN contract_address = '\xa693b19d2931d498c5b318df961919bb4aee87a5' THEN value / 1e6 ELSE 0 END) * (CASE WHEN "to" = '\xceaf7747579696a2f0bb206a14210e3c9e6fb269' THEN 1 ELSE -1 END)) as UST,SUM((CASE WHEN contract_address = '\x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' THEN value / 1e18 ELSE 0 END) * (CASE WHEN "to" = '\xceaf7747579696a2f0bb206a14210e3c9e6fb269' THEN 1 ELSE -1 END)) as three_poolFROM erc20."ERC20_evt_Transfer"WHERE "to" = '\xceaf7747579696a2f0bb206a14210e3c9e6fb269' OR "from" = '\xceaf7747579696a2f0bb206a14210e3c9e6fb269'GROUP BY 1)AS tt)AS tt1WHERE time > '01-01-2022'GROUP BY 1, 2, 3) mainorder by time desc;