esi69sushi 15
    Updated 2023-03-18
    WITH inflow as (select date_trunc(day,block_timestamp) as date,
    'Arbitrum' as blockchain,
    symbol_in as stablecoin,
    count(distinct tx_hash) as swaps,
    count(distinct origin_from_address) as swappers_in,
    sum(amount_in) as volume_in
    from arbitrum.sushi.ez_swaps
    where symbol_in in ('MIM','FRAX','AMUSDC','BUSD','DAI','PUSD','TUSD','USDC','USDT','UST','alUSD','cDAI','sUSD','sUSD','USDD','USDN')
    and date >= CURRENT_DATE-90
    group by 1,2,3),
    outflow as (select date_trunc(day,block_timestamp) as date,
    'Arbitrum' as blockchain,
    symbol_out as stablecoin,
    count(distinct tx_hash) as swaps,
    count(distinct origin_from_address) as swappers_out,
    sum(amount_out) as volume_out
    from arbitrum.sushi.ez_swaps
    where symbol_out in ('MIM','FRAX','AMUSDC','BUSD','DAI','PUSD','TUSD','USDC','USDT','UST','alUSD','cDAI','sUSD','sUSD','USDD','USDN')
    and date >= CURRENT_DATE-90
    group by 1,2,3)
    select inflow.date , volume_out ,volume_in,volume_in - volume_out as Netflow,swappers_in + swappers_out as swappers
    from inflow left join outflow on inflow.date = outflow.date
    Run a query to Download Data