Ludwig_1989Hourly Price Change Comprison
Updated 2023-01-21
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 BLOCK_TIMESTAMP ,FROM_AMOUNT, TO_AMOUNT , (TO_AMOUNT/FROM_AMOUNT) as price
from terra.core.ez_swaps
where TO_CURRENCY ilike 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4'
and FROM_CURRENCY = 'uluna'
and BLOCK_TIMESTAMP > '2022-12-31' and BLOCK_TIMESTAMP < '2023-01-18'
having (TO_AMOUNT/FROM_AMOUNT)> 1.15 and (TO_AMOUNT/FROM_AMOUNT)<2.5
),
Luna as (
select date_trunc('hour',BLOCK_TIMESTAMP) as "DATE",avg (price) as Luna_price,LAG(Luna_price,1) IGNORE NULLS OVER (order by "DATE") as Luna_price_next,
((Luna_price-Luna_price_next)/Luna_price)*100 as Luna_change
from t1
group by 1
order by 1 asc
),
OP as ( select (HOUR) as "DATE", avg(price) as op_price, LAG(op_price,1) IGNORE NULLS OVER (order by "DATE") as op_price_next,
((op_price-op_price_next)/op_price)*100 as op_change
from optimism.core.fact_hourly_token_prices
where symbol = 'OP'
and hour::date > '2022-12-31' and hour::date < '2023-01-18'
group by 1)
,
matic_price as ( select (HOUR) as "DATE", avg(price) as matic_price, LAG(matic_price,1) IGNORE NULLS OVER (order by "DATE") as matic_price_next,
((matic_price-matic_price_next)/matic_price)*100 as matic_change
from ethereum.core.fact_hourly_token_prices
where symbol = 'MATIC'
and hour::date > '2022-12-31' and hour::date < '2023-01-18'
group by 1)
,
eth_price as ( select (HOUR) as "DATE", avg(price) as eth_price, LAG(eth_price,1) IGNORE NULLS OVER (order by "DATE") as eth_price_next,
((eth_price-eth_price_next)/eth_price)*100 as eth_change
from ethereum.core.fact_hourly_token_prices
where symbol = 'WETH'
Run a query to Download Data