Query editor
with markets as (selectmarket_id, blockchain, coll_symbol, loan_symbol, loan_decimalsfrom dune.steakhouse.result_morpho_marketswhere blockchain in ('ethereum', 'base')), market_rates as (selectmd.dt, m.blockchain, m.market_id, m.coll_symbol, m.loan_symbol, md.supply_rate, md.supply_amount * md.loan_price as supply_usdfrom dune.steakhouse.result_morpho_markets_data as mdjoin markets as mon m.market_id = md.market_idand m.blockchain = md.blockchainwhere md.dt between date '2025-08-01' and date '2026-05-29'and md.supply_rate between 0 and 0.5), named_legs as (selectdt, casewhen blockchain = 'ethereum' and coll_symbol = 'cbBTC' then '1_cbBTC_Ethereum'when blockchain = 'base' and coll_symbol = 'cbBTC' then '2_cbBTC_Base'when blockchain = 'base' and coll_symbol = 'cbXRP' then '3_cbXRP_Base'end as series, sum(supply_rate * supply_usd) / nullif(sum(supply_usd), 0) as apyfrom market_rateswhere loan_symbol = 'USDC'and ((blockchain = 'ethereum' and coll_symbol = 'cbBTC')or (blockchain = 'base' and coll_symbol in ('cbBTC', 'cbXRP')))group by 1, 2), hy_vault as (select vault_addressfrom dune.steakhouse.result_morpho_vaultswhere curator_name = 'Steakhouse'and blockchain = 'ethereum'and vault_symbol = 'bbqUSDC'), hy_flows as (selectdate(f.evt_block_time) as dt, f.market_id, sum(f.shares) as shares_deltafrom (select supply.evt_block_time, supply.id as market_id, supply.shares as sharesfrom morpho_blue_multichain.morphoblue_evt_supply as supplyjoin hy_vault on supply.onBehalf = hy_vault.vault_addresswhere supply.chain = 'ethereum'union allselect withdraw.evt_block_time, withdraw.id, -withdraw.shares