Query editor
with token_ratio as (select *,lag(ratio1,1) over (order by time asc) as ratio2from ( select date_trunc('day', evt_block_time) as time, evt_block_number as block_number, (newRatio/1e18) as ratio1, contract_address as contractfrom ankr_ethereum.AETHC_Token_v2_evt_RatioUpdatewhere evt_block_time >= date('2020-09-11') -- contract deployed) g),apy_data as (select time, ((ratio2-ratio1)*(31536000/86400))*100 as apyfrom token_ratiowhere ratio2 is not null and time > date('2023-01-01')order by 1 desc)select time, round(apy, 2) as apy, round((apy - lag(apy, 1) ignore nulls over (order by time))) as apy_change_count,round((apy - lag(apy, 1) ignore nulls over (order by time))/lag(apy, 1) ignore nulls over (order by time), 3) as daily_apy_change_percentfrom apy_dataorder by time desc