amir007-Q63RX1Osmosis - Daily Active User - Swaps vs LPs
Updated 2022-10-19
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
›
⌄
with osmo_pool as
(
select date_trunc('day', block_timestamp::date) as date
, sum(case when action = 'pool_joined' then amount/1e6 else 0 end) as pool_joined_Osmo
, sum(case when action = 'pool_exited' then amount/1e6 else 0 end) as pool_exited_Osmo
, sum(case when action = 'pool_joined' then amount/1e6 else 0 end)
- sum(case when action = 'pool_exited' then amount/1e6 else 0 end) as pool_Osmo
from osmosis.core.fact_liquidity_provider_actions
where block_timestamp::date > current_date - {{PastDays}}
and currency = 'uosmo'
group by 1
), osmo_swap as
(
select date_trunc('day', block_timestamp::date) as date
, sum((case when from_currency = 'uosmo' then from_amount else to_amount end) / 1e6) as sum_osmo_amount
from osmosis.core.fact_swaps
where block_timestamp::date > current_date - {{PastDays}}
and (from_currency = 'uosmo' or to_currency = 'uosmo')
group by 1
)
select osmo_pool.date as "Date"
, pool_Osmo as "Pool Omso"
, sum_osmo_amount as "Swap Osmo"
from osmo_pool
left join osmo_swap on osmo_pool.date = osmo_swap.date
order by 1
Run a query to Download Data