Abbas_ra21ETH vs SOL pt1:price
Updated 2022-09-29Copy 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
26
27
28
29
30
31
32
33
34
›
⌄
with sol_price AS (
select
date_trunc('{{Timeframe}}', BLOCK_TIMESTAMP ) as date,
(sum(SWAP_TO_AMOUNT)/sum(SWAP_FROM_AMOUNT)) as "SOL Price"
from solana.core.fact_swaps
where SWAP_FROM_MINT = 'So11111111111111111111111111111111111111112'
and SWAP_TO_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' and date >= CURRENT_DATE - 365
group by 1),
ETH_price AS (
select
date_trunc('{{Timeframe}}', HOUR ) as date,
Avg(PRICE) AS "ETH Price"
from ethereum.core.fact_hourly_token_prices
where Token_address=lower('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2')
and date >= CURRENT_DATE - 365
group by 1
),
BTC_price AS (
select
date_trunc('week', HOUR ) as date,
Avg(PRICE) AS "BTC Price"
from ethereum.core.fact_hourly_token_prices
where Token_address=lower('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599')
and date >= CURRENT_DATE - 365
group by 1
)
select
A.date AS date,
"SOL Price",
"ETH Price",
"SOL Price"/"BTC Price" AS "SOL/BTC",
"ETH Price"/"BTC Price" AS "ETH/BTC"
from sol_price A inner join ETH_price B on A.date=B.date
inner join BTC_price C on A.date=C.date
Run a query to Download Data