davidwallUntitled Query
    Updated 2023-01-19
    --credit : https://app.flipsidecrypto.com/velocity/queries/9a92bb79-016a-4ca6-82cb-87fd82395df9
    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),

    atomt as (
    select recorded_at::date as date,
    avg (price) as ATOM
    from osmosis.core.dim_prices
    where symbol ilike 'atom'
    and recorded_at::date >= '2023-01-01'
    group by 1)

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