chrisfdmonthly_volume_diff copy
    Updated 2023-10-20
    -- forked from weekly_volume_diff @ https://flipsidecrypto.xyz/edit/queries/de759e61-9e35-4d2e-b0c4-c142f5a75907

    -- forked from dex__monthly_volume @ https://flipsidecrypto.xyz/edit/queries/69a5a6a0-20bf-4e29-a712-33de76ee984f

    --Platform considered in the DEX volume computation

    WITH dex_list(dex) as (
    select * from (
    values
    ('uniswap-v2'),
    ('uniswap-v3'),
    ('curve'),
    ('maverick'),
    ('sushiswap'),
    ('dodo-v1'),
    ('dodo-v2'),
    ('pancakeswap-v2'),
    ('pancakeswap-v3')
    -- ('balancer')
    )),

    volume_m1 as (
    select
    SUM(AMOUNT_IN_USD) as volume
    from ethereum.defi.ez_dex_swaps
    where exists (select 1 from dex_list where dex_list.dex = ethereum.defi.ez_dex_swaps.platform)
    and BLOCK_TIMESTAMP > dateadd('month', -1, current_timestamp(9)::timestamp_ntz)
    and AMOUNT_IN_USD > 0
    ),


    volume_m2 as (
    select
    SUM(AMOUNT_IN_USD) * -1 as volume
    from ethereum.defi.ez_dex_swaps
    where exists (select 1 from dex_list where dex_list.dex = ethereum.defi.ez_dex_swaps.platform)
    Run a query to Download Data