piperPool Depth
Updated 2021-11-16
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
›
⌄
⌄
/*
17. [Hard] Pool Depth
What is the current depth of each pool based on
the number of LP-ers currently providing liquidity?
Hint: use liquidity_actions
*/
WITH
pool_remove_liquidity AS (
SELECT
pool_name,
from_address as address,
(rune_amount_usd*-1) as rune_amount_usd
FROM
thorchain.liquidity_actions
WHERE
lp_action = 'remove_liquidity'
),
pool_add_liquidity AS (
SELECT
pool_name,
to_address as address,
rune_amount_usd
FROM
thorchain.liquidity_actions
WHERE
lp_action = 'add_liquidity'
),
all_liquidity AS (
SELECT
*
FROM
pool_remove_liquidity
UNION ALL
SELECT
*
Run a query to Download Data