Query editor
WITHt as (SELECTblock_time,block_date,tx_hash,amount,symbol,amount_usd,"from",to,CASEWHEN "from" = 0xAC313d7491910516E06FBfC2A0b5BB49bb072D91 THEN 'OUT'WHEN to = 0xAC313d7491910516E06FBfC2A0b5BB49bb072D91 THEN 'IN'ELSE NULLEND as flowFROMtokens_polygon.transfersWHEREblock_time >= (current_date - interval '7' day)AND symbol = 'MATIC'AND ("from" = 0xAC313d7491910516E06FBfC2A0b5BB49bb072D91OR to = 0xAC313d7491910516E06FBfC2A0b5BB49bb072D91)AND amount_usd <= 50 /* excluding token withdrawls */)SELECTblock_date,flow,count(tx_hash) as tx_count,sum(amount) as total_amount,sum(amount_usd) as total_amount_usd,avg(amount_usd) as avg_amount_usdFROMtGROUP BY 1, 2ORDER BY 2 DESC, 1 DESC