Query editor
-- @title Coinbase tokenized-stock markets (Base) — daily supply TVL and borrow, since 10 Sep-- @description Daily total supplied assets (market TVL) and total borrowed 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%), 10 Sep 2026 onward. Long format: one row per (day, market).-- @author Romana (Steakhouse Financial)-- @notes Supply = cum Supply − Withdraw + AccrueInterest.interest − Liquidate.badDebtAssets since market-- creation (7 Sep). Borrow = cum Borrow − Repay + AccrueInterest.interest − Liquidate.repaidAssets −-- Liquidate.badDebtAssets. End-of-day values, forward-filled. USDC = 6 decimals.-- @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)), deltas as (select id, evt_block_time, cast(assets as double) / 1e6 as d_supply, 0e0 as d_borrowfrom morpho_blue_base.morphoblue_evt_supply where evt_block_time >= timestamp '2026-09-07'union allselect id, evt_block_time, - cast(assets as double) / 1e6, 0e0from morpho_blue_base.morphoblue_evt_withdraw where evt_block_time >= timestamp '2026-09-07'union allselect id, evt_block_time, 0e0, cast(assets as double) / 1e6from morpho_blue_base.morphoblue_evt_borrow where evt_block_time >= timestamp '2026-09-07'union allselect id, evt_block_time, 0e0, - cast(assets as double) / 1e6from morpho_blue_base.morphoblue_evt_repay where evt_block_time >= timestamp '2026-09-07'union allselect id, evt_block_time, cast(interest as double) / 1e6, cast(interest as double) / 1e6from morpho_blue_base.morphoblue_evt_accrueinterest where evt_block_time >= timestamp '2026-09-07'union allselect id, evt_block_time, - cast(badDebtAssets as double) / 1e6, - (cast(repaidAssets as double) + cast(badDebtAssets as double)) / 1e6from morpho_blue_base.morphoblue_evt_liquidate where evt_block_time >= timestamp '2026-09-07'), daily as (select m.market, cast(date_trunc('day', d.evt_block_time) as date) as day, sum(d.d_supply) as d_supply, sum(d.d_borrow) as d_borrowfrom deltas dinner join markets m on m.market_id = d.idgroup by 1, 2), calendar as (select dayfrom unnest(sequence(date '2026-09-07', current_date, interval '1' day)) as t(day)), cum as (select c.day, m.market, sum(coalesce(d.d_supply, 0)) over (partition by m.market order by c.day) as supply, sum(coalesce(d.d_borrow, 0)) over (partition by m.market order by c.day) as borrowfrom calendar c