Ludwig_1989TX - moving averages
Updated 2023-01-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
›
⌄
SELECT
trunc(block_timestamp,'day') as "DATE",
count(distinct TX_HASH) as Number_of_Transactions,
sum(Number_of_Transactions) over (order by "DATE") as Cumulative_Transactions,
avg(Number_of_Transactions) over (order by "DATE", "DATE" rows between 7 preceding and current row) as MA7_Tx,
avg(Number_of_Transactions) over (order by "DATE", "DATE" rows between 26 preceding and current row) as MA26_TX,
avg(Number_of_Transactions) over (order by "DATE", "DATE" rows between 52 preceding and current row) as MA52_TX,
avg(Number_of_Transactions) over (order by "DATE", "DATE" rows between 100 preceding and current row) as MA100_TX,
SUM(TRANSACTION_FEE/pow(10,24)) as Total_Fees,
avg(Total_Fees) over (order by "DATE", "DATE" rows between 7 preceding and current row) as MA7_Fee,
avg(Total_Fees) over (order by "DATE", "DATE" rows between 26 preceding and current row) as MA26_Fee,
avg(Total_Fees) over (order by "DATE", "DATE" rows between 52 preceding and current row) as MA52_Fee,
avg(Total_Fees) over (order by "DATE", "DATE" rows between 100 preceding and current row) as MA100_Fee
,count (DISTINCT BLOCK_ID) as Number_of_Blocks,
avg(Number_of_Blocks) over (order by "DATE", "DATE" rows between 7 preceding and current row) as MA7_Blocks,
avg(Number_of_Blocks) over (order by "DATE", "DATE" rows between 26 preceding and current row) as MA26_Blocks,
avg(Number_of_Blocks) over (order by "DATE", "DATE" rows between 52 preceding and current row) as MA52_Blocks,
avg(Number_of_Blocks) over (order by "DATE", "DATE" rows between 100 preceding and current row) as MA100_Blocks
FROM near.core.fact_transactions
where block_timestamp >= '2022-07-01' and block_timestamp < '2022-10-01'
AND TX_STATUS = 'Success'
group by 1
order by 1 ASC
Run a query to Download Data