pandaEVM - 3. Merry Christmas? | Daily Values on Transaction
Updated 2023-01-24Copy 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
26
›
⌄
WITH tx_table as
(
SELECT
TX_HASH as TX_ID,
BLOCK_TIMESTAMP,
TX_FEE,
FROM_ADDRESS
FROM
optimism.core.fact_transactions
WHERE
STATUS = 'SUCCESS' AND BLOCK_TIMESTAMP::date >= '2022-12-01'
)
SELECT
CASE WHEN BLOCK_TIMESTAMP::date = '2022-12-24' then 'Christmas Eve'
WHEN BLOCK_TIMESTAMP::date = '2022-12-25' OR BLOCK_TIMESTAMP::date = '2022-12-26' then 'Christmas Days'
WHEN BLOCK_TIMESTAMP::date >= '2022-12-27' AND BLOCK_TIMESTAMP <= '2023-01-05' then 'Remain Days of Christmas'
ELSE 'Other days' END AS timeline,
BLOCK_TIMESTAMP::date as timestamps,
COUNT(distinct FROM_ADDRESS) as daily_User,
COUNT(distinct TX_ID) as daily_Transaction,
(SUM(TX_FEE) / daily_Transaction) * 100 as daily_avr_Fee,
SUM(daily_User) OVER (order by BLOCK_TIMESTAMP::date ASC) as cum_User,
SUM(daily_Transaction) OVER (order by BLOCK_TIMESTAMP::date ASC) as cum_Transaction
FROM
tx_table
GROUP BY 1, 2
Run a query to Download Data