davidwallUntitled Query
    Updated 2023-01-19
    --credit : https://app.flipsidecrypto.com/velocity/queries/3cfc23fc-cc7d-4d38-a7c6-ffbd1d8e9094
    with lunapricet as (
    select date_trunc (hour,block_timestamp) as date1,
    median (to_amount/from_amount) as LUNA_Price
    from terra.core.ez_swaps
    where from_currency = 'uluna'
    and to_currency = 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4'
    and to_amount < 1e8 and from_amount < 1e8
    and block_timestamp >= '2023-01-01'
    group by 1 having LUNA_Price < 2 and LUNA_Price > 1.22 and LUNA_Price != 1.333487
    order by 1)

    select date_trunc(hour,mindate) as date,
    case when mindate::date = '2023-01-09' then '9 January'
    else 'Other Days' end as timespan,
    luna_price,
    count (distinct tx_sender) as New_Users_Count
    from (
    select tx_sender,
    min (block_timestamp) as mindate
    from terra.core.fact_transactions
    group by 1) t1 join lunapricet t2 on date_trunc(hour,t1.mindate) = t2.date1
    where mindate >= '2023-01-01'
    group by 1,2,3
    order by 1
    Run a query to Download Data