HosseinUntitled Query
Updated 2022-12-02Copy Reference Fork
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
›
⌄
with
price_list as (
select
block_timestamp::date as day,
swap_from_mint,
avg (swap_to_amount/swap_from_amount) as price_usd
from solana.fact_swaps
where swap_to_mint in ('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v')
and succeeded = 1
and swap_to_amount > 0
and swap_from_amount > 0
group by 1, 2
)
select
swapper "Swapper",
count(distinct(tx_id)) "Swaps Count",
sum (price_usd * swap_from_amount) "Volume (USD)",
avg (price_usd * swap_from_amount) "Average Volume (USD)"
from solana.core.fact_swaps
join price_list
using(swap_from_mint)
where succeeded = 1
and day = block_timestamp::date
and block_timestamp::date >= current_date - interval '90 days'
and swap_program = 'orca'
and swapper != '2Vusm1rNHH9h1iEuA8esQycSdQ2gDNHF3u7RG1qnrKD4'
group by 1
order by 3 desc
limit 100
Run a query to Download Data