misaghlbPolygon Ecosystem - trx count
Updated 2023-02-20Copy 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
›
⌄
with transaction_monthly as (
select date_trunc('{{date_trunc}}', BLOCK_TIMESTAMP) as block_date,
case when block_date >= '2023-01-17' then 'Post Update' else 'Pre Update' end as splitter,
count(DISTINCT tx_hash) as transaction_count
from polygon.core.fact_transactions
where date(BLOCK_TIMESTAMP) >= '{{start_date}}'
group by 1,2
order by 1
),
transaction_monthly_change as (
select block_date, splitter,
transaction_count,
(transaction_count - lag(transaction_count, 1) over (order by block_date)) / (lag(transaction_count, 1) over (order by block_date)) as change_rate
from transaction_monthly
order by block_date
)
select block_date, splitter,
transaction_count,
(case when change_rate > 50 then 50 else change_rate end) as change_rate
from transaction_monthly_change
Run a query to Download Data