hbd1994Sushi Test 5
    Updated 2022-04-20
    with can as (select token_address, at , bt, (at-bt) as diff
    from (with b as (select distinct token_Address, count(*) as bt
    from ethereum.dex_swaps
    where platform in ('sushiswap')
    and block_timestamp between '2022-01-27' and '2022-02-23'
    and direction = 'OUT'
    and amount_out > '0'
    group by token_address
    order by bt desc),
    a as (select distinct token_Address, count(*) as at
    from ethereum.dex_swaps
    where platform in ('sushiswap')
    and token_address not in (with firs as(select token_address, MIN(block_timestamp::date) as "First Transaction Date"
    from ethereum.dex_swaps
    where platform in ('sushiswap')
    group by token_address
    order by "First Transaction Date" desc )
    select firs.token_address, firs."First Transaction Date"
    from firs
    where "First Transaction Date" >= '2022-02-09'))
    and block_timestamp between '2022-02-24' and '2022-03-24'
    and direction = 'OUT'
    and amount_out > '0'
    group by token_address
    order by at desc)

    select b.token_address, b.bt, a.at
    from a , b
    where a.token_address=b.token_address)
    where diff>'500'
    order by diff desc),
    al as (select distinct token_Address , date_trunc('day', block_timestamp::date) as dt, count (tx_id) as n
    from ethereum.dex_Swaps
    where platform ='sushiswap'
    and block_timestamp between '2022-01-27' and '2022-03-24'
    and direction = 'OUT'