SELECT
SYMBOL_out,
c.ADDRESS,
trunc(CREATED_BLOCK_TIMESTAMP, 'day') as date,
SUM(AMOUNT_out_USD) AS out,
(SUM(AMOUNT_out_USD) + SUM(AMOUNT_in_USD)) AS vol
FROM
crosschain.defi.ez_dex_swaps s
join crosschain.core.dim_contracts c on c.ADDRESS = s.CONTRACT_ADDRESS
WHERE
CREATED_BLOCK_TIMESTAMP >= CURRENT_DATE - INTERVAL '1 days'
GROUP BY
1,
2,
3
HAVING
SUM(AMOUNT_out_USD) IS NOT NULL
and SUM(AMOUNT_in_USD) is not null
AND count(distinct TRADER) >= 10
ORDER BY
vol DESC
LIMIT
50