2844LUNA
    Updated 2022-05-08
    with price as (
    select date_trunc('day', block_timestamp) as P_date, avg(price_usd) as luna_price
    from terra.oracle_prices
    where symbol like 'LUNA%'
    and (block_timestamp) >= current_date -30
    group by 1),
    market_caps as (
    select date as M_date, sum(balance) as total
    from terra.daily_balances
    where currency like 'LUNA%'
    group by 1)

    select P_date, luna_price, total as luna_supply,(luna_price * total) as market_cap
    from price, market_caps
    where price.P_date=market_caps.M_date


    order by P_date desc
    Run a query to Download Data