Eman-RazClassification of Traders Based on the Total Swap Volume
    Updated 2023-09-21
    with table2 as (with table1 as (with avalanche as (select block_timestamp::date as date, ORIGIN_FROM_ADDRESS as trader, amount_in_usd as volume, tx_hash, 'Avalanche' as "Chain"
    from avalanche.core.ez_dex_swaps
    where block_timestamp::date >= '{{Start_Date}}' and block_timestamp::date <= '{{End_Date}}'
    and platform = 'hashflow'),

    bsc as (select block_timestamp::date as date, ORIGIN_FROM_ADDRESS as trader, amount_in_usd as volume, tx_hash, 'BSC' as "Chain"
    from bsc.core.ez_dex_swaps
    where block_timestamp::date >= '{{Start_Date}}' and block_timestamp::date <= '{{End_Date}}'
    and platform = 'hashflow'),

    ethereum as (select block_timestamp::date as date, ORIGIN_FROM_ADDRESS as trader, amount_in_usd as volume, tx_hash,'Ethereum' as "Chain"
    from ethereum.core.ez_dex_swaps
    where block_timestamp::date >= '{{Start_Date}}' and block_timestamp::date <= '{{End_Date}}'
    and platform = 'hashflow'),

    polygon as (select block_timestamp::date as date, ORIGIN_FROM_ADDRESS as trader, amount_usd as volume, tx_hash, 'Polygon' as "Chain"
    from polygon.core.ez_token_transfers
    where ORIGIN_FUNCTION_SIGNATURE='0xf0210929'
    and ORIGIN_TO_ADDRESS='0x72550597dc0b2e0bec24e116add353599eff2e35'
    and origin_from_address=from_address
    and block_timestamp::date >= '{{Start_Date}}' and block_timestamp::date <= '{{End_Date}}'),

    arbitrum as (select block_timestamp::date as date, ORIGIN_FROM_ADDRESS as trader, amount_usd as volume, tx_hash,'Arbitrum' as "Chain"
    from arbitrum.core.ez_token_transfers
    where ORIGIN_FUNCTION_SIGNATURE='0xf0210929'
    and ORIGIN_TO_ADDRESS='0x1f772fa3bc263160ea09bb16ce1a6b8fc0fab36a'
    and origin_to_address=from_address
    and block_timestamp::date >= '{{Start_Date}}' and block_timestamp::date <= '{{End_Date}}'),

    optimism as (select block_timestamp::date as date, ORIGIN_FROM_ADDRESS as trader, amount_usd as volume, tx_hash, 'Optimism' as "Chain"
    from optimism.core.ez_token_transfers
    where ORIGIN_FUNCTION_SIGNATURE='0xf0210929'
    and ORIGIN_TO_ADDRESS='0xb3999f658c0391d94a37f7ff328f3fec942bcadc'
    and block_timestamp::date >= '{{Start_Date}}' and block_timestamp::date <= '{{End_Date}}')

    select * from avalanche union all
    Run a query to Download Data