adam10LUNA Price
    Updated 2021-08-02
    with new_luna_prices as (
    SELECT
    date_trunc('day', block_timestamp) as date
    FROM terra.oracle_prices
    where symbol = 'LUNA' AND date >= CURRENT_DATE - 56
    group by date),

    luna_prices as (
    SELECT
    date_trunc('day', block_timestamp) as date,
    avg(price_usd) as luna_daily_avg_price
    FROM terra.oracle_prices
    where symbol = 'LUNA' AND date >= CURRENT_DATE - 56
    group by date
    ),

    actual_luna_prices as (
    SELECT
    date_trunc('day', block_timestamp) as date
    -- avg(price_usd) as luna_daily_percentage
    FROM terra.oracle_prices
    where symbol = 'LUNA' AND date >= CURRENT_DATE - 56
    group by date)

    SELECT
    u.date,
    -- u.luna_daily_percentage,
    l.luna_daily_avg_price
    from new_luna_prices u
    inner join luna_prices l
    on u.date = l.date
    inner join actual_luna_prices a
    on u.date = a.date
    Run a query to Download Data