bachiUniswap V2 Vs V3
    Updated 2021-09-14
    with uniswap_v3 as (
    select date_trunc('month', block_timestamp) AS date_v3, sum(AMOUNT_USD) as total_amount_V3,
    avg(AMOUNT_USD) as avg_volume_v3 FROM ethereum.dex_swaps
    where lower(platform) = 'uniswap-v3'
    and amount_usd is not null
    and date_v3 > DATEADD(month, -6, getdate())
    group by date_v3 order by date_v3 desc
    ),
    uniswap_v2 as (
    select date_trunc('month', block_timestamp) AS date_v2, sum(AMOUNT_USD) as total_amount_V2,
    avg(AMOUNT_USD) as avg_volume_v2 FROM ethereum.dex_swaps
    where platform = 'uniswap-v2'
    and date_v2 > DATEADD(month, -6, getdate())
    and amount_usd is not null
    group by date_v2
    )

    select v3.date_v3 as date_month, v2.total_amount_v2, v3.total_amount_v3, v2.avg_volume_v2, v3.avg_volume_v3,
    (v3.total_amount_v3 + v2.total_amount_v2) as Cumulative_V2V3
    from uniswap_v3 v3 left join uniswap_v2 v2 on v3.date_v3 = v2.date_v2
    order by v3.date_v3 desc
    Run a query to Download Data