Flipside Teamnear fee Usd copy
Updated 2024-09-16
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
›
⌄
-- forked from Masi / near fee Usd @ https://flipsidecrypto.xyz/Masi/q/XpZUIyjBzfP3/near-fee-usd
with tb1 as ( select date_trunc(day, BLOCK_TIMESTAMP) as date,
count(distinct tx_hash) as "Transactions",
sum(TRANSACTION_FEE/1e24) as "Fee",
sum("Transactions") over (order by date) as "Total Transactions",
sum("Fee") over (order by date) as "Total Fee"
from near.core.fact_transactions
where tx_succeeded=true and date is not null
group by 1)
,
tb2 as ( select trunc(hour,'day') as Date,
avg(price) as Near_Price
from near.price.ez_prices_hourly
where symbol = 'NEAR'
group by 1)
select a.date as "Date",
"Fee",
"Fee"*Near_Price as "Fee USD",
sum("Fee USD") over (order by a.date) as "Total Fee (USD)"
from tb1 a join tb2 b on a.Date = b.Date
QueryRunArchived: QueryRun has been archived