ML6Volume of Buyers and Sellers over time
    Updated 2022-05-21
    with buying_swapper as (select count(distinct swapper) as cnt , date_trunc('day', block_timestamp) as dt from algorand.swaps
    where (swap_from_asset_id=386195940 or swap_from_asset_id=386192725) and swap_from_amount is not null and swap_from_amount!=0
    group by 2)
    , buying_swapper_asset_name as (select count(distinct swapper) as cnt ,
    ( case
    when swap_from_asset_id=386195940 then 'goETH'
    when swap_from_asset_id=386192725 then 'goBTC'
    END ) as asset_name
    from algorand.swaps
    where (swap_from_asset_id=386195940 or swap_from_asset_id=386192725) and swap_from_amount is not null and swap_from_amount!=0
    group by 2)
    ,selling_swapper as (
    select count(distinct swapper) as cnt , date_trunc('day', block_timestamp) as dt from algorand.swaps
    where (swap_to_asset_id=386195940 or swap_to_asset_id=386192725) and swap_to_amount is not null and swap_to_amount !=0
    group by 2)
    , selling_swapper_asset_name as (
    select count(distinct swapper) as cnt ,
    ( case
    when swap_to_asset_id=386195940 then 'goETH'
    when swap_to_asset_id=386192725 then 'goBTC'
    END ) as asset_name
    from algorand.swaps
    where (swap_to_asset_id=386195940 or swap_to_asset_id=386192725) and swap_to_amount is not null and swap_to_amount !=0
    group by 2)
    , buying_volume as (select sum(swap_from_amount + swap_to_amount) as vol , date_trunc('day', block_timestamp) as dt from algorand.swaps
    where (swap_from_asset_id=386195940 or swap_from_asset_id=386192725)
    and swap_from_amount is not null and swap_from_amount!=0 and swap_to_amount is not null and swap_to_amount !=0
    group by 2)
    , buying_volume_asset_name as (select sum(swap_from_amount + swap_to_amount) as vol ,
    ( case
    when swap_from_asset_id=386195940 then 'goETH'
    when swap_from_asset_id=386192725 then 'goBTC'
    END ) as asset_name
    from algorand.swaps
    where (swap_from_asset_id=386195940 or swap_from_asset_id=386192725)
    and swap_from_amount is not null and swap_from_amount!=0 and swap_to_amount is not null and swap_to_amount !=0
    Run a query to Download Data