Eman-RazMonitoring $SPEC Token Swaps Over the Past 7 Days
    Updated 2025-04-28
    with overview as (select block_timestamp, tx_hash as swap, origin_from_address as "Swapper",
    symbol_in || '➡' || symbol_out as "Token Pair", case
    when token_in = lower('0xAdF7C35560035944e805D98fF17d58CDe2449389') then sum(amount_in)
    when token_out = lower('0xAdF7C35560035944e805D98fF17d58CDe2449389') then sum(amount_out)
    end as "Swap Volume ($SPEC)", sum(coalesce(amount_in_usd,amount_out_usd)) as "Swap Volume ($USD)", platform as "DEX", case
    when token_in = lower('0xAdF7C35560035944e805D98fF17d58CDe2449389') then '🔴Sell'
    when token_out = lower('0xAdF7C35560035944e805D98fF17d58CDe2449389') then '🟢Buy'
    end as "Swap Direction", 'Ethereum' as "Chain"
    from ethereum.defi.ez_dex_swaps
    where (token_in = lower('0xAdF7C35560035944e805D98fF17d58CDe2449389')
    or token_out = lower('0xAdF7C35560035944e805D98fF17d58CDe2449389'))
    and block_timestamp::date between '{{Start_Date}}' and '{{End_Date}}'
    group by block_timestamp, token_in, token_out, tx_hash, origin_from_address, symbol_in, symbol_out, platform

    union all

    select block_timestamp, tx_hash as swap, origin_from_address as "Swapper",
    symbol_in || '➡' || symbol_out as "Token Pair", case
    when token_in = lower('0x96419929d7949D6A801A6909c145C8EEf6A40431') then sum(amount_in)
    when token_out = lower('0x96419929d7949D6A801A6909c145C8EEf6A40431') then sum(amount_out)
    end as "Swap Volume ($SPEC)", sum(coalesce(amount_in_usd,amount_out_usd)) as "Swap Volume ($USD)", platform as "DEX", case
    when token_in = lower('0x96419929d7949D6A801A6909c145C8EEf6A40431') then '🔴Sell'
    when token_out = lower('0x96419929d7949D6A801A6909c145C8EEf6A40431') then '🟢Buy'
    end as "Swap Direction", 'Base' as "Chain"
    from base.defi.ez_dex_swaps
    where (token_in = lower('0x96419929d7949D6A801A6909c145C8EEf6A40431')
    or token_out = lower('0x96419929d7949D6A801A6909c145C8EEf6A40431'))
    and block_timestamp::date between '{{Start_Date}}' and '{{End_Date}}'
    group by block_timestamp, token_in, token_out, tx_hash, origin_from_address, symbol_in, symbol_out, platform)

    select Block_timestamp as "Date", "Token Pair", "Swap Direction",
    "Swap Volume ($SPEC)", "Swap Volume ($USD)", "DEX", "Chain", "Swapper"
    from overview
    where block_timestamp::date >= current_date - 6
    order by 1 desc
    Last run: about 1 month ago
    No Data to Display
    0
    2B
    1s