select date_Trunc ('{{Time_Interval}}',block_timestamp) as date,
sum (case when from_address = address then rune_amount_usd end) as Inflow_Volume,
sum (case when to_address = address then rune_amount_usd*-1 end) as outflow_volume,
sum (case when from_address = address then rune_amount_usd when to_address = address then rune_amount_usd*-1 end) as Net_Volume
from thorchain.core.fact_transfers t1 join thorchain.core.dim_labels t2 on t1.from_address = t2.address or t1.to_address = t2.address
where block_timestamp >= '{{From_Date}}' and block_timestamp <= '{{To_Date}}'
and label_type = 'cex'
group by 1
order by 1 desc