h4wkOsmo fish and whale swap to
Updated 2022-06-21
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
›
⌄
-- 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.
with price_date as (
select date_trunc(day, RECORDED_AT) as date_price, symbol, avg(price) as price
from osmosis.core.dim_prices group by date_price, symbol
),
top_10_token as (
select symbol,
sum(to_amount/pow(10,to_decimal)*price) as swap_volume
from osmosis.core.fact_swaps join osmosis.core.dim_labels on to_currency = address
join price_date on block_timestamp::date = date_price and project_name = symbol
group by symbol order by swap_volume desc limit 10
),
wallet_dist as (
select trader as users,
sum(to_amount/pow(10,to_decimal)*price) as swap_volume,
avg(to_amount/pow(10,to_decimal)*price) as avg_volume,
case when avg_volume < 10000 then 'Normal'
when avg_volume >= 10000 then 'Whale' end as type
from osmosis.core.fact_swaps join osmosis.core.dim_labels on to_currency = address
join price_date on block_timestamp::date = date_price and project_name = symbol
group by trader
)
, type_and_date as (
select
-- date_trunc(day, block_timestamp) as date,
users as address,
symbol,
tx_id,
to_amount/pow(10,to_decimal)*price as volume_usd,
type
Run a query to Download Data