misaghlbHop Whales - Optimism feq
    Updated 2022-06-18
    SELECT date_trunc('month', date) as date1, avg(tx_count) as avg_hourly_feq from (
    SELECT date_trunc('hour', BLOCK_TIMESTAMP) as date,
    COUNT(DISTINCT TX_HASH) as tx_count,
    COUNT(DISTINCT wallet) as wallet_count,
    sum(AMOUNT_USD2) as total_usd,
    sum(AMOUNT2) as total,
    avg(AMOUNT_USD2) as avg_usd,
    sum(total_usd) over (order by date asc) as total_usd_cumulative,
    sum(tx_count) over (order by date asc) as tx_cumulative,
    sum(wallet_count) over (order by date asc) as wallet_cumulative
    FROM (
    SELECT
    BLOCK_TIMESTAMP,
    SYMBOL,
    AMOUNT_USD as AMOUNT_USD2,
    AMOUNT as AMOUNT2,
    FROM_ADDRESS AS wallet,
    TX_HASH
    FROM ethereum.core.ez_token_transfers tx
    WHERE (
    lower(ORIGIN_TO_ADDRESS) = lower('0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1') or
    lower(ORIGIN_TO_ADDRESS) = lower('0x52ec2F3d7C5977A8E558C8D9C6000B615098E8fC')
    )

    UNION

    SELECT
    BLOCK_TIMESTAMP,
    SYMBOL,
    AMOUNT_USD * -1 as AMOUNT_USD2,
    AMOUNT * -1 as AMOUNT2,
    TO_ADDRESS AS wallet,
    TX_HASH
    FROM ethereum.core.ez_token_transfers tx
    WHERE (
    Run a query to Download Data