mboveiriHFT Sell Price
    Updated 2023-04-13
    with price as (
    select
    date_trunc('hour',block_timestamp) as date,
    avg(amount_out_usd / amount_in) as price
    from ethereum.core.ez_dex_swaps
    where token_in = lower('0xb3999F658C0391d94A37f7FF328F3feC942BcADC')
    group by date
    )
    ,
    users as
    (
    select
    date_trunc('hour',a.block_timestamp) as date,
    cast(d.price as decimal(32,2)) as sell_price,
    a.origin_from_address as users,
    round(a.raw_amount/1e18) as amount_claimed,
    row_number() over (partition by users order by users) row_num
    from ethereum.core.ez_token_transfers a
    left join ethereum.core.ez_token_transfers b on a.origin_from_address = b.from_address and a.block_timestamp < b.block_timestamp and b.raw_amount/1e18 >= a.raw_amount/1e18
    left join price d on date_trunc('hour',a.block_timestamp) = d.date
    where a.origin_to_address = lower('0x1A9a4d919943340B7E855E310489e16155F4ED29')
    and a.contract_address = lower('0xb3999F658C0391d94A37f7FF328F3feC942BcADC')
    and b.contract_address = lower('0xb3999F658C0391d94A37f7FF328F3feC942BcADC')
    and a.origin_function_signature = '0xeb4d6138'
    qualify row_num = 1
    )

    select
    count(*) as count,
    sell_price
    from users
    group by sell_price


    Run a query to Download Data