Query editor
-- Credit to @three-sigma for the interest rate calculations querywith data as (selecttoken,hour,variable_borrow_apy,'v3' as versionfrom query_2638969 -- v3where token in ('USDC', 'USDT', 'DAI')union allselecttoken,hour,variable_borrow_apy,'v2' as versionfrom query_2638998 -- v2where token in ('USDC', 'USDT', 'DAI')),aggregated_data as (selecthour,avg(variable_borrow_apy) as final_variable_borrow_apy -- this should be weighted by pool size across asset and protocol versionfrom datagroup by hour)selecthour,final_variable_borrow_apy,avg(final_variable_borrow_apy) over(order by hour rows between 1*24 preceding and current row) as daily_ma,avg(final_variable_borrow_apy) over(order by hour rows between 7*24 preceding and current row) as weekly_ma,avg(final_variable_borrow_apy) over(order by hour rows between 30*24 preceding and current row) as monthly_mafrom aggregated_datawhere hour > now() - interval '3' year