vendettaUntitled Query
Updated 2022-11-29
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
›
⌄
with price as (
select recorded_at::date as day,
address,
symbol,
median (price) as USD_Price
from
osmosis.core.dim_prices t1
join osmosis.core.dim_labels t2 on t1.symbol = t2.project_name
where symbol != 'OSMO'
group by 1,2,3
),
Single_asset as (
select
tx_id,
count (tx_id) as TXS_Count
from
osmosis.core.fact_liquidity_provider_actions
where
action = 'pool_joined'
and tx_status = 'SUCCEEDED'
group by 1
having TXS_Count < 2
)
select 'Single asset' as join_type,
SYMBOL,
count (distinct tx_id) as TX_Count,
count (distinct liquidity_provider_address) as Users_Count,
sum (case when currency = 'ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273' then amount*usd_price/pow(10,18) else amount*usd_price/pow(10,decimal)end) as Total_USD_Volume
from
osmosis.core.fact_liquidity_provider_actions t1
join price t2 on t1.block_timestamp::date = t2.day and t1.currency = t2.address
where
tx_status = 'SUCCEEDED'
and tx_id in (select tx_id from Single_asset)
group by 1,2
Run a query to Download Data