headitmanagerwhales swap from
    Updated 2022-06-18
    with temptbl_in as (select sum(amount/1e6) as amount_in,receiver from osmosis.core.fact_transfers where currency='uosmo'
    group by receiver)
    , temptbl_out as (select sum(amount/1e6) as amount_out,sender from osmosis.core.fact_transfers where currency='uosmo'
    group by sender)
    ,whale as (select (amount_in-amount_out) as amount,receiver from temptbl_in inner join temptbl_out
    on sender=receiver where amount>100000 )
    ,swapping_from_whale as (select count(*),label from osmosis.core.fact_swaps inner join osmosis.core.dim_labels
    on osmosis.core.fact_swaps.from_currency=osmosis.core.dim_labels.address
    where trader in (select receiver from whale)
    group by label )
    ,swapping_to_whale as (select count(*),label from osmosis.core.fact_swaps inner join osmosis.core.dim_labels
    on osmosis.core.fact_swaps.to_currency=osmosis.core.dim_labels.address
    where trader in (select receiver from whale)
    group by label )
    ,swaping_from_users as (select count(*),label from osmosis.core.fact_swaps inner join osmosis.core.dim_labels
    on osmosis.core.fact_swaps.from_currency=osmosis.core.dim_labels.address
    where trader not in (select receiver from whale)
    group by label)
    ,swaping_to_users as (select count(*),label from osmosis.core.fact_swaps inner join osmosis.core.dim_labels
    on osmosis.core.fact_swaps.to_currency=osmosis.core.dim_labels.address
    where trader not in (select receiver from whale)
    group by label)
    select * from swapping_from_whale
    Run a query to Download Data