Updated 2023-09-07
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 pool_info as (
select
token0_address,
token1_address,
min(date(block_timestamp)) as min_date
from ethereum.uniswapv3.ez_pool_stats
where pool_address ilike '{{pool_info_address}}'
group by 1,2
),
first_token0_price as (select
date(hour) as daily,
symbol,
avg(price) as daily_price
from ethereum.core.fact_hourly_token_prices
where token_address ilike (select distinct token0_address from pool_info)
and
daily = (select min_date from pool_info)
group by 1,2
),
last_token0_price as (select
date(hour) as daily,
symbol,
avg(price) as daily_price
from ethereum.core.fact_hourly_token_prices
where token_address ilike (select distinct token0_address from pool_info)
and
daily>= (select min_date from pool_info)
group by 1,2)
,
Run a query to Download Data