SalehPleasure to Burn-compare
    Updated 2022-02-27
    with Luna_burned as (
    select
    block_timestamp::date as DAY ,
    sum(token_0_amount) as Luna_burned
    from terra.swaps
    where block_timestamp::date>=CURRENT_DATE-30
    and ask_currency = 'UST'
    and offer_currency = 'LUNA'
    and tx_status = 'SUCCEEDED'
    group by 1
    order by 1
    )
    , lst_UST as (
    select DATE as day
    ,sum(BALANCE) as sum_usd
    from terra.daily_balances
    where BALANCE_TYPE='liquid'
    and CURRENCY='UST'
    and BALANCE>0
    and date>=CURRENT_DATE-30
    group by 1
    order by 1
    )
    ,lst_all as (
    select 'luna' as action,DAY,Luna_burned from Luna_burned
    union all select 'ust' as action,day,sum_usd from lst_UST
    )
    select day
    ,sum(iff(action='luna',Luna_burned,0)) as sum_Luna_burned
    ,sum(iff(action='ust',Luna_burned,0)) as sum_ust
    from lst_all
    group by 1
    order by 1

    Run a query to Download Data