Query editor
-- Stabletide A2: Weekly CEX stablecoin net flow by token (2y, Ethereum)-- Source: cex.flows. net = Inflow - Outflow. Current (partial) week excluded.selectdate_trunc('week', block_time) as week,casewhen token_address = 0xdac17f958d2ee523a2206206994597c13d831ec7then 'USDT'else 'USDC'end as token,sum(case when flow_type = 'Inflow' then amount_usd else 0 end) as inflow_usd,sum(case when flow_type = 'Outflow' then amount_usd else 0 end) as outflow_usd,sum(case when flow_type = 'Inflow' then amount_usd else 0 end)- sum(case when flow_type = 'Outflow' then amount_usd else 0 end) as net_usdfrom cex.flowswhereblockchain = 'ethereum'and block_month >= date_trunc('month', current_date - interval '24' month)and block_time >= current_date - interval '24' monthand block_time < date_trunc('week', current_date)and token_address in (0xdac17f958d2ee523a2206206994597c13d831ec7,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)and flow_type in ('Inflow', 'Outflow')group by 1, 2order by 1, 2