Query editor
-- 7-day rolling APR on equity of the Aave v3 Plasma USDe/sUSDe loop of 0xa11B…ADC5 (daily rows from query 9232115).-- APR_7d = sum of income over the last 7 days / sum of (start-of-day equity × day fraction) over the same days × 365.with d as (select day, as_of, equity_usdc, net_market_income, net_total,lag(equity_usdc) over (order by day) as equity_start,date_diff('second', cast(day as timestamp), as_of) / 86400.0 as day_fracfrom query_9232115),r as (select day,sum(net_market_income) over w as market_7d,sum(net_total) over w as total_7d,sum(equity_start * day_frac) over w as equity_days_7d,count(equity_start) over w as n_daysfrom dwindow w as (order by day rows between 6 preceding and current row))select day,market_7d / equity_days_7d * 365 * 100 as apr_7d_market_pct,total_7d / equity_days_7d * 365 * 100 as apr_7d_total_pct,market_7d as income_7d_market,total_7d as income_7d_totalfrom rwhere n_days = 7order by day