shadabSEI Fee stats copy
Updated 2024-05-15
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
›
⌄
-- forked from Moe / SEI Fee stats @ https://flipsidecrypto.xyz/Moe/q/zLvsomVakPYB/sei-fee-stats
with price as (
SELECT
TO_TIMESTAMP(value [0] :: string) as date,
'SEI' as symbol,
value [1] as price
from
(
SELECT
livequery.live.udf_api(
'https://api.coingecko.com/api/v3/coins/sei-network/market_chart?vs_currency=usd&days=90&interval=daily&precision=3'
) as resp
),
LATERAL FLATTEN (input => resp:data:prices)
),
mid as (
select
*,
price * (split(fee, 'usei') [0] / pow(10, 6)) as fee_usd
from
sei.core.fact_transactions
left join price
where
tx_from is not null
and block_timestamp :: date = date
)
select
block_timestamp::date as date ,
count(distinct tx_id) as tx_count,
sum(fee_usd) as total_fee_us
from
mid
group by 1
QueryRunArchived: QueryRun has been archived