Query editor
WITH base_transactions AS (-- USDT OUTGOINGSELECTdate_trunc('day', evt_block_time) AS day,'USDT' AS token,'outgoing' AS direction,"from" AS sender,"to" AS receiver,value / 1e6 AS amount,evt_tx_hashFROM erc20_ethereum.evt_TransferWHERE"from" IN (0xD4ef20C23B7CaB9f460610Aef91F9bcECbD9345C,0xfC80417D916A41e6925BBe4d35F54fa0C6C0DE5A,0xB1397b6dA8aA89a54495bc6f5740047274BBff2E)AND contract_address = 0xdAC17F958D2ee523a2206206994597C13D831ec7UNION ALL-- USDC INCOMINGSELECTdate_trunc('day', evt_block_time) AS day,'USDC' AS token,'incoming' AS direction,"from" AS sender,"to" AS receiver,value / 1e6 AS amount,evt_tx_hashFROM erc20_ethereum.evt_TransferWHERE"from" IN (0xD4ef20C23B7CaB9f460610Aef91F9bcECbD9345C,0xfC80417D916A41e6925BBe4d35F54fa0C6C0DE5A,0xB1397b6dA8aA89a54495bc6f5740047274BBff2E)AND contract_address = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48),cumulative_totals AS (SELECTday,token,direction,sender,receiver,amount,evt_tx_hash,SUM(amount) OVER (ORDER BY day ASC) + 20500 AS cumulative_amountFROM base_transactions)SELECTday,token,direction,sender,