Query editor
with token_price as(select * from prices.usd where symbol = 'WETH' and blockchain = 'ethereum')SELECT *,(Primary_Conversion_Rate/LAG_RATE - 1) * 365 AS WBETH_APRFROM(SELECT *,lag(Primary_Conversion_Rate) over(order by day asc) as LAG_RATEFROM(select Date_Trunc('day',evt_block_time) as day ,evt_block_time,minute,CAST(newExchangeRate/1e18 AS Double) AS Primary_Conversion_Rate,CAST(newExchangeRate/1e18 AS Double) * price as wbeth_pricefrombinance_bnb.wBETH_evt_ExchangeRateUpdated eleft join token_price pon Date_Trunc('minute',evt_block_time) = p.minute) T) TTorder by day desc