with luna_prices as (select
date_trunc('day', block_timestamp) as date,
avg(price_usd) as price
-- dateadd('day', 7, block_day) as week_later
from terra.oracle_prices
where block_timestamp >= current_date() - 30
and symbol = 'LUNA'
group by date
order by date),
data as (select *,
lead(price, 7, 0) over (order by date) as price_week_later,
((price_week_later-price)/price)*100 as percentage_difference
from luna_prices)
select * from data
where percentage_difference >= 15