Elprognerd3 - luna <-> usd Swaps
    Updated 2023-01-16
    with t1 as (select
    --date_trunc('hour',block_timestamp) as date,
    CASE WHEN to_currency = 'uluna' then 'USD -> LUNA'
    WHEN from_currency = 'uluna' then 'LUNA -> USD'
    end as "Type",
    count(distinct tx_id) as "Number of TXs",
    count(distinct trader) as "Number of Swappers",
    sum(case when to_currency = 'uluna' then from_amount/1e6 else to_amount/1e6 end) as "Total Swapped Volume in USD",
    sum(case when from_currency = 'uluna' then from_amount/1e6 else to_amount/1e6 end) as "Total Swapped Volume in LUNA"
    from terra.core.ez_swaps
    where block_timestamp >= '2023-01-08' and to_currency in ('uluna', 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4', 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858') and
    from_currency in ('uluna', 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4', 'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858')
    GROUP by 1--, 2
    --order by 1
    )
    select *
    FROM t1
    where "Type" is not null


    Run a query to Download Data