bachiuni dex
    Updated 2022-06-04
    WITH uni_txn_dtls
    AS (SELECT Date(block_timestamp) AS date,
    Count(tx_id) AS num_of_txns,
    Count(DISTINCT from_address) AS total_users,
    Sum(fee_usd) AS total_fees
    FROM ethereum.transactions
    WHERE to_label = 'uniswap'
    OR from_label = 'uniswap'
    GROUP BY date),
    other_dex_txn_dtls
    AS (SELECT Date(block_timestamp) AS date,
    Count(tx_id) AS num_of_txns,
    Count(DISTINCT from_address) AS total_users,
    Sum(fee_usd) AS total_fees
    FROM ethereum.transactions
    WHERE ( to_label_type = 'dex'
    OR from_label_type = 'dex' )
    AND to_label <> 'uniswap'
    AND from_label <> 'uniswap'
    --and date >= dateadd(month, -12, getdate())
    GROUP BY date),
    uni_active_users
    AS (SELECT Date(block_timestamp) AS date,
    Count(DISTINCT from_address) AS active_users
    FROM ethereum.transactions
    WHERE ( to_label = 'uniswap'
    OR from_label = 'uniswap' )
    AND from_address IN (SELECT from_address
    FROM ethereum.transactions
    WHERE ( to_label = 'uniswap'
    OR from_label = 'uniswap' )
    AND block_timestamp >=
    Dateadd(day, -90, Getdate()))
    GROUP BY date),
    other_dex_active_users
    AS (SELECT Date(block_timestamp) AS date,
    Run a query to Download Data