nickpayiatis_Last 30 Days Swap TO Selected Asset Statistics
    Updated 2022-10-19
    select
    asset.asset_name as "Swap FROM Asset",
    count(case when swap_from_amount > 0 then 1 else 0 end) as "Swaps",
    sum(swap_from_amount) as "Swap FROM Asset Volume",
    sum(swap_to_amount) as "Swap TO Asset Volume",
    "Swap TO Asset Volume"/"Swaps" as "Average Swap TO Asset Amount"
    from algorand.swaps swaps
    left join algorand.asset asset on swaps.swap_from_asset_id = asset.asset_id
    left join algorand.asset asset2 on swaps.swap_to_asset_id = asset2.asset_id
    where
    swaps.block_timestamp::Date > dateadd(day, -30, current_date())
    and swaps.swap_to_asset_id = {{ASA_ID}}
    group by
    "Swap FROM Asset"
    order by "Swap TO Asset Volume" desc
    Run a query to Download Data