Afonso_DiazUntitled Query
Updated 2023-02-05
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
t1 as (
select
swapper as trader,
swap_to_mint,
swap_from_amount as amount_sol,
swap_to_amount as swap_amount,
swap_from_amount / swap_to_amount as token_price_sol
from solana.core.fact_swaps
where swap_from_mint = 'So11111111111111111111111111111111111111112'
and not swap_to_amount = 0
and block_timestamp > current_date - 90
),
t2 as (
select
trader,
swap_to_mint,
sum(amount_sol) as volume_swap_sol,
sum(amount_sol * token_price_sol) / sum(amount_sol) as avg_price_sum
from t1
where not amount_sol = 0
group by 1, 2
),
t3 as (
select
swapper,
swap_from_mint,
swap_from_amount as amount_sol,
swap_to_amount as swap_amount,
swap_to_amount / swap_from_amount as token_price_sol
from solana.core.fact_swaps
where swap_to_mint = 'So11111111111111111111111111111111111111112'
and not swap_from_amount = 0
and block_timestamp > current_date - 90
Run a query to Download Data