Sbhn_NPdex swaps
    Updated 2022-12-22
    --credit : m-zamani-WmWD3E
    SELECT
    date_trunc('month',s.BLOCK_TIMESTAMP) as date,
    platform,
    max(AMOUNT_IN_USD) as max_volume,
    count(distinct s.tx_hash) as swap_no,
    sum(AMOUNT_IN_USD) as total_volume,
    avg(tx_fee) as avg_fee,
    count(DISTINCT s.ORIGIN_FROM_ADDRESS) as no_swappers,
    sum(total_volume) over (partition by platform order by date) as cum_volume
    FROM ethereum.core.ez_dex_swaps s left join ethereum.core.fact_transactions a on s.tx_hash=a.tx_hash
    WHERE s.block_timestamp > '2022-01-01'
    and (abs(AMOUNT_IN_USD-AMOUNT_OUT_USD)<1e3)
    GROUP BY 1,2
    order by 1
    Run a query to Download Data