SELECT
date_trunc('day',block_hour) as day,
underlying_symbol,
avg(supply_apy) as supply_apy_,
avg(comp_apy_supply) as distribution,
+distribution+supply_apy_ as total_apy
FROM compound.market_stats
WHERE
(underlying_symbol = 'USDT' OR underlying_symbol = 'DAI' OR underlying_symbol = 'USDC')
AND block_hour >= getdate() - interval '2 month'
AND comp_apy_borrow <> 'inf'
GROUP BY 1,2
ORDER BY 1