datavortexphysical-cyan
Updated 2024-11-23
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 TotalFees AS (
SELECT
SUM(tx_fee_precise) / POW(10, 18) AS total_fees_in_avax,
COUNT(DISTINCT tx_hash) AS total_transactions
FROM avalanche.core.fact_transactions
WHERE status = 'SUCCESS'
AND tx_fee > 0
AND DATE_TRUNC('month', block_timestamp) = DATE_TRUNC('month', CURRENT_DATE)
),
AVAXPrice AS (
SELECT
AVG(price) AS avax_price
FROM avalanche.price.ez_prices_hourly
WHERE symbol = 'AVAX'
AND DATE_TRUNC('month', hour) = DATE_TRUNC('month', CURRENT_DATE)
)
SELECT
tf.total_transactions AS "Total Transactions",
tf.total_fees_in_avax AS "Total Fees in AVAX",
tf.total_fees_in_avax * ap.avax_price AS "Total Fees in USD",
tf.total_fees_in_avax / tf.total_transactions AS "Avg Fee Per Transaction in AVAX",
ROUND((tf.total_fees_in_avax / tf.total_transactions) * ap.avax_price, 4) AS "Avg Fee Per Transaction in USD"
FROM
TotalFees tf,
AVAXPrice ap;
*/
--SELECT decimalS FROM avalanche.price.ez_prices_hourly
--WHERE symbol ILIKE 'AVAX'
SELECT
price AS latest_avax_price
FROM
avalanche.price.ez_prices_hourly
WHERE
symbol = 'AVAX'
QueryRunArchived: QueryRun has been archived