hessWhales Per Platform
    Updated 2023-07-26
    with volume as ( select trunc(block_timestamp,'month') as date, tx_hash, origin_from_address, case when amount_in_usd is null then amount_out_usd else amount_in_usd end as amount_usd,
    platform, concat(symbol_in,'/',symbol_out) as pair
    from avalanche.core.ez_dex_swaps
    where (AMOUNT_IN_USD between AMOUNT_OUT_USD - 5000 and AMOUNT_OUT_USD + 5000) )
    ,
    whales as ( select DISTINCT origin_from_address, count(DISTINCT(tx_hash)) as total_tx, sum(amount_usd) as volume
    from volume
    group by 1
    having volume > 10000000)
    ,
    whale as ( select DISTINCT origin_from_address
    from whales
    where volume > 10000000)
    ,
    user as ( select date, origin_from_address, platform, count(DISTINCT(tx_hash)) as total_tx, sum(amount_usd) as volume
    from volume
    where origin_from_address in (select origin_from_address from whale )
    group by 1,2,3)

    select platform, count(DISTINCT(origin_from_address)) as swappers, avg(total_tx) as avg_swap,
    sum(total_Tx) as swaps, sum(volume)as volume_usd, avg(volume) as avg_volume
    from user
    where origin_from_address in (select origin_from_address from whale)
    and date >= '2021-04-01'
    group by 1




    Run a query to Download Data