Sbhn_NPstake terra
Updated 2022-12-15
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
›
⌄
--credit : https://app.flipsidecrypto.com/velocity/queries/47efda77-58e2-4ff4-9221-87240f63b51d
with luna_price as(select
date_trunc('day',RECORDED_HOUR) as date,
avg(CLOSE) as price
from crosschain.core.fact_hourly_prices
where ID ilike 'terra-luna-2'
group by 1
),
main as(select
date_trunc('day',BLOCK_TIMESTAMP) as date,
action as type,
count(TX_ID) as stake_txs,
count(DISTINCT DELEGATOR_ADDRESS) as users,
sum(amount) as volume
from terra.core.ez_staking
where TX_SUCCEEDED = TRUE
group by 1,2
)
select
a.date,
type,
price,
stake_txs,
users,
volume,
sum(stake_txs) over (order by a.date) as cum_txs,
sum(users) over (order by a.date) as cum_users,
sum(volume) over (order by a.date) as cum_volume
from main a
join luna_price b on a.date=b.date
Run a query to Download Data