davidwallUntitled Query
    Updated 2023-01-19
    --credit : https://app.flipsidecrypto.com/velocity/queries/f9b706ba-fe65-4cc2-a2b6-47f22a08bb41
    with lunapricet as (
    select block_timestamp::Date as date,
    median (to_amount/from_amount) as LUNA
    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 < 2 and LUNA > 1.22 and LUNA != 1.333487
    order by 1),

    solt as (
    select recorded_hour::date as date,
    avg (close) as SOL
    from solana.core.fact_token_prices_hourly
    where symbol in ('SOL')
    and recorded_hour >= '2023-01-01'
    group by 1)

    select t1.date,
    LUNA,
    SOL
    from lunapricet t1 join solt t2 on t1.date = t2.date
    Run a query to Download Data