MLDZMNGASg7
Updated 2022-11-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
›
⌄
with tb1 as (select block_timestamp::date as day,
median (swap_to_amount/swap_from_amount) as price_token
from solana.fact_swaps
where swap_from_mint = 'So11111111111111111111111111111111111111112'
and swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')
and swap_to_amount > 0
and swap_from_amount > 0
and succeeded = 'TRUE'
group by 1)
select
sum(FEE/1e9) as amount,
sum(FEE*price_token/1e9) as amount_usd,
avg(fee*price_token/1e9) as avg_usd,
median(fee*price_token/1e9) as median_usd,
min(fee*price_token/1e9) as min_usd,
max(fee*price_token/1e9) as max_usd,
amount_usd/count(distinct date_trunc(day, block_timestamp)) as average_usd_day,
amount_usd/count(distinct BLOCK_ID) as average_usd_block
--(sum(fee*price_token) / (sum(amount*price_token)))*1000000 as average_per_one_million
from solana.core.fact_transactions s left join tb1 b on s.BLOCK_TIMESTAMP::date=b.day
where BLOCK_TIMESTAMP>=CURRENT_DATE-30
Run a query to Download Data