brian-terraTotal LUNA Supply Change - 7 days
    Updated 2022-05-12
    with staked as
    (select date,
    sum(balance) as total_luna,
    sum(balance_usd) as total_usd
    from terra.daily_balances
    where date > CURRENT_DATE-8
    and balance_type = 'staked'
    and currency = 'LUNA'
    group by date)

    select a.date previous_date,
    b.date current_date,
    a.total_luna prev_luna,
    b.total_luna current_luna,
    a.total_usd prev_usd,
    b.total_usd curr_usd,
    b.total_luna - a.total_luna as net_luna_change,
    b.total_usd - a.total_usd as net_usd_change
    from staked a, staked b
    where a.date = b.date-1
    order by b.date desc
    Run a query to Download Data