SELECT
date_trunc('day',block_timestamp) as date,
avg(amount_usd) as swap_volume,
avg(swap_volume) OVER(ORDER BY date
ROWS BETWEEN 19 PRECEDING AND CURRENT ROW )
as moving_average,
direction,
platform
from ethereum.dex_swaps
where
date > '2021-04-01' AND
--platform = 'uniswap-v2' OR
platform = 'uniswap-v3'
group by date,direction,platform
order by date
--sum(n_wallets) over (order by date asc rows between unbounded preceding and current row) as cum_n_wallets