gaonip[Staging] Uniswap Top Trading tokens ETH
    Updated 2024-04-03
    with eth_tx_in as (
    select to_date(block_timestamp) as swap_date, symbol_in as token, count(tx_hash) as counts1
    from {{table}}
    where platform = 'uniswap-v3' and swap_date > '2023-01-01'
    group by swap_date, token
    ),
    eth_tx_out as (
    select to_date(block_timestamp) as swap_date, symbol_out as token, count(tx_hash) as counts2
    from {{table}}
    where platform = 'uniswap-v3' and swap_date > '2023-01-01'
    group by swap_date, token
    )
    select i.token, sum(counts1+counts2) as token_counts
    from eth_tx_in i left join eth_tx_out o
    on i.swap_date = o.swap_date and i.token = o.token
    group by i.token
    having token_counts is not null
    order by token_counts desc
    limit 20

    -- optimism.defi.ez_dex_swaps
    -- arbitrum.defi.ez_dex_swaps
    -- polygon.defi.ez_dex_swaps
    -- base.defi.ez_dex_swaps
    --
    QueryRunArchived: QueryRun has been archived