MadiUntitled Query
Updated 2022-12-14Copy Reference Fork
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
›
⌄
with df as ((SELECT
date_trunc ('week',block_timestamp) as date,
action,
count (distinct TX_ID) as TX_Count,
sum (amount) as Volume
FROM terra.core.ez_staking
WHERE action = 'Delegate' and date >= CURRENT_DATE - 180 and TX_SUCCEEDED = 'TRUE'
group by 1,2
order by 1)
UNION ALL
(SELECT
date_trunc ('week',block_timestamp) as date,
action,
count (distinct TX_ID)*(-1) as TX_Count,
sum (amount)*(-1) as Volume
FROM terra.core.ez_staking
WHERE action = 'Undelegate' and date date >= CURRENT_DATE - 180 and TX_SUCCEEDED = 'TRUE'
group by 1,2
order by 1))
select date, sum(volume) over (order by date) as Cumualtive from(
select date, sum (Volume) as volume --sum(Volume)*100/1047120273 as percstack
from df group by 1)
Run a query to Download Data