nitsStablecoin Popularity
    Updated 2022-04-06
    with usdc as
    (SELECT day, sum(swap_amt) as total_amt_swapped, count(*) as total_txs , 'usdc' as coin , sum(total_txs) over (order by day) as cumulative_txs,sum(total_amt_swapped) over (order by day) as cumulative_amount
    from
    (SELECT date(block_timestamp) as day,*, case when swap_from_asset_id = '31566704' then swap_from_amount when swap_to_asset_id = '31566704' then swap_to_amount end as swap_amt
    from algorand.swaps
    where swap_from_asset_id = '31566704' or swap_to_asset_id = '31566704')
    where day >= '2022-01-01'
    GROUP by 1 ),
    usdt as
    (SELECT day, sum(swap_amt) as total_amt_swapped, count(*) as total_txs , 'usdt' as coin , sum(total_txs) over (order by day) as cumulative_txs,sum(total_amt_swapped) over (order by day) as cumulative_amount
    from
    (SELECT date(block_timestamp) as day,*, case when swap_from_asset_id = '312769' then swap_from_amount when swap_to_asset_id = '312769' then swap_to_amount end as swap_amt
    from algorand.swaps
    where swap_from_asset_id = '312769' or swap_to_asset_id = '312769')
    where day >= '2022-01-01'
    GROUP by 1 ),
    stbl as
    (SELECT day, sum(swap_amt) as total_amt_swapped, count(*) as total_txs , 'stbl' as coin , sum(total_txs) over (order by day) as cumulative_txs,sum(total_amt_swapped) over (order by day) as cumulative_amount
    from
    (SELECT date(block_timestamp) as day,*, case when swap_from_asset_id = '465865291' then swap_from_amount when swap_to_asset_id = '465865291' then swap_to_amount end as swap_amt
    from algorand.swaps
    where swap_from_asset_id = '465865291' or swap_to_asset_id = '465865291')
    where day >= '2022-01-01'
    GROUP by 1 )
    SELECT * from usdc
    UNION ALL
    SELECT * from usdt
    UNION ALL
    SELECT * from stbl
    -- limit 100
    Run a query to Download Data