Ali3NDaily Net Volume of $LUNA Swaps Over Time Since January 2023
    Updated 2023-01-12
    select date_trunc (day,block_timestamp) as date,
    case when block_timestamp::date = '2023-01-09' then '9 January'
    else 'Other Days' end as timespan,
    case when from_currency = 'uluna' and to_currency != 'uluna' then 'Swaps From LUNA'
    when to_currency = 'uluna' and from_currency != 'uluna' then 'Swaps To LUNA'
    else null end as swap_type,
    count (distinct tx_id) as TX_Count,
    sum (case when to_currency = 'uluna' then to_amount/pow(10,to_decimal) end) as "Swap To (BUY) Volume",
    sum (case when from_currency = 'uluna' then from_amount*-1/pow(10,from_decimal) end) as "Swap From (SELL) Volume",
    sum (case when to_currency = 'uluna' then to_amount/pow(10,to_decimal) when from_currency = 'uluna' then from_amount*-1/pow(10,from_decimal) end) as NET_Volume,
    sum (NET_Volume) over (order by date) as Cumulative_NET_Volume
    from terra.core.ez_swaps
    where tx_succeeded = 'TRUE'
    and block_timestamp >= '2023-01-01'
    and swap_type is not null
    group by 1,2,3
    order by 1

    Run a query to Download Data