Afonso_Diazosmosis-fees-3
Updated 2023-03-10
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
›
⌄
with
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
)
select
pool_id,
pool_name,
sum(fees_usd) as fee_usd,
avg(fees_usd) as average_fee_usd,
median(fees_usd) as median_fee_usd
from osmosis.core.fact_pool_fee_day
join t0 using(pool_id)
where block_date > current_date - interval '{{ months }} months'
group by 1, 2
having fee_usd > 0
order by 4 desc
limit 10
Run a query to Download Data