Afonso_Diaz2023-05-26 08:35 PM
Updated 2023-05-26
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 t as (
select
hour::date as date,
symbol,
avg(price) as price_usd
from ethereum.core.fact_hourly_token_prices
where symbol in ('WFLOW', 'SOL', 'axl')
group by 1, 2
),
t2 as (
select
date_trunc('day', block_timestamp)::date as day,
'Flow' as chain,
count(distinct tx_id) as transactions,
sum(event_data:amount::float * price_usd) as fees_usd,
avg(event_data:amount::float * price_usd) as average_fees_usd,
median(event_data:amount::float * price_usd) as median_fees_usd,
sum(transactions) over (order by day) as cumulative_transactions,
sum(fees_usd) over (order by day) as cumulative_fees_usd
from flow.core.fact_events a
join t on a.block_timestamp::date = t.date and t.symbol = 'WFLOW'
where event_type = 'FeesDeducted'
and block_timestamp::date >= current_date - 30
group by 1, 2
union all
select
date_trunc('day', block_timestamp)::date as day,
'Solana' as chain,
count(distinct tx_id) as transactions,
sum((fee/1e9) * price_usd) as fees_usd,
avg((fee/1e9) * price_usd) as average_fees_usd,
median((fee/1e9) * price_usd) as median_fees_usd,
sum(transactions) over (order by day) as cumulative_transactions,
Run a query to Download Data