shreyash-5873Untitled Query
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
›
⌄
with oracle_prices as (select
date_trunc('hour', block_timestamp) as terra_block_hour,
symbol,
currency,
avg(price_usd) as terra_oracle_price_usd
from terra.oracle_prices
where symbol = 'UST'
group by 1, 2, 3
order by 1, 2),
uniswap_prices as (select
date_trunc('hour', block_timestamp) AS uniswap_block_hour,
avg(price_0_1) as uniswap_price_usd
from uniswapv3.pool_stats
where pool_address = lower('0x868b7bbbfe148516e5397f23982923686182c2d2')
and price_0_1 is not null
group by 1
order by 1
)
select
*,
terra_oracle_price_usd - 1 as terra_deviation_usd,
uniswap_price_usd - 1 as uniswap_deviation_usd,
abs(terra_oracle_price_usd - 1) as abs_terra_deviation_usd,
abs(uniswap_price_usd - 1) as abs_uniswap_deviation_usd,
abs(terra_oracle_price_usd - uniswap_price_usd) as abs_pair_difference_usd
from uniswap_prices
inner join oracle_prices
on terra_block_hour = uniswap_block_hour
Run a query to Download Data