Pmisha-bmlMdxTerra.52.pickup
    Updated 2022-02-27
    --with tt as (
    with lp as (
    SELECT DATE(block_timestamp) as date, AVG(price_usd) as LunaPrice
    FROM terra.oracle_prices
    WHERE symbol = 'LUNA'
    AND DATEDIFF('day', TO_DATE(block_timestamp), CURRENT_DATE()) <= 60
    GROUP BY 1)

    select
    case when LunaPrice < 52 then 'under 52'
    when LunaPrice >= 52 then 'over 52'
    end as luna_class,
    count (LunaPrice)
    from lp group by 1
    --)

    --select
    --count(below_52)+count(over_52) as total,
    --count(below_52) as below52,
    --count(over_52) as over52
    --from tt

    Run a query to Download Data