CryptoIcicleOsmo-12.Do Whales Have Diamond Hands? - Swaps Non-Whales
    Updated 2022-06-18
    -- Payout 63.99 OSMO
    -- Grand Prize 191.96 OSMO
    -- Level Beginner
    -- Q12. Does the swap behavior of OSMO whales differ from everyday users? How does it differ?
    -- Create visuals showing what whales swap to and from compared to a normal Osmosis user.
    -- For payment, submit the address of your Osmosis wallet.
    with whales as (
    select
    delegator_address as wallet,
    amount/1e6 as amount_staked,
    rank() over (order by amount_staked desc ) as rank,
    iff(rank <= 50, 'whale', 'non-whale') as type
    from osmosis.core.fact_staking
    where block_timestamp >= CURRENT_DATE - 30
    order by amount_staked desc
    ),
    swap_from as (
    select
    concat('from::',l.label) as token,
    count(distinct tx_id) as n_txns
    from osmosis.core.fact_swaps s join whales w on s.trader = w.wallet and w.type <> 'whale'
    join osmosis.core.dim_labels l on l.address = from_currency
    where block_timestamp >= CURRENT_DATE - 30 and from_amount >0
    group by token
    order by n_txns desc
    limit 10
    ),
    swap_to as (
    select
    concat('to::',l.label) as token,
    count(distinct tx_id) as n_txns
    from osmosis.core.fact_swaps s join whales w on s.trader = w.wallet and w.type <> 'whale'
    join osmosis.core.dim_labels l on l.address = to_currency
    where block_timestamp >= CURRENT_DATE - 30 and to_amount > 0
    group by token
    Run a query to Download Data