iboo-jbj2MVgoBTC swap volume based - on type of swap
    Updated 2022-05-21
    with goBTC_swap_from as (
    select BLOCK_TIMESTAMP::date as date ,
    sum (SWAP_FROM_AMOUNT) as volume ,
    count (DISTINCT tx_group_id) as num_swaps
    from flipside_prod_db.algorand.swaps
    where year(BLOCK_TIMESTAMP) = '2022'
    and SWAP_FROM_AMOUNT>0
    and SWAP_FROM_ASSET_ID = 386192725
    group by 1
    ),
    goBTC_swap_to as (
    select BLOCK_TIMESTAMP::date as date ,
    sum (SWAP_to_AMOUNT) as volume ,
    count (DISTINCT tx_group_id) as num_swaps
    from flipside_prod_db.algorand.swaps
    where year(BLOCK_TIMESTAMP) = '2022'
    and SWAP_FROM_AMOUNT>0
    and SWAP_to_ASSET_ID = 386192725
    group by 1
    ),
    all_goBTC as (
    select 'sell' as type , * from goBTC_swap_from
    UNION all
    select 'buy' as type, * from goBTC_swap_to
    ),
    final_goBTC as (
    select date ,type , sum (volume) as goBTC_volume ,
    sum (num_swaps) as goBTC_swaps
    from all_goBTC
    group by 1,2
    ),
    goETH_swap_from as (
    select BLOCK_TIMESTAMP::date as date ,
    sum (SWAP_FROM_AMOUNT) as volume ,
    count (DISTINCT tx_group_id) as num_swaps
    Run a query to Download Data