mboveiriLUNA Market Cap - Past Year
Updated 2022-05-11
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
›
⌄
/*SQL Code copied from another dashbord from Discover and i edit it to get Luna MARKETCAP*/
with price_luna as (
select date_trunc('day', block_timestamp) as dt, avg(price_usd) as price_luna
from terra.oracle_prices
where symbol = 'LUNA'
and year(block_timestamp)='2021'
group by 1
),
liquid as (
select sum(balance) as total_liquid, date
from terra.daily_balances
where currency = 'LUNA'
and balance_type = 'liquid'
and address_label_type is null
and address != 'terra1vzkcuzksektankc2yj7puxztn08mqauewtqx4f'
and address != 'terra1vzkcuzksektankc2yj7puxztn08mqauewtqx4f'
and year(date)='2021'
group by 2
),
stake as (
select sum(voting_power) as total , block_id, date_trunc('day', block_timestamp) as dt,
ROW_NUMBER() over (partition by dt order by block_id desc) as rank
from terra.validator_voting_power where year(block_timestamp)='2021'
group by 2,3
),
supply as (
select total,total_liquid, dt from stake
join liquid liq on
stake.dt = liq.date
where rank = 1
),
Run a query to Download Data