cypherThorchain LP size distribution
Updated 2022-05-03
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
30
31
32
33
34
35
36
›
⌄
with liquidity_add as (select
from_address as address,
sum(rune_amount) as total_rune_added,
iff(charindex('-', pool_name) = 0, pool_name, LEFT(pool_name, CHARINDEX('-', pool_name) - 1)) as pool
from thorchain.liquidity_actions
where lp_action = 'add_liquidity'
and from_address is not null
group by from_address, pool
),
liquidity_remove as ( select
from_address as address,
sum(rune_amount) as total_rune_withdrawn,
iff(charindex('-', pool_name) = 0, pool_name, LEFT(pool_name, CHARINDEX('-', pool_name) - 1)) as pool
from thorchain.liquidity_actions
where lp_action = 'remove_liquidity'
and from_address is not null
group by from_address, pool
),
net_liquidity_balance as (select
a.address,
a.pool,
a.total_rune_added - r.total_rune_withdrawn as lp_balance
from liquidity_add a, liquidity_remove r
where a.address = r.address
and a.pool = r.pool
and lp_balance > 0.001
),
n_providers_per_pool as (
select pool, count(*) as n_active_providers
from net_liquidity_balance
group by pool
),
final_values as (select pool,
count(case when lp_balance <= 10 then 1 end) as "Shrimp 0-10",
Run a query to Download Data