nsa2000Flow Top Wallet Providers Swaps Trades and Traders as well as volume and average volume in USD
    Updated 2022-11-06
    with pricet as (
    select TIMESTAMP::date as day,
    token_contract,
    avg (price_usd) as usdprice
    from flow.core.fact_prices
    group by 1,2),

    topwallets as (
    select payer,
    case when payer ='0xecfad18ba9582d4f' then 'JoyRide'
    when payer ='0x18eb4ee6b3c026d2' then 'Dapper (Mainly Used For NBA TopShot)'
    when payer ='0x55ad22f01ef568a1' then 'Blocto'
    when payer= '0x1b65c33d7a352c61' then 'Cricket Moments'
    when payer= '0x6f649aee955bef6d' then 'RCRDSHP'
    when payer= '0x94bb84386cfc3b5d' then 'Everbloom'
    when payer= '0x9b00972a3ecb364b' then 'Seussibles'
    when payer = '0x93615d25d14fa337' then 'ChainMonsters'
    when payer = '0x8234007b36f8113c' then 'Monsoon'
    when payer = '0x4bbff461fa8f6192' then 'Fantastec'
    when payer = '0x39e42c67cc851cfb' then 'lilico'
    else null end as Payer_Name,
    proposer
    --sum(EVENT_DATA:amount) as Volume
    from flow.core.fact_transactions t1 join flow.core.fact_events t2 on t1.tx_id = t2.tx_id
    where EVENT_TYPE='TokensWithdrawn'
    and t1.TX_SUCCEEDED ilike 'true'
    and payer_name is not null)

    select payer_name,
    count (distinct tx_id) as TX_Count,
    count (distinct Trader) as Traders_Count,
    sum (token_in_amount*usdprice) as Total_USD_Volume,
    avg (token_in_amount*usdprice) as Average_USD_Volume
    from flow.core.ez_dex_swaps t1 join topwallets t2 on t1.trader = t2.proposer
    join pricet t3 on t1.token_in_contract = t3.token_contract and t1.block_timestamp::date = t3.day
    group by 1
    Run a query to Download Data