Sbhn_NP2023-06-17 03:11 AM
Updated 2023-06-19
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 price_near as (
select timestamp::date as datee,
avg(price_usd) as usdprice
from near.core.fact_prices
where symbol = 'wNEAR'
group by 1
),
price_sol as (
select recorded_hour::date as datee,
avg(close) as usdprice
from solana.core.fact_token_prices_hourly
where symbol ='SOL'
group by 1
),
price_osmo as (
select recorded_hour::date as datee,
avg(price) as usdprice
from osmosis.core.ez_prices
where currency = 'uosmo'
GROUP by 1
)
select 'NEAR' as chain,
date_trunc('{{Date}}',block_timestamp) as date,
count(DISTINCT signer_id) as stakers,
sum(amount) as native_staked,
sum(amount*usdprice) as usd_staked,
sum(native_staked) over (order by date) as cumu_native,
sum(usd_staked) over (order by date) as cumu_usd
from near.core.fact_staking_actions
join price_near on block_timestamp::date=datee
where date >= '{{From_Date}}'
and action = 'staking'
group by 1,2
Run a query to Download Data