select
BLOCK_TIMESTAMP::date as day
,action
,avg((select avg(PRICE) from ethereum.core.fact_hourly_token_prices where HOUR::date =block_timestamp::date and SYMBOL='WETH')) as ETH_PRICE
,sum (AMOUNT_USD) as amount_usd
from ethereum.sushi.ez_lending
where BLOCK_TIMESTAMP::date >= CURRENT_DATE - 40
group by 1,2
order by 1