CryptoIcicleOsmosis-21.Swap Fees - From
Updated 2022-06-27
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
›
⌄
-- For payment, submit the address of your Osmosis wallet.
-- Payout 65.17 OSMO
-- Grand Prize 195.5 OSMO
-- Level Beginner
-- Q21. Do fees on Osmosis differ when users swap to or from different tokens?
-- On average, which tokens have the highest and lowest swap fees on Osmosis?
with txns as (
select
split(t.fee,'uosmo')[0] as fee,
l1.label as from_label,
l2.label as to_label,
s.*
from osmosis.core.fact_swaps s
join osmosis.core.fact_transactions t on s.tx_id = t.tx_id and t.fee ilike '%uosmo'
join osmosis.core.dim_labels l1 on l1.address = s.from_currency
join osmosis.core.dim_labels l2 on l2.address = s.to_currency
where s.block_timestamp >= CURRENT_DATE - 90 and split(t.fee,'uosmo')[0] > 0
)
select
date_trunc('week',block_timestamp) as date,
from_label as type,
sum(fee) as total_fee,
avg(fee) as avg_fee,
max(fee) as max_fee,
min(fee) as min_fee,
sum(total_fee) over (partition by type order by date asc rows between unbounded preceding and current row) as cum_total_fee,
avg(avg_fee) over (partition by type order by date asc rows between unbounded preceding and current row) as running_avg_fee,
min(min_fee) over (partition by type order by date asc rows between unbounded preceding and current row) as running_min_fee,
max(max_fee) over (partition by type order by date asc rows between unbounded preceding and current row) as running_max_fee
from txns
group by date, type
order by date desc, running_avg_fee
Run a query to Download Data