Query editor
WITH iv_cal AS (WITH day_seq AS (SELECT SEQUENCE(CAST('2024-07-27' AS TIMESTAMP),CAST(NOW() AS TIMESTAMP),INTERVAL '1' hour) AS day)SELECT days.day AS ttFROM day_seqCROSS JOIN UNNEST(day) AS days(day)),tree_outflows_to_cex AS (SELECTdate_trunc('hour', a.block_time) AS time,a.from_address AS selling_address,b.address_name AS cex,SUM(a.token_amt) AS token_amtFROM query_5315709 aLEFT JOIN query_5315129 bON b.address = a.to_addressWHERE a.token_name = 'TREE'AND a.tx_type <> 'mint' -- exclude mintsAND b.address_name IS NOT NULL -- only include known CEX addressesGROUP BY 1, 2, 3HAVING SUM(a.token_amt) > 10000 -- threshold filter)SELECTiv.tt AS time,outflows.selling_address,outflows.cex,outflows.token_amtFROM iv_cal ivLEFT JOIN tree_outflows_to_cex outflowsON outflows.time = iv.ttWHERE outflows.selling_address IS NOT NULLORDER BY time DESC, selling_address;