Afonso_Diaz2023-04-17 02:15 AM
    Updated 2023-04-16
    with t as (
    select
    recorded_hour::date as date,
    currency,
    symbol,
    avg(price) as price_usd
    from osmosis.core.ez_prices
    group by 1, 2, 3
    ),


    t2 as (
    select
    block_timestamp,
    symbol,
    tx_id,
    trader as swapper,
    (from_amount) * price_usd as amount_usd
    from osmosis.mars.ez_swaps a
    join t on date = block_timestamp::date and t.currency = a.from_currency
    where block_timestamp >= '2023-01-01' and block_timestamp < '2023-04-01'
    and tx_succeeded = 1
    )

    select
    case
    when amount_usd < 10 then 'Less than 10$'
    when amount_usd < 50 then '10$ - 50$'
    when amount_usd < 100 then '50$ - 100$'
    when amount_usd < 500 then '100$ - 500$'
    when amount_usd < 1000 then '500$ - 1000$'
    when amount_usd < 10000 then '1000$ - 10,000$'
    else 'More than 10,000$'
    end as type,
    count(distinct tx_id) as swaps
    from t2
    Run a query to Download Data