with cte1 as (select date(block_timestamp) as date_ ,COLLATERAL_SYMBOL, count(DISTINCT(BORROWER)) as user,count(DISTINCT(tx_hash)) as total_tx , sum(amount_usd) as volume,
sum(total_tx) over (order by date_ asc) as Cumulative_tx , sum(volume) over (order by date_ asc) as Cumulative_volume,sum(user) over (order by date_ asc) as Cumulative_user, avg(amount_usd) as average_amount
from polygon.sushi.ez_borrowing
where action = 'Borrow' and amount_usd is not null and COLLATERAL_SYMBOL in ('USDC','BUSD', 'USDT','DAI') and block_timestamp::date >= '2022-01-01'
group by 1,2)
select *
from cte1