c2ctraderDaily Swaped ALGOs Volume to Receive ASA
    Updated 2022-04-14
    with asa as(
    select round(sum(SWAP_FROM_AMOUNT),0) total_ALGO_Swap_volume,round(avg(SWAP_FROM_AMOUNT),0) average_ALGO_Swap_volume, SWAP_TO_ASSET_ID asset_id
    from algorand.swaps
    where SWAP_FROM_ASSET_ID=0
    group by SWAP_TO_ASSET_ID
    ),
    top10 as (
    select top 10 asa.asset_id,a.asset_name, asa.total_ALGO_Swap_volume,asa.average_ALGO_Swap_volume from asa
    join algorand.asset a on asa.asset_id=a.asset_id
    order by total_ALGO_Swap_volume DESC
    ),
    top10_volume as(
    select date_trunc('day',block_timestamp) day, round(sum(swap_from_amount),0) swap_volume, round(avg(swap_from_amount),0) swap_average_volume, SWAP_TO_ASSET_ID asset_id
    from algorand.swaps where asset_id in (select asset_id from top10)
    group by day,asset_id
    order by swap_volume DESC
    )
    select tv.day,tv.asset_id,t.asset_name,tv.swap_volume, tv.swap_average_volume
    from top10_volume tv join top10 t on tv.asset_id=t.asset_id
    where day>'2021-12-31'
    order by day,swap_volume
    Run a query to Download Data