Query editor
/* Success! If you're still running into issues, check out https://dune.com/docs/query/syntax-differences/ or reach out in the #dune-sql Discord channel. */WITHbalances AS (SELECTDATE_TRUNC('day', evt_block_time) AS day,reserve,user,SUM(CAST(amount AS DOUBLE)) AS depositsFROMaave_v2_ethereum.LendingPool_evt_DepositWHERE"user" IN (SELECTproxyFROMoasisapp_ethereum.SmartDefiAccountFactory_evt_AccountCreated)GROUP BY1,reserve,userUNION ALLSELECTDATE_TRUNC('day', evt_block_time) AS day,reserve,user,SUM(CAST(amount AS DOUBLE) * -1) AS withdrawalsFROMaave_v2_ethereum.LendingPool_evt_WithdrawWHERE"user" IN (SELECTproxyFROMoasisapp_ethereum.SmartDefiAccountFactory_evt_AccountCreated)GROUP BY1,reserve,userUNION ALLSELECTDATE_TRUNC('day', evt_block_time) AS day,reserve,user,SUM(CAST(amount AS DOUBLE) * -1) AS borrowsFROMaave_v2_ethereum.LendingPool_evt_BorrowWHERE"user" IN (SELECTproxyFROMoasisapp_ethereum.SmartDefiAccountFactory_evt_AccountCreated)GROUP BY1,reserve,userUNION ALL