0xHaM-dDEXs - Distribution of Users based on Avg Time between Txs
Updated 2024-12-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
34
35
36
›
⌄
-- forked from Distribution of Users based on Avg Time between Txs @ https://flipsidecrypto.xyz/studio/queries/caeb2e40-f7f2-4967-9437-3346820a9b9f
-- forked from Distribution of Users based on Avg Time between Txs @ https://flipsidecrypto.xyz/studio/queries/e61fd1cb-786a-47e7-9422-58ee7475fde7
with
txs as (
SELECT DISTINCT
block_timestamp,
tx_hash,
ORIGIN_FROM_ADDRESS as FROM_ADDRESS
FROM avalanche.defi.ez_dex_swaps
WHERE BLOCK_TIMESTAMP::date >= '2024-01-01'
)
,
txsGap AS (
SELECT
FROM_ADDRESS as User,
block_timestamp as Txs_date,
LAG(block_timestamp) OVER (
PARTITION BY User
ORDER BY
block_timestamp
) AS prev_Txs_date
FROM txs
),
txs_time as (
SELECT
User,
AVG(
DATEDIFF(hour, prev_Txs_date, Txs_date)
) AS avg_txs_gap
FROM
txsGap
WHERE
prev_Txs_date IS NOT NULL
GROUP BY
QueryRunArchived: QueryRun has been archived