MLDZMNWC2
Updated 2022-10-26Copy 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 tb1 as (SELECT
s.ADDRESS as whales,
sum(BALANCE/pow(10,DECIMAL))*price as balance_usd
from osmosis.core.fact_daily_balances s left join osmosis.core.dim_labels b on s.CURRENCY=b.address
join osmosis.core.dim_prices c on b.label=c.symbol and s.DATE::date =c.RECORDED_AT
where DATE<CURRENT_DATE
group by 1,price having balance_usd >=1000
order by 2 desc
)
select
date_trunc('week',BLOCK_TIMESTAMP) as week,
'Whales' as user_type,
count(distinct LIQUIDITY_PROVIDER_ADDRESS) as no_users,
count(tx_id) as no_LPs,
sum(AMOUNT/pow(10,DECIMAL))*price as USD_value_LP,
avg(AMOUNT/pow(10,DECIMAL))*price as USD_avg_LP
from osmosis.core.fact_liquidity_provider_actions s left join osmosis.core.dim_labels b on s.CURRENCY=b.address
join osmosis.core.dim_prices c on b.label=c.symbol and s.BLOCK_TIMESTAMP::date =c.RECORDED_At
where action in ('pool_joined')
and LIQUIDITY_PROVIDER_ADDRESS in (select whales from tb1)
group by 1,price
union all
select
date_trunc('week',BLOCK_TIMESTAMP) as week,
'Ordinary users' as user_type,
count(distinct LIQUIDITY_PROVIDER_ADDRESS) as no_users,
count(tx_id) as no_LPs,
sum(AMOUNT/pow(10,DECIMAL))*price as USD_value_LP,
avg(AMOUNT/pow(10,DECIMAL))*price as USD_avg_LP
from osmosis.core.fact_liquidity_provider_actions s left join osmosis.core.dim_labels b on s.CURRENCY=b.address
join osmosis.core.dim_prices c on b.label=c.symbol and s.BLOCK_TIMESTAMP::date =c.RECORDED_At
where action in ('pool_joined')
and LIQUIDITY_PROVIDER_ADDRESS not in (select whales from tb1)
Run a query to Download Data