boomer77daily fees collected 22
    Updated 2022-04-01
    with raw as (select date_trunc('day', block_timestamp) as dt, fee[0]:amount[0]:denom::string as currency, sum(fee[0]:amount[0]:amount/1e6) as fees
    from terra.transactions
    where year(block_timestamp) = '2022' and fee[0]:amount[0]:amount is not null and tx_status = 'SUCCEEDED'
    group by 1,2),

    price as (select date_trunc('day', block_timestamp) as dt, currency, avg(price_usd) as price
    from terra.oracle_prices
    where year(block_timestamp) = '2022'
    group by 1,2),

    tx as (select date_trunc('day', block_timestamp) as dt, count(distinct tx_id) as tx_vol
    from terra.transactions
    where tx_status = 'SUCCEEDED' and year(block_timestamp) = '2022'
    group by 1),

    lasts as (select a.dt, a.currency, a.fees, b.price, c.tx_vol, (a.fees*b.price) as fees_usd
    from raw a
    left join price b on a.dt = b.dt and a.currency = b.currency
    left join tx c on a.dt = c.dt)

    select * from lasts
    where fees_usd is not null
    Run a query to Download Data