theericstonenear price comp
Updated 2025-01-08Copy 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
35
36
›
⌄
⌄
-- forked from simple price query @ https://flipsidecrypto.xyz/studio/queries/6ca54b23-6336-45f5-b466-cd03eddbbcc9
/*select * from crosschain.price.ez_prices_hourly ezp
where symbol = 'BTC' and blockchain = 'bitcoin'
and ezp.hour > current_date;*/
WITH nearprice AS (
SELECT DISTINCT
ezp.blockchain,
ezp.symbol,
ezp.hour::DATE AS date,
LAST_VALUE(ezp.price) OVER (
PARTITION BY ezp.blockchain, ezp.token_address, ezp.hour::date
ORDER BY ezp.hour ASC
) AS price
FROM near.price.ez_prices_hourly ezp
WHERE ezp.hour > '2024-10-01'
AND ezp.symbol = 'NEAR'
AND blockchain = 'near protocol'
),
btcethbm AS (
SELECT DISTINCT
ezp.blockchain,
ezp.symbol,
date_trunc('day',ezp.hour) AS date,
LAST_VALUE(ezp.price) OVER (
PARTITION BY ezp.blockchain, ezp.token_address, date_trunc('day',ezp.hour)
ORDER BY ezp.hour ASC
) AS price
FROM crosschain.price.ez_prices_hourly ezp
WHERE ezp.hour > '2024-10-01'
AND ((ezp.symbol = 'BTC' AND ezp.blockchain = 'bitcoin')
OR (ezp.symbol = 'ETH' AND ezp.blockchain = 'ethereum'))
),
QueryRunArchived: QueryRun has been archived