maybeyonassol_perform_price
Updated 2022-07-10Copy 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
›
⌄
with
price_data as (
select
block_timestamp,
swap_program,
case
when swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' then swap_from_amount/swap_to_amount
else swap_to_amount/swap_from_amount end as price
from solana.core.fact_swaps
where
(
(swap_from_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' and swap_to_mint = 'So11111111111111111111111111111111111111112')
or
(swap_to_mint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' and swap_from_mint = 'So11111111111111111111111111111111111111112')
)
and swap_from_amount > 0
)
select
date(block_timestamp) as date,
swap_program,
median(price) as price
from price_data
group by 1,2
-- limit 100
Run a query to Download Data