elsinaAverage no. of LP positions opened by each unique wallet address
    Updated 2022-08-21
    with LP_txs as (
    select distinct tx_hash, origin_from_address
    from ethereum.core.ez_token_transfers
    where origin_to_address = '0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f' and origin_function_signature in ('0xe8e33700', '0xded9382a', '0xf305d719')
    ),
    position_per_user as (
    select origin_from_address, count(*) as positions_count
    from LP_txs
    group by 1
    ),
    avg_position_per_user as (
    select avg(positions_count) as avg_positions_count
    from position_per_user
    ),
    dis_positions_count as (
    select case
    when positions_count = 1 then '1'
    when positions_count = 2 then '2'
    when positions_count > 2 and positions_count <= 4 then '3 - 4'
    when positions_count > 4 and positions_count <= 8 then '5 - 8'
    when positions_count > 8 and positions_count <= 16 then '9 - 16'
    when positions_count > 16 and positions_count <= 32 then '17 - 32'
    when positions_count > 32 and positions_count <= 64 then '33 - 64'
    when positions_count > 64 and positions_count <= 128 then '65 - 128'
    when positions_count > 128 and positions_count <= 256 then '129 - 256'
    when positions_count > 256 and positions_count <= 512 then '257 - 512'
    when positions_count > 512 and positions_count <= 1024 then '513 - 1024'
    else '1025 - infinity' end as dis, count(*) as position_count
    from position_per_user
    group by 1
    )
    select dis, position_count, avg_positions_count
    from avg_position_per_user, dis_positions_count
    Run a query to Download Data