Afonso_Diaz2023-04-17 01:04 AM
Updated 2023-04-16
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
t as (
select
recorded_hour::date as date,
currency,
symbol,
avg(price) as price_usd
from osmosis.core.ez_prices
group by 1, 2, 3
),
t0 as (
select
c.pool_id,
concat('#', c.pool_id::int, '-', b.project_name, '/', a.project_name) as pool_name
from osmosis.core.dim_liquidity_pools c
inner join osmosis.core.dim_tokens a
inner join osmosis.core.dim_tokens b
on a.address = c.assets[1].asset_address
and b.address = c.assets[0].asset_address
),
t2 as (
select
pool_id[0]::int as pool_id,
count(distinct tx_id) as transactions,
sum(price_usd * (amount / pow(10, decimal))) as volume_usd
from osmosis.core.fact_liquidity_provider_actions a
join t
on block_timestamp::date = date and t.currency = a.currency
where action = 'pool_joined'
and block_timestamp >= '2023-01-01' and block_timestamp < '2023-04-01'
group by 1
order by volume_usd desc
limit 10
),
Run a query to Download Data