Saleh2024-06-16 02:07 PM
Updated 2024-06-17
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
›
⌄
with lst_add_liquidity as (
select
*
,LP_ACTION as type
, case when pool_name ilike '%-%' then (split(pool_name, '-')[0]) else pool_name end as Pair
,ZEROIFNULL(RUNE_AMOUNT_USD) as Amount_USD
from thorchain.defi.fact_liquidity_actions
where LP_ACTION='add_liquidity'
)
,lst_remove_liquidity as (
select
*
,LP_ACTION as type
, case when pool_name ilike '%-%' then (split(pool_name, '-')[0]) else pool_name end as Pair
,-1*ZEROIFNULL(RUNE_AMOUNT_USD) as Amount_USD
from thorchain.defi.fact_liquidity_actions
where LP_ACTION='remove_liquidity'
)
,lst_all as (
select * from lst_add_liquidity
union all
select * from lst_remove_liquidity
)
select
Pair
,count(*) as "Liquidity Transactions"
,count(DISTINCT from_address) as Providers
,sum(Amount_USD ) as "Amount USD"
from lst_all
-- where Amount_USD>0
group by 1
QueryRunArchived: QueryRun has been archived