with swap_to as (
select date_trunc('day',block_timestamp) as dt, sum(swap_to_amount) as volume_swap_to , count(tx_group_id) as trade_swap_to,count(distinct swapper) as wallet_swap_to
from algorand.swaps
where swap_to_asset_id = '571576867' and block_timestamp < CURRENT_DATE
group by 1
),
swap_from as (
select date_trunc('day',block_timestamp) as dt, sum(swap_from_amount) as volume_swap_from,count(tx_group_id) as trade_swap_from,count(distinct swapper) as wallet_swap_from
from algorand.swaps
where swap_from_asset_id = '571576867' and block_timestamp < CURRENT_DATE
group by 1
)
select swap_to.dt, volume_swap_to,volume_swap_from,trade_swap_to,trade_swap_from,wallet_swap_to,wallet_swap_from
from swap_to join swap_from on swap_to.dt = swap_from.dt