bachimarket volatility sushi
    Updated 2022-06-30
    WITH
    swapin_txns as (
    SELECT
    date(block_timestamp) as day,
    round(sum(amount_in_usd),2) as swapped_amount_usd,
    count(distinct tx_hash) as no_of_swaps,
    count(distinct origin_from_address) as no_of_users
    from ethereum.sushi.ez_swaps
    where block_timestamp >='2022-05-01' and amount_in_usd<1e8
    and amount_in_usd > 0 and amount_in_usd is not null
    and platform = 'sushiswap'
    group by 1
    order by 1 ASC
    ),
    swapout_txns as (
    SELECT
    date(block_timestamp) as day,
    round(sum(amount_out_usd),2) as swapped_amount_usd,
    count(distinct tx_hash) as no_of_swaps,
    count(distinct origin_from_address) as no_of_users
    from ethereum.sushi.ez_swaps
    where block_timestamp >='2022-05-01'
    and amount_out_usd < 1e8 and amount_out_usd > 0 and amount_out_usd is not null
    and platform = 'sushiswap'
    group by 1
    order by 1 ASC
    )

    select *, 'Swap-in' as "Swap Category" from swapin_txns
    UNION
    select *, 'Swap-Out' as "Swap Category" from swapout_txns
    Run a query to Download Data