CryptoGowdaStaked [ Near ]
Updated 2023-04-17
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
›
⌄
WITH
daily_latest_block_id AS (
SELECT
address,
DATE_TRUNC('day', block_timestamp) AS day,
MAX(block_id) AS max_block_id
FROM
near.core.fact_staking_pool_balances
GROUP BY
address,
day
),
daily_latest_staking_balances AS (
SELECT
f.address,
f.balance,
f.block_timestamp,
f.block_id,
DATE_TRUNC('day', f.block_timestamp) AS day
FROM
near.core.fact_staking_pool_balances f
JOIN daily_latest_block_id lb ON f.address = lb.address
AND f.block_id = lb.max_block_id
)
SELECT
day,
SUM(balance) AS daily_staking_balance
FROM
daily_latest_staking_balances
GROUP BY
day
ORDER BY
day DESC;
Run a query to Download Data