feyikemiKaia 3
Updated 2024-10-01
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 kaia_stats AS (
SELECT
date_trunc('day', block_timestamp) AS Date,
count(distinct from_address) AS active_users,
count(distinct tx_hash) AS transactions,
sum(Value) AS txn_volume
FROM
kaia.core.fact_transactions
WHERE
block_timestamp > trunc(current_date, 'month')
AND tx_succeeded = 'True'
GROUP BY 1
),
usd_stats AS (
SELECT
date_trunc('day', hour) AS Date,
AVG(price) AS price
FROM
kaia.price.ez_prices_hourly
WHERE
symbol = 'KLAY'
GROUP BY 1
),
totals AS (
SELECT
k.Date,
k.active_users,
k.transactions,
k.txn_volume * u.price AS usd_txn_volume
FROM
kaia_stats k
JOIN
usd_stats u
ON
QueryRunArchived: QueryRun has been archived