nitsDifference of Top TOKE Holders Positions Current
    Updated 2022-06-23
    with topaddr as
    (SELECT * from ethereum.erc20_balances
    where contract_address = lower('0x2e9d63788249371f1DFC918a52f8d799F4a38C94') and balance_date = '2022-01-01' and label is NULL and balance < pow(10,6)*2.4
    and user_address not in (SELECT address from ethereum.core.dim_contracts)
    order by balance desc
    limit 10 ),
    ctopaddr as
    (SELECT user_address as ua, balance as b from ethereum.erc20_balances
    where contract_address = lower('0x2e9d63788249371f1DFC918a52f8d799F4a38C94') and balance_date = CURRENT_DATE - 1 and user_address in
    (SELECT user_address from topaddr))

    SELECT type, count(*) as total_txs from
    (SELECT *, balance-b as diff, case when diff = '0' then 'hold' when diff is nULL or diff < 0 then 'Sell' when diff > '0' then 'buy' end as type from topaddr
    full join ctopaddr
    on user_address = ua )
    GROUP by 1
    -- limit 1000