bitmitgALGO3 : to & from (trades)
    Updated 2022-04-26
    with tbl1 as (select count(*) as count,block_timestamp::date as date from algorand.swaps where swap_to_asset_id=694432641
    group by date)
    ,tbl2 as (select count(*) as count,block_timestamp::date as date from algorand.swaps where swap_from_asset_id=694432641
    group by date)
    ,tbl3 as (select sum(swap_to_amount) as sum,block_timestamp::date as date from algorand.swaps where swap_to_asset_id=694432641
    group by date)
    ,tbl4 as (select sum(swap_from_asset_id) as sum,block_timestamp::date as date from algorand.swaps where swap_from_asset_id=694432641
    group by date)
    ,tbl5 as(select count(1),date(block_timestamp), swap_program from algorand.swaps
    where (swap_from_asset_id=694432641 or swap_to_asset_id=694432641)
    and swap_program in (select distinct swap_program from algorand.swaps where (swap_from_asset_id=694432641 or swap_to_asset_id=694432641))
    group by 2,3)
    ,tbl6 as (select count(*) as count,swap_from_asset_id from algorand.swaps where swap_to_asset_id=694432641
    group by 2)
    ,tbl7 as(select count(*) as count,swap_to_asset_id from algorand.swaps where swap_from_asset_id=694432641
    group by 2)
    select *,'Swap To' from tbl1
    UNION
    select *,'Swap From' from tbl2
    Run a query to Download Data