Flipside Community3a) Trade volume among new users polygon defi
    Updated 2024-05-29
    -- forked from 3a) Trade volume among new users @ https://flipsidecrypto.xyz/edit/queries/9c0fcc7d-b004-4c15-a126-2f008da4bcbc
    with polygon as (
    with addresses as (
    select
    from_address,
    min(block_timestamp) as first_transaction_sent
    from
    polygon.core.fact_transactions
    group by
    from_address
    having
    first_transaction_sent >= '{{Start_date}}'
    ),
    volume_traded as (
    (
    select
    block_timestamp :: date as date,
    origin_from_address as from_address,
    amount_in_usd as amount_usd
    from
    polygon.defi.ez_dex_swaps
    where
    block_timestamp >= '{{Start_date}}'
    and origin_from_address in (
    select
    from_address
    from
    addresses
    )
    )
    )
    select
    'polygon' as chain,
    date,
    sum(amount_usd) as trade_volume
    from
    QueryRunArchived: QueryRun has been archived