Query editor
-- Q4: Lending Borrow Demand Pressure — Tail Risk Leading Indicator-- Ratio of borrow flow to supply flow. When borrow >> supply flow, utilization rises-- and borrow rates spike — the leading signal for forced unwind (Chapter 6).-- USDe Spoke: 55%->98% utilization preceded the Oct 2025 de-peg cascade.WITH borrows AS (SELECTblockchain,project,symbol,SUM(amount_usd) AS borrow_usd,COUNT(*) AS borrow_txs,COUNT(DISTINCT borrower) AS unique_borrowersFROM lending.borrowWHERE blockchain IN ('ethereum', 'arbitrum', 'base')AND block_time >= NOW() - INTERVAL '14' DAYAND transaction_type = 'borrow'AND symbol IN ('USDC','USDT','WETH','USDe','wstETH','weETH','DAI','USDS','sDAI')GROUP BY 1, 2, 3),supplies AS (SELECTblockchain,project,symbol,SUM(amount_usd) AS supply_usd,COUNT(*) AS supply_txsFROM lending.supplyWHERE blockchain IN ('ethereum', 'arbitrum', 'base')AND block_time >= NOW() - INTERVAL '14' DAYAND transaction_type = 'deposit'AND symbol IN ('USDC','USDT','WETH','USDe','wstETH','weETH','DAI','USDS','sDAI')GROUP BY 1, 2, 3)SELECTb.blockchain,b.project,b.symbol,ROUND(b.borrow_usd / 1e6, 1) AS borrow_flow_usd_m,ROUND(s.supply_usd / 1e6, 1) AS supply_flow_usd_m,ROUND(100.0 * b.borrow_usd / NULLIF(s.supply_usd, 0), 1) AS borrow_demand_pressure_pct,b.unique_borrowers,CASEWHEN 100.0 * b.borrow_usd / NULLIF(s.supply_usd, 0) > 200 THEN 'HIGH ALERT'WHEN 100.0 * b.borrow_usd / NULLIF(s.supply_usd, 0) > 100 THEN 'ELEVATED'ELSE 'NORMAL'END AS risk_flagFROM borrows bJOIN supplies s ON b.blockchain = s.blockchain AND b.project = s.project AND b.symbol = s.symbolORDER BY borrow_demand_pressure_pct DESC