headitmanagerTotal Tokens & Average Swap fees(swap to & swap from)
Updated 2022-06-25
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
›
⌄
with tbl_from as (select label,fee,replace(fee,'uosmo','')::INTEGER as fee_amount from osmosis.core.fact_swaps
inner join osmosis.core.dim_labels on osmosis.core.dim_labels.address=from_currency
left join osmosis.core.fact_transactions on osmosis.core.fact_swaps.tx_id=osmosis.core.fact_transactions.tx_id
where replace(fee,'uosmo','')!='0' and fee like '%uosmo%')
, tbl_to as (select label,fee,replace(fee,'uosmo','')::INTEGER as fee_amount from osmosis.core.fact_swaps
inner join osmosis.core.dim_labels on osmosis.core.dim_labels.address=to_currency
left join osmosis.core.fact_transactions on osmosis.core.fact_swaps.tx_id=osmosis.core.fact_transactions.tx_id
where replace(fee,'uosmo','')!='0' and fee like '%uosmo%')
, tbl_from_to as (select dim_from.label as from_label, dim_to.label as to_label ,fee,replace(fee,'uosmo','')::INTEGER as fee_amount
from osmosis.core.fact_swaps
inner join osmosis.core.dim_labels as dim_from on dim_from.address=from_currency
inner join osmosis.core.dim_labels as dim_to on dim_to.address=to_currency
left join osmosis.core.fact_transactions on osmosis.core.fact_swaps.tx_id=osmosis.core.fact_transactions.tx_id
where replace(fee,'uosmo','')!='0' and fee like '%uosmo%')
select avg(fee_amount),concat(from_label , '/' , to_label) as swap_pairs from tbl_from_to
group by swap_pairs
Run a query to Download Data