datavortexChanges last 1 month
Updated 2024-11-18
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
›
⌄
WITH current_month AS (
SELECT
SUM(COALESCE(amount_usd, 0)) AS "This Month Volume",
COUNT(DISTINCT tx_hash) AS "This Month Bridges",
COUNT(DISTINCT source_address) AS "This Month Users"
FROM
near.defi.ez_bridge_activity
WHERE
block_timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '30 days' AND CURRENT_TIMESTAMP
),
previous_month AS (
SELECT
SUM(COALESCE(amount_usd, 0)) AS "Last Month Volume",
COUNT(DISTINCT tx_hash) AS "Last Month Bridges",
COUNT(DISTINCT source_address) AS "Last Month Users"
FROM
near.defi.ez_bridge_activity
WHERE
block_timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '60 days' AND CURRENT_TIMESTAMP - INTERVAL '30 days'
)
SELECT
current_month."This Month Volume",
previous_month."Last Month Volume",
CASE
WHEN previous_month."Last Month Volume" = 0 THEN NULL
ELSE (current_month."This Month Volume" - previous_month."Last Month Volume") / previous_month."Last Month Volume" * 100
END AS "Volume Change (%)",
current_month."This Month Bridges",
previous_month."Last Month Bridges",
CASE
WHEN previous_month."Last Month Bridges" = 0 THEN NULL
ELSE (current_month."This Month Bridges" - previous_month."Last Month Bridges") / previous_month."Last Month Bridges" * 100
END AS "Bridge Change (%)",
current_month."This Month Users",
QueryRunArchived: QueryRun has been archived