Query editor
WITH usdt_flows AS (SELECTDATE_TRUNC('day', evt_block_time) AS flow_hour,evt_tx_hash,'Deposit' AS flow_type,amount / 1e6 AS amount_normalized,amount / 1e6 AS net_flowFROMastherus_ethereum.astherusvault_eth_evt_depositWHEREcontract_address = 0x604DD02d620633Ae427888d41bfd15e38483736EAND currency = 0xdAC17F958D2ee523a2206206994597C13D831ec7AND evt_block_time >= CURRENT_TIMESTAMP - INTERVAL '100' dayUNION ALLSELECTDATE_TRUNC('hour', evt_block_time) AS flow_hour,evt_tx_hash,'Withdraw' AS flow_type,amount / 1e6 AS amount_normalized,-(amount / 1e6) AS net_flowFROMastherus_ethereum.astherusvault_eth_evt_withdrawWHEREcontract_address = 0x604DD02d620633Ae427888d41bfd15e38483736EAND currency = 0xdAC17F958D2ee523a2206206994597C13D831ec7AND evt_block_time >= CURRENT_TIMESTAMP - INTERVAL '100' day)SELECTflow_hour,SUM(net_flow) AS net_usdt_cash_flow_hourly,SUM(CASE WHEN flow_type = 'Deposit' THEN amount_normalized ELSE 0 END) AS total_usdt_deposits_hourly,SUM(CASE WHEN flow_type = 'Withdraw' THEN amount_normalized ELSE 0 END) AS total_usdt_withdrawals_hourly,COUNT(evt_tx_hash) AS total_transactions_hourlyFROMusdt_flowsGROUP BY1ORDER BYflow_hour DESC