bachiosmo swaps
    Updated 2022-06-28
    with labels as (
    select project_name, address from osmosis.core.dim_labels
    ),

    from_txns as (
    select tx_id, b.project_name as from_symbol from osmosis.core.fact_swaps a join labels b on a.from_currency = b.address
    ),
    to_txns as (
    select tx_id, b.project_name as to_symbol from osmosis.core.fact_swaps a join labels b on a.to_currency = b.address
    )

    select concat(from_symbol, ' - ', to_symbol) as swap_pair, round(sum(replace(c.fee, 'uosmo', '')),2) as total_fee, round(avg(replace(c.fee, 'uosmo', '')),2) as avg_fee
    from from_txns a join to_txns b on a.tx_id = b.tx_id join osmosis.core.fact_transactions c on a.tx_id = c.tx_id
    where c.fee like '%uosmo%' --and replace(c.fee, 'uosmo', '') > 0
    group by swap_pair

    Run a query to Download Data