hessOsmosis Vs. Cosmsos
Updated 2023-09-28
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 atom_price as ( select avg(price) as atom_price
from osmosis.core.ez_prices
where RECORDED_HOUR::date = CURRENT_DATE - 1
and symbol = 'ATOM')
,
senders as ( select sender, sum(amount/pow(10,6)) as total_sent
from cosmos.core.fact_transfers
where sender ilike 'cos%'
and CURRENCY = 'uatom'
and amount/pow(10,6) > 0 and TX_SUCCEEDED = 'TRUE'
group by 1)
,
receiver as ( select RECEIVER , sum(amount/pow(10,6)) as total_received
from cosmos.core.fact_transfers
where RECEIVER ilike 'cos%'
and CURRENCY = 'uatom'
and amount/pow(10,6) > 0 and TX_SUCCEEDED = 'TRUE'
group by 1)
,
final as ( select sender, total_received-total_sent as net
from senders a join RECEIVER b on a.sender = b.RECEIVER
where sender not in ('cosmos14yrwzkjxcgsupam8yd09zruk2jnu2r4k0rx78m','cosmos1my7d7egfkz5k00q97fmwdmvcmac02axmezapdc',
'cosmos1j8pmdu2wy4h5fl4xxnfxc3k2aw3wm3ztggskzc'))
,
final_2 as ( select sender , net, net*atom_price as net_usd
from final, atom_price
where net > 0)
,
final_3 as ( select address, balance/pow(10,6) as net, net*atom_price as net_usd
from osmosis.core.fact_daily_balances , atom_price
where currency = 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2'
and date = CURRENT_DATE - 1)
select 'Cosmos' as type, count(DISTINCT(sender)) as holders, sum(net) as total_atom, sum(net_usd) as atom_in_usd,
avg(net) as avg_atom, avg(net_usd) as avg_usd, median(net) as median_atom, max(net) as max_net
from final_2
Run a query to Download Data