SELECT date(block_timestamp) as day, collateral_symbol, count(DISTINCT tx_hash) as total_txs
, sum(total_txs) over (partition by collateral_symbol order by day) as cum_txs ,
sum(amt_net) as total_amt_usd,
sum(total_amt_usd) over (partition by collateral_symbol order by day) as cum_amt
from
(SELECT *, case when action = 'Borrow' then amount_usd else amount_usd*(-1) end as amt_net
from crosschain.ez_borrowing)
where collateral_symbol in (
'USDC',
'DAI',
'USDT',
'RAI',
'TUSD',
'sUSD',
'UST',
'FEI' ) and day >= '2022-01-01'
GROUP by 1,2
-- limit 100