saber-jlBTC vs LUNA price on January 9
Updated 2023-01-16Copy 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 BTC as(
select
trunc(hour,'hour') as bdate,
avg(price) as "BTC price"
from optimism.core.fact_hourly_token_prices
where SYMBOL ilike '%wbtc'
and bdate >= '2023-01-09'
group by 1
order by 1 limit 24),
luna as (select
date_trunc('hour',BLOCK_TIMESTAMP) as date,
avg(to_amount/from_amount) as "luna price"
from terra.core.ez_swaps
where FROM_CURRENCY = 'uluna'
and TO_CURRENCY = 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4'
and date >= '2023-01-09'
and TX_SUCCEEDED = 'TRUE'
group by 1
order by 1
limit 24)
select date , "BTC price" , "luna price"
from luna join btc on luna.date = btc.bdate
group by 1,2,3
Run a query to Download Data