select date_trunc ({{Time_Interval}},date) as date,
symbol as market,
avg (apy) as Market_APY,
avg (tvl_usd) as TVL
from external.defillama.fact_pool_yields
where chain = 'Avalanche'
--and (projects ilike '%AAVE%'
and projects ilike '%BENQI%'
--and date = (select max(date) from external.defillama.fact_pool_yields and chain = 'Avalanche' )
group by 1,2
order by 1 desc