datavortexTotal AMount
Updated 2024-10-31
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
›
⌄
WITH prices AS (
SELECT
recorded_hour,
price,
currency,
symbol
FROM sei.price.ez_prices
),
volume AS (
SELECT
v.amount,
v.currency,
v.decimal,
p.symbol,
p.recorded_hour,
(v.amount / NULLIF(POW(10, v.decimal), 0)) * p.price AS volume_usd
FROM sei.core.fact_transfers v
JOIN prices p
ON v.currency = p.currency
AND v.block_timestamp = p.recorded_hour
WHERE v.amount IS NOT NULL
AND v.decimal IS NOT NULL
AND p.price IS NOT NULL
)
SELECT
DATE_TRUNC('month', recorded_hour) AS month,
SUM(volume_usd) AS monthly_total_amount_usd
FROM volume
GROUP BY month
ORDER BY month;
QueryRunArchived: QueryRun has been archived