azerbaijanUntitled Query
Updated 2022-10-25Copy Reference Fork
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
›
⌄
with prices as (
select recorded_at::date as day,
symbol,
address,
avg (price) as USDPrice
from osmosis.core.dim_prices p join osmosis.core.dim_labels l on project_name = symbol
group by 1,2,3),
wallets as (
select
'Humpback Whale' as types,
p.address,
sum (balance*usdprice/pow(10,decimal)) as USD_Balance
from osmosis.core.fact_daily_balances p join prices l on p.currency = l.address and p.date = l.day
where date = (select max (date) from osmosis.core.fact_daily_balances)
group by 1,2
having usd_balance >= 10000000
union ALL
select
'Whale' as types,
p.address,
sum (balance*usdprice/pow(10,decimal)) as USD_Balance
from osmosis.core.fact_daily_balances p join prices l on p.currency = l.address and p.date = l.day
where date = (select max (date) from osmosis.core.fact_daily_balances)
group by 1,2
having usd_balance >= 1000000 and usd_balance < 10000000
union ALL
select
'Shark' as types,
p.address,
sum (balance*usdprice/pow(10,decimal)) as USD_Balance
from osmosis.core.fact_daily_balances p join prices l on p.currency = l.address and p.date = l.day
Run a query to Download Data