Query editor
withgs AS (SELECT dayFROMUNNEST(sequence(TIMESTAMP '2022-03-21', CAST(current_date AS timestamp), INTERVAL '1' day)) tbl (day)) ,getbalance2 as (selectdate_trunc('day', minute) day,avg(price) pricefrom (selectdate_trunc('minute', block_time) minute,amount_usd / token_bought_amount as pricefrom dex.tradeswhere token_bought_address = 0x0d02755a5700414b26ff040e1de35d337df56218and blockchain = 'ethereum'union allselectdate_trunc('minute', block_time) minute,amount_usd / token_sold_amount as pricefrom dex.tradeswhere token_sold_address = 0x0d02755a5700414b26ff040e1de35d337df56218and blockchain = 'ethereum')group by 1),setLeadData2 AS (SELECT*, lead(day, 1, NOW()) OVER (ORDER BY day ASC) latest_dayFROMgetBalance2)SELECTCAST(gs.day AS timestamp) day,priceFROM(setLeadData2 gINNER JOIN gs ON ((g.day <= gs.day) AND (gs.day < g.latest_day)))order by 1 desc