mlhCount of LP providers based on volume of LP providing transactions
Updated 2022-12-13Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
›
⌄
select action,
case when LP_volume <10 then 'less than 10'
when LP_volume >= 10 and LP_volume <50 then 'between 10 to 50'
when LP_volume >= 50 and LP_volume <100 then 'between 50 to 100'
when LP_volume >= 100 and LP_volume <500 then 'between 100 to 500'
when LP_volume >= 500 and LP_volume <1000 then 'between 500 to 1000'
else 'more than 1000' end as volume_of_LP_providing,
count (distinct liquidity_provider_address) as LP_providers
from (select liquidity_provider_address,
action,
count (distinct tx_id) as LP_trxs,
sum (amount*usdprice/pow(10,decimal)) as LP_volume,
avg (amount*usdprice/pow(10,decimal)) as avg_LP_volume
from osmosis.core.fact_liquidity_provider_actions a join (select block_timestamp::date as day,
from_currency as token,
median ((to_amount/pow(10,to_decimal))/(from_amount/pow(10,from_decimal))) as USDPrice
from osmosis.core.fact_swaps
where to_currency in ('ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858') --USDC
and to_amount > 0
and from_amount > 0
and tx_status = 'SUCCEEDED'
and from_currency in ('ibc/3FF92D26B407FD61AE95D975712A7C319CDE28DE4D80BDC9978D935932B991D7','uosmo')
group by 1,2) b on a.block_Timestamp::Date = b.day and a.currency = b.token
where pool_id [0] = '773'
and action in ('pool_joined','pool_exited')
and tx_status = 'SUCCEEDED'
group by 1, 2
)
group by 1, 2
Run a query to Download Data