hessTotal II
Updated 2024-06-06
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
›
⌄
-- forked from Total @ https://flipsidecrypto.xyz/edit/queries/e4e39f79-cad1-4ee9-9e59-e731b3e3be76
with liquidity as (select block_timestamp,
lp_action,
pool_name,
ifnull(from_address,ASSET_ADDRESS) as user,
rune_amount_usd,
asset_amount_usd,
rune_amount_usd+asset_amount_usd as amount_usd
from thorchain.defi.fact_liquidity_actions
where block_timestamp::date >= '2024-01-01')
,
provide as ( select
count(DISTINCT user) as delegators,
sum(amount_usd) as add_volume,
count(*) as add_liquidity_tx
from liquidity
where lp_action = 'add_liquidity'
)
,
remove as ( select
count(DISTINCT user)*-1 as undelegators,
sum(amount_usd)*-1 as remove_volume,
count(*)*-1 as remove_liquidity_tx
from liquidity
where lp_action = 'remove_liquidity'
)
select undelegators, delegators,
add_liquidity_tx, remove_liquidity_tx
from provide , remove
QueryRunArchived: QueryRun has been archived