kiacryptoYLDLY swap volume
    Updated 2022-05-22
    with sell as (
    select date_trunc('day', block_timestamp) as date, sum(swap_from_amount) as sell_volume
    from algorand.swaps
    where date >= '2022-01-01' and swap_from_amount > 0 and swap_from_asset_id = '226701642'
    group by 1
    ),

    buy as (
    select date_trunc('day', block_timestamp) as date, sum(swap_to_amount) as buy_volume
    from algorand.swaps
    where date >= '2022-01-01' and swap_to_amount > 0 and swap_to_asset_id = '226701642'
    group by 1
    )

    select s.date, sell_volume + buy_volume as volume
    from sell s, buy b
    where s.date = b.date
    Run a query to Download Data