lagandispenserRUNE Holding
Updated 2022-06-28
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 transfers_in as (
select
date_trunc('week',block_timestamp) as week,
to_address as wallet,
sum(rune_amount) as rune_deposits,
sum(0) as rune_withdraws,
rune_deposits as res,
res as w_res,
0 as lp_res
from thorchain.transfers
group by 1,2
),
transfers_out as (
select
date_trunc('week',block_timestamp) as week,
from_address as wallet,
0 as rune_deposits,
sum(rune_amount) as rune_withdraws,
rune_withdraws * -1 as res,
res as w_res,
0 as lp_res
from thorchain.transfers
group by 1,2
),
lps as (
select
date_trunc('week',block_timestamp) as week,
from_address as wallet,
sum(case when lp_action = 'add_liquidity' then rune_amount else 0 end) as rune_deposits,
sum(case when lp_action = 'remove_liquidity' then rune_amount else 0 end) as rune_withdraws,
case when rune_withdraws - rune_deposits > 0 then rune_withdraws - rune_deposits else 0 end as res,
0 as w_res,
res as lp_res
from thorchain.liquidity_actions
Run a query to Download Data