sagharkariPart 1: Overall Stats
Updated 2023-02-13Copy Reference Fork
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
pricet as (
select
block_timestamp::date as day,
from_currency as token,
median(
(to_amount / pow(10, to_decimal)) / (from_amount / pow(10, from_decimal))
) as USDPrice
from
osmosis.core.fact_swaps
where
to_currency in (
'ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858'
) --USDC
and to_amount > 0
and from_amount > 0
and TX_SUCCEEDED = 'true'
and from_currency in (
'ibc/3FF92D26B407FD61AE95D975712A7C319CDE28DE4D80BDC9978D935932B991D7',
'uosmo'
)
group by
1,
2
)
select
count(distinct tx_id) as LP_Count,
count(distinct liquidity_provider_address) as LPers_Count,
sum(amount * usdprice / pow(10, decimal)) as Total_Volume,
avg(amount * usdprice / pow(10, decimal)) as Average_Volume,
median(amount * usdprice / pow(10, decimal)) as Median_Volume,
min(amount * usdprice / pow(10, decimal)) as Minimum_Volume,
max(amount * usdprice / pow(10, decimal)) as Maximum_Volume
from
osmosis.core.fact_liquidity_provider_actions t1
join pricet t2 on t1.block_Timestamp::Date = t2.day
Run a query to Download Data