Query editor
-- @title Coinbase tokenized-stock markets (Base) — hourly borrow APY-- @description Hourly borrow APY for the five Coinbase tokenized-stock / USDC Morpho Blue markets on Base that-- Steakhouse High Yield USDC allocates to (AAPLc 62.5%, GOOGLc 77%, NVDAc 62.5%, METAc 62.5%, SPCXc 62.5%),-- from market creation on 7 Sep 2026. Long format: one row per (hour, market).-- @author Romana (Steakhouse Financial)-- @notes Rate taken from Morpho Blue AccrueInterest.prevBorrowRate (per-second, WAD), last event per hour,-- forward-filled across hours with no accrual. APY = exp(rate × 365 × 86400) − 1 (continuous compounding, which-- is how Blue accrues). This is the rate in force between accruals, not a time-weighted average within the hour.-- @version 1.0with markets as (select *from (values(0xae1a30486234bf7e7ac166c7c03d9bc5f2cd8a39be2c48e73c665ac7148c3c28, 'AAPLc/USDC 62.5%'), (0xa3913d896b7e9c0e0a84f1be27d376cf2065616101cb7c44674af8a154e684cc, 'GOOGLc/USDC 77%'), (0xb4b42dd66cef25614b94510a910d54b2c148e7621d22b4271566724beda63d13, 'NVDAc/USDC 62.5%'), (0x44b343b5087c0bd34207cb5c199f12030777bf6b8c0a128438246f1212f37ca5, 'METAc/USDC 62.5%'), (0xce983b9ee6344e16ebbcc66812f23caafc63ae83fcc14fa29b66c7e69e9cecf6, 'SPCXc/USDC 62.5%')) as t(market_id, market)), calendar as (select hourfrom unnest(sequence(timestamp '2026-09-07 00:00:00', cast(date_trunc('hour', now()) as timestamp), interval '1' hour)) as t(hour)), rates as (select m.market, cast(date_trunc('hour', a.evt_block_time) as timestamp) as hour, max_by(cast(a.prevBorrowRate as double) / 1e18, a.evt_block_time) as rate_per_secfrom morpho_blue_base.morphoblue_evt_accrueinterest ainner join markets m on m.market_id = a.idwhere a.evt_block_time >= timestamp '2026-09-07'group by 1, 2), filled as (select c.hour, m.market, last_value(r.rate_per_sec) ignore nulls over (partition by m.market order by c.hour rows between unbounded preceding and current row) as rate_per_secfrom calendar ccross join markets mleft join rates r on r.market = m.market and r.hour = c.hour)select hour, market, rate_per_sec * 365 * 86400 as borrow_apr, exp(rate_per_sec * 365 * 86400) - 1 as borrow_apyfrom filledwhere rate_per_sec is not nullorder by hour desc, market