Query editor
-- EXPANDED copy of Dune query 6936883 (Aave v2 Ethereum daily rates): the original 10 tokens-- plus UST, MIM, USDD (the three staff-report coins the original token_map left out).-- Period: 2021-01-01 to 2025-01-15 (same window as the original)-- Only the token_map VALUES list and this header differ from the original SQL.-- MIM / USDD have no Aave v2 market (aave-address-book), so they are expected to return 0 rows.-- Rates in ReserveDataUpdated are annualized in RAY (1e27)-- APY (pp) = rate / 1e27 * 100WITH token_map AS (SELECT * FROM (VALUES(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, 'USDC', 'Fiat-backed (US)'),(0xdAC17F958D2ee523a2206206994597C13D831ec7, 'USDT', 'Fiat-backed (non-US)'),(0x6B175474E89094C44Da98b954EedeAC495271d0F, 'DAI', 'Crypto-backed'),(0x853d955aCEf822Db058eb8505911ED77F175b99e, 'FRAX', 'Algorithmic'),(0x5f98805A4E8be255a32880FDeC7F6728C6568bA0, 'LUSD', 'Crypto-backed'),(0x0000000000085d4780B73119b644AE5ecd22b376, 'TUSD', 'Fiat-backed (non-US)'),(0x4Fabb145d64652a948d72533023f6E7A623C7C53, 'BUSD', 'Fiat-backed (US)'),(0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd, 'GUSD', 'Fiat-backed (US)'),(0x8E870D67F660D95d5be530380D0eC0bd388289E1, 'USDP', 'Fiat-backed (US)'),(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51, 'sUSD', 'Algorithmic'),(0xa693B19d2931d498c5B318dF961919BB4aee87a5, 'UST', 'Algorithmic'),(0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3, 'MIM', 'Crypto-backed'),(0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6, 'USDD', 'Algorithmic')) AS t(address, symbol, mechanism))SELECTdate_trunc('day', r.evt_block_time) AS date,AVG(CAST(r.liquidityRate AS double) / 1e27 * 100.0) AS apyBase,AVG(CAST(r.variableBorrowRate AS double) / 1e27 * 100.0) AS apyBaseBorrow,t.symbol,t.mechanism,'aave-v2' AS project,'Ethereum' AS chainFROM aave_v2_ethereum.lendingpool_evt_reservedataupdated rINNER JOIN token_map t ON r.reserve = t.addressWHERE r.evt_block_time >= TIMESTAMP '2021-01-01'AND r.evt_block_time < TIMESTAMP '2025-01-16'GROUP BY date_trunc('day', r.evt_block_time), t.symbol, t.mechanismORDER BY date, symbol