maybeyonasluna_std_dev_l1
Updated 2022-03-01
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 luna_price as (
select
date_trunc('hour',block_timestamp) as hour,
'LUNA' as asset,
median(price_usd) as usd_price
from terra.oracle_prices
where symbol = 'LUNA'
group by 1,2
),
eth_price as (
select
hour,
symbol,
price
from ethereum.token_prices_hourly
where symbol in ('WETH','WBTC')
),
sol_price as (
select
date_trunc('hour',block_timestamp) as hour,
'SOL' as asset,
median(
case when swap_from_mint = 'So11111111111111111111111111111111111111112' then swap_to_amount/swap_from_amount
else swap_from_amount/swap_to_amount end
) as price
from solana.swaps
where swap_from_mint in (
'So11111111111111111111111111111111111111112', --wSOL
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' --USDC
)
and swap_to_mint in (
'So11111111111111111111111111111111111111112', --wSOL
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' --USDC
)
and swap_from_mint != swap_to_mint
and swap_from_amount != 0
Run a query to Download Data