datavortexGas Fees
Updated 2024-12-21
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 swap_fees AS (
SELECT
s.tx_hash,
(t.gas_used * t.gas_unit_price) / 1e8 AS "total apt Gas Fees"
FROM
aptos.defi.ez_dex_swaps AS s
INNER JOIN
aptos.core.fact_transactions AS t ON s.tx_hash = t.tx_hash
WHERE
s.block_timestamp BETWEEN '2024-01-01' AND '2024-12-31'
AND (s.token_in = '0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT'
OR s.token_out = '0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT')
)
SELECT
COUNT(DISTINCT s.swapper) AS "Total Swappers",
COUNT(DISTINCT s.tx_hash) AS "Total Swaps",
SUM(s.amount_in_usd) AS "Total Volume Swapped (USD)",
SUM(f."total apt Gas Fees") AS "Total Gas Fees (APT)",
AVG(f."total apt Gas Fees") AS "Average Gas Fee per Swap (APT)"
FROM
swap_fees AS f
INNER JOIN
aptos.defi.ez_dex_swaps AS s ON f.tx_hash = s.tx_hash;
*/
WITH apt_price AS (
SELECT
AVG(price) AS avg_apt_price_usd
FROM
aptos.price.ez_prices_hourly
WHERE
symbol = 'APT'
AND hour BETWEEN '2024-01-01' AND '2024-12-31'
),
swap_fees AS (
SELECT
QueryRunArchived: QueryRun has been archived