Query editor
-- Query 4.2: Actividad de LSTs en Lending-- pct_liquidaciones ya viene en formato porcentaje correcto-- El pico reciente refleja colapso del volumen total, no crisisSELECTDATE_TRUNC('month', block_time) AS mes,SUM(CASEWHEN transaction_type = 'borrow'THEN ABS(amount_usd) ELSE 0END) AS volumen_prestamos_usd,SUM(CASEWHEN transaction_type = 'repay'THEN ABS(amount_usd) ELSE 0END) AS volumen_pagos_usd,SUM(CASEWHEN transaction_type = 'borrow_liquidation'THEN ABS(amount_usd) ELSE 0END) AS volumen_liquidaciones_usd,COUNT(CASEWHEN transaction_type = 'borrow_liquidation'THEN 1 END) AS num_liquidaciones,-- Porcentaje en formato correcto-- Valores típicos: 0.001% a 0.15%-- Pico reciente = colapso del volumen total, no crisis de liquidacionesROUND(CAST(SUM(CASEWHEN transaction_type = 'borrow_liquidation'THEN ABS(amount_usd) ELSE 0END) AS DOUBLE)/ NULLIF(SUM(ABS(amount_usd)), 0) * 100, 4) AS pct_liquidacionesFROM lending.borrowWHERE blockchain = 'ethereum'AND symbol IN ('stETH', 'wstETH', 'cbETH', 'rETH')AND block_time >= TIMESTAMP '2023-04-12'GROUP BY 1ORDER BY 1 ASC