Josh956Luna year
    Updated 2022-05-09
    with a as (select date_trunc('day', date) as day, sum(balance) as amt
    from terra.daily_balances
    where currency like '%LUNA%'
    and day>current_date-365
    group by 1),

    b as (select date_trunc('day', block_timestamp) as daya, avg(price_USD) as pp
    from terra.oracle_prices
    where symbol like '%LUNA%'
    and daya>current_date-365
    group by 1)

    select daya, (pp*amt)/3.25 as Market_cap
    from a
    inner join b
    on a.day=b.daya

    Run a query to Download Data