SELECT date(block_timestamp) as date, SWAP_PROGRAM, sum(SWAP_TO_AMOUNT) as vol,
COUNT(DISTINCT swapper) as swappers,
'buy' as type
from flipside_prod_db.algorand.swaps
where SWAP_TO_ASSET_ID = 226701642
GROUP by date, SWAP_PROGRAM
UNION
SELECT date(block_timestamp) as date, SWAP_PROGRAM, sum(SWAP_FROM_AMOUNT) as vol,
COUNT(DISTINCT swapper) as swappers,
'sell' as type
from flipside_prod_db.algorand.swaps
where SWAP_FROM_ASSET_ID = 226701642
GROUP by date, SWAP_PROGRAM