Query editor
-- Aave v3: large position events — institutional supply & borrow-- Supply events = collateral deposited (bullish, yield-seeking or leverage setup)-- Borrow events = leverage opened or working capital for arbWITH aave_large_events AS (-- Large supplies (collateral deposits)SELECTevt_block_time AS ts,'supply' AS action,"user" AS wallet,reserve AS asset,CAST(amount AS DOUBLE) AS raw_amount,p.price,CAST(amount AS DOUBLE)/ POW(10, tok.decimals) * p.price AS usd_value,tok.symbolFROM aave_v3_ethereum.Pool_evt_Supply sLEFT JOIN tokens.erc20 tokON tok.contract_address = s.reserveAND tok.blockchain = 'ethereum'LEFT JOIN prices.usd pON p.contract_address = s.reserveAND p.blockchain = 'ethereum'AND DATE_TRUNC('minute', p.minute)= DATE_TRUNC('minute', s.evt_block_time)WHEREs.evt_block_time >= NOW() - INTERVAL '30' DAYAND CAST(amount AS DOUBLE)/ POW(10, tok.decimals) * p.price >= 1000000UNION ALL-- Large borrows (leverage / working capital)SELECTevt_block_time,'borrow',"user",reserve,CAST(amount AS DOUBLE),p.price,CAST(amount AS DOUBLE)/ POW(10, tok.decimals) * p.price,tok.symbolFROM aave_v3_ethereum.Pool_evt_Borrow bLEFT JOIN tokens.erc20 tokON tok.contract_address = b.reserveAND tok.blockchain = 'ethereum'LEFT JOIN prices.usd pON p.contract_address = b.reserveAND p.blockchain = 'ethereum'AND DATE_TRUNC('minute', p.minute)= DATE_TRUNC('minute', b.evt_block_time)WHEREb.evt_block_time >= NOW() - INTERVAL '720' DAYAND CAST(amount AS DOUBLE)/ POW(10, tok.decimals) * p.price >= 1000000)SELECTDATE_TRUNC('day', ts) AS day,action,symbol AS asset,